linux-user *at() syscalls
PATCH 1/1 linux-user *at() syscalls
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.
[Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
This patch adds the utimensat syscall to linux-user.
linux-user/syscall.c +29 -0
@@ -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);
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user futimesat() syscall
This patch adds the futimesat syscall to linux-user.
linux-user/syscall.c +29 -0
@@ -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_listcase TARGET_NR_set_robust_list: goto unimplemented_nowarn;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user openat() syscall
This patch adds the openat syscall to linux-user.
linux-user/syscall.c +22 -0
@@ -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 ;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall
This patch adds the mkdirat syscall to linux-user.
linux-user/syscall.c +19 -0
@@ -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));
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user mknodat() syscall
This patch adds the mknodat syscall to linux-user.
linux-user/syscall.c +20 -0
@@ -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));
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user fchownat() syscall
This patch adds the fchownat syscall to linux-user.
linux-user/syscall.c +20 -0
@@ -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_setresuidcase TARGET_NR_setresuid: ret = get_errno(setresuid(low2highuid(arg1),
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall
This patch adds the unlinkat syscall to linux-user.
linux-user/syscall.c +19 -0
@@ -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;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user renameat() syscall
This patch adds the renameat syscall to linux-user.
linux-user/syscall.c +27 -0
@@ -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));
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user linkat() syscall
This patch adds the linkat syscall to linux-user.
linux-user/syscall.c +27 -0
@@ -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));
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall
This patch adds the symlinkat syscall to linux-user.
linux-user/syscall.c +27 -0
@@ -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_oldlstatcase TARGET_NR_oldlstat: goto unimplemented;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall
This patch adds the readlinkat syscall to linux-user.
linux-user/syscall.c +27 -0
@@ -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_uselibcase TARGET_NR_uselib: goto unimplemented;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall
This patch adds the fchmodat syscall to linux-user.
linux-user/syscall.c +20 -0
@@ -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 ;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user faccessat() syscall
This patch adds the faccessat syscall to linux-user.
linux-user/syscall.c +19 -0
@@ -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));
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user stat64_put_user function
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.
linux-user/syscall.c +84 -57
@@ -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) + &©_to_user_statbuf64_wrapper (arg2,&st)) +return -EFAULT ; +break ;#endif #ifdef TARGET_NR_lstat64case 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) + &©_to_user_statbuf64_wrapper (arg2,&st)) +return -EFAULT ; +break ;#endif #ifdef TARGET_NR_fstat64case 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) + &©_to_user_statbuf64_wrapper (arg2,&st)) +return -EFAULT ; +break ;#endif #ifdef USE_UID16 case TARGET_NR_lchown:
[Qemu-devel] Re: [PATCH] linux-user fstatat syscall
This patch adds the fstatat syscall to linux-user. To depends on the previous stat64_put_user patch.
linux-user/syscall.c +45 -1
@@ -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) + &©_to_user_statbuf64_wrapper ((struct target_stat64 *)arg3, &statbuf)) + ret = -EFAULT ; + } +if (p) +unlock_user (p, arg2,0 ); + } +break ; +#endif #ifdef TARGET_NR_setresuidcase TARGET_NR_setresuid: ret = get_errno(setresuid(low2highuid(arg1),
linux-user/arm/syscall_nr.h +1 -0
@@ -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
[Qemu-devel] Re: [PATCH] linux-user futimesat() syscall
In reply to Thayne HarbaughQuoted 1 line · Thayne Harbaugh
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.
linux-user/syscall.c +29 -0
@@ -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_listcase TARGET_NR_set_robust_list: goto unimplemented_nowarn;
linux-user/arm/syscall_nr.h +1 -0
@@ -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
linux-user/i386/syscall_nr.h +2 -0
@@ -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
Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
In reply to Thayne HarbaughQuoted 1 line · Thayne Harbaugh
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
Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
Quoted 9 lines · Thiemo Seufer
Quoted 1 line · Thayne Harbaugh
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.onwfpe/fpa11_cpdo.onwfpe/fpa11_cpdt.onwfpe/fpa11_cprt.onwfpe/fpopcode.onwfpe/single_cpdo.onwfpe/double_cpdo.onwfpe/extended_cpdo.oarm-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 tocopy_from_user_timespec' /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference tocopy_from_user_timespec'
It's looking for something that is in the EFAULT patch.
Stuart
Stuart R. Anderson [email protected] Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149
Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
Quoted 4 lines · Stuart Anderson
Quoted 2 lines · Thiemo Seufer
Quoted 1 line · Thayne Harbaugh
This patch adds the utimensat syscall to linux-user
Oops!
Quoted 8 lines
Quoted 6 lines
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.onwfpe/fpa11_cpdo.onwfpe/fpa11_cpdt.onwfpe/fpa11_cprt.onwfpe/fpopcode.onwfpe/single_cpdo.onwfpe/double_cpdo.onwfpe/extended_cpdo.oarm-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 tocopy_from_user_timespec' /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference tocopy_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.
Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall
Quoted 15 lines · Thayne Harbaugh
Quoted 4 lines · Stuart Anderson
Quoted 2 lines · Thiemo Seufer
Quoted 1 line · Thayne Harbaugh
This patch adds the utimensat syscall to linux-user
Oops!
Quoted 7 lines
Quoted 6 lines
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.onwfpe/fpa11_cpdo.onwfpe/fpa11_cpdt.onwfpe/fpa11_cprt.onwfpe/fpopcode.onwfpe/single_cpdo.onwfpe/double_cpdo.onwfpe/extended_cpdo.oarm-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 tocopy_from_user_timespec' /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference tocopy_from_user_timespec'
Quoted 4 lines
Quoted 1 line
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.
linux-user/arm/syscall_nr.h +1 -0
@@ -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
linux-user/i386/syscall_nr.h +2 -0
@@ -275,3 +275,5 @@#define TARGET_NR_utimes 271#define TARGET_NR_set_robust_list 311 + +#define TARGET_NR_utimensat 320
linux-user/syscall.c +26 -0
@@ -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);