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>
Michael Tokarev committed
Jan 9, 2026 at 23:46 UTC
11de2477071a253ff2917281e52fbac1c7c8c1d6
3 files changed
+2
-26
linux-user/fd-trans.c
-5
@@ -18,9 +18,7 @@
18
#include <sys/signalfd.h>
19
#include <linux/unistd.h>
20
#include <linux/audit.h>
21
-#ifdef CONFIG_INOTIFY
21
#include <sys/inotify.h>
23
-#endif
22
#include <linux/netlink.h>
23
#ifdef CONFIG_RTNETLINK
24
#include <linux/rtnetlink.h>
@@ -1861,8 +1859,6 @@ TargetFdTrans target_timerfd_trans = {
1859
.host_to_target_data = swap_data_u64,
1860
};
1861
1864
-#if defined(CONFIG_INOTIFY) && (defined(TARGET_NR_inotify_init) || \
1865
- defined(TARGET_NR_inotify_init1))
1862
static abi_long host_to_target_data_inotify(void *buf, size_t len)
1863
{
1864
struct inotify_event *ev;
@@ -1885,4 +1881,3 @@ static abi_long host_to_target_data_inotify(void *buf, size_t len)
1881
TargetFdTrans target_inotify_trans = {
1882
.host_to_target_data = host_to_target_data_inotify,
1883
};
1888
-#endif
linux-user/fd-trans.h
-4
@@ -141,9 +141,5 @@ extern TargetFdTrans target_netlink_audit_trans;
141
extern TargetFdTrans target_signalfd_trans;
142
extern TargetFdTrans target_eventfd_trans;
143
extern TargetFdTrans target_timerfd_trans;
144
-#if (defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init)) || \
145
- (defined(CONFIG_INOTIFY1) && defined(TARGET_NR_inotify_init1) && \
146
- defined(__NR_inotify_init1))
144
extern TargetFdTrans target_inotify_trans;
145
#endif
149
-#endif
linux-user/syscall.c
+2
-17
@@ -514,15 +514,7 @@ static int sys_renameat2(int oldfd, const char *old,
514
#endif
515
#endif /* TARGET_NR_renameat2 */
516
517
-#ifdef CONFIG_INOTIFY
517
#include <sys/inotify.h>
519
-#else
520
-/* Userspace can usually survive runtime without inotify */
521
-#undef TARGET_NR_inotify_init
522
-#undef TARGET_NR_inotify_init1
523
-#undef TARGET_NR_inotify_add_watch
524
-#undef TARGET_NR_inotify_rm_watch
525
-#endif /* CONFIG_INOTIFY */
518
519
#if defined(TARGET_NR_prlimit64)
520
#ifndef __NR_prlimit64
@@ -13441,8 +13433,8 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
13433
case TARGET_NR_futex_time64:
13434
return do_futex(cpu, true, arg1, arg2, arg3, arg4, arg5, arg6);
13435
#endif
13444
-#ifdef CONFIG_INOTIFY
13445
-#if defined(TARGET_NR_inotify_init)
13436
+
13437
+#ifdef TARGET_NR_inotify_init
13438
case TARGET_NR_inotify_init:
13439
ret = get_errno(inotify_init());
13440
if (ret >= 0) {
@@ -13450,7 +13442,6 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
13442
}
13443
return ret;
13444
#endif
13453
-#if defined(TARGET_NR_inotify_init1) && defined(CONFIG_INOTIFY1)
13445
case TARGET_NR_inotify_init1:
13446
ret = get_errno(inotify_init1(target_to_host_bitmask(arg1,
13447
fcntl_flags_tbl)));
@@ -13458,19 +13449,13 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
13449
fd_trans_register(ret, &target_inotify_trans);
13450
}
13451
return ret;
13461
-#endif
13462
-#if defined(TARGET_NR_inotify_add_watch)
13452
case TARGET_NR_inotify_add_watch:
13453
p = lock_user_string(arg2);
13454
ret = get_errno(inotify_add_watch(arg1, path(p), arg3));
13455
unlock_user(p, arg2, 0);
13456
return ret;
13468
-#endif
13469
-#if defined(TARGET_NR_inotify_rm_watch)
13457
case TARGET_NR_inotify_rm_watch:
13458
return get_errno(inotify_rm_watch(arg1, arg2));
13472
-#endif
13473
-#endif
13459
13460
#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open)
13461
case TARGET_NR_mq_open: