Commit ac8a6556482ad8ecd7ba856d41ed850bd9866c77

Authored by balrog
1 parent 6a24a778

Implement the futimesat() syscall (by Kirill Shutemov).

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5269 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 25 additions and 0 deletions
linux-user/syscall.c
@@ -157,6 +157,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \ @@ -157,6 +157,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
157 #define __NR_sys_fchmodat __NR_fchmodat 157 #define __NR_sys_fchmodat __NR_fchmodat
158 #define __NR_sys_fchownat __NR_fchownat 158 #define __NR_sys_fchownat __NR_fchownat
159 #define __NR_sys_fstatat64 __NR_fstatat64 159 #define __NR_sys_fstatat64 __NR_fstatat64
  160 +#define __NR_sys_futimesat __NR_futimesat
160 #define __NR_sys_getcwd1 __NR_getcwd 161 #define __NR_sys_getcwd1 __NR_getcwd
161 #define __NR_sys_getdents __NR_getdents 162 #define __NR_sys_getdents __NR_getdents
162 #define __NR_sys_getdents64 __NR_getdents64 163 #define __NR_sys_getdents64 __NR_getdents64
@@ -205,6 +206,10 @@ _syscall5(int,sys_fchownat,int,dirfd,const char *,pathname, @@ -205,6 +206,10 @@ _syscall5(int,sys_fchownat,int,dirfd,const char *,pathname,
205 _syscall4(int,sys_fstatat64,int,dirfd,const char *,pathname, 206 _syscall4(int,sys_fstatat64,int,dirfd,const char *,pathname,
206 struct stat *,buf,int,flags) 207 struct stat *,buf,int,flags)
207 #endif 208 #endif
  209 +#if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
  210 +_syscall3(int,sys_futimesat,int,dirfd,const char *,pathname,
  211 + const struct timeval *,times)
  212 +#endif
208 _syscall2(int,sys_getcwd1,char *,buf,size_t,size) 213 _syscall2(int,sys_getcwd1,char *,buf,size_t,size)
209 #if TARGET_ABI_BITS == 32 214 #if TARGET_ABI_BITS == 32
210 _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count); 215 _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
@@ -3662,6 +3667,26 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, @@ -3662,6 +3667,26 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
3662 unlock_user(p, arg1, 0); 3667 unlock_user(p, arg1, 0);
3663 } 3668 }
3664 break; 3669 break;
  3670 +#if defined(TARGET_NR_futimesat) && defined(__NR_futimesat)
  3671 + case TARGET_NR_futimesat:
  3672 + {
  3673 + struct timeval *tvp, tv[2];
  3674 + if (arg3) {
  3675 + if (copy_from_user_timeval(&tv[0], arg3)
  3676 + || copy_from_user_timeval(&tv[1],
  3677 + arg3 + sizeof(struct target_timeval)))
  3678 + goto efault;
  3679 + tvp = tv;
  3680 + } else {
  3681 + tvp = NULL;
  3682 + }
  3683 + if (!(p = lock_user_string(arg2)))
  3684 + goto efault;
  3685 + ret = get_errno(sys_futimesat(arg1, path(p), tvp));
  3686 + unlock_user(p, arg2, 0);
  3687 + }
  3688 + break;
  3689 +#endif
3665 #ifdef TARGET_NR_stty 3690 #ifdef TARGET_NR_stty
3666 case TARGET_NR_stty: 3691 case TARGET_NR_stty:
3667 goto unimplemented; 3692 goto unimplemented;