Fanotify syscalls are not supported in uClibc. Add a new include file - missing_syscalls.h - implementing the syscalls directly in busybox.
Signed-off-by: Bartosz Golaszewski <bartekg...@gmail.com> --- include/missing_syscalls.h | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 include/missing_syscalls.h diff --git a/include/missing_syscalls.h b/include/missing_syscalls.h new file mode 100644 index 0000000..080bb28 --- /dev/null +++ b/include/missing_syscalls.h @@ -0,0 +1,47 @@ +/* vi: set sw=4 ts=4: */ +/* + * Declarations for syscalls missing on some platforms. + * + * Licensed under GPLv2 or later, see file LICENSE in this source tree. + */ + +#ifndef __BB_MISSING_SYSCALLS_H +#define __BB_MISSING_SYSCALLS_H + +#include "libbb.h" + +#include <sys/syscall.h> + +#if defined(__UCLIBC__) && defined(__linux__) + +/* fanotify() is missing on uClibc */ + +#include <limits.h> /* for __WORDSIZE */ + +#if __WORDSIZE == 64 +#define __SYSCALL_LONG_LONG_ARG(arg) (arg) +#else +/* + * On 32-bit systems we need to pass uint64_t arguments as two + * uint32_t's, that are going to be sewn together in the kernel. + */ +#define __SYSCALL_LONG_LONG_ARG(arg) \ + ((union { uint64_t ll; uint32_t l[2]; }){ .ll = arg }).l[0], \ + ((union { uint64_t ll; uint32_t l[2]; }){ .ll = arg }).l[1] +#endif + +static ALWAYS_INLINE int fanotify_init(unsigned flags, unsigned event_f_flags) +{ + return syscall(SYS_fanotify_init, flags, event_f_flags); +} + +static ALWAYS_INLINE int fanotify_mark(int fanotify_fd, unsigned flags, + uint64_t mask, int dfd, const char *pathname) +{ + return syscall(SYS_fanotify_mark, fanotify_fd, flags, + __SYSCALL_LONG_LONG_ARG(mask), dfd, pathname); +} + +#endif /* __UCLIBC__ && __linux__ */ + +#endif /* __BB_MISSING_SYSCALLS_H */ -- 2.1.4 _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox