Skip to contentSkip to conversation

linux-user: fix problems with inotify syscalls

PATCH Applied Nathan Froyd 3 participants 3 messages Mar 28, 2009 – Apr 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: fix problems with inotify syscalls

The sys_inotify* calls are defined if the target supports them and the host supports the necessary syscalls. But the syscalls are handled if the target supports them. This situation leads to compilation failures when the host doesn't support the necessary syscalls, as the linker will complain about undefined functions.

Fix this state of affairs by making the handling conditions the same as the call definition conditions.

---
 linux-user/syscall.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
linux-user/syscall.c +3 -3
index 226ee6c..8608171 100644
@@ -6109,19 +6109,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
         break;
 #endif
-#ifdef TARGET_NR_inotify_init
+#if defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init)
     case TARGET_NR_inotify_init:
         ret = get_errno(sys_inotify_init());
         break;
 #endif
-#ifdef TARGET_NR_inotify_add_watch
+#if defined(TARGET_NR_inotify_add_watch) && defined(__NR_inotify_add_watch)
     case TARGET_NR_inotify_add_watch:
         p = lock_user_string(arg2);
         ret = get_errno(sys_inotify_add_watch(arg1, path(p), arg3));
         unlock_user(p, arg2, 0);
         break;
 #endif
-#ifdef TARGET_NR_inotify_rm_watch
+#if defined(TARGET_NR_inotify_rm_watch) && defined(__NR_inotify_rm_watch)
     case TARGET_NR_inotify_rm_watch:
         ret = get_errno(sys_inotify_rm_watch(arg1, arg2));
         break;
Signature · 1 line
1.6.0.5
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Nathan Froyd

The sys_inotify* calls are defined if the target supports them and the host supports the necessary syscalls. But the syscalls are handled if the target supports them. This situation leads to compilation failures when the host doesn't support the necessary syscalls, as the linker will complain about undefined functions.

Looks ok to me, this is how the *at syscalls are #ifdeffed as well.

Quoted 39 lines

Fix this state of affairs by making the handling conditions the same as the call definition conditions.

---
 linux-user/syscall.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
linux-user/syscall.c +3 -3
index 226ee6c..8608171 100644
@@ -6109,19 +6109,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
         break;
 #endif
-#ifdef TARGET_NR_inotify_init
+#if defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init)
     case TARGET_NR_inotify_init:
         ret = get_errno(sys_inotify_init());
         break;
 #endif
-#ifdef TARGET_NR_inotify_add_watch
+#if defined(TARGET_NR_inotify_add_watch) && defined(__NR_inotify_add_watch)
     case TARGET_NR_inotify_add_watch:
         p = lock_user_string(arg2);
         ret = get_errno(sys_inotify_add_watch(arg1, path(p), arg3));
         unlock_user(p, arg2, 0);
         break;
 #endif
-#ifdef TARGET_NR_inotify_rm_watch
+#if defined(TARGET_NR_inotify_rm_watch) && defined(__NR_inotify_rm_watch)
     case TARGET_NR_inotify_rm_watch:
         ret = get_errno(sys_inotify_rm_watch(arg1, arg2));
         break;
Signature · 1 line
1.6.0.5
Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
#2 lore raw
In reply to Nathan Froyd
Quoted 6 lines · Nathan Froyd

The sys_inotify* calls are defined if the target supports them and the host supports the necessary syscalls. But the syscalls are handled if the target supports them. This situation leads to compilation failures when the host doesn't support the necessary syscalls, as the linker will complain about undefined functions.

Quoted 7 lines

Fix this state of affairs by making the handling conditions the same as the call definition conditions.

---
 linux-user/syscall.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Thanks, applied.

Quoted 33 lines
linux-user/syscall.c +3 -3
index 226ee6c..8608171 100644
@@ -6109,19 +6109,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
         break;
 #endif
-#ifdef TARGET_NR_inotify_init
+#if defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init)
     case TARGET_NR_inotify_init:
         ret = get_errno(sys_inotify_init());
         break;
 #endif
-#ifdef TARGET_NR_inotify_add_watch
+#if defined(TARGET_NR_inotify_add_watch) && defined(__NR_inotify_add_watch)
     case TARGET_NR_inotify_add_watch:
         p = lock_user_string(arg2);
         ret = get_errno(sys_inotify_add_watch(arg1, path(p), arg3));
         unlock_user(p, arg2, 0);
         break;
 #endif
-#ifdef TARGET_NR_inotify_rm_watch
+#if defined(TARGET_NR_inotify_rm_watch) && defined(__NR_inotify_rm_watch)
     case TARGET_NR_inotify_rm_watch:
         ret = get_errno(sys_inotify_rm_watch(arg1, arg2));
         break;
Signature · 1 line
1.6.0.5
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net