qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user *at() syscalls
@ 2007-09-19 12:46 Thayne Harbaugh
  2007-09-19 12:51 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:46 UTC (permalink / raw)
  To: qemu-devel

I have a series of patches to add *at() syscalls to linux-user.  The
patches have minor inter-dependencies due to adjacent modifications in
some files.

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

* [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
  2007-09-19 12:46 [Qemu-devel] [PATCH] linux-user *at() syscalls Thayne Harbaugh
@ 2007-09-19 12:51 ` Thayne Harbaugh
  2007-09-19 12:53   ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
  2007-09-23 15:42   ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thiemo Seufer
  0 siblings, 2 replies; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:51 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the utimensat syscall to linux-user.

[-- Attachment #2: 22_utimensat.patch --]
[-- Type: text/x-patch, Size: 2313 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:16:40.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:17:45.000000000 -0600
@@ -158,6 +158,7 @@
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
 #define __NR_sys_tkill __NR_tkill
+#define __NR_sys_utimensat __NR_utimensat
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
 #define __NR__llseek __NR_lseek
@@ -192,6 +193,10 @@
 #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
 _syscall1(int,set_tid_address,int *,tidptr)
 #endif
+#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
+_syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
+          const struct timespec *,tsp,int,flags)
+#endif
 
 extern int personality(int);
 extern int flock(int, int);
@@ -4873,6 +4878,30 @@
 	goto unimplemented_nowarn;
 #endif
 
+#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
+    case TARGET_NR_utimensat:
+        {
+            struct timespec ts[2];
+            if (copy_from_user_timespec(ts, (struct target_timespec *)arg3)
+                || copy_from_user_timespec(ts+1, (struct target_timespec *)arg3+1)) {
+                ret = -EFAULT;
+        	goto fail;
+            }
+            if (!arg2)
+                ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4));
+            else {
+                p = lock_user_string(arg2);
+                if (!access_ok(VERIFY_READ, p, 1))
+                    ret = -EFAULT;
+                else
+                    ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4));
+                if (p)
+                    unlock_user(p, arg2, 0);
+            }
+        }
+	break;
+#endif
+
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-18 23:36:22.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:17:18.000000000 -0600
@@ -325,3 +325,4 @@
 #define TARGET_NR_mbind			319
 #define TARGET_NR_get_mempolicy		320
 #define TARGET_NR_set_mempolicy		321
+#define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall
  2007-09-19 12:51 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thayne Harbaugh
@ 2007-09-19 12:53   ` Thayne Harbaugh
  2007-09-19 12:54     ` [Qemu-devel] Re: [PATCH] linux-user openat() syscall Thayne Harbaugh
  2007-10-02 20:50     ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
  2007-09-23 15:42   ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thiemo Seufer
  1 sibling, 2 replies; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:53 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the futimesat syscall to linux-user.


[-- Attachment #2: 23_futimesat.patch --]
[-- Type: text/x-patch, Size: 2316 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:17:45.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:18:58.000000000 -0600
@@ -151,6 +151,7 @@
 
 
 #define __NR_sys_uname __NR_uname
+#define __NR_sys_futimesat __NR_futimesat
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
@@ -172,6 +173,10 @@
 }
 #endif
 _syscall1(int,sys_uname,struct new_utsname *,buf)
+#if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
+_syscall3(int,sys_futimesat,int,dirfd,const char *,pathname,
+          const struct timeval *,times)
+#endif
 _syscall2(int,sys_getcwd1,char *,buf,size_t,size)
 _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
 #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
@@ -4873,6 +4878,30 @@
 	break;
 #endif
 
+#if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
+    case TARGET_NR_futimesat:
+        {
+            struct timeval tv[2];
+            if (copy_from_user_timespec(tv, (struct target_timespec *)arg3)
+                || copy_from_user_timespec(tv+1, (struct target_timespec *)arg3+1)) {
+        	ret = -EFAULT;
+        	goto fail;
+            }
+            if (!arg2)
+                ret = get_errno(sys_futimesat(arg1, NULL, tv));
+            else {
+                p = lock_user_string(arg2);
+                if (!access_ok(VERIFY_READ, p, 1))
+                    ret =  -EFAULT;
+		else
+                    ret = get_errno(sys_futimesat(arg1, path(p), tv));
+                if (p)
+                    unlock_user(p, arg2, 0);
+            }
+        }
+        break;
+#endif
+
 #ifdef TARGET_NR_set_robust_list
     case TARGET_NR_set_robust_list:
 	goto unimplemented_nowarn;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:17:18.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:18:22.000000000 -0600
@@ -325,4 +325,5 @@
 #define TARGET_NR_mbind			319
 #define TARGET_NR_get_mempolicy		320
 #define TARGET_NR_set_mempolicy		321
+#define TARGET_NR_futimesat			326
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user openat() syscall
  2007-09-19 12:53   ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
@ 2007-09-19 12:54     ` Thayne Harbaugh
  2007-09-19 12:57       ` [Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall Thayne Harbaugh
  2007-10-02 20:50     ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
  1 sibling, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:54 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the openat syscall to linux-user.

[-- Attachment #2: 24_openat.patch --]
[-- Type: text/x-patch, Size: 2276 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:18:58.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:19:38.000000000 -0600
@@ -155,6 +155,7 @@
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
+#define __NR_sys_openat __NR_openat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
@@ -184,6 +185,9 @@
 #endif
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
+#if defined(TARGET_NR_openat) && defined(__NR_openat)
+_syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
+#endif
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
 _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
 #if defined(TARGET_NR_tgkill) && defined(__NR_tgkill)
@@ -2685,6 +2689,24 @@
                              arg3));
         unlock_user(p, arg1, 0);
         break;
+#if defined(TARGET_NR_openat) && defined(__NR_openat)
+    case TARGET_NR_openat:
+        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_openat(arg1,
+                                       path(p),
+                                       target_to_host_bitmask(arg3, fcntl_flags_tbl),
+                                       arg4));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
     case TARGET_NR_close:
         ret = get_errno(close(arg1));
         break;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:18:22.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:19:07.000000000 -0600
@@ -325,5 +325,6 @@
 #define TARGET_NR_mbind			319
 #define TARGET_NR_get_mempolicy		320
 #define TARGET_NR_set_mempolicy		321
+#define TARGET_NR_openat			322
 #define TARGET_NR_futimesat			326
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall
  2007-09-19 12:54     ` [Qemu-devel] Re: [PATCH] linux-user openat() syscall Thayne Harbaugh
@ 2007-09-19 12:57       ` Thayne Harbaugh
  2007-09-19 12:58         ` [Qemu-devel] Re: [PATCH] linux-user mknodat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:57 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the mkdirat syscall to linux-user.

[-- Attachment #2: 25_mkdirat.patch --]
[-- Type: text/x-patch, Size: 2090 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:19:38.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:20:59.000000000 -0600
@@ -155,6 +155,7 @@
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
+#define __NR_sys_mkdirat __NR_mkdirat
 #define __NR_sys_openat __NR_openat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_syslog __NR_syslog
@@ -185,6 +186,9 @@
 #endif
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
+#if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
+_syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode)
+#endif
 #if defined(TARGET_NR_openat) && defined(__NR_openat)
 _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
 #endif
@@ -2973,6 +2977,21 @@
         ret = get_errno(mkdir(p, arg2));
         unlock_user(p, arg1, 0);
         break;
+#if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
+    case TARGET_NR_mkdirat:
+        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_mkdirat(arg1, p, arg3));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
     case TARGET_NR_rmdir:
         p = lock_user_string(arg1);
         ret = get_errno(rmdir(p));
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:19:07.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:20:24.000000000 -0600
@@ -326,5 +326,6 @@
 #define TARGET_NR_get_mempolicy		320
 #define TARGET_NR_set_mempolicy		321
 #define TARGET_NR_openat			322
+#define TARGET_NR_mkdirat			323
 #define TARGET_NR_futimesat			326
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user mknodat() syscall
  2007-09-19 12:57       ` [Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall Thayne Harbaugh
@ 2007-09-19 12:58         ` Thayne Harbaugh
  2007-09-19 12:59           ` [Qemu-devel] Re: [PATCH] linux-user fchownat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:58 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the mknodat syscall to linux-user.

[-- Attachment #2: 26_mknodat.patch --]
[-- Type: text/x-patch, Size: 2160 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:20:59.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:21:49.000000000 -0600
@@ -156,6 +156,7 @@
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
 #define __NR_sys_mkdirat __NR_mkdirat
+#define __NR_sys_mknodat __NR_mknodat
 #define __NR_sys_openat __NR_openat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_syslog __NR_syslog
@@ -189,6 +190,10 @@
 #if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
 _syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode)
 #endif
+#if defined(TARGET_NR_mknodat) && defined(__NR_mknodat)
+_syscall4(int,sys_mknodat,int,dirfd,const char *,pathname,
+          mode_t,mode,dev_t,dev)
+#endif
 #if defined(TARGET_NR_openat) && defined(__NR_openat)
 _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
 #endif
@@ -2828,6 +2833,21 @@
         ret = get_errno(mknod(p, arg2, arg3));
         unlock_user(p, arg1, 0);
         break;
+#if defined(TARGET_NR_mknodat) && defined(__NR_mknodat)
+    case TARGET_NR_mknodat:
+        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_mknodat(arg1, p, arg3, arg4));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
     case TARGET_NR_chmod:
         p = lock_user_string(arg1);
         ret = get_errno(chmod(p, arg2));
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:20:24.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:21:07.000000000 -0600
@@ -327,5 +327,6 @@
 #define TARGET_NR_set_mempolicy		321
 #define TARGET_NR_openat			322
 #define TARGET_NR_mkdirat			323
+#define TARGET_NR_mknodat			324
 #define TARGET_NR_futimesat			326
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user fchownat() syscall
  2007-09-19 12:58         ` [Qemu-devel] Re: [PATCH] linux-user mknodat() syscall Thayne Harbaugh
@ 2007-09-19 12:59           ` Thayne Harbaugh
  2007-09-19 13:00             ` [Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 12:59 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the fchownat syscall to linux-user.

[-- Attachment #2: 27_fchownat.patch --]
[-- Type: text/x-patch, Size: 2085 bytes --]

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

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

* [Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall
  2007-09-19 12:59           ` [Qemu-devel] Re: [PATCH] linux-user fchownat() syscall Thayne Harbaugh
@ 2007-09-19 13:00             ` Thayne Harbaugh
  2007-09-19 13:01               ` [Qemu-devel] Re: [PATCH] linux-user renameat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:00 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the unlinkat syscall to linux-user.

[-- Attachment #2: 28_unlinkat.patch --]
[-- Type: text/x-patch, Size: 2046 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:22:58.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:23:52.000000000 -0600
@@ -163,6 +163,7 @@
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
 #define __NR_sys_tkill __NR_tkill
+#define __NR_sys_unlinkat __NR_unlinkat
 #define __NR_sys_utimensat __NR_utimensat
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
@@ -216,6 +217,9 @@
 #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
 _syscall1(int,set_tid_address,int *,tidptr)
 #endif
+#if defined(TARGET_NR_unlinkat) && defined(__NR_unlinkat)
+_syscall3(int,sys_unlinkat,int,dirfd,const char *,pathname,int,flags)
+#endif
 #if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
 _syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
           const struct timespec *,tsp,int,flags)
@@ -2762,6 +2766,21 @@
         ret = get_errno(unlink(p));
         unlock_user(p, arg1, 0);
         break;
+#if defined(TARGET_NR_unlinkat) && defined(__NR_unlinkat)
+    case TARGET_NR_unlinkat:
+        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_unlinkat(arg1, p, arg3));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
     case TARGET_NR_execve:
         {
             char **argp, **envp;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:22:15.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:23:07.000000000 -0600
@@ -330,4 +330,5 @@
 #define TARGET_NR_mknodat			324
 #define TARGET_NR_fchownat			325
 #define TARGET_NR_futimesat			326
+#define TARGET_NR_unlinkat			328
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user renameat() syscall
  2007-09-19 13:00             ` [Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall Thayne Harbaugh
@ 2007-09-19 13:01               ` Thayne Harbaugh
  2007-09-19 13:02                 ` [Qemu-devel] Re: [PATCH] linux-user linkat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:01 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the renameat syscall to linux-user.

[-- Attachment #2: 29_renameat.patch --]
[-- Type: text/x-patch, Size: 2387 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:23:52.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:24:47.000000000 -0600
@@ -159,6 +159,7 @@
 #define __NR_sys_mkdirat __NR_mkdirat
 #define __NR_sys_mknodat __NR_mknodat
 #define __NR_sys_openat __NR_openat
+#define __NR_sys_renameat __NR_renameat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
@@ -203,6 +204,10 @@
 #if defined(TARGET_NR_openat) && defined(__NR_openat)
 _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
 #endif
+#if defined(TARGET_NR_renameat) && defined(__NR_renameat)
+_syscall4(int,sys_renameat,int,olddirfd,const char *,oldpath,
+          int,newdirfd,const char *,newpath)
+#endif
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
 _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
 #if defined(TARGET_NR_tgkill) && defined(__NR_tgkill)
@@ -3016,6 +3021,28 @@
             unlock_user(p, arg1, 0);
         }
         break;
+#if defined(TARGET_NR_renameat) && defined(__NR_renameat)
+    case TARGET_NR_renameat:
+        if (!arg2 || !arg4) {
+            ret = -EFAULT;
+	    goto fail;
+        }
+        {
+            void *p2 = NULL;
+            p  = lock_user_string(arg2);
+            p2 = lock_user_string(arg4);
+            if (!access_ok(VERIFY_READ, p, 1)
+                || !access_ok(VERIFY_READ, p2, 1))
+                ret = -EFAULT;
+            else
+                ret = get_errno(sys_renameat(arg1, p, arg3, p2));
+            if (p2)
+                unlock_user(p2, arg4, 0);
+            if (p)
+                unlock_user(p, arg2, 0);
+        }
+        break;
+#endif
     case TARGET_NR_mkdir:
         p = lock_user_string(arg1);
         ret = get_errno(mkdir(p, arg2));
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:23:07.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:24:10.000000000 -0600
@@ -331,4 +331,5 @@
 #define TARGET_NR_fchownat			325
 #define TARGET_NR_futimesat			326
 #define TARGET_NR_unlinkat			328
+#define TARGET_NR_renameat			329
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user linkat() syscall
  2007-09-19 13:01               ` [Qemu-devel] Re: [PATCH] linux-user renameat() syscall Thayne Harbaugh
@ 2007-09-19 13:02                 ` Thayne Harbaugh
  2007-09-19 13:03                   ` [Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:02 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the linkat syscall to linux-user.

[-- Attachment #2: 30_linkat.patch --]
[-- Type: text/x-patch, Size: 2285 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:24:47.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:25:51.000000000 -0600
@@ -156,6 +156,7 @@
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
+#define __NR_sys_linkat __NR_linkat
 #define __NR_sys_mkdirat __NR_mkdirat
 #define __NR_sys_mknodat __NR_mknodat
 #define __NR_sys_openat __NR_openat
@@ -194,6 +195,10 @@
 #endif
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
+#if defined(TARGET_NR_linkat) && defined(__NR_linkat)
+_syscall5(int,sys_linkat,int,olddirfd,const char *,oldpath,
+	  int,newdirfd,const char *,newpath,int,flags)
+#endif
 #if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
 _syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode)
 #endif
@@ -2766,6 +2771,28 @@
             unlock_user(p, arg1, 0);
         }
         break;
+#if defined(TARGET_NR_linkat) && defined(__NR_linkat)
+    case TARGET_NR_linkat:
+        if (!arg2 || !arg4) {
+            ret = -EFAULT;
+            goto fail;
+	}
+        {
+            void * p2 = NULL;
+            p  = lock_user_string(arg2);
+            p2 = lock_user_string(arg4);
+            if (!access_ok(VERIFY_READ, p, 1)
+                || !access_ok(VERIFY_READ, p2, 1))
+                ret = -EFAULT;
+            else
+                ret = get_errno(sys_linkat(arg1, p, arg3, p2, arg5));
+            if (p2)
+                unlock_user(p, arg2, 0);
+            if (p)
+                unlock_user(p2, arg4, 0);
+        }
+        break;
+#endif
     case TARGET_NR_unlink:
         p = lock_user_string(arg1);
         ret = get_errno(unlink(p));
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:24:10.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:25:08.000000000 -0600
@@ -332,4 +332,5 @@
 #define TARGET_NR_futimesat			326
 #define TARGET_NR_unlinkat			328
 #define TARGET_NR_renameat			329
+#define TARGET_NR_linkat			330
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall
  2007-09-19 13:02                 ` [Qemu-devel] Re: [PATCH] linux-user linkat() syscall Thayne Harbaugh
@ 2007-09-19 13:03                   ` Thayne Harbaugh
  2007-09-19 13:04                     ` [Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:03 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the symlinkat syscall to linux-user.

[-- Attachment #2: 31_symlinkat.patch --]
[-- Type: text/x-patch, Size: 2275 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:25:51.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:26:51.000000000 -0600
@@ -162,6 +162,7 @@
 #define __NR_sys_openat __NR_openat
 #define __NR_sys_renameat __NR_renameat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
+#define __NR_sys_symlinkat __NR_symlinkat
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
 #define __NR_sys_tkill __NR_tkill
@@ -214,6 +215,10 @@
           int,newdirfd,const char *,newpath)
 #endif
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
+#ifdef TARGET_NR_symlinkat
+_syscall3(int,sys_symlinkat,const char *,oldpath,
+          int,newdirfd,const char *,newpath)
+#endif
 _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
 #if defined(TARGET_NR_tgkill) && defined(__NR_tgkill)
 _syscall3(int,sys_tgkill,int,tgid,int,pid,int,sig)
@@ -3543,6 +3548,28 @@
             unlock_user(p, arg1, 0);
         }
         break;
+#if defined(TARGET_NR_symlinkat) && defined(__NR_symlinkat)
+    case TARGET_NR_symlinkat:
+        if (!arg1 || !arg3) {
+            ret = -EFAULT;
+	    goto fail;
+	}
+        {
+            void *p2 = NULL;
+            p  = lock_user_string(arg1);
+            p2 = lock_user_string(arg3);
+            if (!access_ok(VERIFY_READ, p, 1)
+                || !access_ok(VERIFY_READ, p2, 1))
+                ret = -EFAULT;
+            else
+                ret = get_errno(sys_symlinkat(p, arg2, p2));
+            if (p2)
+                unlock_user(p2, arg3, 0);
+            if (p)
+                unlock_user(p, arg1, 0);
+        }
+        break;
+#endif
 #ifdef TARGET_NR_oldlstat
     case TARGET_NR_oldlstat:
         goto unimplemented;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:25:08.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:26:21.000000000 -0600
@@ -333,4 +333,5 @@
 #define TARGET_NR_unlinkat			328
 #define TARGET_NR_renameat			329
 #define TARGET_NR_linkat			330
+#define TARGET_NR_symlinkat			331
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall
  2007-09-19 13:03                   ` [Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall Thayne Harbaugh
@ 2007-09-19 13:04                     ` Thayne Harbaugh
  2007-09-19 13:05                       ` [Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:04 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the readlinkat syscall to linux-user.

[-- Attachment #2: 32_readlinkat.patch --]
[-- Type: text/x-patch, Size: 2372 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:26:51.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:27:29.000000000 -0600
@@ -160,6 +160,7 @@
 #define __NR_sys_mkdirat __NR_mkdirat
 #define __NR_sys_mknodat __NR_mknodat
 #define __NR_sys_openat __NR_openat
+#define __NR_sys_readlinkat __NR_readlinkat
 #define __NR_sys_renameat __NR_renameat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_symlinkat __NR_symlinkat
@@ -210,6 +211,10 @@
 #if defined(TARGET_NR_openat) && defined(__NR_openat)
 _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
 #endif
+#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat)
+_syscall4(int,sys_readlinkat,int,dirfd,const char *,pathname,
+          char *,buf,size_t,bufsize)
+#endif
 #if defined(TARGET_NR_renameat) && defined(__NR_renameat)
 _syscall4(int,sys_renameat,int,olddirfd,const char *,oldpath,
           int,newdirfd,const char *,newpath)
@@ -3584,6 +3589,28 @@
             unlock_user(p, arg1, 0);
         }
         break;
+#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat)
+    case TARGET_NR_readlinkat:
+        if (!arg2 || !arg3) {
+            ret = -EFAULT;
+            goto fail;
+	}
+        {
+            void *p2 = NULL;
+            p  = lock_user_string(arg2);
+            p2 = lock_user(arg3, arg4, 0);
+            if (!access_ok(VERIFY_READ, p, 1)
+                || !access_ok(VERIFY_READ, p2, 1))
+        	ret = -EFAULT;
+            else
+                ret = get_errno(sys_readlinkat(arg1, path(p), p2, arg4));
+            if (p2)
+                unlock_user(p2, arg3, ret);
+            if (p)
+                unlock_user(p, arg2, 0);
+        }
+        break;
+#endif
 #ifdef TARGET_NR_uselib
     case TARGET_NR_uselib:
         goto unimplemented;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:26:21.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:26:57.000000000 -0600
@@ -334,4 +334,5 @@
 #define TARGET_NR_renameat			329
 #define TARGET_NR_linkat			330
 #define TARGET_NR_symlinkat			331
+#define TARGET_NR_readlinkat			332
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall
  2007-09-19 13:04                     ` [Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall Thayne Harbaugh
@ 2007-09-19 13:05                       ` Thayne Harbaugh
  2007-09-19 13:06                         ` [Qemu-devel] Re: [PATCH] linux-user faccessat() syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:05 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the fchmodat syscall to linux-user.

[-- Attachment #2: 33_fchmodat.patch --]
[-- Type: text/x-patch, Size: 1975 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:27:29.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:28:02.000000000 -0600
@@ -151,6 +151,7 @@
 
 
 #define __NR_sys_uname __NR_uname
+#define __NR_sys_fchmodat __NR_fchmodat
 #define __NR_sys_fchownat __NR_fchownat
 #define __NR_sys_futimesat __NR_futimesat
 #define __NR_sys_getcwd1 __NR_getcwd
@@ -182,6 +183,10 @@
 }
 #endif
 _syscall1(int,sys_uname,struct new_utsname *,buf)
+#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
+_syscall4(int,sys_fchmodat,int,dirfd,const char *,pathname,
+          mode_t,mode,int,flags)
+#endif
 #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)
@@ -3715,6 +3720,21 @@
     case TARGET_NR_fchmod:
         ret = get_errno(fchmod(arg1, arg2));
         break;
+#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
+    case TARGET_NR_fchmodat:
+        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_fchmodat(arg1, p, arg3, arg4));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
     case TARGET_NR_getpriority:
         ret = get_errno(getpriority(arg1, arg2));
         break;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:26:57.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:27:37.000000000 -0600
@@ -335,4 +335,5 @@
 #define TARGET_NR_linkat			330
 #define TARGET_NR_symlinkat			331
 #define TARGET_NR_readlinkat			332
+#define TARGET_NR_fchmodat			333
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user faccessat() syscall
  2007-09-19 13:05                       ` [Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall Thayne Harbaugh
@ 2007-09-19 13:06                         ` Thayne Harbaugh
  2007-09-19 13:09                           ` [Qemu-devel] Re: [PATCH] linux-user stat64_put_user function Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:06 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the faccessat syscall to linux-user.

[-- Attachment #2: 34_faccessat.patch --]
[-- Type: text/x-patch, Size: 1968 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:28:02.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:28:30.000000000 -0600
@@ -151,6 +151,7 @@
 
 
 #define __NR_sys_uname __NR_uname
+#define __NR_sys_faccessat __NR_faccessat
 #define __NR_sys_fchmodat __NR_fchmodat
 #define __NR_sys_fchownat __NR_fchownat
 #define __NR_sys_futimesat __NR_futimesat
@@ -183,6 +184,9 @@
 }
 #endif
 _syscall1(int,sys_uname,struct new_utsname *,buf)
+#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
+_syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags)
+#endif
 #if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
 _syscall4(int,sys_fchmodat,int,dirfd,const char *,pathname,
           mode_t,mode,int,flags)
@@ -3037,6 +3041,21 @@
         ret = get_errno(access(p, arg2));
         unlock_user(p, arg1, 0);
         break;
+#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
+    case TARGET_NR_faccessat:
+        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_faccessat(arg1, p, arg3, arg4));
+        if (p)
+            unlock_user(p, arg2, 0);
+        break;
+#endif
 #ifdef TARGET_NR_nice /* not on alpha */
     case TARGET_NR_nice:
         ret = get_errno(nice(arg1));
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:27:37.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:28:08.000000000 -0600
@@ -336,4 +336,5 @@
 #define TARGET_NR_symlinkat			331
 #define TARGET_NR_readlinkat			332
 #define TARGET_NR_fchmodat			333
+#define TARGET_NR_faccessat			334
 #define TARGET_NR_utimensat			348

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

* [Qemu-devel] Re: [PATCH] linux-user stat64_put_user function
  2007-09-19 13:06                         ` [Qemu-devel] Re: [PATCH] linux-user faccessat() syscall Thayne Harbaugh
@ 2007-09-19 13:09                           ` Thayne Harbaugh
  2007-09-19 13:11                             ` [Qemu-devel] Re: [PATCH] linux-user fstatat syscall Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:09 UTC (permalink / raw)
  To: qemu-devel

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

This patch puts stat64 functionality into a function rather than using
gotos for all the locations that copy stat64 buffers to user space.
This patch is necessary for following fstatat64 syscall patch.

[-- Attachment #2: 35_stat64_put_user.patch --]
[-- Type: text/x-patch, Size: 7816 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:28:30.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:28:34.000000000 -0600
@@ -526,6 +526,77 @@
     return 0;
 }
 
+#ifdef TARGET_ARM
+#define copy_to_user_statbuf64_wrapper(tsb,hsb)		\
+	((((CPUARMState *)cpu_env)->eabi)		\
+	 ? copy_to_user_statbuf64_eabi((tsb),(hsb))	\
+	 : copy_to_user_statbuf64((tsb),(hsb)))
+#else
+#define copy_to_user_statbuf64_wrapper(tsb,hsb)		\
+	copy_to_user_eabi_statbuf64((tsb),(hsb))
+#endif
+
+#ifdef TARGET_ARM
+static inline long copy_to_user_statbuf64_eabi(void *gen_target_stbuf,
+					       const struct stat *host_stbuf)
+{
+    struct target_eabi_stat64 *target_stbuf = (struct target_eabi_stat64 *)gen_target_stbuf;
+    int i;
+
+    if( !access_ok(VERIFY_WRITE,target_stbuf,sizeof(struct target_eabi_stat64)) ) return -EFAULT;
+    memset(target_stbuf, 0, sizeof(struct target_eabi_stat64));
+    /* use __put_user() since we just checked that the buffer is valid  */
+    __put_user(host_stbuf->st_dev, &target_stbuf->st_dev);
+    __put_user(host_stbuf->st_ino, &target_stbuf->st_ino);
+#ifdef TARGET_STAT64_HAS_BROKEN_ST_INO
+    __put_user(host_stbuf->st_ino, &target_stbuf->__st_ino);
+#endif
+    __put_user(host_stbuf->st_mode, &target_stbuf->st_mode);
+    __put_user(host_stbuf->st_nlink, &target_stbuf->st_nlink);
+    __put_user(host_stbuf->st_uid, &target_stbuf->st_uid);
+    __put_user(host_stbuf->st_gid, &target_stbuf->st_gid);
+    __put_user(host_stbuf->st_rdev, &target_stbuf->st_rdev);
+    /* XXX: better use of kernel struct */
+    __put_user(host_stbuf->st_size, &target_stbuf->st_size);
+    __put_user(host_stbuf->st_blksize, &target_stbuf->st_blksize);
+    __put_user(host_stbuf->st_blocks, &target_stbuf->st_blocks);
+    __put_user(host_stbuf->st_atime, &target_stbuf->target_st_atime);
+    __put_user(host_stbuf->st_mtime, &target_stbuf->target_st_mtime);
+    __put_user(host_stbuf->st_ctime, &target_stbuf->target_st_ctime);
+
+    return 0;
+}
+#endif
+
+static inline long copy_to_user_statbuf64(void *gen_target_stbuf,
+					  const struct stat *host_stbuf)
+{
+    struct target_stat64 *target_stbuf = (struct target_stat64 *)gen_target_stbuf;
+    gemu_log("%s()\n", __func__);
+    if( !access_ok(VERIFY_WRITE,target_stbuf,sizeof(struct target_stat64)) ) return -EFAULT;
+    memset(target_stbuf, 0, sizeof(struct target_stat64));
+    /* use __put_user() since we just checked that the buffer is valid  */
+    __put_user(host_stbuf->st_dev, &target_stbuf->st_dev);
+    __put_user(host_stbuf->st_ino, &target_stbuf->st_ino);
+#ifdef TARGET_STAT64_HAS_BROKEN_ST_INO
+    __put_user(host_stbuf->st_ino, &target_stbuf->__st_ino);
+#endif
+    __put_user(host_stbuf->st_mode, &target_stbuf->st_mode);
+    __put_user(host_stbuf->st_nlink, &target_stbuf->st_nlink);
+    __put_user(host_stbuf->st_uid, &target_stbuf->st_uid);
+    __put_user(host_stbuf->st_gid, &target_stbuf->st_gid);
+    __put_user(host_stbuf->st_rdev, &target_stbuf->st_rdev);
+    /* XXX: better use of kernel struct */
+    __put_user(host_stbuf->st_size, &target_stbuf->st_size);
+    __put_user(host_stbuf->st_blksize, &target_stbuf->st_blksize);
+    __put_user(host_stbuf->st_blocks, &target_stbuf->st_blocks);
+    __put_user(host_stbuf->st_atime, &target_stbuf->target_st_atime);
+    __put_user(host_stbuf->st_mtime, &target_stbuf->target_st_mtime);
+    __put_user(host_stbuf->st_ctime, &target_stbuf->target_st_ctime);
+    return 0;
+}
+
+
 static inline long copy_from_user_timeval(struct timeval *tv,
                                           struct target_timeval *target_tv)
 {
@@ -4562,7 +4633,10 @@
         if( !access_ok(VERIFY_READ,p,1) ) return -EFAULT;
         ret = get_errno(stat(path(p), &st));
         unlock_user(p, arg1, 0);
-        goto do_stat64;
+        if (!is_error(ret)
+            && copy_to_user_statbuf64_wrapper(arg2,&st))
+            return -EFAULT;
+	break;
 #endif
 #ifdef TARGET_NR_lstat64
     case TARGET_NR_lstat64:
@@ -4570,65 +4644,18 @@
         if( !access_ok(VERIFY_READ,p,1) ) return -EFAULT;
         ret = get_errno(lstat(path(p), &st));
         unlock_user(p, arg1, 0);
-        goto do_stat64;
+        if (!is_error(ret)
+            && copy_to_user_statbuf64_wrapper(arg2,&st))
+            return -EFAULT;
+	break;
 #endif
 #ifdef TARGET_NR_fstat64
     case TARGET_NR_fstat64:
-        {
-            ret = get_errno(fstat(arg1, &st));
-        do_stat64:
-            if (!is_error(ret)) {
-#ifdef TARGET_ARM
-                if (((CPUARMState *)cpu_env)->eabi) {
-                    struct target_eabi_stat64 *target_st = (struct target_eabi_stat64 *)arg2;
-		    if( !access_ok(VERIFY_WRITE,target_st,sizeof(struct target_eabi_stat64)) ) return -EFAULT;
-                    memset(target_st, 0, sizeof(struct target_eabi_stat64));
-                    /* use __put_user() since we just checked that the buffer is valid  */
-                    __put_user(st.st_dev, &target_st->st_dev);
-                    __put_user(st.st_ino, &target_st->st_ino);
-#ifdef TARGET_STAT64_HAS_BROKEN_ST_INO
-                    __put_user(st.st_ino, &target_st->__st_ino);
-#endif
-                    __put_user(st.st_mode, &target_st->st_mode);
-                    __put_user(st.st_nlink, &target_st->st_nlink);
-                    __put_user(st.st_uid, &target_st->st_uid);
-                    __put_user(st.st_gid, &target_st->st_gid);
-                    __put_user(st.st_rdev, &target_st->st_rdev);
-                    /* XXX: better use of kernel struct */
-                    __put_user(st.st_size, &target_st->st_size);
-                    __put_user(st.st_blksize, &target_st->st_blksize);
-                    __put_user(st.st_blocks, &target_st->st_blocks);
-                    __put_user(st.st_atime, &target_st->target_st_atime);
-                    __put_user(st.st_mtime, &target_st->target_st_mtime);
-                    __put_user(st.st_ctime, &target_st->target_st_ctime);
-                } else
-#endif
-                {
-                    struct target_stat64 *target_st = (struct target_stat64 *)arg2;
-		    if( !access_ok(VERIFY_WRITE,target_st,sizeof(struct target_stat64)) ) return -EFAULT;
-                    memset(target_st, 0, sizeof(struct target_stat64));
-                    /* use __put_user() since we just checked that the buffer is valid  */
-                    __put_user(st.st_dev, &target_st->st_dev);
-                    __put_user(st.st_ino, &target_st->st_ino);
-#ifdef TARGET_STAT64_HAS_BROKEN_ST_INO
-                    __put_user(st.st_ino, &target_st->__st_ino);
-#endif
-                    __put_user(st.st_mode, &target_st->st_mode);
-                    __put_user(st.st_nlink, &target_st->st_nlink);
-                    __put_user(st.st_uid, &target_st->st_uid);
-                    __put_user(st.st_gid, &target_st->st_gid);
-                    __put_user(st.st_rdev, &target_st->st_rdev);
-                    /* XXX: better use of kernel struct */
-                    __put_user(st.st_size, &target_st->st_size);
-                    __put_user(st.st_blksize, &target_st->st_blksize);
-                    __put_user(st.st_blocks, &target_st->st_blocks);
-                    __put_user(st.st_atime, &target_st->target_st_atime);
-                    __put_user(st.st_mtime, &target_st->target_st_mtime);
-                    __put_user(st.st_ctime, &target_st->target_st_ctime);
-                }
-            }
-        }
-        break;
+        ret = get_errno(fstat(arg1, &st));
+        if (!is_error(ret)
+            && copy_to_user_statbuf64_wrapper(arg2,&st))
+            return -EFAULT;
+	break;
 #endif
 #ifdef USE_UID16
     case TARGET_NR_lchown:

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

* [Qemu-devel] Re: [PATCH] linux-user fstatat syscall
  2007-09-19 13:09                           ` [Qemu-devel] Re: [PATCH] linux-user stat64_put_user function Thayne Harbaugh
@ 2007-09-19 13:11                             ` Thayne Harbaugh
  0 siblings, 0 replies; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-19 13:11 UTC (permalink / raw)
  To: qemu-devel

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

This patch adds the fstatat syscall to linux-user.  To depends on the
previous stat64_put_user patch.

[-- Attachment #2: 35_fstatat64.patch --]
[-- Type: text/x-patch, Size: 3648 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:28:34.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:31:35.000000000 -0600
@@ -149,11 +149,26 @@
 	return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6);	\
 }
 
+#if defined(__NR_fstatat64)
+#define HOST_NR_FSTATAT __NR_fstatat64
+typedef struct stat64 host_statbuf_t;
+#elif defined(__NR_newfstatat)
+#define HOST_NR_FSTATAT __NR_newfstatat
+typedef struct stat host_statbuf_t;
+#endif
+#if defined(TARGET_NR_fstatat64)
+#define TARGET_NR_FSTATAT (TARGET_NR_fstatat64)
+typedef struct target_stat64 target_statbuf_t;
+#elif defined(TARGET_NR_newfstatat)
+#define TARGET_NR_FSTATAT (TARGET_NR_newfstatat)
+typedef struct target_stat target_statbuf_t;
+#endif
 
 #define __NR_sys_uname __NR_uname
 #define __NR_sys_faccessat __NR_faccessat
 #define __NR_sys_fchmodat __NR_fchmodat
 #define __NR_sys_fchownat __NR_fchownat
+#define __NR_sys_fstatat HOST_NR_FSTATAT
 #define __NR_sys_futimesat __NR_futimesat
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
@@ -170,6 +185,9 @@
 #define __NR_sys_tgkill __NR_tgkill
 #define __NR_sys_tkill __NR_tkill
 #define __NR_sys_unlinkat __NR_unlinkat
+#if !defined(__NR_utimensat) && defined(__x86_64__)
+#define __NR_utimensat		280
+#endif
 #define __NR_sys_utimensat __NR_utimensat
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
@@ -199,6 +217,10 @@
 _syscall3(int,sys_futimesat,int,dirfd,const char *,pathname,
           const struct timeval *,times)
 #endif
+#if defined(TARGET_NR_FSTATAT) && (HOST_NR_FSTATAT)
+_syscall4(int,sys_fstatat,int,dirfd,const char *,pathname,
+          host_statbuf_t *,buf,int,flags)
+#endif
 _syscall2(int,sys_getcwd1,char *,buf,size_t,size)
 _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
 #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
@@ -533,7 +555,7 @@
 	 : copy_to_user_statbuf64((tsb),(hsb)))
 #else
 #define copy_to_user_statbuf64_wrapper(tsb,hsb)		\
-	copy_to_user_eabi_statbuf64((tsb),(hsb))
+	copy_to_user_statbuf64((tsb),(hsb))
 #endif
 
 #ifdef TARGET_ARM
@@ -4731,6 +4753,28 @@
             unlock_user(p, arg2, 0);
         break;
 #endif
+#if defined(TARGET_NR_FSTATAT) && defined(HOST_NR_FSTATAT)
+    case TARGET_NR_FSTATAT:
+        if (!arg2) {
+            ret = -EFAULT;
+            goto fail;
+        }
+        {
+            host_statbuf_t statbuf;
+            p = lock_user_string(arg2);
+            if (!access_ok(VERIFY_READ, p, 1))
+                ret = -EFAULT;
+            else {
+                ret = get_errno(sys_fstatat(arg1, path(p), &statbuf, arg4));
+                if (!is_error(ret)
+                    && copy_to_user_statbuf64_wrapper((struct target_stat64 *)arg3, &statbuf))
+                    ret = -EFAULT;
+            }
+            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:28:08.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:29:54.000000000 -0600
@@ -330,6 +330,7 @@
 #define TARGET_NR_mknodat			324
 #define TARGET_NR_fchownat			325
 #define TARGET_NR_futimesat			326
+#define TARGET_NR_fstatat64			327
 #define TARGET_NR_unlinkat			328
 #define TARGET_NR_renameat			329
 #define TARGET_NR_linkat			330

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

* Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
  2007-09-19 12:51 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thayne Harbaugh
  2007-09-19 12:53   ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
@ 2007-09-23 15:42   ` Thiemo Seufer
  2007-09-23 16:58     ` Stuart Anderson
  1 sibling, 1 reply; 21+ messages in thread
From: Thiemo Seufer @ 2007-09-23 15:42 UTC (permalink / raw)
  To: Thayne Harbaugh; +Cc: qemu-devel

Thayne Harbaugh wrote:
> This patch adds the utimensat syscall to linux-user.

Doesn't build:

gcc-3.4 -g  -Wl,-T,/home/ths/qemu/qemu-work/ppc.ld   -o qemu-arm main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o elfload.o linuxload.o flatload.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o libqemu.a gdbstub.o   -lm -lrt
syscall.o: In function `do_syscall':
/home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
/home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
collect2: ld returned 1 exit status
make[1]: *** [qemu-arm] Error 1
make[1]: Leaving directory `/home/ths/qemu/qemu-work/arm-linux-user'
make: *** [subdir-arm-linux-user] Error 2


Thiemo

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

* Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
  2007-09-23 15:42   ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thiemo Seufer
@ 2007-09-23 16:58     ` Stuart Anderson
  2007-09-24 19:45       ` Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Stuart Anderson @ 2007-09-23 16:58 UTC (permalink / raw)
  To: qemu-devel


On Sun, 23 Sep 2007, Thiemo Seufer wrote:

> Thayne Harbaugh wrote:
>> This patch adds the utimensat syscall to linux-user.
>
> Doesn't build:
>
> gcc-3.4 -g  -Wl,-T,/home/ths/qemu/qemu-work/ppc.ld   -o qemu-arm main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o elfload.o linuxload.o flatload.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o libqemu.a gdbstub.o   -lm -lrt
> syscall.o: In function `do_syscall':
> /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
> /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'

It's looking for something that is in the EFAULT patch.


                                 Stuart

Stuart R. Anderson                               anderson@netsweng.com
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                  BD03 0A62 E534 37A7 9149

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

* Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
  2007-09-23 16:58     ` Stuart Anderson
@ 2007-09-24 19:45       ` Thayne Harbaugh
  2007-09-25  4:25         ` Thayne Harbaugh
  0 siblings, 1 reply; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-24 19:45 UTC (permalink / raw)
  To: qemu-devel

On Sun, 2007-09-23 at 12:58 -0400, Stuart Anderson wrote:
> On Sun, 23 Sep 2007, Thiemo Seufer wrote:
> 
> > Thayne Harbaugh wrote:
> >> This patch adds the utimensat syscall to linux-user

Oops!

> > Doesn't build:
> >
> > gcc-3.4 -g  -Wl,-T,/home/ths/qemu/qemu-work/ppc.ld   -o qemu-arm main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o elfload.o linuxload.o flatload.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o libqemu.a gdbstub.o   -lm -lrt
> > syscall.o: In function `do_syscall':
> > /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
> > /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
> 
> It's looking for something that is in the EFAULT patch.

Yeah, I guess I had the EFAULT patch applied.  I'll work up a patch for
utimensat() without the EFAULT patch.

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

* Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
  2007-09-24 19:45       ` Thayne Harbaugh
@ 2007-09-25  4:25         ` Thayne Harbaugh
  0 siblings, 0 replies; 21+ messages in thread
From: Thayne Harbaugh @ 2007-09-25  4:25 UTC (permalink / raw)
  To: qemu-devel

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

On Mon, 2007-09-24 at 13:45 -0600, Thayne Harbaugh wrote:
> On Sun, 2007-09-23 at 12:58 -0400, Stuart Anderson wrote:
> > On Sun, 23 Sep 2007, Thiemo Seufer wrote:
> > 
> > > Thayne Harbaugh wrote:
> > >> This patch adds the utimensat syscall to linux-user
> 
> Oops!
> 
> > > Doesn't build:
> > >
> > > gcc-3.4 -g  -Wl,-T,/home/ths/qemu/qemu-work/ppc.ld   -o qemu-arm main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o elfload.o linuxload.o flatload.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o libqemu.a gdbstub.o   -lm -lrt
> > > syscall.o: In function `do_syscall':
> > > /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
> > > /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference to `copy_from_user_timespec'
> > 
> > It's looking for something that is in the EFAULT patch.
> 
> Yeah, I guess I had the EFAULT patch applied.  I'll work up a patch for
> utimensat() without the EFAULT patch.

Try this patch for utimensat() that doesn't depend on the EFAULT patch.

[-- Attachment #2: 22_utimensat.2.patch --]
[-- Type: text/x-patch, Size: 2600 bytes --]

Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-24 15:22:35.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-24 15:22:58.000000000 -0600
@@ -325,3 +325,4 @@
 #define TARGET_NR_mbind			319
 #define TARGET_NR_get_mempolicy		320
 #define TARGET_NR_set_mempolicy		321
+#define TARGET_NR_utimensat			348
Index: qemu/linux-user/i386/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/i386/syscall_nr.h	2007-09-24 15:22:42.000000000 -0600
+++ qemu/linux-user/i386/syscall_nr.h	2007-09-24 15:22:58.000000000 -0600
@@ -275,3 +275,5 @@
 #define TARGET_NR_utimes		271
 
 #define TARGET_NR_set_robust_list	311
+
+#define TARGET_NR_utimensat		320
Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-24 15:22:50.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-24 15:41:51.000000000 -0600
@@ -146,6 +146,7 @@
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
 #define __NR_sys_tkill __NR_tkill
+#define __NR_sys_utimensat __NR_utimensat
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
 #define __NR__llseek __NR_lseek
@@ -180,6 +181,10 @@
 #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
 _syscall1(int,set_tid_address,int *,tidptr)
 #endif
+#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
+_syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
+          const struct timespec *,tsp,int,flags)
+#endif
 
 extern int personality(int);
 extern int flock(int, int);
@@ -4653,6 +4658,27 @@
 	goto unimplemented_nowarn;
 #endif
 
+#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
+    case TARGET_NR_utimensat:
+        {
+            struct timespec ts[2];
+            target_to_host_timespec(ts, arg3);
+            target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec));
+            if (!arg2)
+                ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4));
+            else {
+                p = lock_user_string(arg2);
+                if (!access_ok(VERIFY_READ, p, 1))
+                    ret = -EFAULT;
+                else
+                    ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4));
+                if (p)
+                    unlock_user(p, arg2, 0);
+            }
+        }
+	break;
+#endif
+
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);

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

* [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall
  2007-09-19 12:53   ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
  2007-09-19 12:54     ` [Qemu-devel] Re: [PATCH] linux-user openat() syscall Thayne Harbaugh
@ 2007-10-02 20:50     ` Thayne Harbaugh
  1 sibling, 0 replies; 21+ messages in thread
From: Thayne Harbaugh @ 2007-10-02 20:50 UTC (permalink / raw)
  To: qemu-devel

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

On Wed, 2007-09-19 at 06:53 -0600, Thayne Harbaugh wrote:
> This patch adds the futimesat syscall to linux-user.

The previous futimesat() patch that was sent was horribly brain-damaged:
it used timespec in a few places that should have used timeval.  This is
a corrected patch.

I'm sure the previous patch was composed and sent by my evil twin from a
parallel universe.  I will find him and discipline him appropriately.

Yeah, that's it.

[-- Attachment #2: 23_futimesat.patch --]
[-- Type: text/x-patch, Size: 2769 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-28 13:08:43.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-10-02 14:56:47.000000000 -0600
@@ -151,6 +151,7 @@
 
 
 #define __NR_sys_uname __NR_uname
+#define __NR_sys_futimesat __NR_futimesat
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
@@ -172,6 +173,10 @@
 }
 #endif
 _syscall1(int,sys_uname,struct new_utsname *,buf)
+#if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
+_syscall3(int,sys_futimesat,int,dirfd,const char *,pathname,
+          const struct timeval *,times)
+#endif
 _syscall2(int,sys_getcwd1,char *,buf,size_t,size)
 _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
 #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
@@ -4873,6 +4878,30 @@
 	break;
 #endif
 
+#if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
+    case TARGET_NR_futimesat:
+        {
+            struct timeval tv[2];
+            if (copy_from_user_timeval(tv, (struct target_timeval *)arg3)
+                || copy_from_user_timeval(tv+1, (struct target_timeval *)arg3+1)) {
+        	ret = -EFAULT;
+        	goto fail;
+            }
+            if (!arg2)
+                ret = get_errno(sys_futimesat(arg1, NULL, tv));
+            else {
+                p = lock_user_string(arg2);
+                if (!access_ok(VERIFY_READ, p, 1))
+                    ret =  -EFAULT;
+		else
+                    ret = get_errno(sys_futimesat(arg1, path(p), tv));
+                if (p)
+                    unlock_user(p, arg2, 0);
+            }
+        }
+        break;
+#endif
+
 #ifdef TARGET_NR_set_robust_list
     case TARGET_NR_set_robust_list:
 	goto unimplemented_nowarn;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-28 13:08:43.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-10-02 14:54:56.000000000 -0600
@@ -325,4 +325,5 @@
 #define TARGET_NR_mbind			319
 #define TARGET_NR_get_mempolicy		320
 #define TARGET_NR_set_mempolicy		321
+#define TARGET_NR_futimesat			326
 #define TARGET_NR_utimensat			348
Index: qemu/linux-user/i386/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/i386/syscall_nr.h	2007-09-28 13:08:43.000000000 -0600
+++ qemu/linux-user/i386/syscall_nr.h	2007-10-02 14:54:56.000000000 -0600
@@ -274,6 +274,8 @@
 #define TARGET_NR_tgkill		270
 #define TARGET_NR_utimes		271
 
+#define TARGET_NR_futimesat		299
+
 #define TARGET_NR_set_robust_list	311
 
 #define TARGET_NR_utimensat		320

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

end of thread, other threads:[~2007-10-02 20:58 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-19 12:46 [Qemu-devel] [PATCH] linux-user *at() syscalls Thayne Harbaugh
2007-09-19 12:51 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thayne Harbaugh
2007-09-19 12:53   ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
2007-09-19 12:54     ` [Qemu-devel] Re: [PATCH] linux-user openat() syscall Thayne Harbaugh
2007-09-19 12:57       ` [Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall Thayne Harbaugh
2007-09-19 12:58         ` [Qemu-devel] Re: [PATCH] linux-user mknodat() syscall Thayne Harbaugh
2007-09-19 12:59           ` [Qemu-devel] Re: [PATCH] linux-user fchownat() syscall Thayne Harbaugh
2007-09-19 13:00             ` [Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall Thayne Harbaugh
2007-09-19 13:01               ` [Qemu-devel] Re: [PATCH] linux-user renameat() syscall Thayne Harbaugh
2007-09-19 13:02                 ` [Qemu-devel] Re: [PATCH] linux-user linkat() syscall Thayne Harbaugh
2007-09-19 13:03                   ` [Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall Thayne Harbaugh
2007-09-19 13:04                     ` [Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall Thayne Harbaugh
2007-09-19 13:05                       ` [Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall Thayne Harbaugh
2007-09-19 13:06                         ` [Qemu-devel] Re: [PATCH] linux-user faccessat() syscall Thayne Harbaugh
2007-09-19 13:09                           ` [Qemu-devel] Re: [PATCH] linux-user stat64_put_user function Thayne Harbaugh
2007-09-19 13:11                             ` [Qemu-devel] Re: [PATCH] linux-user fstatat syscall Thayne Harbaugh
2007-10-02 20:50     ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
2007-09-23 15:42   ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thiemo Seufer
2007-09-23 16:58     ` Stuart Anderson
2007-09-24 19:45       ` Thayne Harbaugh
2007-09-25  4:25         ` Thayne Harbaugh

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).