[RFC/PATCH 07/10] libbb: add syncfs() support for uClibc

Bartosz Golaszewski bartekgola at gmail.com
Thu Aug 13 13:57:27 UTC 2015


Currently uClibc declares but doesn't define syncfs(). In versions <= 0.9.33
it's not even declared in unistd.h. This makes it impossible to compile sync
with CONFIG_FEATURE_SYNC_FANCY on uClibc.

Add support for this system call to missing_syscalls.h.

Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
---
 coreutils/sync.c           | 3 +++
 include/missing_syscalls.h | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/coreutils/sync.c b/coreutils/sync.c
index 974e904..7615620 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -38,6 +38,9 @@
 //usage:    )
 
 #include "libbb.h"
+#ifdef __UCLIBC__
+#include "missing_syscalls.h"
+#endif
 
 /* This is a NOFORK applet. Be very careful! */
 
diff --git a/include/missing_syscalls.h b/include/missing_syscalls.h
index 080bb28..ca8617c 100644
--- a/include/missing_syscalls.h
+++ b/include/missing_syscalls.h
@@ -42,6 +42,13 @@ static ALWAYS_INLINE int fanotify_mark(int fanotify_fd, unsigned flags,
 		       __SYSCALL_LONG_LONG_ARG(mask), dfd, pathname);
 }
 
+/* uClibc declares syncfs, but doesn't define it */
+
+static ALWAYS_INLINE int syncfs(int fd)
+{
+	return syscall(SYS_syncfs, fd);
+}
+
 #endif /* __UCLIBC__ && __linux__ */
 
 #endif /* __BB_MISSING_SYSCALLS_H */
-- 
2.1.4



More information about the busybox mailing list