This patch adds the fchownat syscall to linux-user.
Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:21:49.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:22:58.000000000 -0600
@@ -151,6 +151,7 @@
 
 
 #define __NR_sys_uname __NR_uname
+#define __NR_sys_fchownat __NR_fchownat
 #define __NR_sys_futimesat __NR_futimesat
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
@@ -176,6 +177,10 @@
 }
 #endif
 _syscall1(int,sys_uname,struct new_utsname *,buf)
+#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat)
+_syscall5(int,sys_fchownat,int,dirfd,const char *,pathname,
+          uid_t,owner,gid_t,group,int,flags)
+#endif
 #if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
 _syscall3(int,sys_futimesat,int,dirfd,const char *,pathname,
           const struct timeval *,times)
@@ -4518,6 +4523,21 @@
     case TARGET_NR_fchown:
         ret = get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3)));
         break;
+#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat)
+    case TARGET_NR_fchownat:
+        if (!arg2) {
+            ret = -EFAULT;
+            goto fail;
+        }
+        p = lock_user_string(arg2);
+        if (!access_ok(VERIFY_READ, p, 1))
+            ret = -EFAULT;
+	else
+            ret = get_errno(sys_fchownat(arg1, p, low2highuid(arg3), low2highgid(arg4), arg5));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
 #ifdef TARGET_NR_setresuid
     case TARGET_NR_setresuid:
         ret = get_errno(setresuid(low2highuid(arg1),
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:21:07.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:22:15.000000000 -0600
@@ -328,5 +328,6 @@
 #define TARGET_NR_openat			322
 #define TARGET_NR_mkdirat			323
 #define TARGET_NR_mknodat			324
+#define TARGET_NR_fchownat			325
 #define TARGET_NR_futimesat			326
 #define TARGET_NR_utimensat			348

Reply via email to