[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 022/108] linux-user: Split out access, faccessat,
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 022/108] linux-user: Split out access, faccessat, futimesat, kill, nice, sync, syncfs |
Date: |
Sat, 9 Jun 2018 17:00:54 -1000 |
All targets define faccessat and syncfs; remove the ifdefs.
Fix the missing flags parameter to faccessat.
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall.c | 143 +++++++++++++++++++++++++++----------------
1 file changed, 91 insertions(+), 52 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d5f7519e62..6729a960ea 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7871,6 +7871,21 @@ static abi_long impl_##NAME(void *cpu_env, unsigned num,
abi_long arg1, \
abi_long arg5, abi_long arg6, abi_long arg7, \
abi_long arg8)
+#ifdef TARGET_NR_access
+IMPL(access)
+{
+ char *p = lock_user_string(arg1);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(access(path(p), arg2));
+ unlock_user(p, arg1, 0);
+ return ret;
+}
+#endif
+
#ifdef TARGET_NR_alarm
IMPL(alarm)
{
@@ -8080,6 +8095,19 @@ IMPL(exit)
g_assert_not_reached();
}
+IMPL(faccessat)
+{
+ char *p = lock_user_string(arg2);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(faccessat(arg1, p, arg3, arg4));
+ unlock_user(p, arg2, 0);
+ return ret;
+}
+
#ifdef TARGET_NR_fork
IMPL(fork)
{
@@ -8087,6 +8115,29 @@ IMPL(fork)
}
#endif
+#ifdef TARGET_NR_futimesat
+IMPL(futimesat)
+{
+ struct timeval tv[2];
+ char *p;
+ abi_long ret;
+
+ if (arg3 &&
+ (copy_from_user_timeval(&tv[0], arg3) ||
+ copy_from_user_timeval(&tv[1],
+ arg3 + sizeof(struct target_timeval)))) {
+ return -TARGET_EFAULT;
+ }
+ p = lock_user_string(arg2);
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(futimesat(arg1, path(p), arg3 ? tv : NULL));
+ unlock_user(p, arg2, 0);
+ return ret;
+}
+#endif
+
#ifdef TARGET_NR_getpid
IMPL(getpid)
{
@@ -8102,6 +8153,11 @@ IMPL(getxpid)
}
#endif
+IMPL(kill)
+{
+ return get_errno(safe_kill(arg1, target_to_host_signal(arg2)));
+}
+
#ifdef TARGET_NR_link
IMPL(link)
{
@@ -8256,6 +8312,13 @@ IMPL(name_to_handle_at)
}
#endif
+#ifdef TARGET_NR_nice
+IMPL(nice)
+{
+ return get_errno(nice(arg1));
+}
+#endif
+
#ifdef TARGET_NR_open
IMPL(open)
{
@@ -8368,6 +8431,19 @@ IMPL(stime)
}
#endif
+IMPL(sync)
+{
+ sync();
+ return 0;
+}
+
+#ifdef CONFIG_SYNCFS
+IMPL(syncfs)
+{
+ return get_errno(syncfs(arg1));
+}
+#endif
+
#ifdef TARGET_NR_time
IMPL(time)
{
@@ -8545,58 +8621,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num,
abi_long arg1,
void *p;
switch(num) {
-#if defined(TARGET_NR_futimesat)
- case TARGET_NR_futimesat:
- {
- struct timeval *tvp, tv[2];
- if (arg3) {
- if (copy_from_user_timeval(&tv[0], arg3)
- || copy_from_user_timeval(&tv[1],
- arg3 + sizeof(struct
target_timeval)))
- return -TARGET_EFAULT;
- tvp = tv;
- } else {
- tvp = NULL;
- }
- if (!(p = lock_user_string(arg2))) {
- return -TARGET_EFAULT;
- }
- ret = get_errno(futimesat(arg1, path(p), tvp));
- unlock_user(p, arg2, 0);
- }
- return ret;
-#endif
-#ifdef TARGET_NR_access
- case TARGET_NR_access:
- if (!(p = lock_user_string(arg1))) {
- return -TARGET_EFAULT;
- }
- ret = get_errno(access(path(p), arg2));
- unlock_user(p, arg1, 0);
- return ret;
-#endif
-#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
- case TARGET_NR_faccessat:
- if (!(p = lock_user_string(arg2))) {
- return -TARGET_EFAULT;
- }
- ret = get_errno(faccessat(arg1, p, arg3, 0));
- unlock_user(p, arg2, 0);
- return ret;
-#endif
-#ifdef TARGET_NR_nice /* not on alpha */
- case TARGET_NR_nice:
- return get_errno(nice(arg1));
-#endif
- case TARGET_NR_sync:
- sync();
- return 0;
-#if defined(TARGET_NR_syncfs) && defined(CONFIG_SYNCFS)
- case TARGET_NR_syncfs:
- return get_errno(syncfs(arg1));
-#endif
- case TARGET_NR_kill:
- return get_errno(safe_kill(arg1, target_to_host_signal(arg2)));
#ifdef TARGET_NR_rename
case TARGET_NR_rename:
{
@@ -12544,6 +12568,9 @@ static impl_fn *syscall_table(unsigned num)
/*
* Other syscalls listed in collation order, with '_' ignored.
*/
+#ifdef TARGET_NR_access
+ SYSCALL(access);
+#endif
#ifdef TARGET_NR_alarm
SYSCALL(alarm);
#endif
@@ -12558,15 +12585,20 @@ static impl_fn *syscall_table(unsigned num)
#endif
SYSCALL(execve);
SYSCALL(exit);
+ SYSCALL(faccessat);
#ifdef TARGET_NR_fork
SYSCALL(fork);
#endif
+#ifdef TARGET_NR_futimesat
+ SYSCALL(futimesat);
+#endif
#ifdef TARGET_NR_getpid
SYSCALL(getpid);
#endif
#if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA)
SYSCALL(getxpid);
#endif
+ SYSCALL(kill);
#ifdef TARGET_NR_link
SYSCALL(link);
#endif
@@ -12580,6 +12612,9 @@ static impl_fn *syscall_table(unsigned num)
#ifdef CONFIG_OPEN_BY_HANDLE
SYSCALL(name_to_handle_at);
#endif
+#ifdef TARGET_NR_nice
+ SYSCALL(nice);
+#endif
#ifdef TARGET_NR_open
SYSCALL(open);
#endif
@@ -12593,6 +12628,10 @@ static impl_fn *syscall_table(unsigned num)
SYSCALL(read);
#ifdef TARGET_NR_stime
SYSCALL(stime);
+#endif
+ SYSCALL(sync);
+#ifdef CONFIG_SYNCFS
+ SYSCALL(syncfs);
#endif
#ifdef TARGET_NR_time
SYSCALL(time);
--
2.17.1
- [Qemu-devel] [PATCH v2 012/108] linux-user: Split out open, openat, (continued)
- [Qemu-devel] [PATCH v2 012/108] linux-user: Split out open, openat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 013/108] linux-user: Split out name_to_handle_at, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 014/108] linux-user: Split out open_to_handle_at, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 016/108] linux-user: Split out link, linkat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 015/108] linux-user: Split out creat, fork, waitid, waitpid, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 017/108] linux-user: Split out unlink, unlinkat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 018/108] linux-user: Split out chdir, mknod, mknodat, time, chmod, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 019/108] linux-user: Split out getpid, getxpid, lseek, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 020/108] linux-user: Split out mount, umount, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 021/108] linux-user: Split out alarm, pause, stime, utime, utimes, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 022/108] linux-user: Split out access, faccessat, futimesat, kill, nice, sync, syncfs,
Richard Henderson <=
- [Qemu-devel] [PATCH v2 023/108] linux-user: Split out rename, renameat, renameat2, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 024/108] linux-user: Split out dup, mkdir, mkdirat, rmdir, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 025/108] linux-user: Split out acct, pipe, pipe2, times, umount2, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 027/108] linux-user: Split out chroot, dup2, dup3, fcntl, setpgid, umask, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 026/108] linux-user: Split out ioctl, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 028/108] linux-user: Split out getpgrp, getppid, setsid, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 029/108] linux-user: Split out rt_sigaction, sigaction, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 030/108] linux-user: Split out rt_sigprocmask, sgetmask, sigprocmask, ssetmask, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 031/108] linux-user: Split out rt_sigpending, rt_sigsuspend, sigpending, sigsuspend, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 032/108] linux-user: Split out rt_sigqueueinfo, rt_sigtimedwait, rt_tgsigqueueinfo, Richard Henderson, 2018/06/09
- Prev by Date:
[Qemu-devel] [PATCH v2 021/108] linux-user: Split out alarm, pause, stime, utime, utimes
- Next by Date:
[Qemu-devel] [PATCH v2 023/108] linux-user: Split out rename, renameat, renameat2
- Previous by thread:
[Qemu-devel] [PATCH v2 021/108] linux-user: Split out alarm, pause, stime, utime, utimes
- Next by thread:
[Qemu-devel] [PATCH v2 023/108] linux-user: Split out rename, renameat, renameat2
- Index(es):