klibc-bot for Ben Hutchings
2024-Oct-07 21:36 UTC
[klibc] [klibc:master] syscalls: Support for inotify_init1()
Commit-ID: dad7655407b550d345663785097a341dd46488dc Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=dad7655407b550d345663785097a341dd46488dc Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Wed, 2 Oct 2024 02:13:36 +0200 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Wed, 2 Oct 2024 03:00:52 +0200 [klibc] syscalls: Support for inotify_init1() Linux 2.6.27 added the inotify_init1() system call, a variant of inotify_init() with a flags parameter added. Generate a wrapper for this system call. Newer architectures support only inotify_init1(), so also add a inotify_init() implementation for them. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/sys/inotify.h | 1 + usr/klibc/Kbuild | 1 + usr/klibc/SYSCALLS.def | 1 + usr/klibc/inotify_init.c | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+) diff --git a/usr/include/sys/inotify.h b/usr/include/sys/inotify.h index e08cb055..256aa56e 100644 --- a/usr/include/sys/inotify.h +++ b/usr/include/sys/inotify.h @@ -10,6 +10,7 @@ #include <klibc/extern.h> __extern int inotify_init(void); +__extern int inotify_init1(int); __extern int inotify_add_watch(int, const char *, __u32); __extern int inotify_rm_watch(int, __u32); diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index b2a122aa..1add6a12 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -64,6 +64,7 @@ klib-y += vsnprintf.o snprintf.o vsprintf.o sprintf.o \ fstat.o fstatat.o lstat.o stat.o \ lchown.o link.o rmdir.o unlink.o mkdir.o \ readlink.o realpath.o select.o symlink.o pipe.o \ + inotify_init.o \ ctype/isalnum.o ctype/isalpha.o ctype/isascii.o \ ctype/isblank.o ctype/iscntrl.o ctype/isdigit.o \ ctype/isgraph.o ctype/islower.o ctype/isprint.o \ diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def index d4a593af..ef29a8f8 100644 --- a/usr/klibc/SYSCALLS.def +++ b/usr/klibc/SYSCALLS.def @@ -148,6 +148,7 @@ int getcwd::__getcwd(char *, size_t); <32> int utimensat_time64::utimensat(int, const char *, const struct timespec *, int); <64> int utimensat(int, const char *, const struct timespec *, int); <?> int inotify_init(); +int inotify_init1(int); int inotify_add_watch(int, const char *, __u32); int inotify_rm_watch(int, __u32); diff --git a/usr/klibc/inotify_init.c b/usr/klibc/inotify_init.c new file mode 100644 index 00000000..d9129bbb --- /dev/null +++ b/usr/klibc/inotify_init.c @@ -0,0 +1,18 @@ +/* + * inotify_init.c + * + * Some architectures need to wrap the system call + */ + +#include <unistd.h> +#include <sys/inotify.h> +#include <sys/syscall.h> + +#ifndef __NR_inotify_init + +int inotify_init(void) +{ + return inotify_init1(0); +} + +#endif