qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] add inotify syscalls
@ 2008-09-17 19:45 Riku Voipio
  2008-09-19  8:08 ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Riku Voipio @ 2008-09-17 19:45 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 166 bytes --]

Inotify syscall implementation lifted from scratchbox.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
-- 
"rm -rf" only sounds scary if you don't have backups

[-- Attachment #1.2: 97_inotify.patch --]
[-- Type: text/plain, Size: 1139 bytes --]

Index: trunk/linux-user/syscall.c
===================================================================
--- trunk.orig/linux-user/syscall.c	2008-09-17 22:08:51.000000000 +0300
+++ trunk/linux-user/syscall.c	2008-09-17 22:12:04.000000000 +0300
@@ -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);

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] add inotify syscalls
  2008-09-17 19:45 [Qemu-devel] [PATCH] add inotify syscalls Riku Voipio
@ 2008-09-19  8:08 ` Kirill A. Shutemov
  2008-09-19 11:37   ` Riku Voipio
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2008-09-19  8:08 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1705 bytes --]

On Wed, Sep 17, 2008 at 10:45:50PM +0300, Riku Voipio wrote:
> Inotify syscall implementation lifted from scratchbox.
> 
> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
> -- 
> "rm -rf" only sounds scary if you don't have backups

> Index: trunk/linux-user/syscall.c
> ===================================================================
> --- trunk.orig/linux-user/syscall.c	2008-09-17 22:08:51.000000000 +0300
> +++ trunk/linux-user/syscall.c	2008-09-17 22:12:04.000000000 +0300
> @@ -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);


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

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] add inotify syscalls
  2008-09-19  8:08 ` Kirill A. Shutemov
@ 2008-09-19 11:37   ` Riku Voipio
  0 siblings, 0 replies; 3+ messages in thread
From: Riku Voipio @ 2008-09-19 11:37 UTC (permalink / raw)
  To: qemu-devel

On Fri, Sep 19, 2008 at 11:08:07AM +0300, Kirill A. Shutemov wrote:
> On Wed, Sep 17, 2008 at 10:45:50PM +0300, Riku Voipio wrote:
> > Inotify syscall implementation lifted from scratchbox.
> > 
> > Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
> > -- 
> > "rm -rf" only sounds scary if you don't have backups
> 
> > Index: trunk/linux-user/syscall.c
> > ===================================================================
> > --- trunk.orig/linux-user/syscall.c	2008-09-17 22:08:51.000000000 +0300
> > +++ trunk/linux-user/syscall.c	2008-09-17 22:12:04.000000000 +0300
> > @@ -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);
> 
> 
> This syscalls like *at introduced in glibc 2.4. So you should use
> _syscall* macros for backward compatible.

Right, will fix in a moment


-- 
"rm -rf" only sounds scary if you don't have backups

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-19 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 19:45 [Qemu-devel] [PATCH] add inotify syscalls Riku Voipio
2008-09-19  8:08 ` Kirill A. Shutemov
2008-09-19 11:37   ` Riku Voipio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).