mirror of https://github.com/xemu-project/xemu.git
linux-user linkat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3223 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
722183f69b
commit
64f0ce4c0d
|
@ -143,6 +143,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
|
||||||
#define __NR_sys_getcwd1 __NR_getcwd
|
#define __NR_sys_getcwd1 __NR_getcwd
|
||||||
#define __NR_sys_getdents __NR_getdents
|
#define __NR_sys_getdents __NR_getdents
|
||||||
#define __NR_sys_getdents64 __NR_getdents64
|
#define __NR_sys_getdents64 __NR_getdents64
|
||||||
|
#define __NR_sys_linkat __NR_linkat
|
||||||
#define __NR_sys_mkdirat __NR_mkdirat
|
#define __NR_sys_mkdirat __NR_mkdirat
|
||||||
#define __NR_sys_mknodat __NR_mknodat
|
#define __NR_sys_mknodat __NR_mknodat
|
||||||
#define __NR_sys_openat __NR_openat
|
#define __NR_sys_openat __NR_openat
|
||||||
|
@ -176,6 +177,10 @@ _syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count);
|
||||||
#endif
|
#endif
|
||||||
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
|
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
|
||||||
loff_t *, res, uint, wh);
|
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)
|
#if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
|
||||||
_syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode)
|
_syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode)
|
||||||
#endif
|
#endif
|
||||||
|
@ -2581,6 +2586,28 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
|
||||||
unlock_user(p, arg1, 0);
|
unlock_user(p, arg1, 0);
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case TARGET_NR_unlink:
|
||||||
p = lock_user_string(arg1);
|
p = lock_user_string(arg1);
|
||||||
ret = get_errno(unlink(p));
|
ret = get_errno(unlink(p));
|
||||||
|
|
Loading…
Reference in New Issue