Skip to contentSkip to conversation

add inotify syscalls

PATCH In review Riku Voipio 2 participants 3 messages Sep 17, 2008 – Sep 19, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add inotify syscalls

Inotify syscall implementation lifted from scratchbox.

Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
linux-user/syscall.c +18 -1
Index: trunk/linux-user/syscall.c
===================================================================
@@ -29,6 +29,7 @@
 #include <time.h>
 #include <limits.h>
 #include <sys/types.h>
+#include <sys/inotify.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
 #include <sys/wait.h>
@@ -5821,7 +5822,23 @@
         ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
         break;
 #endif
-
+#ifdef TARGET_NR_inotify_init
+    case TARGET_NR_inotify_init:
+        ret = get_errno(inotify_init());
+        break;
+#endif
+#ifdef 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);
+        break;
+#endif
+#ifdef TARGET_NR_inotify_rm_watch
+    case TARGET_NR_inotify_rm_watch:
+        ret = get_errno(inotify_rm_watch(arg1, arg2));
+        break;
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
#1 lore raw
Quoted 33 lines · Riku Voipio

Inotify syscall implementation lifted from scratchbox.

Signature · 4 lines
"rm -rf" only sounds scary if you don't have backups

Index: trunk/linux-user/syscall.c
===================================================================
linux-user/syscall.c +11 -1
@@ -29,6 +29,7 @@
 #include <time.h>
 #include <limits.h>
 #include <sys/types.h>
+#include <sys/inotify.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
 #include <sys/wait.h>
@@ -5821,7 +5822,23 @@
         ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
         break;
 #endif
-
+#ifdef TARGET_NR_inotify_init
+    case TARGET_NR_inotify_init:
+        ret = get_errno(inotify_init());
+        break;
+#endif
+#ifdef 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);

linux-user/syscall.c line 5844

Quoted 10 lines
linux-user/syscall.c +7 -0
+        break;
+#endif
+#ifdef TARGET_NR_inotify_rm_watch
+    case TARGET_NR_inotify_rm_watch:
+        ret = get_errno(inotify_rm_watch(arg1, arg2));
+        break;
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);

This syscalls like *at introduced in glibc 2.4. So you should use _syscall* macros for backward compatible.

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/
#2 lore raw
Quoted 40 lines · Kirill A. Shutemov
Quoted 39 lines · Riku Voipio

Inotify syscall implementation lifted from scratchbox.

Signature · 4 lines
"rm -rf" only sounds scary if you don't have backups

Index: trunk/linux-user/syscall.c
===================================================================
linux-user/syscall.c +17 -1
@@ -29,6 +29,7 @@
 #include <time.h>
 #include <limits.h>
 #include <sys/types.h>
+#include <sys/inotify.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
 #include <sys/wait.h>
@@ -5821,7 +5822,23 @@
         ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
         break;
 #endif
-
+#ifdef TARGET_NR_inotify_init
+    case TARGET_NR_inotify_init:
+        ret = get_errno(inotify_init());
+        break;
+#endif
+#ifdef 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);
+        break;
+#endif
+#ifdef TARGET_NR_inotify_rm_watch
+    case TARGET_NR_inotify_rm_watch:
+        ret = get_errno(inotify_rm_watch(arg1, arg2));
+        break;
Quoted 8 lines

linux-user/syscall.c line 5844

Quoted 4 lines
linux-user/syscall.c +1 -0
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);

This syscalls like *at introduced in glibc 2.4. So you should use _syscall* macros for backward compatible.

Right, will fix in a moment

Signature · 1 line
"rm -rf" only sounds scary if you don't have backups