Commit 75ac37a09b585cf3e6e3dd45575b1d8e693dddc5
1 parent
4472ad0d
linux-user mknodat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3219 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
20 additions
and
0 deletions
linux-user/syscall.c
@@ -143,6 +143,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ | @@ -143,6 +143,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ | ||
143 | #define __NR_sys_getdents __NR_getdents | 143 | #define __NR_sys_getdents __NR_getdents |
144 | #define __NR_sys_getdents64 __NR_getdents64 | 144 | #define __NR_sys_getdents64 __NR_getdents64 |
145 | #define __NR_sys_mkdirat __NR_mkdirat | 145 | #define __NR_sys_mkdirat __NR_mkdirat |
146 | +#define __NR_sys_mknodat __NR_mknodat | ||
146 | #define __NR_sys_openat __NR_openat | 147 | #define __NR_sys_openat __NR_openat |
147 | #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo | 148 | #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo |
148 | #define __NR_sys_syslog __NR_syslog | 149 | #define __NR_sys_syslog __NR_syslog |
@@ -171,6 +172,10 @@ _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, | @@ -171,6 +172,10 @@ _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, | ||
171 | #if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat) | 172 | #if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat) |
172 | _syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode) | 173 | _syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode) |
173 | #endif | 174 | #endif |
175 | +#if defined(TARGET_NR_mknodat) && defined(__NR_mknodat) | ||
176 | +_syscall4(int,sys_mknodat,int,dirfd,const char *,pathname, | ||
177 | + mode_t,mode,dev_t,dev) | ||
178 | +#endif | ||
174 | #if defined(TARGET_NR_openat) && defined(__NR_openat) | 179 | #if defined(TARGET_NR_openat) && defined(__NR_openat) |
175 | _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode) | 180 | _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode) |
176 | #endif | 181 | #endif |
@@ -2643,6 +2648,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -2643,6 +2648,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
2643 | ret = get_errno(mknod(p, arg2, arg3)); | 2648 | ret = get_errno(mknod(p, arg2, arg3)); |
2644 | unlock_user(p, arg1, 0); | 2649 | unlock_user(p, arg1, 0); |
2645 | break; | 2650 | break; |
2651 | +#if defined(TARGET_NR_mknodat) && defined(__NR_mknodat) | ||
2652 | + case TARGET_NR_mknodat: | ||
2653 | + if (!arg2) { | ||
2654 | + ret = -EFAULT; | ||
2655 | + goto fail; | ||
2656 | + } | ||
2657 | + p = lock_user_string(arg2); | ||
2658 | + if (!access_ok(VERIFY_READ, p, 1)) | ||
2659 | + ret = -EFAULT; | ||
2660 | + else | ||
2661 | + ret = get_errno(sys_mknodat(arg1, p, arg3, arg4)); | ||
2662 | + if (p) | ||
2663 | + unlock_user(p, arg2, 0); | ||
2664 | + break; | ||
2665 | +#endif | ||
2646 | case TARGET_NR_chmod: | 2666 | case TARGET_NR_chmod: |
2647 | p = lock_user_string(arg1); | 2667 | p = lock_user_string(arg1); |
2648 | ret = get_errno(chmod(p, arg2)); | 2668 | ret = get_errno(chmod(p, arg2)); |