Browse Source

syncfs: add system call support

Add support for the syncfs() system call.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Bartosz Golaszewski 8 years ago
parent
commit
ea86f1d888
2 changed files with 14 additions and 1 deletions
  1. 1 1
      include/unistd.h
  2. 13 0
      libc/sysdeps/linux/common/syncfs.c

+ 1 - 1
include/unistd.h

@@ -1073,7 +1073,7 @@ extern char *getpass (const char *__prompt) __nonnull ((1));
 extern int fsync (int __fd);
 #endif /* Use BSD || X/Open || Unix98.  */
 
-#if 0 /*def __USE_GNU */
+#if __USE_GNU
 /* Make all changes done to all files on the file system associated
  *    with FD actually appear on disk.  */
 extern int syncfs (int __fd) __THROW;

+ 13 - 0
libc/sysdeps/linux/common/syncfs.c

@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2015 Bartosz Golaszewski <bartekgola@gmail.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+
+#if defined(__NR_syncfs) && __USE_GNU
+#include <unistd.h>
+_syscall1(int, syncfs, int, fd)
+#endif