linux-user: assume inotify sycalls are always present

inotify_init() and other syscalls appeared in linux 2.6.13,
inotify_init1() - in linux 2.6.27.

There's no need to check their presence on linux anymore.

Keep condition on TARGET_NR_inotify_init because modern
architectures have only more generic inotify_init1().

Other, not linux-specific, places of the code checks for
inotify_init1() syscall only.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Michael Tokarev
2026-01-09 23:46:02 +03:00
parent 44c49d9b0d
commit 11de247707
3 changed files with 2 additions and 26 deletions

View File

@@ -18,9 +18,7 @@
#include <sys/signalfd.h>
#include <linux/unistd.h>
#include <linux/audit.h>
#ifdef CONFIG_INOTIFY
#include <sys/inotify.h>
#endif
#include <linux/netlink.h>
#ifdef CONFIG_RTNETLINK
#include <linux/rtnetlink.h>
@@ -1861,8 +1859,6 @@ TargetFdTrans target_timerfd_trans = {
.host_to_target_data = swap_data_u64,
};
#if defined(CONFIG_INOTIFY) && (defined(TARGET_NR_inotify_init) || \
defined(TARGET_NR_inotify_init1))
static abi_long host_to_target_data_inotify(void *buf, size_t len)
{
struct inotify_event *ev;
@@ -1885,4 +1881,3 @@ static abi_long host_to_target_data_inotify(void *buf, size_t len)
TargetFdTrans target_inotify_trans = {
.host_to_target_data = host_to_target_data_inotify,
};
#endif

View File

@@ -141,9 +141,5 @@ extern TargetFdTrans target_netlink_audit_trans;
extern TargetFdTrans target_signalfd_trans;
extern TargetFdTrans target_eventfd_trans;
extern TargetFdTrans target_timerfd_trans;
#if (defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init)) || \
(defined(CONFIG_INOTIFY1) && defined(TARGET_NR_inotify_init1) && \
defined(__NR_inotify_init1))
extern TargetFdTrans target_inotify_trans;
#endif
#endif

View File

@@ -514,15 +514,7 @@ static int sys_renameat2(int oldfd, const char *old,
#endif
#endif /* TARGET_NR_renameat2 */
#ifdef CONFIG_INOTIFY
#include <sys/inotify.h>
#else
/* Userspace can usually survive runtime without inotify */
#undef TARGET_NR_inotify_init
#undef TARGET_NR_inotify_init1
#undef TARGET_NR_inotify_add_watch
#undef TARGET_NR_inotify_rm_watch
#endif /* CONFIG_INOTIFY */
#if defined(TARGET_NR_prlimit64)
#ifndef __NR_prlimit64
@@ -13441,8 +13433,8 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
case TARGET_NR_futex_time64:
return do_futex(cpu, true, arg1, arg2, arg3, arg4, arg5, arg6);
#endif
#ifdef CONFIG_INOTIFY
#if defined(TARGET_NR_inotify_init)
#ifdef TARGET_NR_inotify_init
case TARGET_NR_inotify_init:
ret = get_errno(inotify_init());
if (ret >= 0) {
@@ -13450,7 +13442,6 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
}
return ret;
#endif
#if defined(TARGET_NR_inotify_init1) && defined(CONFIG_INOTIFY1)
case TARGET_NR_inotify_init1:
ret = get_errno(inotify_init1(target_to_host_bitmask(arg1,
fcntl_flags_tbl)));
@@ -13458,19 +13449,13 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
fd_trans_register(ret, &target_inotify_trans);
}
return ret;
#endif
#if defined(TARGET_NR_inotify_add_watch)
case TARGET_NR_inotify_add_watch:
p = lock_user_string(arg2);
ret = get_errno(inotify_add_watch(arg1, path(p), arg3));
unlock_user(p, arg2, 0);
return ret;
#endif
#if defined(TARGET_NR_inotify_rm_watch)
case TARGET_NR_inotify_rm_watch:
return get_errno(inotify_rm_watch(arg1, arg2));
#endif
#endif
#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open)
case TARGET_NR_mq_open: