summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.syscall/sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.syscall/sync.c')
-rw-r--r--testsuite/systemtap.syscall/sync.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/systemtap.syscall/sync.c b/testsuite/systemtap.syscall/sync.c
new file mode 100644
index 00000000..b23d68be
--- /dev/null
+++ b/testsuite/systemtap.syscall/sync.c
@@ -0,0 +1,27 @@
+/* COVERAGE: fdatasync fsync sync */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+
+int main()
+{
+ int fd;
+
+ fd = creat("foobar",S_IREAD|S_IWRITE);
+
+ sync();
+ // sync () = 0
+
+ fsync(fd);
+ // fsync (4) = 0
+
+ fdatasync(fd);
+ // fdatasync (4) = 0
+
+ close(fd);
+
+ return 0;
+}