linux-user: Split do_syscall
v7 cover linux-user: Split do_syscall
Based-on: <[email protected]> Aka "linux-user: path, clone, sparc, shmat fixes"
Version 6 was
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg04794.html
Since v5, I've fixed the ioctl failure that Laurent found, and have done a few more syscalls.
I've tried to do more testing with LTP, but it's a really annoying testsuite. There are at least 3 tests that hang forever (before and after this patch set), and the host kernel's OOM handler kills my login session, ending the test run. This seems to be different behaviour than I was seeing in January, when I did have test runs that completed successfully.
OTOH, looking back at the v6 cover letter, I now see that I was testing armhf and i386 as guests, whereas this time I was trying aarch64 and ppc64 as guests. 32-bit guests unable to trigger the host OOM killer?
Laurent, is there anything special that you're doing to see these tests run to completion?
r~
Richard Henderson (74):
linux-user: Setup split syscall infrastructure
linux-user: Split out open, open_at
linux-user: Share more code for open and openat
linux-user: Tidy do_openat loop over fakes
linux-user: Split out readlink, readlinkat
linux-user: Split out close
linux-user: Split out read, write
linux-user: Reduce regpairs_aligned & target_offset64 ifdefs
linux-user: Split out readv, writev
linux-user: Split out pread64, pwrite64
linux-user: Split out preadv, pwritev
linux-user: Split out name_to_handle_at, open_by_handle_at
linux-user: Split out ipc syscalls
linux-user: Split out memory syscalls
linux-user: Split out exit
linux-user: Split out brk
linux-user: Split out clone, fork, vfork
linux-user: Split out wait4, waitid, waitpid
linux-user: Implement rusage argument to waitid
linux-user: Split out creat
linux-user: Split out link, linkat
linux-user: Split out unlink, unlinkat, rmdir
linux-user: Split out execve
linux-user: Implement execveat
linux-user: Split out chdir
linux-user: Split out time
linux-user: Split out mknod, mknodat
linux-user: Split out chmod, fchmod, fchmodat
linux-user: Split out lseek, llseek
linux-user: Split out getpid, getppid, getxpid
linux-user: Split out mount
linux-user: Split out umount, umount2
linux-user: Split out stime
linux-user: Split out alarm, pause
linux-user: Split out utime, utimes, futimesat
linux-user: Split out access, faccessat
linux-user: Split out nice
linux-user: Split out sync, syncfs
linux-user: Split out kill
linux-user: Split out rename, renameat, renameat2
linux-user: Split out mkdir, mkdirat
linux-user: Split out dup, dup2, dup3
linux-user: Split out pipe, pipe2
linux-user: Split out times
linux-user: Split out acct
linux-user: Move syscall_init to the end
linux-user: Split out ioctl
linux-user: Fix types in ioctl logging
linux-user: Remove sentinel from ioctl_entries
linux-user: Split out fcntl, fcntl64
linux-user: Split out setpgid
linux-user: Split out umask
linux-user: Split out chroot
linux-user: Split out getpgid, getpgrp
linux-user: Split out getsid, setsid
linux-user: Split out sigaction, rt_sigaction
linux-user: Split out sgetmask, ssetmask
linux-user: Split out sigprocmask, rt_sigprocmask
linux-user: Split out sigpending, rt_sigpending
linux-user: Split out sigsuspend, rt_sigsuspend
linux-user: Split out rt_sigtimedwait
linux-user: Split out rt_sigqueueinfo, rt_tgsigqueueinfo
linux-user: Split out sigreturn, rt_sigreturn
linux-user: Split out gethostname, sethostname
linux-user: Split out getrlimit, setrlimit
linux-user: Split out getrusage
linux-user: Split out gettimeofday, settimeofday
linux-user: Split out select, _newselect
linux-user: Split out pselect6
linux-user: Split out symlink, symlinkat
linux-user: Split out swapon, swapoff
linux-user: Split out reboot
linux-user: Split out truncate, truncate64, ftruncate, ftruncate64
linux-user: Split out getpriority, setpriority
linux-user/syscall-defs.h | 338 +++ linux-user/syscall.h | 103 + linux-user/strace.c | 1569 +++------- linux-user/syscall-fcntl.inc.c | 322 ++ linux-user/syscall-file.inc.c | 1526 ++++++++++ linux-user/syscall-ioctl.inc.c | 873 ++++++ linux-user/syscall-ipc.inc.c | 1088 +++++++ linux-user/syscall-mem.inc.c | 244 ++ linux-user/syscall-proc.inc.c | 758 +++++ linux-user/syscall-sig.inc.c | 549 ++++ linux-user/syscall-time.inc.c | 77 + linux-user/syscall.c | 5045 ++------------------------------ configure | 20 - linux-user/strace.list | 414 --- 14 files changed, 6512 insertions(+), 6414 deletions(-) create mode 100644 linux-user/syscall-defs.h create mode 100644 linux-user/syscall.h create mode 100644 linux-user/syscall-fcntl.inc.c create mode 100644 linux-user/syscall-file.inc.c create mode 100644 linux-user/syscall-ioctl.inc.c create mode 100644 linux-user/syscall-ipc.inc.c create mode 100644 linux-user/syscall-mem.inc.c create mode 100644 linux-user/syscall-proc.inc.c create mode 100644 linux-user/syscall-sig.inc.c create mode 100644 linux-user/syscall-time.inc.c
Signature · 1 line
2.17.1
PATCH v7 1/74 linux-user: Setup split syscall infrastructure
Defines a unified structure for implementation and strace.
--- linux-user/syscall-defs.h | 17 ++ linux-user/syscall.h | 89 +++++++++ linux-user/strace.c | 388 +++++++++++++++++++++++++++----------- linux-user/syscall.c | 103 +++++++++- 4 files changed, 484 insertions(+), 113 deletions(-) create mode 100644 linux-user/syscall-defs.h create mode 100644 linux-user/syscall.h
linux-user/syscall-defs.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Linux syscall definitions +* Copyright (c) 2003 Fabrice Bellard +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/
linux-user/syscall.h new file +89 -0
89 lines not on this page · raw message
linux-user/strace.c +283 -105
484 lines not on this page · raw message
linux-user/syscall.c +95 -8
129 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 2/74 linux-user: Split out open, open_at
In reply to Richard HendersonFor the moment, leave a forward declaration for is_proc_myself until the readlink syscalls are also moved to syscall-file.inc.c.
--- linux-user/syscall-defs.h | 5 + linux-user/strace.c | 35 ---- linux-user/syscall-file.inc.c | 325 ++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 288 +----------------------------- linux-user/strace.list | 6 - 5 files changed, 332 insertions(+), 327 deletions(-) create mode 100644 linux-user/syscall-file.inc.c
linux-user/syscall-defs.h +5 -0
@@ -15,3 +15,8 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#ifdef TARGET_NR_open +SYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG ); +#endif +SYSCALL_DEF (openat,ARG_ATDIRFD ,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );
linux-user/strace.c +0 -35
@@ -2228,41 +2228,6 @@ print_mq_open(const struct syscallname *name, }#endif -#ifdef TARGET_NR_open -static void -print_open (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -int is_creat = (arg1 &TARGET_O_CREAT ); - -print_syscall_prologue (name); -print_string (arg0,0 ); -print_open_flags (arg1, (is_creat ==0 )); -if (is_creat) -print_file_mode (arg2,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_openat -static void -print_openat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -int is_creat = (arg2 &TARGET_O_CREAT ); - -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_open_flags (arg2, (is_creat ==0 )); -if (is_creat) -print_file_mode (arg3,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_mq_unlink static void print_mq_unlink(const struct syscallname *name,
linux-user/syscall-file.inc.c new file +325 -0
325 lines not on this page · raw message
linux-user/syscall.c +2 -286
306 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -677,12 +677,6 @@ #ifdef TARGET_NR_olduname { TARGET_NR_olduname, "olduname" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_open -{ TARGET_NR_open, "open" , NULL, print_open, NULL }, -#endif -#ifdef TARGET_NR_openat -{ TARGET_NR_openat, "openat" , NULL, print_openat, NULL }, -#endif #ifdef TARGET_NR_osf_adjtime { TARGET_NR_osf_adjtime, "osf_adjtime" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 3/74 linux-user: Share more code for open and openat
In reply to Richard HendersonThe do_openat helper can have all of the code that is not directly related to the argument ordering of these two syscalls.
--- linux-user/syscall-file.inc.c | 69 ++++++++++++++++------------------- 1 file changed, 31 insertions(+), 38 deletions(-)
linux-user/syscall-file.inc.c +31 -38
@@ -227,8 +227,8 @@ static int open_net_route(void *cpu_env, int fd) }#endif -static int do_openat (void *cpu_env,int dirfd,const char *pathname, -int flags,mode_t mode) +static abi_long do_openat (void *cpu_env,int dirfd,abi_ulong target_path, +int target_flags,mode_t mode) {struct fake_open {const char *filename;
@@ -247,9 +247,20 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, { NULL, NULL, NULL } }; +char *pathname =lock_user_string (target_path); +int flags =target_to_host_bitmask (target_flags, fcntl_flags_tbl); +abi_long ret; + +if (!pathname) { +return -TARGET_EFAULT ; + } +if (is_proc_myself (pathname,"exe" )) { -int execfd =qemu_getauxval (AT_EXECFD ); -return execfd ? execfd :safe_openat (dirfd, exec_path, flags, mode); + ret =qemu_getauxval (AT_EXECFD ); +if (ret ==0 ) { + ret =get_errno (safe_openat (dirfd, exec_path, flags, mode)); + } + goto done; }for (fake_open = fakes; fake_open->filename; fake_open++) {
@@ -261,7 +272,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname,if (fake_open->filename) {const char *tmpdir;char filename[PATH_MAX ]; -int fd, r; +int fd;/* create temporary file to map stat to */ tmpdir =getenv ("TMPDIR" );
@@ -271,55 +282,37 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname,snprintf (filename,sizeof (filename),"%s/qemu-open.XXXXXX" , tmpdir); fd =mkstemp (filename);if (fd <0 ) { -return fd; + ret = -TARGET_ENOENT ; + goto done; }unlink (filename); - r = fake_open->fill (cpu_env, fd); -if (r) { -int e = errno; + ret = fake_open->fill (cpu_env, fd); +if (ret) { + ret =get_errno (ret);close (fd); - errno = e; -return r; + goto done; }lseek (fd,0 ,SEEK_SET ); - -return fd; + ret = fd; + goto done; } -return safe_openat (dirfd,path (pathname), flags, mode); + ret =get_errno (safe_openat (dirfd,path (pathname), flags, mode)); + done: +fd_trans_unregister (ret); +unlock_user (pathname, target_path,0 ); +return ret; }#ifdef TARGET_NR_openSYSCALL_IMPL (open) { -char *p =lock_user_string (arg1); -abi_long ret; - -if (!p) { -return -TARGET_EFAULT ; - } - ret =get_errno (do_openat (cpu_env,AT_FDCWD , p, -target_to_host_bitmask (arg2, fcntl_flags_tbl), - arg3)); -fd_trans_unregister (ret); -unlock_user (p, arg1,0 ); -return ret; +return do_openat (cpu_env,AT_FDCWD , arg1, arg2, arg3); }#endif SYSCALL_IMPL (openat) { -char *p =lock_user_string (arg2); -abi_long ret; - -if (!p) { -return -TARGET_EFAULT ; - } - ret =get_errno (do_openat (cpu_env, arg1, p, -target_to_host_bitmask (arg3, fcntl_flags_tbl), - arg4)); -fd_trans_unregister (ret); -unlock_user (p, arg2,0 ); -return ret; +return do_openat (cpu_env, arg1, arg2, arg3, arg4); }
Signature · 1 line
2.17.1
PATCH v7 4/74 linux-user: Tidy do_openat loop over fakes
In reply to Richard HendersonCleaner to use ARRAY_SIZE to loop over elements instead of using a sentinel within the data structure.
--- linux-user/syscall-file.inc.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
linux-user/syscall-file.inc.c +7 -9
@@ -235,7 +235,6 @@ static abi_long do_openat(void *cpu_env, int dirfd, abi_ulong target_path,int (*fill)(void *cpu_env,int fd);int (*cmp)(const char *s1,const char *s2); }; -const struct fake_open *fake_open;static const struct fake_open fakes[] = { {"maps" , open_self_maps, is_proc_myself }, {"stat" , open_self_stat, is_proc_myself },
@@ -244,12 +243,12 @@ static abi_long do_openat(void *cpu_env, int dirfd, abi_ulong target_path, #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) { "/proc/net/route", open_net_route, is_proc }, #endif - { NULL, NULL, NULL } }; char *pathname = lock_user_string(target_path); int flags = target_to_host_bitmask(target_flags, fcntl_flags_tbl); abi_long ret; + size_t i; if (!pathname) { return -TARGET_EFAULT;
@@ -263,17 +262,16 @@ static abi_long do_openat(void *cpu_env, int dirfd, abi_ulong target_path, goto done; } -for (fake_open = fakes; fake_open->filename; fake_open++) { -if (fake_open->cmp (pathname, fake_open->filename)) { -break ; - } - } - -if (fake_open->filename) { +for (i =0 ; i <ARRAY_SIZE (fakes); ++i) { +const struct fake_open *fake_open = &fakes[i];const char *tmpdir;char filename[PATH_MAX ];int fd; +if (!fake_open->cmp (pathname, fake_open->filename)) { +continue ; + } +/* create temporary file to map stat to */ tmpdir =getenv ("TMPDIR" );if (!tmpdir) {
Signature · 1 line
2.17.1
PATCH v7 5/74 linux-user: Split out readlink, readlinkat
In reply to Richard HendersonSplit out a shared implementation for both of these; unify the best parts of /proc/self/exe checking.
Remove the temporary forward declaration for is_proc_self.
--- linux-user/syscall-defs.h | 6 ++++ linux-user/strace.c | 29 ------------------ linux-user/syscall-file.inc.c | 45 ++++++++++++++++++++++++++++ linux-user/syscall.c | 55 ----------------------------------- linux-user/strace.list | 6 ---- 5 files changed, 51 insertions(+), 90 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -20,3 +20,9 @@SYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );#endif SYSCALL_DEF (openat,ARG_ATDIRFD ,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG ); +#ifdef TARGET_NR_readlink +SYSCALL_DEF (readlink,ARG_STR ,ARG_PTR ,ARG_DEC ); +#endif +#ifdef TARGET_NR_readlinkat +SYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC ); +#endif
linux-user/strace.c +0 -29
@@ -2256,35 +2256,6 @@ print_fstatat64(const struct syscallname *name,#define print_newfstatat print_fstatat64#endif -#ifdef TARGET_NR_readlink -static void -print_readlink (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_pointer (arg1,0 ); -print_raw_param ("%u" , arg2,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_readlinkat -static void -print_readlinkat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_pointer (arg2,0 ); -print_raw_param ("%u" , arg3,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_rename static void print_rename(const struct syscallname *name,
linux-user/syscall-file.inc.c +45 -0
48 lines not on this page · raw message
linux-user/syscall.c +0 -55
67 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -1079,12 +1079,6 @@ #ifdef TARGET_NR_readdir { TARGET_NR_readdir, "readdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_readlink -{ TARGET_NR_readlink, "readlink" , NULL, print_readlink, NULL }, -#endif -#ifdef TARGET_NR_readlinkat -{ TARGET_NR_readlinkat, "readlinkat" , NULL, print_readlinkat, NULL }, -#endif #ifdef TARGET_NR_readv { TARGET_NR_readv, "readv" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 6/74 linux-user: Split out close
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-file.inc.c | 8 ++++++++ linux-user/syscall.c | 4 ---- linux-user/strace.list | 3 --- 4 files changed, 9 insertions(+), 7 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -16,6 +16,7 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +SYSCALL_DEF (close,ARG_DEC );#ifdef TARGET_NR_openSYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );#endif
linux-user/syscall-file.inc.c +8 -0
@@ -16,6 +16,14 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +SYSCALL_IMPL (close) +{ +int fd = arg1; + +fd_trans_unregister (fd); +return get_errno (close (fd)); +} +/* * Helpers for do_openat, manipulating /proc/self/foo. */
linux-user/syscall.c +0 -4
@@ -6827,10 +6827,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,fd_trans_unregister (ret);return ret;#endif -case TARGET_NR_close: -fd_trans_unregister (arg1); -return get_errno (close (arg1)); -case TARGET_NR_brk:return do_brk (arg1);#ifdef TARGET_NR_fork
linux-user/strace.list +0 -3
@@ -97,9 +97,6 @@ #ifdef TARGET_NR_clone { TARGET_NR_clone, "clone" , NULL, print_clone, NULL }, #endif -#ifdef TARGET_NR_close -{ TARGET_NR_close, "close" , "%s(%d)", NULL, NULL }, -#endif #ifdef TARGET_NR_connect { TARGET_NR_connect, "connect" , "%s(%d,%#x,%d)", NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 7/74 linux-user: Split out read, write
In reply to Richard Henderson--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-file.inc.c | 58 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 34 -------------------- linux-user/strace.list | 6 ---- 4 files changed, 60 insertions(+), 40 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -21,9 +21,11 @@ SYSCALL_DEF(close, ARG_DEC);SYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );#endif SYSCALL_DEF (openat,ARG_ATDIRFD ,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG ); +SYSCALL_DEF (read,ARG_DEC ,ARG_PTR ,ARG_DEC );#ifdef TARGET_NR_readlinkSYSCALL_DEF (readlink,ARG_STR ,ARG_PTR ,ARG_DEC );#endif #ifdef TARGET_NR_readlinkatSYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC );#endif +SYSCALL_DEF (write,ARG_DEC ,ARG_PTR ,ARG_DEC );
linux-user/syscall-file.inc.c +58 -0
67 lines not on this page · raw message
linux-user/syscall.c +0 -34
@@ -6782,40 +6782,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,preexit_cleanup (cpu_env, arg1);_exit (arg1);return 0 ;/* avoid warning */ -case TARGET_NR_read: -if (arg2 ==0 && arg3 ==0 ) { -return get_errno (safe_read (arg1,0 ,0 )); - }else { -if (!(p =lock_user (VERIFY_WRITE , arg2, arg3,0 ))) -return -TARGET_EFAULT ; - ret =get_errno (safe_read (arg1, p, arg3)); -if (ret >=0 && -fd_trans_host_to_target_data (arg1)) { - ret =fd_trans_host_to_target_data (arg1)(p, ret); - } -unlock_user (p, arg2, ret); - } -return ret; -case TARGET_NR_write: -if (arg2 ==0 && arg3 ==0 ) { -return get_errno (safe_write (arg1,0 ,0 )); - } -if (!(p =lock_user (VERIFY_READ , arg2, arg3,1 ))) -return -TARGET_EFAULT ; -if (fd_trans_target_to_host_data (arg1)) { -void *copy =g_malloc (arg3); -memcpy (copy, p, arg3); - ret =fd_trans_target_to_host_data (arg1)(copy, arg3); -if (ret >=0 ) { - ret =get_errno (safe_write (arg1, copy, ret)); - } -g_free (copy); - }else { - ret =get_errno (safe_write (arg1, p, arg3)); - } -unlock_user (p, arg2,0 ); -return ret; -#if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE )case TARGET_NR_name_to_handle_at: ret =do_name_to_handle_at (arg1, arg2, arg3, arg4, arg5);
linux-user/strace.list +0 -6
@@ -1067,9 +1067,6 @@ #ifdef TARGET_NR_quotactl { TARGET_NR_quotactl, "quotactl" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_read -{ TARGET_NR_read, "read" , "%s(%d,%#x,%d)", NULL, NULL }, -#endif #ifdef TARGET_NR_readahead { TARGET_NR_readahead, "readahead" , NULL, NULL, NULL }, #endif
@@ -1611,9 +1608,6 @@ #ifdef TARGET_NR_waitpid { TARGET_NR_waitpid, "waitpid" , "%s(%d,%p,%#x)", NULL, NULL }, #endif -#ifdef TARGET_NR_write -{ TARGET_NR_write, "write" , "%s(%d,%#x,%d)", NULL, NULL }, -#endif #ifdef TARGET_NR_writev { TARGET_NR_writev, "writev" , "%s(%d,%p,%#x)", NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 8/74 linux-user: Reduce regpairs_aligned & target_offset64 ifdefs
In reply to Richard Henderson--- linux-user/syscall.c | 54 ++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 29 deletions(-)
linux-user/syscall.c +25 -29
@@ -464,37 +464,38 @@ static inline int next_free_host_timer(void) }#endif -/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */ +/* +* Returns true if syscall NUM expects 64bit types aligned even +* on pairs of registers. +*/ +static inline bool regpairs_aligned (void *cpu_env,int num) +{#ifdef TARGET_ARM -static inline int regpairs_aligned (void *cpu_env,int num) -{ -return ((((CPUARMState *)cpu_env)->eabi) ==1 ) ; -} -#elif defined(TARGET_MIPS ) && (TARGET_ABI_BITS ==32 ) -static inline int regpairs_aligned (void *cpu_env,int num) {return 1 ; } +return ((CPUARMState *)cpu_env)->eabi; +#elif defined(TARGET_MIPS ) &&TARGET_ABI_BITS ==32 +return true;#elif defined(TARGET_PPC ) && !defined(TARGET_PPC64 ) -/* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs -* of registers which translates to the same as ARM/MIPS, because we start with -* r3 as arg1 */ -static inline int regpairs_aligned (void *cpu_env,int num) {return 1 ; } +/* +* SysV AVI for PPC32 expects 64bit parameters to be passed on +* odd/even pairs of registers which translates to the same as +* we start with r3 as arg1. +*/ +return true;#elif defined(TARGET_SH4 ) -/* SH4 doesn't align register pairs, except for p{read,write}64 */ -static inline int regpairs_aligned (void *cpu_env,int num) -{ +/* SH4 doesn't align register pairs, except for p{read,write}64. */ switch (num) {case TARGET_NR_pread64:case TARGET_NR_pwrite64: -return 1 ; - +return true;default : -return 0 ; +return false; } -}#elif defined(TARGET_XTENSA ) -static inline int regpairs_aligned (void *cpu_env,int num) {return 1 ; } +return true;#else -static inline int regpairs_aligned (void *cpu_env,int num) {return 0 ; } +return false;#endif +}#define ERRNO_TABLE_SIZE 1200
@@ -6161,21 +6162,16 @@ void syscall_init(void) } } -#if TARGET_ABI_BITS ==32 -static inline uint64_t target_offset64 (uint32_t word0,uint32_t word1) +static inline uint64_t target_offset64 (abi_ulong word0,abi_ulong word1) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_ABI_BITS ==64 +return word0; +#elif defined(TARGET_WORDS_BIGENDIAN )return ((uint64_t )word0 <<32 ) | word1;#else return ((uint64_t )word1 <<32 ) | word0;#endif } -#else /* TARGET_ABI_BITS == 32 */ -static inline uint64_t target_offset64 (uint64_t word0,uint64_t word1) -{ -return word0; -} -#endif /* TARGET_ABI_BITS != 32 */ #ifdef TARGET_NR_truncate64 static inline abi_long target_truncate64(void *cpu_env, const char *arg1,
Signature · 1 line
2.17.1
PATCH v7 9/74 linux-user: Split out readv, writev
In reply to Richard Henderson--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-file.inc.c | 34 ++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 22 ---------------------- linux-user/strace.list | 6 ------ 4 files changed, 36 insertions(+), 28 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -28,4 +28,6 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC);#ifdef TARGET_NR_readlinkatSYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC );#endif +SYSCALL_DEF (readv,ARG_DEC ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (write,ARG_DEC ,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (writev,ARG_DEC ,ARG_PTR ,ARG_DEC );
linux-user/syscall-file.inc.c +34 -0
@@ -349,6 +349,23 @@ SYSCALL_IMPL(read)return ret; } +SYSCALL_IMPL (readv) +{ +int fd = arg1; +abi_ulong target_vec = arg2; +int count = arg3; +struct iovec *vec =lock_iovec (VERIFY_WRITE , target_vec, count,0 ); +abi_long ret; + +if (vec !=NULL ) { + ret =get_errno (safe_readv (fd, vec, count)); +unlock_iovec (vec, target_vec, count,1 ); + }else { + ret = -host_to_target_errno (errno); + } +return ret; +} +static abi_long do_readlinkat (int dirfd,abi_ulong target_path,abi_ulong target_buf,abi_ulong bufsiz) {
@@ -425,3 +442,20 @@ SYSCALL_IMPL(write)unlock_user (p, target_p,0 );return ret; } + +SYSCALL_IMPL (writev) +{ +int fd = arg1; +abi_ulong target_vec = arg2; +int count = arg3; +struct iovec *vec =lock_iovec (VERIFY_READ , target_vec, count,1 ); +abi_long ret; + +if (vec !=NULL ) { + ret =get_errno (safe_writev (fd, vec, count)); +unlock_iovec (vec, target_vec, count,0 ); + }else { + ret = -host_to_target_errno (errno); + } +return ret; +}
linux-user/syscall.c +0 -22
@@ -9005,28 +9005,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,/* NOTE: the flock constant seems to be the same for every Linux platform */ return get_errno (safe_flock (arg1, arg2)); -case TARGET_NR_readv: - { -struct iovec *vec =lock_iovec (VERIFY_WRITE , arg2, arg3,0 ); -if (vec !=NULL ) { - ret =get_errno (safe_readv (arg1, vec, arg3)); -unlock_iovec (vec, arg2, arg3,1 ); - }else { - ret = -host_to_target_errno (errno); - } - } -return ret; -case TARGET_NR_writev: - { -struct iovec *vec =lock_iovec (VERIFY_READ , arg2, arg3,1 ); -if (vec !=NULL ) { - ret =get_errno (safe_writev (arg1, vec, arg3)); -unlock_iovec (vec, arg2, arg3,0 ); - }else { - ret = -host_to_target_errno (errno); - } - } -return ret;#if defined(TARGET_NR_preadv)case TARGET_NR_preadv: {
linux-user/strace.list +0 -6
@@ -1073,9 +1073,6 @@ #ifdef TARGET_NR_readdir { TARGET_NR_readdir, "readdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_readv -{ TARGET_NR_readv, "readv" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_reboot { TARGET_NR_reboot, "reboot" , NULL, NULL, NULL }, #endif
@@ -1608,9 +1605,6 @@ #ifdef TARGET_NR_waitpid { TARGET_NR_waitpid, "waitpid" , "%s(%d,%p,%#x)", NULL, NULL }, #endif -#ifdef TARGET_NR_writev -{ TARGET_NR_writev, "writev" , "%s(%d,%p,%#x)", NULL, NULL }, -#endif #ifdef TARGET_NR_utimensat { TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 10/74 linux-user: Split out pread64, pwrite64
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 ++++ linux-user/syscall-file.inc.c | 62 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 36 -------------------- linux-user/strace.list | 6 ---- 4 files changed, 68 insertions(+), 42 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -21,6 +21,12 @@ SYSCALL_DEF(close, ARG_DEC);SYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );#endif SYSCALL_DEF (openat,ARG_ATDIRFD ,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG ); +SYSCALL_DEF_FULL(pread64, .impl = impl_pread64, + .args = args_pread64_pwrite64, + .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 }); +SYSCALL_DEF_FULL(pwrite64, .impl = impl_pwrite64, + .args = args_pread64_pwrite64, + .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 });SYSCALL_DEF (read,ARG_DEC ,ARG_PTR ,ARG_DEC );#ifdef TARGET_NR_readlinkSYSCALL_DEF (readlink,ARG_STR ,ARG_PTR ,ARG_DEC );
linux-user/syscall-file.inc.c +62 -0
68 lines not on this page · raw message
linux-user/syscall.c +0 -36
@@ -9404,42 +9404,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,#else #error unreachable#endif -#endif -#ifdef TARGET_NR_pread64 -case TARGET_NR_pread64: -if (regpairs_aligned (cpu_env, num)) { - arg4 = arg5; - arg5 = arg6; - } -if (arg2 ==0 && arg3 ==0 ) { -/* Special-case NULL buffer and zero length, which should succeed */ - p =0 ; - }else { - p =lock_user (VERIFY_WRITE , arg2, arg3,0 ); -if (!p) { -return -TARGET_EFAULT ; - } - } - ret =get_errno (pread64 (arg1, p, arg3,target_offset64 (arg4, arg5))); -unlock_user (p, arg2, ret); -return ret; -case TARGET_NR_pwrite64: -if (regpairs_aligned (cpu_env, num)) { - arg4 = arg5; - arg5 = arg6; - } -if (arg2 ==0 && arg3 ==0 ) { -/* Special-case NULL buffer and zero length, which should succeed */ - p =0 ; - }else { - p =lock_user (VERIFY_READ , arg2, arg3,1 ); -if (!p) { -return -TARGET_EFAULT ; - } - } - ret =get_errno (pwrite64 (arg1, p, arg3,target_offset64 (arg4, arg5))); -unlock_user (p, arg2,0 ); -return ret;#endif case TARGET_NR_getcwd:if (!(p =lock_user (VERIFY_WRITE , arg1, arg2,0 )))
linux-user/strace.list +0 -6
@@ -1025,9 +1025,6 @@ #ifdef TARGET_NR_prctl { TARGET_NR_prctl, "prctl" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pread64 -{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_preadv { TARGET_NR_preadv, "preadv" , NULL, NULL, NULL }, #endif
@@ -1055,9 +1052,6 @@ #ifdef TARGET_NR_putpmsg { TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pwrite64 -{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_pwritev { TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 11/74 linux-user: Split out preadv, pwritev
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 ++++ linux-user/syscall-file.inc.c | 64 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 49 --------------------------- linux-user/strace.list | 6 ---- 4 files changed, 70 insertions(+), 55 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -27,6 +27,12 @@ SYSCALL_DEF_FULL(pread64, .impl = impl_pread64, SYSCALL_DEF_FULL(pwrite64, .impl = impl_pwrite64, .args = args_pread64_pwrite64, .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 }); +SYSCALL_DEF_FULL(preadv, .impl = impl_preadv, + .args = args_preadv_pwritev, + .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 }); +SYSCALL_DEF_FULL(pwritev, .impl = impl_pwritev, + .args = args_preadv_pwritev, + .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 });SYSCALL_DEF (read,ARG_DEC ,ARG_PTR ,ARG_DEC );#ifdef TARGET_NR_readlinkSYSCALL_DEF (readlink,ARG_STR ,ARG_PTR ,ARG_DEC );
linux-user/syscall-file.inc.c +64 -0
70 lines not on this page · raw message
linux-user/syscall.c +0 -49
61 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -1025,9 +1025,6 @@ #ifdef TARGET_NR_prctl { TARGET_NR_prctl, "prctl" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_preadv -{ TARGET_NR_preadv, "preadv" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_prlimit64 { TARGET_NR_prlimit64, "prlimit64" , NULL, NULL, NULL }, #endif
@@ -1052,9 +1049,6 @@ #ifdef TARGET_NR_putpmsg { TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pwritev -{ TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_query_module { TARGET_NR_query_module, "query_module" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 12/74 linux-user: Split out name_to_handle_at, open_by_handle_at
In reply to Richard HendersonAll targets have these syscalls, so they need not be ifdefed. If we provide safe syscalls for the host, we can remove the configure test for this too.
--- linux-user/syscall-defs.h | 3 + linux-user/syscall.h | 1 + linux-user/strace.c | 5 +- linux-user/syscall-file.inc.c | 81 +++++++++++++++++++++++++++ linux-user/syscall.c | 102 ++-------------------------------- configure | 20 ------- linux-user/strace.list | 3 - 7 files changed, 93 insertions(+), 122 deletions(-)
linux-user/syscall-defs.h +3 -0
@@ -17,10 +17,13 @@*/ SYSCALL_DEF (close,ARG_DEC ); +SYSCALL_DEF (name_to_handle_at, +ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG );#ifdef TARGET_NR_openSYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );#endif SYSCALL_DEF (openat,ARG_ATDIRFD ,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG ); +SYSCALL_DEF (open_by_handle_at,ARG_DEC ,ARG_PTR ,ARG_OPENFLAG ); SYSCALL_DEF_FULL(pread64, .impl = impl_pread64, .args = args_pread64_pwrite64, .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 });
linux-user/syscall.h +1 -0
@@ -57,6 +57,7 @@ typedef enum {/* These print as sets of flags. */ ARG_ATDIRFD , +ARG_ATFLAG ,ARG_MODEFLAG , ARG_OPENFLAG,
linux-user/strace.c +4 -1
@@ -780,7 +780,7 @@ UNUSED static struct flags access_flags[] = { FLAG_END, }; -UNUSED static struct flags at_file_flags[] = { +static struct flags const at_file_flags[] = { #ifdef AT_EACCESSFLAG_GENERIC (AT_EACCESS ), #endif
@@ -2693,6 +2693,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_ATDIRFD : len =add_atdirfd (b, rest, arg);break ; +case ARG_ATFLAG : + len =add_flags (b, rest, at_file_flags, arg, false); +break ;case ARG_MODEFLAG : len =add_flags (b, rest, mode_flags, arg, true);break ;
linux-user/syscall-file.inc.c +81 -0
87 lines not on this page · raw message
linux-user/syscall.c +4 -98
120 lines not on this page · raw message
configure +0 -20
@@ -5243,22 +5243,6 @@ if test "$debug_stack_usage" = "yes"; then fi -########################################## -# check if we have open_by_handle_at - -open_by_handle_at=no -cat > $TMPC << EOF -#include <fcntl.h> -#if !defined(AT_EMPTY_PATH) -# error missing definition -#else -int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } -#endif -EOF -if compile_prog "" "" ; then - open_by_handle_at=yes -fi - ######################################## # check if we have linux/magic.h
@@ -7012,10 +6996,6 @@ if test "$crypto_afalg" = "yes" ; then echo "CONFIG_AF_ALG=y" >> $config_host_mak fi -if test "$open_by_handle_at" = "yes" ; then - echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak -fi - if test "$linux_magic_h" = "yes" ; then echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak fi
linux-user/strace.list +0 -3
@@ -635,9 +635,6 @@ #ifdef TARGET_NR_munmap { TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL }, #endif -#ifdef TARGET_NR_name_to_handle_at -{ TARGET_NR_name_to_handle_at, "name_to_handle_at" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_nanosleep { TARGET_NR_nanosleep, "nanosleep" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 13/74 linux-user: Split out ipc syscalls
In reply to Richard HendersonBecause of the ipc multiplex syscall, these must be done all at once.
--- linux-user/syscall-defs.h | 38 ++ linux-user/strace.c | 83 --- linux-user/syscall-ipc.inc.c | 1088 ++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 973 +----------------------------- linux-user/strace.list | 42 -- 5 files changed, 1129 insertions(+), 1095 deletions(-) create mode 100644 linux-user/syscall-ipc.inc.c
linux-user/syscall-defs.h +38 -0
@@ -17,6 +17,21 @@*/ SYSCALL_DEF (close,ARG_DEC ); +#ifdef TARGET_NR_ipc +SYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_msgctl) +SYSCALL_DEF (msgctl,ARG_DEC ,ARG_DEC ,ARG_PTR ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_msgget) +SYSCALL_DEF (msgget,ARG_DEC ,ARG_DEC ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_msgrcv) +SYSCALL_DEF (msgrcv,ARG_DEC ,ARG_PTR ,ARG_DEC ,ARG_DEC ,ARG_HEX ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_msgsnd) +SYSCALL_DEF (msgsnd,ARG_DEC ,ARG_PTR ,ARG_DEC ,ARG_HEX ); +#endif SYSCALL_DEF (name_to_handle_at,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG );#ifdef TARGET_NR_open
@@ -44,5 +59,28 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC);SYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC );#endif SYSCALL_DEF (readv,ARG_DEC ,ARG_PTR ,ARG_DEC ); +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl) +SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semget) +SYSCALL_DEF (semget,ARG_DEC ,ARG_DEC ,ARG_HEX ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semop) +SYSCALL_DEF (semop,ARG_DEC ,ARG_PTR ,ARG_DEC ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmat) +SYSCALL_DEF_FULL(shmat, .impl = impl_shmat, + .print_ret = print_syscall_ptr_ret, + .arg_type = { ARG_DEC, ARG_PTR, ARG_HEX }); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmctl) +SYSCALL_DEF (shmctl,ARG_DEC ,ARG_DEC ,ARG_PTR ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmdt) +SYSCALL_DEF (shmdt,ARG_PTR ); +#endif +#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmget) +SYSCALL_DEF (shmget,ARG_DEC ,ARG_DEC ,ARG_HEX ); +#endif SYSCALL_DEF (write,ARG_DEC ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (writev,ARG_DEC ,ARG_PTR ,ARG_DEC );
linux-user/strace.c +0 -83
105 lines not on this page · raw message
linux-user/syscall-ipc.inc.c new file +1088 -0
1,088 lines not on this page · raw message
linux-user/syscall.c +3 -970
1,009 lines not on this page · raw message
linux-user/strace.list +0 -42
72 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 14/74 linux-user: Split out memory syscalls
In reply to Richard HendersonThis includes mmap, mmap2, munmap, mlock, mlockall, munlock, munlockall, mprotect, mremap, msync.
--- linux-user/syscall-defs.h | 24 ++++++ linux-user/syscall.h | 2 + linux-user/strace.c | 55 ++----------- linux-user/syscall-mem.inc.c | 154 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 119 +-------------------------- linux-user/strace.list | 33 -------- 6 files changed, 189 insertions(+), 198 deletions(-) create mode 100644 linux-user/syscall-mem.inc.c
linux-user/syscall-defs.h +24 -0
@@ -20,6 +20,26 @@ SYSCALL_DEF(close, ARG_DEC);#ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif +SYSCALL_DEF (mlock,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (mlockall,ARG_HEX ); +#ifdef TARGET_NR_mmap +SYSCALL_DEF_FULL(mmap, .impl = impl_mmap, + .args = args_mmap, + .print_ret = print_syscall_ptr_ret, + .arg_type = { ARG_PTR, ARG_DEC, ARG_MMAPPROT, + ARG_MMAPFLAG, ARG_DEC, ARG_DEC }); +#endif +#ifdef TARGET_NR_mmap2 +SYSCALL_DEF_FULL(mmap2, .impl = impl_mmap, + .args = args_mmap2, + .print_ret = print_syscall_ptr_ret, + .arg_type = { ARG_PTR, ARG_DEC, ARG_MMAPPROT, + ARG_MMAPFLAG, ARG_DEC, ARG_DEC64 }); +#endif +SYSCALL_DEF (mprotect,ARG_PTR ,ARG_DEC ,ARG_MMAPPROT ); +SYSCALL_DEF_FULL(mremap, .impl = impl_mremap, + .print_ret = print_syscall_ptr_ret, + .arg_type = { ARG_PTR, ARG_DEC, ARG_DEC, ARG_HEX, ARG_PTR });#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_msgctl)SYSCALL_DEF (msgctl,ARG_DEC ,ARG_DEC ,ARG_PTR );#endif
@@ -32,6 +52,10 @@ SYSCALL_DEF(msgrcv, ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC, ARG_HEX);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_msgsnd)SYSCALL_DEF (msgsnd,ARG_DEC ,ARG_PTR ,ARG_DEC ,ARG_HEX );#endif +SYSCALL_DEF (msync,ARG_PTR ,ARG_DEC ,ARG_HEX ); +SYSCALL_DEF (munlock,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (munlockall); +SYSCALL_DEF (munmap,ARG_PTR ,ARG_DEC );SYSCALL_DEF (name_to_handle_at,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG );#ifdef TARGET_NR_open
linux-user/syscall.h +2 -0
@@ -58,6 +58,8 @@ typedef enum {/* These print as sets of flags. */ ARG_ATDIRFD ,ARG_ATFLAG , +ARG_MMAPFLAG , +ARG_MMAPPROT ,ARG_MODEFLAG , ARG_OPENFLAG,
linux-user/strace.c +8 -47
79 lines not on this page · raw message
linux-user/syscall-mem.inc.c new file +154 -0
154 lines not on this page · raw message
linux-user/syscall.c +1 -118
143 lines not on this page · raw message
linux-user/strace.list +0 -33
@@ -554,21 +554,6 @@ #ifdef TARGET_NR_mknodat { TARGET_NR_mknodat, "mknodat" , NULL, print_mknodat, NULL }, #endif -#ifdef TARGET_NR_mlock -{ TARGET_NR_mlock, "mlock" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_mlock2 -{ TARGET_NR_mlock2, "mlock2" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_mlockall -{ TARGET_NR_mlockall, "mlockall" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_mmap -{ TARGET_NR_mmap, "mmap" , NULL, print_mmap, print_syscall_ret_addr }, -#endif -#ifdef TARGET_NR_mmap2 -{ TARGET_NR_mmap2, "mmap2" , NULL, print_mmap2, print_syscall_ret_addr }, -#endif #ifdef TARGET_NR_modify_ldt { TARGET_NR_modify_ldt, "modify_ldt" , NULL, NULL, NULL }, #endif
@@ -578,9 +563,6 @@ #ifdef TARGET_NR_move_pages { TARGET_NR_move_pages, "move_pages" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_mprotect -{ TARGET_NR_mprotect, "mprotect" , NULL, print_mprotect, NULL }, -#endif #ifdef TARGET_NR_mpx { TARGET_NR_mpx, "mpx" , NULL, NULL, NULL }, #endif
@@ -602,24 +584,9 @@ #ifdef TARGET_NR_mq_unlink { TARGET_NR_mq_unlink, "mq_unlink" , NULL, print_mq_unlink, NULL }, #endif -#ifdef TARGET_NR_mremap -{ TARGET_NR_mremap, "mremap" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_msync -{ TARGET_NR_msync, "msync" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_multiplexer { TARGET_NR_multiplexer, "multiplexer" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_munlock -{ TARGET_NR_munlock, "munlock" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_munlockall -{ TARGET_NR_munlockall, "munlockall" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_munmap -{ TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL }, -#endif #ifdef TARGET_NR_nanosleep { TARGET_NR_nanosleep, "nanosleep" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 15/74 linux-user: Split out exit
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 61 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 38 +--------------------- 3 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 linux-user/syscall-proc.inc.c
linux-user/syscall-defs.h +1 -0
@@ -17,6 +17,7 @@*/ SYSCALL_DEF (close,ARG_DEC ); +SYSCALL_DEF (exit,ARG_DEC );#ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif
linux-user/syscall-proc.inc.c new file +61 -0
61 lines not on this page · raw message
linux-user/syscall.c +1 -37
@@ -5681,43 +5681,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_exit: -/* In old applications this may be used to implement _exit(2). -However in threaded applictions it is used for thread termination, -and _exit_group is used for application termination. -Do thread termination if we have more then one thread. */ - -if (block_signals ()) { -return -TARGET_ERESTARTSYS ; - } - -cpu_list_lock (); - -if (CPU_NEXT (first_cpu)) { -TaskState *ts; - -/* Remove the CPU from the list. */ -QTAILQ_REMOVE_RCU (&cpus, cpu, node); - -cpu_list_unlock (); - - ts = cpu->opaque; -if (ts->child_tidptr) { -put_user_u32 (0 , ts->child_tidptr); -sys_futex (g2h (ts->child_tidptr),FUTEX_WAKE ,INT_MAX , -NULL ,NULL ,0 ); - } - thread_cpu =NULL ; -object_unref (OBJECT (cpu)); -g_free (ts); -rcu_unregister_thread (); -pthread_exit (NULL ); - } - -cpu_list_unlock (); -preexit_cleanup (cpu_env, arg1); -_exit (arg1); -return 0 ;/* avoid warning */ case TARGET_NR_brk:return do_brk (arg1);#ifdef TARGET_NR_fork
@@ -9975,6 +9938,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,#include "syscall-file.inc.c" #include "syscall-ipc.inc.c" #include "syscall-mem.inc.c" +#include "syscall-proc.inc.c" #undef SYSCALL_IMPL#undef SYSCALL_ARGS
Signature · 1 line
2.17.1
PATCH v7 16/74 linux-user: Split out brk
In reply to Richard Henderson--- linux-user/syscall-defs.h | 3 ++ linux-user/strace.c | 35 -------------- linux-user/syscall-mem.inc.c | 90 ++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 93 ------------------------------------ linux-user/strace.list | 3 -- 5 files changed, 93 insertions(+), 131 deletions(-)
linux-user/syscall-defs.h +3 -0
@@ -16,6 +16,9 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +SYSCALL_DEF_FULL(brk, .impl = impl_brk, + .print_ret = print_syscall_ptr_ret, + .arg_type = { ARG_PTR });SYSCALL_DEF (close,ARG_DEC );SYSCALL_DEF (exit,ARG_DEC );#ifdef TARGET_NR_ipc
linux-user/strace.c +0 -35
@@ -604,29 +604,6 @@ print_execve(const struct syscallname *name,* Variants for the return value output function */ -static void -print_syscall_ret_addr (const struct syscallname *name,abi_long ret) -{ -const char *errstr =NULL ; - -if (ret <0 ) { - errstr =target_strerror (-ret); - } -if (errstr) { -gemu_log (" = -1 errno=%d (%s)\n" , (int )-ret, errstr); - }else { -gemu_log (" = 0x" TARGET_ABI_FMT_lx"\n" , ret); - } -} - -#if 0 /* currently unused */ -static void -print_syscall_ret_raw (struct syscallname *name,abi_long ret) -{ -gemu_log (" = 0x" TARGET_ABI_FMT_lx"\n" , ret); -} -#endif -#ifdef TARGET_NR__newselectstatic void print_syscall_ret_newselect (const struct syscallname *name,abi_long ret)
@@ -1168,18 +1145,6 @@ print_access(const struct syscallname *name, }#endif -#ifdef TARGET_NR_brk -static void -print_brk (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_pointer (arg0,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_chdir static void print_chdir(const struct syscallname *name,
linux-user/syscall-mem.inc.c +90 -0
96 lines not on this page · raw message
linux-user/syscall.c +0 -93
105 lines not on this page · raw message
linux-user/strace.list +0 -3
@@ -49,9 +49,6 @@ #ifdef TARGET_NR_break { TARGET_NR_break, "break" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_brk -{ TARGET_NR_brk, "brk" , NULL, print_brk, print_syscall_ret_addr }, -#endif #ifdef TARGET_NR_cachectl { TARGET_NR_cachectl, "cachectl" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 17/74 linux-user: Split out clone, fork, vfork
In reply to Richard HendersonRename do_fork to do_clone, since that is what it does.
--- linux-user/syscall-defs.h | 8 ++ linux-user/syscall.h | 1 + linux-user/strace.c | 36 +---- linux-user/syscall-proc.inc.c | 259 ++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 220 ----------------------------- linux-user/strace.list | 9 -- 6 files changed, 272 insertions(+), 261 deletions(-)
linux-user/syscall-defs.h +8 -0
@@ -19,8 +19,12 @@ SYSCALL_DEF_FULL(brk, .impl = impl_brk, .print_ret = print_syscall_ptr_ret, .arg_type = { ARG_PTR }); +SYSCALL_DEF_ARGS (clone,ARG_CLONEFLAG ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (close,ARG_DEC );SYSCALL_DEF (exit,ARG_DEC ); +#ifdef TARGET_NR_fork +SYSCALL_DEF (fork); +#endif #ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif
@@ -110,5 +114,9 @@ SYSCALL_DEF(shmdt, ARG_PTR);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmget)SYSCALL_DEF (shmget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +#ifdef TARGET_NR_vfork +/* Emulate vfork() with fork(). */ +SYSCALL_DEF_FULL(vfork, .impl = impl_fork); +#endif SYSCALL_DEF (write,ARG_DEC ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (writev,ARG_DEC ,ARG_PTR ,ARG_DEC );
linux-user/syscall.h +1 -0
@@ -58,6 +58,7 @@ typedef enum {/* These print as sets of flags. */ ARG_ATDIRFD ,ARG_ATFLAG , +ARG_CLONEFLAG ,ARG_MMAPFLAG ,ARG_MMAPPROT , ARG_MODEFLAG,
linux-user/strace.c +4 -32
@@ -813,7 +813,7 @@ static struct flags const mmap_flags[] = { FLAG_END, }; -UNUSED static struct flags clone_flags[] = { +static struct flags const clone_flags[] = {FLAG_GENERIC (CLONE_VM ),FLAG_GENERIC (CLONE_FS ),FLAG_GENERIC (CLONE_FILES ),
@@ -1195,37 +1195,6 @@ print_clock_adjtime(const struct syscallname *name, }#endif -#ifdef TARGET_NR_clone -static void do_print_clone (unsigned int flags,abi_ulong newsp, -abi_ulong parent_tidptr,target_ulong newtls, -abi_ulong child_tidptr) -{ -print_flags (clone_flags, flags,0 ); -print_raw_param ("child_stack=0x" TARGET_ABI_FMT_lx, newsp,0 ); -print_raw_param ("parent_tidptr=0x" TARGET_ABI_FMT_lx, parent_tidptr,0 ); -print_raw_param ("tls=0x" TARGET_ABI_FMT_lx, newtls,0 ); -print_raw_param ("child_tidptr=0x" TARGET_ABI_FMT_lx, child_tidptr,1 ); -} - -static void -print_clone (const struct syscallname *name, -abi_long arg1,abi_long arg2,abi_long arg3, -abi_long arg4,abi_long arg5,abi_long arg6) -{ -print_syscall_prologue (name); -#if defined(TARGET_MICROBLAZE ) -do_print_clone (arg1, arg2, arg4, arg6, arg5); -#elif defined(TARGET_CLONE_BACKWARDS ) -do_print_clone (arg1, arg2, arg3, arg4, arg5); -#elif defined(TARGET_CLONE_BACKWARDS2 ) -do_print_clone (arg2, arg1, arg3, arg5, arg4); -#else -do_print_clone (arg1, arg2, arg3, arg5, arg4); -#endif -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_creat static void print_creat(const struct syscallname *name,
@@ -2533,6 +2502,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_ATFLAG : len =add_flags (b, rest, at_file_flags, arg, false);break ; +case ARG_CLONEFLAG : + len =add_flags (b, rest, clone_flags, arg, false); +break ;case ARG_MMAPFLAG : len =add_flags (b, rest, mmap_flags, arg, false);break ;
linux-user/syscall-proc.inc.c +259 -0
268 lines not on this page · raw message
linux-user/syscall.c +0 -220
250 lines not on this page · raw message
linux-user/strace.list +0 -9
@@ -91,9 +91,6 @@ #ifdef TARGET_NR_clock_settime { TARGET_NR_clock_settime, "clock_settime" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_clone -{ TARGET_NR_clone, "clone" , NULL, print_clone, NULL }, -#endif #ifdef TARGET_NR_connect { TARGET_NR_connect, "connect" , "%s(%d,%#x,%d)", NULL, NULL }, #endif
@@ -220,9 +217,6 @@ #ifdef TARGET_NR_flock { TARGET_NR_flock, "flock" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_fork -{ TARGET_NR_fork, "fork" , "%s()", NULL, NULL }, -#endif #ifdef TARGET_NR_fremovexattr { TARGET_NR_fremovexattr, "fremovexattr" , NULL, NULL, NULL }, #endif
@@ -1485,9 +1479,6 @@ #ifdef TARGET_NR_utrap_install { TARGET_NR_utrap_install, "utrap_install" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_vfork -{ TARGET_NR_vfork, "vfork" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_vhangup { TARGET_NR_vhangup, "vhangup" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 18/74 linux-user: Split out wait4, waitid, waitpid
In reply to Richard HendersonNote that waitid is universally provided and need not be conditional.
--- linux-user/syscall-defs.h | 5 ++ linux-user/syscall-proc.inc.c | 88 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 67 -------------------------- linux-user/strace.list | 9 ---- 4 files changed, 93 insertions(+), 76 deletions(-)
linux-user/syscall-defs.h +5 -0
@@ -118,5 +118,10 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);/* Emulate vfork() with fork(). */ SYSCALL_DEF_FULL(vfork, .impl = impl_fork);#endif +SYSCALL_DEF (wait4,ARG_DEC ,ARG_PTR ,ARG_HEX ,ARG_PTR ); +SYSCALL_DEF (waitid,ARG_HEX ,ARG_DEC ,ARG_PTR ,ARG_HEX ); +#ifdef TARGET_NR_waitpid +SYSCALL_DEF (waitpid,ARG_DEC ,ARG_PTR ,ARG_HEX ); +#endif SYSCALL_DEF (write,ARG_DEC ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (writev,ARG_DEC ,ARG_PTR ,ARG_DEC );
linux-user/syscall-proc.inc.c +88 -0
91 lines not on this page · raw message
linux-user/syscall.c +0 -67
85 lines not on this page · raw message
linux-user/strace.list +0 -9
@@ -1494,15 +1494,6 @@ #ifdef TARGET_NR_vserver { TARGET_NR_vserver, "vserver" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_wait4 -{ TARGET_NR_wait4, "wait4" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_waitid -{ TARGET_NR_waitid, "waitid" , "%s(%#x,%d,%p,%#x)", NULL, NULL }, -#endif -#ifdef TARGET_NR_waitpid -{ TARGET_NR_waitpid, "waitpid" , "%s(%d,%p,%#x)", NULL, NULL }, -#endif #ifdef TARGET_NR_utimensat { TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 19/74 linux-user: Implement rusage argument to waitid
In reply to Richard HendersonThe kernel interface, which we are supposed to be implementing, takes a fifth argument: an rusage pointer akin to wait4.
--- linux-user/syscall-defs.h | 2 +- linux-user/syscall-proc.inc.c | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-)
linux-user/syscall-defs.h +1 -1
@@ -119,7 +119,7 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX); SYSCALL_DEF_FULL(vfork, .impl = impl_fork);#endif SYSCALL_DEF (wait4,ARG_DEC ,ARG_PTR ,ARG_HEX ,ARG_PTR ); -SYSCALL_DEF (waitid,ARG_HEX ,ARG_DEC ,ARG_PTR ,ARG_HEX ); +SYSCALL_DEF (waitid,ARG_HEX ,ARG_DEC ,ARG_PTR ,ARG_HEX ,ARG_PTR );#ifdef TARGET_NR_waitpidSYSCALL_DEF (waitpid,ARG_DEC ,ARG_PTR ,ARG_HEX );#endif
linux-user/syscall-proc.inc.c +19 -8
@@ -370,19 +370,30 @@ SYSCALL_IMPL(waitid)id_t id = arg2;abi_ulong target_info = arg3;int options = arg4; +abi_ulong target_rusage = arg5;siginfo_t info, *info_ptr = target_info ? &info :NULL ; +struct rusage rusage; +struct rusage *rusage_ptr = target_rusage ? &rusage :NULL ;abi_long ret; info.si_pid =0 ; - ret =get_errno (safe_waitid (idtype, id, info_ptr, options,NULL )); -if (!is_error (ret) && target_info && info.si_pid !=0 ) { -target_siginfo_t *p =lock_user (VERIFY_WRITE , target_info, -sizeof (target_siginfo_t),0 ); -if (!p) { -return -TARGET_EFAULT ; + ret =get_errno (safe_waitid (idtype, id, info_ptr, options, rusage_ptr)); +if (!is_error (ret)) { +if (target_info && info.si_pid !=0 ) { +target_siginfo_t *p =lock_user (VERIFY_WRITE , target_info, +sizeof (target_siginfo_t),0 ); +if (!p) { +return -TARGET_EFAULT ; + } +host_to_target_siginfo (p, &info); +unlock_user (p, target_info,sizeof (target_siginfo_t)); + } +if (target_rusage) { +abi_long err =host_to_target_rusage (target_rusage, &rusage); +if (err) { + ret = err; + } } -host_to_target_siginfo (p, &info); -unlock_user (p, target_info,sizeof (target_siginfo_t)); }return ret; }
Signature · 1 line
2.17.1
PATCH v7 20/74 linux-user: Split out creat
In reply to Richard Henderson--- linux-user/syscall-defs.h | 3 +++ linux-user/strace.c | 13 ------------- linux-user/syscall-file.inc.c | 16 ++++++++++++++++ linux-user/syscall.c | 9 --------- linux-user/strace.list | 3 --- 5 files changed, 19 insertions(+), 25 deletions(-)
linux-user/syscall-defs.h +3 -0
@@ -21,6 +21,9 @@ SYSCALL_DEF_FULL(brk, .impl = impl_brk, .arg_type = { ARG_PTR });SYSCALL_DEF_ARGS (clone,ARG_CLONEFLAG ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (close,ARG_DEC ); +#ifdef TARGET_NR_creat +SYSCALL_DEF (creat,ARG_STR ,ARG_MODEFLAG ); +#endif SYSCALL_DEF (exit,ARG_DEC );#ifdef TARGET_NR_forkSYSCALL_DEF (fork);
linux-user/strace.c +0 -13
@@ -1195,19 +1195,6 @@ print_clock_adjtime(const struct syscallname *name, }#endif -#ifdef TARGET_NR_creat -static void -print_creat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_file_mode (arg1,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_execv static void print_execv(const struct syscallname *name,
linux-user/syscall-file.inc.c +16 -0
@@ -24,6 +24,22 @@ SYSCALL_IMPL(close)return get_errno (close (fd)); } +#ifdef TARGET_NR_creat +SYSCALL_IMPL (creat) +{ +char *p =lock_user_string (arg1); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (creat (p, arg2)); +fd_trans_unregister (ret); +unlock_user (p, arg1,0 ); +return ret; +} +#endif +/* * Helpers for do_openat, manipulating /proc/self/foo. */
linux-user/syscall.c +0 -9
@@ -5383,15 +5383,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_creat/* not on alpha */ -case TARGET_NR_creat: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (creat (p, arg2)); -fd_trans_unregister (ret); -unlock_user (p, arg1,0 ); -return ret; -#endif #ifdef TARGET_NR_linkcase TARGET_NR_link: {
linux-user/strace.list +0 -3
@@ -94,9 +94,6 @@ #ifdef TARGET_NR_connect { TARGET_NR_connect, "connect" , "%s(%d,%#x,%d)", NULL, NULL }, #endif -#ifdef TARGET_NR_creat -{ TARGET_NR_creat, "creat" , NULL, print_creat, NULL }, -#endif #ifdef TARGET_NR_create_module { TARGET_NR_create_module, "create_module" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 21/74 linux-user: Split out link, linkat
In reply to Richard HendersonNote that linkat is universally provided.
--- linux-user/syscall-defs.h | 4 ++++ linux-user/strace.c | 29 ----------------------------- linux-user/syscall-file.inc.c | 28 ++++++++++++++++++++++++++++ linux-user/syscall.c | 32 -------------------------------- linux-user/strace.list | 6 ------ 5 files changed, 32 insertions(+), 67 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -31,6 +31,10 @@ SYSCALL_DEF(fork);#ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif +#ifdef TARGET_NR_link +SYSCALL_DEF (link,ARG_STR ,ARG_STR ); +#endif +SYSCALL_DEF (linkat,ARG_ATDIRFD ,ARG_STR ,ARG_ATDIRFD ,ARG_STR ,ARG_ATFLAG );SYSCALL_DEF (mlock,ARG_PTR ,ARG_DEC );SYSCALL_DEF (mlockall,ARG_HEX );#ifdef TARGET_NR_mmap
linux-user/strace.c +0 -29
@@ -1369,35 +1369,6 @@ print_futimesat(const struct syscallname *name, }#endif -#ifdef TARGET_NR_link -static void -print_link (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_string (arg1,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_linkat -static void -print_linkat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_at_dirfd (arg2,0 ); -print_string (arg3,0 ); -print_flags (at_file_flags, arg4,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR__llseek static void print__llseek(const struct syscallname *name,
linux-user/syscall-file.inc.c +28 -0
@@ -40,6 +40,34 @@ SYSCALL_IMPL(creat) }#endif +static abi_long do_linkat (int olddirfd,abi_ulong target_oldpath, +int newdirfd,abi_ulong target_newpath, +int flags) +{ +char *oldpath =lock_user_string (target_oldpath); +char *newpath =lock_user_string (target_newpath); +abi_long ret = -TARGET_EFAULT ; + +if (oldpath && newpath) { + ret =get_errno (linkat (olddirfd, oldpath, newdirfd, newpath, flags)); + } +unlock_user (oldpath, target_oldpath,0 ); +unlock_user (newpath, target_newpath,0 ); +return ret; +} + +#ifdef TARGET_NR_link +SYSCALL_IMPL (link) +{ +return do_linkat (AT_FDCWD , arg1,AT_FDCWD , arg2,0 ); +} +#endif + +SYSCALL_IMPL (linkat) +{ +return do_linkat (arg1, arg2, arg3, arg4, arg5); +} +/* * Helpers for do_openat, manipulating /proc/self/foo. */
linux-user/syscall.c +0 -32
@@ -5383,38 +5383,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_link -case TARGET_NR_link: - { -void * p2; - p =lock_user_string (arg1); - p2 =lock_user_string (arg2); -if (!p || !p2) - ret = -TARGET_EFAULT ; -else - ret =get_errno (link (p, p2)); -unlock_user (p2, arg2,0 ); -unlock_user (p, arg1,0 ); - } -return ret; -#endif -#if defined(TARGET_NR_linkat) -case TARGET_NR_linkat: - { -void * p2 =NULL ; -if (!arg2 || !arg4) -return -TARGET_EFAULT ; - p =lock_user_string (arg2); - p2 =lock_user_string (arg4); -if (!p || !p2) - ret = -TARGET_EFAULT ; -else - ret =get_errno (linkat (arg1, p, arg3, p2, arg5)); -unlock_user (p, arg2,0 ); -unlock_user (p2, arg4,0 ); - } -return ret; -#endif #ifdef TARGET_NR_unlinkcase TARGET_NR_unlink:if (!(p =lock_user_string (arg1)))
linux-user/strace.list +0 -6
@@ -461,12 +461,6 @@ #ifdef TARGET_NR_lgetxattr { TARGET_NR_lgetxattr, "lgetxattr" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_link -{ TARGET_NR_link, "link" , NULL, print_link, NULL }, -#endif -#ifdef TARGET_NR_linkat -{ TARGET_NR_linkat, "linkat" , NULL, print_linkat, NULL }, -#endif #ifdef TARGET_NR_Linux { TARGET_NR_Linux, "Linux" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 22/74 linux-user: Split out unlink, unlinkat, rmdir
In reply to Richard HendersonNote that unlinkat is universally provided.
Implement rmdir in terms of unlinkat.
--- linux-user/syscall-defs.h | 7 ++++++ linux-user/syscall.h | 1 + linux-user/strace.c | 43 ++++------------------------------- linux-user/syscall-file.inc.c | 32 ++++++++++++++++++++++++++ linux-user/syscall.c | 24 ------------------- linux-user/strace.list | 9 -------- 6 files changed, 44 insertions(+), 72 deletions(-)
linux-user/syscall-defs.h +7 -0
@@ -98,6 +98,9 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC);SYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC );#endif SYSCALL_DEF (readv,ARG_DEC ,ARG_PTR ,ARG_DEC ); +#ifdef TARGET_NR_rmdir +SYSCALL_DEF (rmdir,ARG_STR ); +#endif #if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
@@ -121,6 +124,10 @@ SYSCALL_DEF(shmdt, ARG_PTR);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmget)SYSCALL_DEF (shmget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +#ifdef TARGET_NR_unlink +SYSCALL_DEF (unlink,ARG_STR ); +#endif +SYSCALL_DEF (unlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_UNLINKATFLAG );#ifdef TARGET_NR_vfork/* Emulate vfork() with fork(). */ SYSCALL_DEF_FULL(vfork, .impl = impl_fork);
linux-user/syscall.h +1 -0
@@ -63,6 +63,7 @@ typedef enum {ARG_MMAPPROT ,ARG_MODEFLAG ,ARG_OPENFLAG , +ARG_UNLINKATFLAG ,/* These are interpreted as pointers. */ ARG_PTR,
linux-user/strace.c +4 -39
67 lines not on this page · raw message
linux-user/syscall-file.inc.c +32 -0
@@ -662,6 +662,38 @@ SYSCALL_IMPL(readlinkat) }#endif +static abi_long do_unlinkat (int dirfd,abi_ulong target_path,int flags) +{ +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (unlinkat (dirfd, p, flags)); +unlock_user (p, target_path,0 ); +return ret; +} + +#ifdef TARGET_NR_unlink +SYSCALL_IMPL (unlink) +{ +return do_unlinkat (AT_FDCWD , arg1,0 ); +} +#endif + +#ifdef TARGET_NR_rmdir +SYSCALL_IMPL (rmdir) +{ +return do_unlinkat (AT_FDCWD , arg1,AT_REMOVEDIR ); +} +#endif + +SYSCALL_IMPL (unlinkat) +{ +return do_unlinkat (arg1, arg2, arg3); +} +SYSCALL_IMPL (write) {int fd = arg1;
linux-user/syscall.c +0 -24
@@ -5383,22 +5383,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_unlink -case TARGET_NR_unlink: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (unlink (p)); -unlock_user (p, arg1,0 ); -return ret; -#endif -#if defined(TARGET_NR_unlinkat) -case TARGET_NR_unlinkat: -if (!(p =lock_user_string (arg2))) -return -TARGET_EFAULT ; - ret =get_errno (unlinkat (arg1, p, arg3)); -unlock_user (p, arg2,0 ); -return ret; -#endif case TARGET_NR_execve: {char **argp, **envp;
@@ -5790,14 +5774,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, ret =get_errno (mkdirat (arg1, p, arg3));unlock_user (p, arg2,0 );return ret; -#endif -#ifdef TARGET_NR_rmdir -case TARGET_NR_rmdir: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (rmdir (p)); -unlock_user (p, arg1,0 ); -return ret;#endif case TARGET_NR_dup: ret =get_errno (dup (arg1));
linux-user/strace.list +0 -9
@@ -527,9 +527,6 @@ #ifdef TARGET_NR_mkdirat { TARGET_NR_mkdirat, "mkdirat" , NULL, print_mkdirat, NULL }, #endif -#ifdef TARGET_NR_rmdir -{ TARGET_NR_rmdir, "rmdir" , NULL, print_rmdir, NULL }, -#endif #ifdef TARGET_NR_mknod { TARGET_NR_mknod, "mknod" , NULL, print_mknod, NULL }, #endif
@@ -1425,12 +1422,6 @@ #ifdef TARGET_NR_uname { TARGET_NR_uname, "uname" , "%s(%p)", NULL, NULL }, #endif -#ifdef TARGET_NR_unlink -{ TARGET_NR_unlink, "unlink" , NULL, print_unlink, NULL }, -#endif -#ifdef TARGET_NR_unlinkat -{ TARGET_NR_unlinkat, "unlinkat" , NULL, print_unlinkat, NULL }, -#endif #ifdef TARGET_NR_unshare { TARGET_NR_unshare, "unshare" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 23/74 linux-user: Split out execve
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/strace.c | 32 ---------- linux-user/syscall-proc.inc.c | 110 ++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 97 ------------------------------ linux-user/strace.list | 3 - 5 files changed, 111 insertions(+), 132 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -25,6 +25,7 @@ SYSCALL_DEF(close, ARG_DEC);SYSCALL_DEF (creat,ARG_STR ,ARG_MODEFLAG );#endif SYSCALL_DEF (exit,ARG_DEC ); +SYSCALL_DEF (execve,ARG_STR ,ARG_PTR ,ARG_PTR );#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif
linux-user/strace.c +0 -32
@@ -568,38 +568,6 @@ print_newselect(const struct syscallname *name, }#endif -static void -print_execve (const struct syscallname *name, -abi_long arg1,abi_long arg2,abi_long arg3, -abi_long arg4,abi_long arg5,abi_long arg6) -{ -abi_ulong arg_ptr_addr; -char *s; - -if (!(s =lock_user_string (arg1))) -return ; -gemu_log ("%s(\"%s\",{" , name->name, s); -unlock_user (s, arg1,0 ); - -for (arg_ptr_addr = arg2; ; arg_ptr_addr +=sizeof (abi_ulong)) { -abi_ulong *arg_ptr, arg_addr; - - arg_ptr =lock_user (VERIFY_READ , arg_ptr_addr,sizeof (abi_ulong),1 ); -if (!arg_ptr) -return ; - arg_addr =tswapal (*arg_ptr); -unlock_user (arg_ptr, arg_ptr_addr,0 ); -if (!arg_addr) -break ; -if ((s =lock_user_string (arg_addr))) { -gemu_log ("\"%s\"," , s); -unlock_user (s, arg_addr,0 ); - } - } - -gemu_log ("NULL})" ); -} -/* * Variants for the return value output function */
linux-user/syscall-proc.inc.c +110 -0
116 lines not on this page · raw message
linux-user/syscall.c +0 -97
103 lines not on this page · raw message
linux-user/strace.list +0 -3
@@ -139,9 +139,6 @@ #ifdef TARGET_NR_execv { TARGET_NR_execv, "execv" , NULL, print_execv, NULL }, #endif -#ifdef TARGET_NR_execve -{ TARGET_NR_execve, "execve" , NULL, print_execve, NULL }, -#endif #ifdef TARGET_NR_execveat { TARGET_NR_execveat, "execveat" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 24/74 linux-user: Implement execveat
In reply to Richard HendersonA trivial extension to our current execve implementation to support the new(ish) syscall.
--- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 19 ++++++++++++++----- linux-user/syscall.c | 3 ++- linux-user/strace.list | 3 --- 4 files changed, 17 insertions(+), 9 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -26,6 +26,7 @@ SYSCALL_DEF(creat, ARG_STR, ARG_MODEFLAG);#endif SYSCALL_DEF (exit,ARG_DEC );SYSCALL_DEF (execve,ARG_STR ,ARG_PTR ,ARG_PTR ); +SYSCALL_DEF (execveat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG );#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif
linux-user/syscall-proc.inc.c +14 -5
@@ -269,14 +269,13 @@ SYSCALL_IMPL(clone)return do_clone (cpu_env, arg1, arg2, arg3, arg4, arg5); } -SYSCALL_IMPL (execve) +static abi_long do_execveat (int dirfd,abi_ulong guest_path, +abi_ulong guest_argp,abi_ulong guest_envp, +int flags) {char **argp, **envp;int argc, envc;abi_ulong gp; -abi_ulong guest_path = arg1; -abi_ulong guest_argp = arg2; -abi_ulong guest_envp = arg3;abi_ulong addr;char **q, *p;int total_size =0 ;
@@ -356,7 +355,7 @@ SYSCALL_IMPL(execve)* before the execve completes and makes it the other * program's problem. */ - ret =get_errno (safe_execve (p, argp, envp)); + ret =get_errno (safe_execveat (dirfd, p, argp, envp, flags));unlock_user (p, guest_path,0 ); execve_free:
@@ -379,6 +378,16 @@ SYSCALL_IMPL(execve)return ret; } +SYSCALL_IMPL (execve) +{ +return do_execveat (AT_FDCWD , arg1, arg2, arg3,0 ); +} + +SYSCALL_IMPL (execveat) +{ +return do_execveat (arg1, arg2, arg3, arg4, arg5); +} +SYSCALL_IMPL (exit) {CPUState *cpu =ENV_GET_CPU (cpu_env);
linux-user/syscall.c +2 -1
@@ -672,7 +672,8 @@ safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \ struct rusage *, rusage) safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop, \ int, options, struct rusage *, rusage) -safe_syscall3(int, execve, const char *, filename, char **, argv, char **, envp) +safe_syscall5(int, execveat, int, dirfd, const char *, filename, + char **, argv, char **, envp, int, flags) safe_syscall6(int, pselect6, int, nfds, fd_set *, readfds, fd_set *, writefds, \ fd_set *, exceptfds, struct timespec *, timeout, void *, sig) safe_syscall5(int, ppoll, struct pollfd *, ufds, unsigned int, nfds,
linux-user/strace.list +0 -3
@@ -139,9 +139,6 @@ #ifdef TARGET_NR_execv { TARGET_NR_execv, "execv" , NULL, print_execv, NULL }, #endif -#ifdef TARGET_NR_execveat -{ TARGET_NR_execveat, "execveat" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_exec_with_loader { TARGET_NR_exec_with_loader, "exec_with_loader" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 25/74 linux-user: Split out chdir
In reply to Richard HendersonNote that chdir is universally provided.
--- linux-user/syscall-defs.h | 1 + linux-user/strace.c | 12 ------------ linux-user/syscall-file.inc.c | 14 ++++++++++++++ linux-user/syscall.c | 6 ------ linux-user/strace.list | 3 --- 5 files changed, 15 insertions(+), 21 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -19,6 +19,7 @@ SYSCALL_DEF_FULL(brk, .impl = impl_brk, .print_ret = print_syscall_ptr_ret, .arg_type = { ARG_PTR }); +SYSCALL_DEF (chdir,ARG_STR );SYSCALL_DEF_ARGS (clone,ARG_CLONEFLAG ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (close,ARG_DEC );#ifdef TARGET_NR_creat
linux-user/strace.c +0 -12
@@ -1113,18 +1113,6 @@ print_access(const struct syscallname *name, }#endif -#ifdef TARGET_NR_chdir -static void -print_chdir (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_chroot static void print_chroot(const struct syscallname *name,
linux-user/syscall-file.inc.c +14 -0
@@ -16,6 +16,20 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +SYSCALL_IMPL (chdir) +{ +abi_ulong target_path = arg1; +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (chdir (p)); +unlock_user (p, target_path,0 ); +return ret; +} +SYSCALL_IMPL (close) {int fd = arg1;
linux-user/syscall.c +0 -6
@@ -5384,12 +5384,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_chdir: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (chdir (p)); -unlock_user (p, arg1,0 ); -return ret;#ifdef TARGET_NR_timecase TARGET_NR_time: {
linux-user/strace.list +0 -3
@@ -61,9 +61,6 @@ #ifdef TARGET_NR_capset { TARGET_NR_capset, "capset" , "%s(%p,%p)", NULL, NULL }, #endif -#ifdef TARGET_NR_chdir -{ TARGET_NR_chdir, "chdir" , NULL, print_chdir, NULL }, -#endif #ifdef TARGET_NR_chmod { TARGET_NR_chmod, "chmod" , NULL, print_chmod, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 26/74 linux-user: Split out time
In reply to Richard Henderson--- linux-user/syscall-defs.h | 3 +++ linux-user/syscall-time.inc.c | 32 ++++++++++++++++++++++++++++++++ linux-user/syscall.c | 13 +------------ linux-user/strace.list | 3 --- 4 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 linux-user/syscall-time.inc.c
linux-user/syscall-defs.h +3 -0
@@ -127,6 +127,9 @@ SYSCALL_DEF(shmdt, ARG_PTR);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmget)SYSCALL_DEF (shmget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +#ifdef TARGET_NR_time +SYSCALL_DEF (time,ARG_PTR ); +#endif #ifdef TARGET_NR_unlinkSYSCALL_DEF (unlink,ARG_STR );#endif
linux-user/syscall-time.inc.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Linux time related syscalls +* Copyright (c) 2003 Fabrice Bellard +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifdef TARGET_NR_time +SYSCALL_IMPL (time) +{ +time_t host_time; +abi_long ret =get_errno (time (&host_time)); + +if (!is_error (ret) + && arg1 + &&put_user_sal (host_time, arg1)) { +return -TARGET_EFAULT ; + } +return ret; +} +#endif
linux-user/syscall.c +1 -12
@@ -5384,18 +5384,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_time -case TARGET_NR_time: - { -time_t host_time; - ret =get_errno (time (&host_time)); -if (!is_error (ret) - && arg1 - &&put_user_sal (host_time, arg1)) -return -TARGET_EFAULT ; - } -return ret; -#endif #ifdef TARGET_NR_mknodcase TARGET_NR_mknod:if (!(p =lock_user_string (arg1)))
@@ -9392,6 +9380,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,#include "syscall-ipc.inc.c" #include "syscall-mem.inc.c" #include "syscall-proc.inc.c" +#include "syscall-time.inc.c" #undef SYSCALL_IMPL#undef SYSCALL_ARGS
linux-user/strace.list +0 -3
@@ -1350,9 +1350,6 @@ #ifdef TARGET_NR_tgkill { TARGET_NR_tgkill, "tgkill" , NULL, print_tgkill, NULL }, #endif -#ifdef TARGET_NR_time -{ TARGET_NR_time, "time" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_timer_create { TARGET_NR_timer_create, "timer_create" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 27/74 linux-user: Split out mknod, mknodat
In reply to Richard HendersonNote that mknodat is universally provided.
--- linux-user/syscall-defs.h | 4 ++++ linux-user/strace.c | 39 ----------------------------------- linux-user/syscall-file.inc.c | 26 +++++++++++++++++++++++ linux-user/syscall.c | 16 -------------- linux-user/strace.list | 6 ------ 5 files changed, 30 insertions(+), 61 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -38,6 +38,10 @@ SYSCALL_DEF_ARGS(ipc, ARG_HEX, ARG_DEC, ARG_DEC, ARG_HEX, ARG_PTR, ARG_HEX);SYSCALL_DEF (link,ARG_STR ,ARG_STR );#endif SYSCALL_DEF (linkat,ARG_ATDIRFD ,ARG_STR ,ARG_ATDIRFD ,ARG_STR ,ARG_ATFLAG ); +#ifdef TARGET_NR_mknod +SYSCALL_DEF (mknod,ARG_STR ,ARG_MODEFLAG ,ARG_HEX ); +#endif +SYSCALL_DEF (mknodat,ARG_ATDIRFD ,ARG_STR ,ARG_MODEFLAG ,ARG_HEX );SYSCALL_DEF (mlock,ARG_PTR ,ARG_DEC );SYSCALL_DEF (mlockall,ARG_HEX );#ifdef TARGET_NR_mmap
linux-user/strace.c +0 -39
@@ -1923,45 +1923,6 @@ print_syslog(const struct syscallname *name, }#endif -#ifdef TARGET_NR_mknod -static void -print_mknod (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -int hasdev = (arg1 & (S_IFCHR |S_IFBLK )); - -print_syscall_prologue (name); -print_string (arg0,0 ); -print_file_mode (arg1, (hasdev ==0 )); -if (hasdev) { -print_raw_param ("makedev(%d" ,major (arg2),0 ); -print_raw_param ("%d)" ,minor (arg2),1 ); - } -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_mknodat -static void -print_mknodat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -int hasdev = (arg2 & (S_IFCHR |S_IFBLK )); - -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_file_mode (arg2, (hasdev ==0 )); -if (hasdev) { -print_raw_param ("makedev(%d" ,major (arg3),0 ); -print_raw_param ("%d)" ,minor (arg3),1 ); - } -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_mq_open static void print_mq_open(const struct syscallname *name,
linux-user/syscall-file.inc.c +26 -0
@@ -82,6 +82,32 @@ SYSCALL_IMPL(linkat)return do_linkat (arg1, arg2, arg3, arg4, arg5); } +static abi_long do_mknodat (int dirfd,abi_ulong target_path, +mode_t mode,dev_t dev) +{ +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (mknodat (dirfd, p, mode, dev)); +unlock_user (p, target_path,0 ); +return ret; +} + +#ifdef TARGET_NR_mknod +SYSCALL_IMPL (mknod) +{ +return do_mknodat (AT_FDCWD , arg1, arg2, arg3); +} +#endif + +SYSCALL_IMPL (mknodat) +{ +return do_mknodat (arg1, arg2, arg3, arg4); +} +/* * Helpers for do_openat, manipulating /proc/self/foo. */
linux-user/syscall.c +0 -16
@@ -5384,22 +5384,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_mknod -case TARGET_NR_mknod: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (mknod (p, arg2, arg3)); -unlock_user (p, arg1,0 ); -return ret; -#endif -#if defined(TARGET_NR_mknodat) -case TARGET_NR_mknodat: -if (!(p =lock_user_string (arg2))) -return -TARGET_EFAULT ; - ret =get_errno (mknodat (arg1, p, arg3, arg4)); -unlock_user (p, arg2,0 ); -return ret; -#endif #ifdef TARGET_NR_chmodcase TARGET_NR_chmod:if (!(p =lock_user_string (arg1)))
linux-user/strace.list +0 -6
@@ -518,12 +518,6 @@ #ifdef TARGET_NR_mkdirat { TARGET_NR_mkdirat, "mkdirat" , NULL, print_mkdirat, NULL }, #endif -#ifdef TARGET_NR_mknod -{ TARGET_NR_mknod, "mknod" , NULL, print_mknod, NULL }, -#endif -#ifdef TARGET_NR_mknodat -{ TARGET_NR_mknodat, "mknodat" , NULL, print_mknodat, NULL }, -#endif #ifdef TARGET_NR_modify_ldt { TARGET_NR_modify_ldt, "modify_ldt" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 28/74 linux-user: Split out chmod, fchmod, fchmodat
In reply to Richard HendersonNote that fchmodat is universally provided.
--- linux-user/syscall-defs.h | 5 +++++ linux-user/strace.c | 28 ---------------------------- linux-user/syscall-file.inc.c | 30 ++++++++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 9 --------- 5 files changed, 35 insertions(+), 55 deletions(-)
linux-user/syscall-defs.h +5 -0
@@ -20,6 +20,9 @@ SYSCALL_DEF_FULL(brk, .impl = impl_brk, .print_ret = print_syscall_ptr_ret, .arg_type = { ARG_PTR });SYSCALL_DEF (chdir,ARG_STR ); +#ifdef TARGET_NR_chmod +SYSCALL_DEF (chmod,ARG_STR ,ARG_MODEFLAG ); +#endif SYSCALL_DEF_ARGS (clone,ARG_CLONEFLAG ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (close,ARG_DEC );#ifdef TARGET_NR_creat
@@ -28,6 +31,8 @@ SYSCALL_DEF(creat, ARG_STR, ARG_MODEFLAG);SYSCALL_DEF (exit,ARG_DEC );SYSCALL_DEF (execve,ARG_STR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (execveat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG ); +SYSCALL_DEF (fchmod,ARG_DEC ,ARG_MODEFLAG ); +SYSCALL_DEF (fchmodat,ARG_ATDIRFD ,ARG_STR ,ARG_MODEFLAG );#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif
linux-user/strace.c +0 -28
@@ -1125,19 +1125,6 @@ print_chroot(const struct syscallname *name, }#endif -#ifdef TARGET_NR_chmod -static void -print_chmod (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_file_mode (arg1,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_clock_adjtime static void print_clock_adjtime(const struct syscallname *name,
@@ -1179,21 +1166,6 @@ print_faccessat(const struct syscallname *name, }#endif -#ifdef TARGET_NR_fchmodat -static void -print_fchmodat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_file_mode (arg2,0 ); -print_flags (at_file_flags, arg3,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_fchownat static void print_fchownat(const struct syscallname *name,
linux-user/syscall-file.inc.c +30 -0
@@ -30,6 +30,26 @@ SYSCALL_IMPL(chdir)return ret; } +static abi_long do_fchmodat (int dirfd,abi_ulong target_path,mode_t mode) +{ +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (fchmodat (dirfd, p, mode,0 )); +unlock_user (p, target_path,0 ); +return ret; +} + +#ifdef TARGET_NR_chmod +SYSCALL_IMPL (chmod) +{ +return do_fchmodat (AT_FDCWD , arg1, arg2); +} +#endif +SYSCALL_IMPL (close) {int fd = arg1;
@@ -54,6 +74,16 @@ SYSCALL_IMPL(creat) }#endif +SYSCALL_IMPL (fchmod) +{ +return get_errno (fchmod (arg1, arg2)); +} + +SYSCALL_IMPL (fchmodat) +{ +return do_fchmodat (arg1, arg2, arg3); +} +static abi_long do_linkat (int olddirfd,abi_ulong target_oldpath,int newdirfd,abi_ulong target_newpath,int flags)
linux-user/syscall.c +0 -18
@@ -5384,14 +5384,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_chmod -case TARGET_NR_chmod: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (chmod (p, arg2)); -unlock_user (p, arg1,0 ); -return ret; -#endif #ifdef TARGET_NR_lseekcase TARGET_NR_lseek:return get_errno (lseek (arg1, arg2, arg3));
@@ -6463,16 +6455,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,#ifdef TARGET_NR_ftruncatecase TARGET_NR_ftruncate:return get_errno (ftruncate (arg1, arg2)); -#endif -case TARGET_NR_fchmod: -return get_errno (fchmod (arg1, arg2)); -#if defined(TARGET_NR_fchmodat) -case TARGET_NR_fchmodat: -if (!(p =lock_user_string (arg2))) -return -TARGET_EFAULT ; - ret =get_errno (fchmodat (arg1, p, arg3,0 )); -unlock_user (p, arg2,0 ); -return ret;#endif case TARGET_NR_getpriority:/* Note that negative values are valid for getpriority, so we must
linux-user/strace.list +0 -9
@@ -61,9 +61,6 @@ #ifdef TARGET_NR_capset { TARGET_NR_capset, "capset" , "%s(%p,%p)", NULL, NULL }, #endif -#ifdef TARGET_NR_chmod -{ TARGET_NR_chmod, "chmod" , NULL, print_chmod, NULL }, -#endif #ifdef TARGET_NR_chown { TARGET_NR_chown, "chown" , NULL, NULL, NULL }, #endif
@@ -169,12 +166,6 @@ #ifdef TARGET_NR_fchdir { TARGET_NR_fchdir, "fchdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_fchmod -{ TARGET_NR_fchmod, "fchmod" , "%s(%d,%#o)", NULL, NULL }, -#endif -#ifdef TARGET_NR_fchmodat -{ TARGET_NR_fchmodat, "fchmodat" , NULL, print_fchmodat, NULL }, -#endif #ifdef TARGET_NR_fchown { TARGET_NR_fchown, "fchown" , "%s(%d,%d,%d)", NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 29/74 linux-user: Split out lseek, llseek
In reply to Richard HendersonCanonicalise the target syscall name on llseek (new kernels) instead of _llseek (old kernels). Always use host lseek(3) rather than attempting to use the host llseek(2).
--- linux-user/syscall-defs.h | 6 ++++++ linux-user/syscall.h | 1 + linux-user/strace.c | 39 +++++++++++++++-------------------- linux-user/syscall-file.inc.c | 36 ++++++++++++++++++++++++++++++++ linux-user/syscall.c | 32 ++-------------------------- linux-user/strace.list | 6 ------ 6 files changed, 62 insertions(+), 58 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -43,6 +43,12 @@ SYSCALL_DEF_ARGS(ipc, ARG_HEX, ARG_DEC, ARG_DEC, ARG_HEX, ARG_PTR, ARG_HEX);SYSCALL_DEF (link,ARG_STR ,ARG_STR );#endif SYSCALL_DEF (linkat,ARG_ATDIRFD ,ARG_STR ,ARG_ATDIRFD ,ARG_STR ,ARG_ATFLAG ); +#ifdef TARGET_NR_lseek +SYSCALL_DEF (lseek,ARG_DEC ,ARG_DEC ,ARG_LSEEKWHENCE ); +#endif +#ifdef TARGET_NR_llseek +SYSCALL_DEF_ARGS (llseek,ARG_DEC ,ARG_DEC ,ARG_PTR ,ARG_LSEEKWHENCE ); +#endif #ifdef TARGET_NR_mknodSYSCALL_DEF (mknod,ARG_STR ,ARG_MODEFLAG ,ARG_HEX );#endif
linux-user/syscall.h +1 -0
@@ -64,6 +64,7 @@ typedef enum {ARG_MODEFLAG ,ARG_OPENFLAG ,ARG_UNLINKATFLAG , +ARG_LSEEKWHENCE ,/* These are interpreted as pointers. */ ARG_PTR,
linux-user/strace.c +17 -22
@@ -934,6 +934,20 @@ print_open_flags(abi_long flags, int last)gemu_log ("%s%s" , buf,get_comma (last)); } +static int add_lseek_whence (char *buf,int size,int whence) +{ +switch (whence) { +case SEEK_SET : +return snprintf (buf, size,"SEEK_SET" ); +case SEEK_CUR : +return snprintf (buf, size,"SEEK_CUR" ); +case SEEK_END : +return snprintf (buf, size,"SEEK_END" ); +default : +return snprintf (buf, size,"%#x" , whence); + } +} +static void print_syscall_prologue (const struct syscallname *sc) {
@@ -1297,28 +1311,6 @@ print_futimesat(const struct syscallname *name, }#endif -#ifdef TARGET_NR__llseek -static void -print__llseek (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -const char *whence ="UNKNOWN" ; -print_syscall_prologue (name); -print_raw_param ("%d" , arg0,0 ); -print_raw_param ("%ld" , arg1,0 ); -print_raw_param ("%ld" , arg2,0 ); -print_pointer (arg3,0 ); -switch (arg4) { -case SEEK_SET : whence ="SEEK_SET" ;break ; -case SEEK_CUR : whence ="SEEK_CUR" ;break ; -case SEEK_END : whence ="SEEK_END" ;break ; - } -gemu_log ("%s" ,whence); -print_syscall_epilogue (name); -} -#endif -#if defined(TARGET_NR_socket) static void print_socket(const struct syscallname *name,
@@ -2329,6 +2321,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_UNLINKATFLAG : len =add_flags (b, rest, unlinkat_flags, arg, true);break ; +case ARG_LSEEKWHENCE : + len =add_lseek_whence (b, rest, arg); +break ;case ARG_PTR : len =add_pointer (b, rest, arg);break ;
linux-user/syscall-file.inc.c +36 -0
@@ -112,6 +112,42 @@ SYSCALL_IMPL(linkat)return do_linkat (arg1, arg2, arg3, arg4, arg5); } +#ifdef TARGET_NR_lseek +SYSCALL_IMPL (lseek) +{ +return get_errno (lseek (arg1, arg2, arg3)); +} +#endif + +#ifdef TARGET_NR_llseek +SYSCALL_ARGS (llseek) +{ +/* The parts for offset are *always* in big-endian order. */ +abi_ulong lo = in[2 ], hi = in[1 ]; + out[1 ] = (((uint64_t )hi << (TARGET_ABI_BITS -1 )) <<1 ) | lo; + out[2 ] = in[3 ]; + out[3 ] = in[4 ]; +return def; +} + +SYSCALL_IMPL (llseek) +{ +int fd = arg1; +int64_t offset = arg2; +abi_ulong target_res = arg3; +int whence = arg4; + +off_t res =lseek (fd, offset, whence); + +if (res ==-1 ) { +return get_errno (-1 ); + }else if (put_user_s64 (res, target_res)) { +return -TARGET_EFAULT ; + } +return 0 ; +} +#endif +static abi_long do_mknodat (int dirfd,abi_ulong target_path,mode_t mode,dev_t dev) {
linux-user/syscall.c +2 -30
@@ -192,8 +192,8 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \#endif /* Newer kernel ports have llseek() instead of _llseek() */ -#if defined(TARGET_NR_llseek) && !defined(TARGET_NR__llseek) -#define TARGET_NR__llseek TARGET_NR_llseek +#if !defined(TARGET_NR_llseek) && defined(TARGET_NR__llseek) +#define TARGET_NR_llseek TARGET_NR__llseek#endif #define __NR_sys_gettid __NR_gettid
@@ -217,10 +217,6 @@ _syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count) (defined(TARGET_NR_getdents64) && defined(__NR_getdents64)) _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);#endif -#if defined(TARGET_NR__llseek) && defined(__NR_llseek) -_syscall5 (int, _llseek, uint, fd, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); -#endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uinfo)_syscall4 (int, sys_rt_tgsigqueueinfo, pid_t, pid, pid_t, tid, int, sig, siginfo_t *, uinfo)
@@ -5384,10 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_lseek -case TARGET_NR_lseek: -return get_errno (lseek (arg1, arg2, arg3)); -#endif #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA )/* Alpha specific */ case TARGET_NR_getxpid:
@@ -6886,26 +6878,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,return get_errno (fchdir (arg1));case TARGET_NR_personality:return get_errno (personality (arg1)); -#ifdef TARGET_NR__llseek/* Not on alpha */ -case TARGET_NR__llseek: - { -int64_t res; -#if !defined(__NR_llseek) - res =lseek (arg1, ((uint64_t )arg2 <<32 ) | (abi_ulong )arg3, arg5); -if (res ==-1 ) { - ret =get_errno (res); - }else { - ret =0 ; - } -#else - ret =get_errno (_llseek (arg1, arg2, arg3, &res, arg5)); -#endif -if ((ret ==0 ) &&put_user_s64 (res, arg4)) { -return -TARGET_EFAULT ; - } - } -return ret; -#endif #ifdef TARGET_NR_getdentscase TARGET_NR_getdents:#ifdef EMULATE_GETDENTS_WITH_GETDENTS
linux-user/strace.list +0 -6
@@ -455,9 +455,6 @@ #ifdef TARGET_NR_llistxattr { TARGET_NR_llistxattr, "llistxattr" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR__llseek -{ TARGET_NR__llseek, "_llseek" , NULL, print__llseek, NULL }, -#endif #ifdef TARGET_NR_lock { TARGET_NR_lock, "lock" , NULL, NULL, NULL }, #endif
@@ -467,9 +464,6 @@ #ifdef TARGET_NR_lremovexattr { TARGET_NR_lremovexattr, "lremovexattr" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_lseek -{ TARGET_NR_lseek, "lseek" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_lsetxattr { TARGET_NR_lsetxattr, "lsetxattr" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 30/74 linux-user: Split out getpid, getppid, getxpid
In reply to Richard Henderson--- linux-user/syscall-defs.h | 9 +++++++++ linux-user/syscall-proc.inc.c | 23 +++++++++++++++++++++++ linux-user/syscall.c | 14 -------------- linux-user/strace.list | 9 --------- 4 files changed, 32 insertions(+), 23 deletions(-)
linux-user/syscall-defs.h +9 -0
@@ -36,6 +36,15 @@ SYSCALL_DEF(fchmodat, ARG_ATDIRFD, ARG_STR, ARG_MODEFLAG);#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif +#ifdef TARGET_NR_getpid +SYSCALL_DEF (getpid); +#endif +#ifdef TARGET_NR_getppid +SYSCALL_DEF (getppid); +#endif +#ifdef TARGET_NR_getxpid +SYSCALL_DEF (getxpid); +#endif #ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif
linux-user/syscall-proc.inc.c +23 -0
@@ -438,6 +438,29 @@ SYSCALL_IMPL(fork) }#endif +#ifdef TARGET_NR_getpid +SYSCALL_IMPL (getpid) +{ +return getpid (); +} +#endif + +#ifdef TARGET_NR_getppid +SYSCALL_IMPL (getppid) +{ +return getppid (); +} +#endif + +#ifdef TARGET_NR_getxpid +SYSCALL_IMPL (getxpid) +{ +/* Alpha specific */ + cpu_env->ir[IR_A4 ] =getppid (); +return getpid (); +} +#endif +/* * Map host to target signal numbers for the wait family of syscalls. * Assume all other status bits are the same.
linux-user/syscall.c +0 -14
@@ -5380,16 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA ) -/* Alpha specific */ -case TARGET_NR_getxpid: - ((CPUAlphaState *)cpu_env)->ir[IR_A4 ] =getppid (); -return get_errno (getpid ()); -#endif -#ifdef TARGET_NR_getpid -case TARGET_NR_getpid: -return get_errno (getpid ()); -#endif case TARGET_NR_mount: {/* need to look at the data field */
@@ -5721,10 +5711,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return ret; }#endif -#ifdef TARGET_NR_getppid/* not on alpha */ -case TARGET_NR_getppid: -return get_errno (getppid ()); -#endif #ifdef TARGET_NR_getpgrpcase TARGET_NR_getpgrp:return get_errno (getpgrp ());
linux-user/strace.list +0 -9
@@ -298,15 +298,9 @@ #ifdef TARGET_NR_getpgrp { TARGET_NR_getpgrp, "getpgrp" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getpid -{ TARGET_NR_getpid, "getpid" , "%s()", NULL, NULL }, -#endif #ifdef TARGET_NR_getpmsg { TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getppid -{ TARGET_NR_getppid, "getppid" , "%s()", NULL, NULL }, -#endif #ifdef TARGET_NR_getpriority { TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL }, #endif
@@ -365,9 +359,6 @@ #ifdef TARGET_NR_getxgid { TARGET_NR_getxgid, "getxgid" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getxpid -{ TARGET_NR_getxpid, "getxpid" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getxuid { TARGET_NR_getxuid, "getxuid" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 31/74 linux-user: Split out mount
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall.h | 1 + linux-user/strace.c | 21 +++---------- linux-user/syscall-file.inc.c | 48 ++++++++++++++++++++++++++++++ linux-user/syscall.c | 55 ----------------------------------- linux-user/strace.list | 3 -- 6 files changed, 54 insertions(+), 75 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -78,6 +78,7 @@ SYSCALL_DEF_FULL(mmap2, .impl = impl_mmap, .arg_type = { ARG_PTR, ARG_DEC, ARG_MMAPPROT, ARG_MMAPFLAG, ARG_DEC, ARG_DEC64 }); #endif +SYSCALL_DEF(mount, ARG_STR, ARG_STR, ARG_STR, ARG_MOUNTFLAG, ARG_PTR); SYSCALL_DEF(mprotect, ARG_PTR, ARG_DEC, ARG_MMAPPROT); SYSCALL_DEF_FULL(mremap, .impl = impl_mremap, .print_ret = print_syscall_ptr_ret,
linux-user/syscall.h +1 -0
@@ -62,6 +62,7 @@ typedef enum {ARG_MMAPFLAG ,ARG_MMAPPROT ,ARG_MODEFLAG , +ARG_MOUNTFLAG ,ARG_OPENFLAG ,ARG_UNLINKATFLAG , ARG_LSEEKWHENCE,
linux-user/strace.c +4 -17
@@ -708,7 +708,7 @@ static struct flags const open_flags[] = { FLAG_END, }; -UNUSED static struct flags mount_flags[] = { +static struct flags const mount_flags[] = { #ifdef MS_BINDFLAG_GENERIC (MS_BIND ), #endif
@@ -2015,22 +2015,6 @@ print_symlinkat(const struct syscallname *name, }#endif -#ifdef TARGET_NR_mount -static void -print_mount (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_string (arg1,0 ); -print_string (arg2,0 ); -print_flags (mount_flags, arg3,0 ); -print_pointer (arg4,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_umount static void print_umount(const struct syscallname *name,
@@ -2315,6 +2299,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_MODEFLAG : len =add_flags (b, rest, mode_flags, arg, true);break ; +case ARG_MOUNTFLAG : + len =add_flags (b, rest, mount_flags, arg, true); +break ;case ARG_OPENFLAG : len =add_open_flags (b, rest, arg);break ;
linux-user/syscall-file.inc.c +48 -0
54 lines not on this page · raw message
linux-user/syscall.c +0 -55
61 lines not on this page · raw message
linux-user/strace.list +0 -3
@@ -497,9 +497,6 @@ #ifdef TARGET_NR_modify_ldt { TARGET_NR_modify_ldt, "modify_ldt" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_mount -{ TARGET_NR_mount, "mount" , NULL, print_mount, NULL }, -#endif #ifdef TARGET_NR_move_pages { TARGET_NR_move_pages, "move_pages" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 32/74 linux-user: Split out umount, umount2
In reply to Richard HendersonNote that umount2 is unconditionally available.
--- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall.h | 1 + linux-user/strace.c | 30 ++++-------------------------- linux-user/syscall-file.inc.c | 25 +++++++++++++++++++++++++ linux-user/syscall.c | 16 ---------------- linux-user/strace.list | 6 ------ 6 files changed, 34 insertions(+), 48 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -155,6 +155,10 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);#ifdef TARGET_NR_timeSYSCALL_DEF (time,ARG_PTR );#endif +#ifdef TARGET_NR_umount +SYSCALL_DEF (umount,ARG_STR ); +#endif +SYSCALL_DEF (umount2,ARG_STR ,ARG_UMOUNTFLAG );#ifdef TARGET_NR_unlinkSYSCALL_DEF (unlink,ARG_STR );#endif
linux-user/syscall.h +1 -0
@@ -64,6 +64,7 @@ typedef enum {ARG_MODEFLAG ,ARG_MOUNTFLAG ,ARG_OPENFLAG , +ARG_UMOUNTFLAG ,ARG_UNLINKATFLAG , ARG_LSEEKWHENCE,
linux-user/strace.c +4 -26
@@ -733,7 +733,7 @@ static struct flags const mount_flags[] = { FLAG_END, }; -UNUSED static struct flags umount2_flags[] = { +static struct flags const umount2_flags[] = { #ifdef MNT_FORCEFLAG_GENERIC (MNT_FORCE ), #endif
@@ -2015,31 +2015,6 @@ print_symlinkat(const struct syscallname *name, }#endif -#ifdef TARGET_NR_umount -static void -print_umount (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_umount2 -static void -print_umount2 (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_flags (umount2_flags, arg1,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_utime static void print_utime(const struct syscallname *name,
@@ -2305,6 +2280,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_OPENFLAG : len =add_open_flags (b, rest, arg);break ; +case ARG_UMOUNTFLAG : + len =add_flags (b, rest, umount2_flags, arg, false); +break ;case ARG_UNLINKATFLAG : len =add_flags (b, rest, unlinkat_flags, arg, true);break ;
linux-user/syscall-file.inc.c +25 -0
@@ -816,6 +816,31 @@ SYSCALL_IMPL(readlinkat) }#endif +static abi_long do_umount2 (abi_ulong target_path,int flags) +{ +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (umount2 (p, flags)); +unlock_user (p, target_path,0 ); +return ret; +} + +#ifdef TARGET_NR_umount +SYSCALL_IMPL (umount) +{ +return do_umount2 (arg1,0 ); +} +#endif + +SYSCALL_IMPL (umount2) +{ +return do_umount2 (arg1, arg2); +} +static abi_long do_unlinkat (int dirfd,abi_ulong target_path,int flags) {char *p =lock_user_string (target_path);
linux-user/syscall.c +0 -16
@@ -5380,14 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_umount -case TARGET_NR_umount: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (umount (p)); -unlock_user (p, arg1,0 ); -return ret; -#endif #ifdef TARGET_NR_stime/* not on alpha */ case TARGET_NR_stime: {
@@ -5608,14 +5600,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,unlock_user (p, arg1,0 ); }return ret; -#ifdef TARGET_NR_umount2 -case TARGET_NR_umount2: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (umount2 (p, arg2)); -unlock_user (p, arg1,0 ); -return ret; -#endif case TARGET_NR_ioctl:return do_ioctl (arg1, arg2, arg3);#ifdef TARGET_NR_fcntl
linux-user/strace.list +0 -6
@@ -1368,12 +1368,6 @@ #ifdef TARGET_NR_umask { TARGET_NR_umask, "umask" , "%s(%#o)", NULL, NULL }, #endif -#ifdef TARGET_NR_umount -{ TARGET_NR_umount, "umount" , NULL, print_umount, NULL }, -#endif -#ifdef TARGET_NR_umount2 -{ TARGET_NR_umount2, "umount2" , NULL, print_umount2, NULL }, -#endif #ifdef TARGET_NR_uname { TARGET_NR_uname, "uname" , "%s(%p)", NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 33/74 linux-user: Split out stime
In reply to Richard Henderson--- linux-user/syscall-defs.h | 3 +++ linux-user/syscall-time.inc.c | 12 ++++++++++++ linux-user/syscall.c | 9 --------- linux-user/strace.list | 3 --- 4 files changed, 15 insertions(+), 12 deletions(-)
linux-user/syscall-defs.h +3 -0
@@ -152,6 +152,9 @@ SYSCALL_DEF(shmdt, ARG_PTR);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmget)SYSCALL_DEF (shmget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +#ifdef TARGET_NR_stime +SYSCALL_DEF (stime,ARG_PTR ); +#endif #ifdef TARGET_NR_timeSYSCALL_DEF (time,ARG_PTR );#endif
linux-user/syscall-time.inc.c +12 -0
@@ -16,6 +16,18 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#ifdef TARGET_NR_stime +SYSCALL_IMPL (stime) +{ +time_t host_time; + +if (get_user_sal (host_time, arg1)) { +return -TARGET_EFAULT ; + } +return get_errno (stime (&host_time)); +} +#endif +#ifdef TARGET_NR_timeSYSCALL_IMPL (time) {
linux-user/syscall.c +0 -9
@@ -5380,15 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_stime/* not on alpha */ -case TARGET_NR_stime: - { -time_t host_time; -if (get_user_sal (host_time, arg1)) -return -TARGET_EFAULT ; -return get_errno (stime (&host_time)); - } -#endif #ifdef TARGET_NR_alarm/* not on alpha */ case TARGET_NR_alarm:return alarm (arg1);
linux-user/strace.list +0 -3
@@ -1254,9 +1254,6 @@ #ifdef TARGET_NR_statfs64 { TARGET_NR_statfs64, "statfs64" , NULL, print_statfs64, NULL }, #endif -#ifdef TARGET_NR_stime -{ TARGET_NR_stime, "stime" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_streams1 { TARGET_NR_streams1, "streams1" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 34/74 linux-user: Split out alarm, pause
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 ++++++ linux-user/syscall-sig.inc.c | 36 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 12 +----------- linux-user/strace.list | 6 ------ 4 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 linux-user/syscall-sig.inc.c
linux-user/syscall-defs.h +6 -0
@@ -16,6 +16,9 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#ifdef TARGET_NR_alarm +SYSCALL_DEF (alarm,ARG_DEC ); +#endif SYSCALL_DEF_FULL(brk, .impl = impl_brk, .print_ret = print_syscall_ptr_ret, .arg_type = { ARG_PTR });
@@ -106,6 +109,9 @@ SYSCALL_DEF(open, ARG_STR, ARG_OPENFLAG, ARG_MODEFLAG);#endif SYSCALL_DEF (openat,ARG_ATDIRFD ,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );SYSCALL_DEF (open_by_handle_at,ARG_DEC ,ARG_PTR ,ARG_OPENFLAG ); +#ifdef TARGET_NR_pause +SYSCALL_DEF (pause); +#endif SYSCALL_DEF_FULL(pread64, .impl = impl_pread64, .args = args_pread64_pwrite64, .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 });
linux-user/syscall-sig.inc.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Linux signal related syscalls +* Copyright (c) 2003 Fabrice Bellard +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifdef TARGET_NR_alarm +SYSCALL_IMPL (alarm) +{ +return alarm (arg1); +} +#endif + +#ifdef TARGET_NR_pause +SYSCALL_IMPL (pause) +{ +if (!block_signals ()) { +CPUState *cpu =ENV_GET_CPU (cpu_env); +TaskState *ts = cpu->opaque; +sigsuspend (&ts->signal_mask); + } +return -TARGET_EINTR ; +} +#endif
linux-user/syscall.c +1 -11
@@ -5380,17 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_alarm/* not on alpha */ -case TARGET_NR_alarm: -return alarm (arg1); -#endif -#ifdef TARGET_NR_pause/* not on alpha */ -case TARGET_NR_pause: -if (!block_signals ()) { -sigsuspend (&((TaskState *)cpu->opaque)->signal_mask); - } -return -TARGET_EINTR ; -#endif #ifdef TARGET_NR_utimecase TARGET_NR_utime: {
@@ -9224,6 +9213,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,#include "syscall-ipc.inc.c" #include "syscall-mem.inc.c" #include "syscall-proc.inc.c" +#include "syscall-sig.inc.c" #include "syscall-time.inc.c" #undef SYSCALL_IMPL
linux-user/strace.list +0 -6
@@ -25,9 +25,6 @@ #ifdef TARGET_NR_afs_syscall { TARGET_NR_afs_syscall, "afs_syscall" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_alarm -{ TARGET_NR_alarm, "alarm" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_aplib { TARGET_NR_aplib, "aplib" , NULL, NULL, NULL }, #endif
@@ -872,9 +869,6 @@ #ifdef TARGET_NR_osf_waitid { TARGET_NR_osf_waitid, "osf_waitid" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pause -{ TARGET_NR_pause, "pause" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_pciconfig_iobase { TARGET_NR_pciconfig_iobase, "pciconfig_iobase" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 35/74 linux-user: Split out utime, utimes, futimesat
In reply to Richard Henderson--- linux-user/syscall-defs.h | 9 ++++ linux-user/strace.c | 41 --------------- linux-user/syscall-file.inc.c | 95 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 63 ----------------------- linux-user/strace.list | 9 ---- 5 files changed, 104 insertions(+), 113 deletions(-)
linux-user/syscall-defs.h +9 -0
@@ -36,6 +36,9 @@ SYSCALL_DEF(execve, ARG_STR, ARG_PTR, ARG_PTR);SYSCALL_DEF (execveat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG );SYSCALL_DEF (fchmod,ARG_DEC ,ARG_MODEFLAG );SYSCALL_DEF (fchmodat,ARG_ATDIRFD ,ARG_STR ,ARG_MODEFLAG ); +#ifdef TARGET_NR_futimesat +SYSCALL_DEF (futimesat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ); +#endif #ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif
@@ -172,6 +175,12 @@ SYSCALL_DEF(umount2, ARG_STR, ARG_UMOUNTFLAG);SYSCALL_DEF (unlink,ARG_STR );#endif SYSCALL_DEF (unlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_UNLINKATFLAG ); +#ifdef TARGET_NR_utime +SYSCALL_DEF (utime,ARG_STR ,ARG_PTR ); +#endif +#ifdef TARGET_NR_utimes +SYSCALL_DEF (utimes,ARG_STR ,ARG_PTR ); +#endif #ifdef TARGET_NR_vfork/* Emulate vfork() with fork(). */ SYSCALL_DEF_FULL(vfork, .impl = impl_fork);
linux-user/strace.c +0 -41
53 lines not on this page · raw message
linux-user/syscall-file.inc.c +95 -0
107 lines not on this page · raw message
linux-user/syscall.c +0 -63
69 lines not on this page · raw message
linux-user/strace.list +0 -9
@@ -226,9 +226,6 @@ #ifdef TARGET_NR_futex { TARGET_NR_futex, "futex" , NULL, print_futex, NULL }, #endif -#ifdef TARGET_NR_futimesat -{ TARGET_NR_futimesat, "futimesat" , NULL, print_futimesat, NULL }, -#endif #ifdef TARGET_NR_getcpu { TARGET_NR_getcpu, "getcpu" , "%s(%p,%d)", NULL, NULL }, #endif
@@ -1392,12 +1389,6 @@ #ifdef TARGET_NR_ustat { TARGET_NR_ustat, "ustat" , "%s(%#x,%p)", NULL, NULL }, #endif -#ifdef TARGET_NR_utime -{ TARGET_NR_utime, "utime" , NULL, print_utime, NULL }, -#endif -#ifdef TARGET_NR_utimes -{ TARGET_NR_utimes, "utimes" , NULL, print_utimes, NULL }, -#endif #ifdef TARGET_NR_utrap_install { TARGET_NR_utrap_install, "utrap_install" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 36/74 linux-user: Split out access, faccessat
In reply to Richard HendersonNote that faccessat is unconditionally available.
--- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall.h | 1 + linux-user/strace.c | 33 ++++----------------------------- linux-user/syscall-file.inc.c | 25 +++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 6 ------ 6 files changed, 34 insertions(+), 53 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -16,6 +16,9 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#ifdef TARGET_NR_access +SYSCALL_DEF (access,ARG_STR ,ARG_ACCESSFLAG ); +#endif #ifdef TARGET_NR_alarmSYSCALL_DEF (alarm,ARG_DEC );#endif
@@ -34,6 +37,7 @@ SYSCALL_DEF(creat, ARG_STR, ARG_MODEFLAG);SYSCALL_DEF (exit,ARG_DEC );SYSCALL_DEF (execve,ARG_STR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (execveat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG ); +SYSCALL_DEF (faccessat,ARG_ATDIRFD ,ARG_STR ,ARG_ACCESSFLAG );SYSCALL_DEF (fchmod,ARG_DEC ,ARG_MODEFLAG );SYSCALL_DEF (fchmodat,ARG_ATDIRFD ,ARG_STR ,ARG_MODEFLAG );#ifdef TARGET_NR_futimesat
linux-user/syscall.h +1 -0
@@ -57,6 +57,7 @@ typedef enum {/* These print as sets of flags. */ ARG_ATDIRFD , +ARG_ACCESSFLAG ,ARG_ATFLAG ,ARG_CLONEFLAG , ARG_MMAPFLAG,
linux-user/strace.c +4 -29
@@ -634,7 +634,7 @@ print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)gemu_log ("\n" ); } -UNUSED static struct flags access_flags[] = { +static struct flags const access_flags[] = {FLAG_GENERIC (F_OK ),FLAG_GENERIC (R_OK ),FLAG_GENERIC (W_OK ),
@@ -1114,19 +1114,6 @@ print_accept(const struct syscallname *name, }#endif -#ifdef TARGET_NR_access -static void -print_access (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_flags (access_flags, arg1,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_chroot static void print_chroot(const struct syscallname *name,
@@ -1165,21 +1152,6 @@ print_execv(const struct syscallname *name, }#endif -#ifdef TARGET_NR_faccessat -static void -print_faccessat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_flags (access_flags, arg2,0 ); -print_flags (at_file_flags, arg3,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_fchownat static void print_fchownat(const struct syscallname *name,
@@ -2218,6 +2190,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_ATDIRFD : len =add_atdirfd (b, rest, arg);break ; +case ARG_ACCESSFLAG : + len =add_flags (b, rest, access_flags, arg, false); +break ;case ARG_ATFLAG : len =add_flags (b, rest, at_file_flags, arg, false);break ;
linux-user/syscall-file.inc.c +25 -0
@@ -16,6 +16,26 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +static abi_long do_faccessat (int dirfd,abi_ulong target_path,int mode) +{ +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (faccessat (dirfd, p, mode,0 )); +unlock_user (p, target_path,0 ); +return ret; +} + +#ifdef TARGET_NR_access +SYSCALL_IMPL (access) +{ +return do_faccessat (AT_FDCWD , arg1, arg2); +} +#endif +SYSCALL_IMPL (chdir) {abi_ulong target_path = arg1;
@@ -74,6 +94,11 @@ SYSCALL_IMPL(creat) }#endif +SYSCALL_IMPL (faccessat) +{ +return do_faccessat (arg1, arg2, arg3); +} +SYSCALL_IMPL (fchmod) {return get_errno (fchmod (arg1, arg2));
linux-user/syscall.c +0 -18
@@ -5380,24 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#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));
linux-user/strace.list +0 -6
@@ -9,9 +9,6 @@ #ifdef TARGET_NR_accept4 { TARGET_NR_accept4, "accept4" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_access -{ TARGET_NR_access, "access" , NULL, print_access, NULL }, -#endif #ifdef TARGET_NR_acct { TARGET_NR_acct, "acct" , NULL, NULL, NULL }, #endif
@@ -142,9 +139,6 @@ #ifdef TARGET_NR_exit_group { TARGET_NR_exit_group, "exit_group" , "%s(%d)\n", NULL, NULL }, #endif -#ifdef TARGET_NR_faccessat -{ TARGET_NR_faccessat, "faccessat" , NULL, print_faccessat, NULL }, -#endif #ifdef TARGET_NR_fadvise64 { TARGET_NR_fadvise64, "fadvise64" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 37/74 linux-user: Split out nice
In reply to Richard Henderson--- linux-user/syscall-defs.h | 3 +++ linux-user/syscall-proc.inc.c | 7 +++++++ linux-user/syscall.c | 4 ---- linux-user/strace.list | 3 --- 4 files changed, 10 insertions(+), 7 deletions(-)
linux-user/syscall-defs.h +3 -0
@@ -111,6 +111,9 @@ SYSCALL_DEF(munlockall);SYSCALL_DEF (munmap,ARG_PTR ,ARG_DEC );SYSCALL_DEF (name_to_handle_at,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG ); +#ifdef TARGET_NR_nice +SYSCALL_DEF (nice,ARG_DEC ); +#endif #ifdef TARGET_NR_openSYSCALL_DEF (open,ARG_STR ,ARG_OPENFLAG ,ARG_MODEFLAG );#endif
linux-user/syscall-proc.inc.c +7 -0
@@ -461,6 +461,13 @@ SYSCALL_IMPL(getxpid) }#endif +#ifdef TARGET_NR_nice +SYSCALL_IMPL (nice) +{ +return get_errno (nice (arg1)); +} +#endif +/* * Map host to target signal numbers for the wait family of syscalls. * Assume all other status bits are the same.
linux-user/syscall.c +0 -4
@@ -5380,10 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_nice/* not on alpha */ -case TARGET_NR_nice: -return get_errno (nice (arg1)); -#endif case TARGET_NR_sync:sync ();return 0 ;
linux-user/strace.list +0 -3
@@ -527,9 +527,6 @@ #ifdef TARGET_NR_nfsservctl { TARGET_NR_nfsservctl, "nfsservctl" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_nice -{ TARGET_NR_nice, "nice" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_old_adjtimex { TARGET_NR_old_adjtimex, "old_adjtimex" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 38/74 linux-user: Split out sync, syncfs
In reply to Richard HendersonNote that syncfs is universally available.
If !CONFIG_SYNCFS, provide our own syscall replacement.
--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-file.inc.c | 11 +++++++++++ linux-user/syscall.c | 20 ++++++++++++-------- linux-user/strace.list | 6 ------ 4 files changed, 25 insertions(+), 14 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -171,6 +171,8 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);#ifdef TARGET_NR_stimeSYSCALL_DEF (stime,ARG_PTR );#endif +SYSCALL_DEF (sync); +SYSCALL_DEF (syncfs,ARG_DEC );#ifdef TARGET_NR_timeSYSCALL_DEF (time,ARG_PTR );#endif
linux-user/syscall-file.inc.c +11 -0
@@ -873,6 +873,17 @@ SYSCALL_IMPL(readlinkat) }#endif +SYSCALL_IMPL (sync) +{ +sync (); +return 0 ; +} + +SYSCALL_IMPL (syncfs) +{ +return get_errno (syncfs (arg1)); +} +static abi_long do_umount2 (abi_ulong target_path,int flags) {char *p =lock_user_string (target_path);
linux-user/syscall.c +12 -8
@@ -199,6 +199,15 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \#define __NR_sys_gettid __NR_gettid_syscall0 (int, sys_gettid) +/* +* These definitions produce an ENOSYS from the host kernel. +* Performing a bogus syscall is easier than boilerplating +* the replacement functions here in C. + */ +#ifndef __NR_syncfs +#define __NR_syncfs -1 +#endif +/* For the 64-bit guest on 32-bit host case we must emulate * getdents using getdents64, because otherwise the host * might hand us back more dirent records than we can fit
@@ -254,11 +263,13 @@ _syscall3(int, ioprio_set, int, which, int, who, int, ioprio)#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom) _syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)#endif -#if defined(TARGET_NR_kcmp) && defined(__NR_kcmp)_syscall5 (int, kcmp, pid_t, pid1, pid_t, pid2, int, type, unsigned long, idx1, unsigned long, idx2)#endif +#ifndef CONFIG_SYNCFS +_syscall1(int, syncfs, int, fd) +#endif static bitmask_transtbl fcntl_flags_tbl[] = { {TARGET_O_ACCMODE ,TARGET_O_WRONLY ,O_ACCMODE ,O_WRONLY , },
@@ -5380,13 +5391,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -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
linux-user/strace.list +0 -6
@@ -1260,12 +1260,6 @@ #ifdef TARGET_NR_symlinkat { TARGET_NR_symlinkat, "symlinkat", NULL, print_symlinkat, NULL }, #endif -#ifdef TARGET_NR_sync -{ TARGET_NR_sync, "sync" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_syncfs -{ TARGET_NR_syncfs, "syncfs" , "%s(%d)", NULL, NULL }, -#endif #ifdef TARGET_NR_syscall { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 39/74 linux-user: Split out kill
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall.h | 7 +++- linux-user/strace.c | 76 ++++++++++++++++++------------------ linux-user/syscall-sig.inc.c | 5 +++ linux-user/syscall.c | 2 - linux-user/strace.list | 3 -- 6 files changed, 48 insertions(+), 46 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -58,6 +58,7 @@ SYSCALL_DEF(getxpid);#ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif +SYSCALL_DEF (kill,ARG_DEC ,ARG_SIGNAL );#ifdef TARGET_NR_linkSYSCALL_DEF (link,ARG_STR ,ARG_STR );#endif
linux-user/syscall.h +5 -2
@@ -55,8 +55,12 @@ typedef enum {ARG_HEX ,ARG_OCT , -/* These print as sets of flags. */ +/* These numbers are interpreted. */ ARG_ATDIRFD , +ARG_SIGNAL , +ARG_LSEEKWHENCE , + +/* These print as sets of flags. */ ARG_ACCESSFLAG ,ARG_ATFLAG , ARG_CLONEFLAG,
@@ -67,7 +71,6 @@ typedef enum {ARG_OPENFLAG ,ARG_UMOUNTFLAG ,ARG_UNLINKATFLAG , -ARG_LSEEKWHENCE ,/* These are interpreted as pointers. */ ARG_PTR,
linux-user/strace.c +37 -39
97 lines not on this page · raw message
linux-user/syscall-sig.inc.c +5 -0
@@ -23,6 +23,11 @@ SYSCALL_IMPL(alarm) }#endif +SYSCALL_IMPL (kill) +{ +return get_errno (safe_kill (arg1,target_to_host_signal (arg2))); +} +#ifdef TARGET_NR_pauseSYSCALL_IMPL (pause) {
linux-user/syscall.c +0 -2
@@ -5391,8 +5391,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_kill: -return get_errno (safe_kill (arg1,target_to_host_signal (arg2)));#ifdef TARGET_NR_renamecase TARGET_NR_rename: {
linux-user/strace.list +0 -3
@@ -410,9 +410,6 @@ #ifdef TARGET_NR_keyctl { TARGET_NR_keyctl, "keyctl" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_kill -{ TARGET_NR_kill, "kill", NULL, print_kill, NULL }, -#endif #ifdef TARGET_NR_lchown { TARGET_NR_lchown, "lchown" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 40/74 linux-user: Split out rename, renameat, renameat2
In reply to Richard HendersonNote that renameat2 is universally available for guests. Merge sys_renameat2 into the new do_renameat2 helper.
--- linux-user/syscall-defs.h | 8 +++++ linux-user/syscall.h | 1 + linux-user/strace.c | 39 ++++++--------------- linux-user/syscall-file.inc.c | 45 ++++++++++++++++++++++++ linux-user/syscall.c | 64 ----------------------------------- linux-user/strace.list | 9 ----- 6 files changed, 65 insertions(+), 101 deletions(-)
linux-user/syscall-defs.h +8 -0
@@ -142,6 +142,14 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC);#ifdef TARGET_NR_readlinkatSYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC );#endif +#ifdef TARGET_NR_rename +SYSCALL_DEF (rename,ARG_STR ,ARG_STR ); +#endif +#ifdef TARGET_NR_renameat +SYSCALL_DEF (renameat,ARG_ATDIRFD ,ARG_STR ,ARG_ATDIRFD ,ARG_STR ); +#endif +SYSCALL_DEF (renameat2,ARG_ATDIRFD ,ARG_STR , +ARG_ATDIRFD ,ARG_STR ,ARG_RENAMEFLAG );SYSCALL_DEF (readv,ARG_DEC ,ARG_PTR ,ARG_DEC );#ifdef TARGET_NR_rmdirSYSCALL_DEF (rmdir,ARG_STR );
linux-user/syscall.h +1 -0
@@ -69,6 +69,7 @@ typedef enum {ARG_MODEFLAG ,ARG_MOUNTFLAG ,ARG_OPENFLAG , +ARG_RENAMEFLAG ,ARG_UMOUNTFLAG , ARG_UNLINKATFLAG,
linux-user/strace.c +11 -28
@@ -4,6 +4,7 @@#include <arpa/inet.h> #include <netinet/tcp.h> #include <linux/if_packet.h> +#include <linux/fs.h> #include <sched.h> #include "qemu.h" #include "syscall.h"
@@ -741,6 +742,13 @@ static struct flags const mount_flags[] = { FLAG_END, }; +static struct flags const renameat2_flags[] = { +FLAG_GENERIC (RENAME_EXCHANGE ), +FLAG_GENERIC (RENAME_NOREPLACE ), +FLAG_GENERIC (RENAME_WHITEOUT ), +FLAG_END , +}; +static struct flags const umount2_flags[] = { #ifdef MNT_FORCE FLAG_GENERIC(MNT_FORCE),
@@ -1899,34 +1907,6 @@ print_fstatat64(const struct syscallname *name,#define print_newfstatat print_fstatat64#endif -#ifdef TARGET_NR_rename -static void -print_rename (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_string (arg1,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_renameat -static void -print_renameat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_at_dirfd (arg2,0 ); -print_string (arg3,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_statfs static void print_statfs(const struct syscallname *name,
@@ -2212,6 +2192,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])case ARG_OPENFLAG : len =add_open_flags (b, rest, arg);break ; +case ARG_RENAMEFLAG : + len =add_flags (b, rest, renameat2_flags, arg, false); +break ;case ARG_UMOUNTFLAG : len =add_flags (b, rest, umount2_flags, arg, false);break ;
linux-user/syscall-file.inc.c +45 -0
51 lines not on this page · raw message
linux-user/syscall.c +0 -64
76 lines not on this page · raw message
linux-user/strace.list +0 -9
@@ -944,15 +944,6 @@ #ifdef TARGET_NR_removexattr { TARGET_NR_removexattr, "removexattr" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rename -{ TARGET_NR_rename, "rename" , NULL, print_rename, NULL }, -#endif -#ifdef TARGET_NR_renameat -{ TARGET_NR_renameat, "renameat" , NULL, print_renameat, NULL }, -#endif -#ifdef TARGET_NR_renameat2 -{ TARGET_NR_renameat2, "renameat2" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_request_key { TARGET_NR_request_key, "request_key" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 41/74 linux-user: Split out mkdir, mkdirat
In reply to Richard HendersonNote that mkdirat is universally available.
--- linux-user/syscall-defs.h | 4 ++++ linux-user/strace.c | 27 --------------------------- linux-user/syscall-file.inc.c | 25 +++++++++++++++++++++++++ linux-user/syscall.c | 16 ---------------- linux-user/strace.list | 6 ------ 5 files changed, 29 insertions(+), 49 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -69,6 +69,10 @@ SYSCALL_DEF(lseek, ARG_DEC, ARG_DEC, ARG_LSEEKWHENCE);#ifdef TARGET_NR_llseekSYSCALL_DEF_ARGS (llseek,ARG_DEC ,ARG_DEC ,ARG_PTR ,ARG_LSEEKWHENCE );#endif +#ifdef TARGET_NR_mkdir +SYSCALL_DEF (mkdir,ARG_STR ,ARG_MODEFLAG ); +#endif +SYSCALL_DEF (mkdirat,ARG_ATDIRFD ,ARG_STR ,ARG_MODEFLAG );#ifdef TARGET_NR_mknodSYSCALL_DEF (mknod,ARG_STR ,ARG_MODEFLAG ,ARG_HEX );#endif
linux-user/strace.c +0 -27
@@ -1676,33 +1676,6 @@ print_fstat(const struct syscallname *name,#define print_fstat64 print_fstat#endif -#ifdef TARGET_NR_mkdir -static void -print_mkdir (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_file_mode (arg1,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_mkdirat -static void -print_mkdirat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_at_dirfd (arg0,0 ); -print_string (arg1,0 ); -print_file_mode (arg2,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_rt_sigaction static void print_rt_sigaction(const struct syscallname *name,
linux-user/syscall-file.inc.c +25 -0
@@ -205,6 +205,31 @@ SYSCALL_IMPL(llseek) }#endif +static abi_long do_mkdirat (int dirfd,abi_ulong target_path,mode_t mode) +{ +char *p =lock_user_string (target_path); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (mkdirat (dirfd, p, mode)); +unlock_user (p, target_path,0 ); +return ret; +} + +#ifdef TARGET_NR_mkdir +SYSCALL_IMPL (mkdir) +{ +return do_mkdirat (AT_FDCWD , arg1, arg2); +} +#endif + +SYSCALL_IMPL (mkdirat) +{ +return do_mkdirat (arg1, arg2, arg3); +} +static abi_long do_mknodat (int dirfd,abi_ulong target_path,mode_t mode,dev_t dev) {
linux-user/syscall.c +0 -16
@@ -5373,22 +5373,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_mkdir -case TARGET_NR_mkdir: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (mkdir (p, arg2)); -unlock_user (p, arg1,0 ); -return ret; -#endif -#if defined(TARGET_NR_mkdirat) -case TARGET_NR_mkdirat: -if (!(p =lock_user_string (arg2))) -return -TARGET_EFAULT ; - ret =get_errno (mkdirat (arg1, p, arg3)); -unlock_user (p, arg2,0 ); -return ret; -#endif case TARGET_NR_dup: ret =get_errno (dup (arg1));if (ret >=0 ) {
linux-user/strace.list +0 -6
@@ -473,12 +473,6 @@ #ifdef TARGET_NR_mincore { TARGET_NR_mincore, "mincore" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_mkdir -{ TARGET_NR_mkdir, "mkdir" , NULL, print_mkdir, NULL }, -#endif -#ifdef TARGET_NR_mkdirat -{ TARGET_NR_mkdirat, "mkdirat" , NULL, print_mkdirat, NULL }, -#endif #ifdef TARGET_NR_modify_ldt { TARGET_NR_modify_ldt, "modify_ldt" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 42/74 linux-user: Split out dup, dup2, dup3
In reply to Richard HendersonNote that dup3 is universally available for guests. Implement host support with syscall when !CONFIG_DUP3.
--- linux-user/syscall-defs.h | 5 +++++ linux-user/syscall-file.inc.c | 42 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 33 +++------------------------ linux-user/strace.list | 6 ----- 4 files changed, 50 insertions(+), 36 deletions(-)
linux-user/syscall-defs.h +5 -0
@@ -34,6 +34,11 @@ SYSCALL_DEF(close, ARG_DEC);#ifdef TARGET_NR_creatSYSCALL_DEF (creat,ARG_STR ,ARG_MODEFLAG );#endif +SYSCALL_DEF (dup,ARG_DEC ); +#ifdef TARGET_NR_dup2 +SYSCALL_DEF (dup2,ARG_DEC ,ARG_DEC ); +#endif +SYSCALL_DEF (dup3,ARG_DEC ,ARG_DEC ,ARG_OPENFLAG );SYSCALL_DEF (exit,ARG_DEC );SYSCALL_DEF (execve,ARG_STR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (execveat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG );
linux-user/syscall-file.inc.c +42 -0
48 lines not on this page · raw message
linux-user/syscall.c +3 -30
@@ -204,6 +204,9 @@ _syscall0(int, sys_gettid)* Performing a bogus syscall is easier than boilerplating * the replacement functions here in C. */ +#ifndef __NR_dup3 +#define __NR_dup3 -1 +#endif #ifndef __NR_syncfs#define __NR_syncfs -1#endif
@@ -5373,12 +5376,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_dup: - ret =get_errno (dup (arg1)); -if (ret >=0 ) { -fd_trans_dup (arg1, ret); - } -return ret;#ifdef TARGET_NR_pipecase TARGET_NR_pipe:return do_pipe (cpu_env, arg1,0 ,0 );
@@ -5433,30 +5430,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, ret =get_errno (chroot (p));unlock_user (p, arg1,0 );return ret; -#ifdef TARGET_NR_dup2 -case TARGET_NR_dup2: - ret =get_errno (dup2 (arg1, arg2)); -if (ret >=0 ) { -fd_trans_dup (arg1, arg2); - } -return ret; -#endif -#if defined(CONFIG_DUP3 ) && defined(TARGET_NR_dup3) -case TARGET_NR_dup3: - { -int host_flags; - -if ((arg3 & ~TARGET_O_CLOEXEC ) !=0 ) { -return -EINVAL ; - } - host_flags =target_to_host_bitmask (arg3, fcntl_flags_tbl); - ret =get_errno (dup3 (arg1, arg2, host_flags)); -if (ret >=0 ) { -fd_trans_dup (arg1, arg2); - } -return ret; - } -#endif #ifdef TARGET_NR_getpgrpcase TARGET_NR_getpgrp:return get_errno (getpgrp ());
linux-user/strace.list +0 -6
@@ -91,12 +91,6 @@ #ifdef TARGET_NR_dipc { TARGET_NR_dipc, "dipc" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_dup -{ TARGET_NR_dup, "dup" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_dup2 -{ TARGET_NR_dup2, "dup2" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_epoll_create { TARGET_NR_epoll_create, "epoll_create" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 43/74 linux-user: Split out pipe, pipe2
In reply to Richard HendersonNote that pipe2 is universally available for guests. Implement host support with syscall when !CONFIG_PIPE2.
--- linux-user/syscall-defs.h | 10 ++++++ linux-user/syscall-file.inc.c | 51 +++++++++++++++++++++++++++ linux-user/syscall.c | 65 +++++++---------------------------- linux-user/strace.list | 6 ---- 4 files changed, 74 insertions(+), 58 deletions(-)
linux-user/syscall-defs.h +10 -0
@@ -132,6 +132,16 @@ SYSCALL_DEF(open_by_handle_at, ARG_DEC, ARG_PTR, ARG_OPENFLAG);#ifdef TARGET_NR_pauseSYSCALL_DEF (pause);#endif +#ifdef TARGET_NR_pipe +# if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || \ + defined(TARGET_SH4 ) || defined(TARGET_SPARC ) +/* ??? We have no way for strace to display the second returned fd. */ +SYSCALL_DEF (pipe); +# else +SYSCALL_DEF (pipe,ARG_PTR ); +# endif +#endif +SYSCALL_DEF (pipe2,ARG_PTR ,ARG_OPENFLAG ); SYSCALL_DEF_FULL(pread64, .impl = impl_pread64, .args = args_pread64_pwrite64, .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 });
linux-user/syscall-file.inc.c +51 -0
57 lines not on this page · raw message
linux-user/syscall.c +13 -52
89 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -860,9 +860,6 @@ #ifdef TARGET_NR_personality { TARGET_NR_personality, "personality" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pipe -{ TARGET_NR_pipe, "pipe" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_pivot_root { TARGET_NR_pivot_root, "pivot_root" , NULL, NULL, NULL }, #endif
@@ -1377,9 +1374,6 @@ #ifdef TARGET_NR_sync_file_range2 { TARGET_NR_sync_file_range2, "sync_file_range2", NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pipe2 -{ TARGET_NR_pipe2, "pipe2", NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_atomic_cmpxchg_32 { TARGET_NR_atomic_cmpxchg_32, "atomic_cmpxchg_32", NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 44/74 linux-user: Split out times
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 25 +++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 3 --- 4 files changed, 26 insertions(+), 21 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -204,6 +204,7 @@ SYSCALL_DEF(syncfs, ARG_DEC);#ifdef TARGET_NR_timeSYSCALL_DEF (time,ARG_PTR );#endif +SYSCALL_DEF (times,ARG_PTR );#ifdef TARGET_NR_umountSYSCALL_DEF (umount,ARG_STR );#endif
linux-user/syscall-proc.inc.c +25 -0
@@ -468,6 +468,31 @@ SYSCALL_IMPL(nice) }#endif +SYSCALL_IMPL (times) +{ +abi_ulong target_buf = arg1; +struct tms tms; +abi_long ret; + + ret =get_errno (times (&tms)); +if (target_buf) { +struct target_tms *tmsp =lock_user (VERIFY_WRITE , target_buf, +sizeof (struct target_tms ),0 ); +if (!tmsp) { +return -TARGET_EFAULT ; + } + tmsp->tms_utime =tswapal (host_to_target_clock_t (tms.tms_utime)); + tmsp->tms_stime =tswapal (host_to_target_clock_t (tms.tms_stime)); + tmsp->tms_cutime =tswapal (host_to_target_clock_t (tms.tms_cutime)); + tmsp->tms_cstime =tswapal (host_to_target_clock_t (tms.tms_cstime)); +unlock_user (tmsp, target_buf,sizeof (struct target_tms )); + } +if (!is_error (ret)) { + ret =host_to_target_clock_t (ret); + } +return ret; +} +/* * Map host to target signal numbers for the wait family of syscalls. * Assume all other status bits are the same.
linux-user/syscall.c +0 -18
@@ -5346,24 +5346,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_times: - { -struct target_tms *tmsp; -struct tms tms; - ret =get_errno (times (&tms)); -if (arg1) { - tmsp =lock_user (VERIFY_WRITE , arg1,sizeof (struct target_tms ),0 ); -if (!tmsp) -return -TARGET_EFAULT ; - tmsp->tms_utime =tswapal (host_to_target_clock_t (tms.tms_utime)); - tmsp->tms_stime =tswapal (host_to_target_clock_t (tms.tms_stime)); - tmsp->tms_cutime =tswapal (host_to_target_clock_t (tms.tms_cutime)); - tmsp->tms_cstime =tswapal (host_to_target_clock_t (tms.tms_cstime)); - } -if (!is_error (ret)) - ret =host_to_target_clock_t (ret); - } -return ret;case TARGET_NR_acct:if (arg1 ==0 ) { ret =get_errno (acct (NULL ));
linux-user/strace.list +0 -3
@@ -1290,9 +1290,6 @@ #ifdef TARGET_NR_timerfd_settime { TARGET_NR_timerfd_settime, "timerfd_settime" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_times -{ TARGET_NR_times, "times" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_tkill { TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 45/74 linux-user: Split out acct
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-file.inc.c | 18 ++++++++++++++++++ linux-user/syscall.c | 11 ----------- linux-user/strace.list | 3 --- 4 files changed, 19 insertions(+), 14 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -19,6 +19,7 @@#ifdef TARGET_NR_accessSYSCALL_DEF (access,ARG_STR ,ARG_ACCESSFLAG );#endif +SYSCALL_DEF (acct,ARG_STR );#ifdef TARGET_NR_alarmSYSCALL_DEF (alarm,ARG_DEC );#endif
linux-user/syscall-file.inc.c +18 -0
@@ -36,6 +36,24 @@ SYSCALL_IMPL(access) }#endif +SYSCALL_IMPL (acct) +{ +abi_ulong target_path = arg1; +abi_long ret; + +if (target_path ==0 ) { + ret =get_errno (acct (NULL )); + }else { +char *p =lock_user_string (target_path); +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (acct (path (p))); +unlock_user (p, target_path,0 ); + } +return ret; +} +SYSCALL_IMPL (chdir) {abi_ulong target_path = arg1;
linux-user/syscall.c +0 -11
@@ -5346,17 +5346,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_acct: -if (arg1 ==0 ) { - ret =get_errno (acct (NULL )); - }else { -if (!(p =lock_user_string (arg1))) { -return -TARGET_EFAULT ; - } - ret =get_errno (acct (path (p))); -unlock_user (p, arg1,0 ); - } -return ret;case TARGET_NR_ioctl:return do_ioctl (arg1, arg2, arg3);#ifdef TARGET_NR_fcntl
linux-user/strace.list +0 -3
@@ -9,9 +9,6 @@ #ifdef TARGET_NR_accept4 { TARGET_NR_accept4, "accept4" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_acct -{ TARGET_NR_acct, "acct" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_add_key { TARGET_NR_add_key, "add_key" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 46/74 linux-user: Move syscall_init to the end
In reply to Richard HendersonNo functional change. This will aid moving everything related to ioctls to a separate file.
--- linux-user/syscall.c | 113 +++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 52 deletions(-)
linux-user/syscall.c +61 -52
@@ -4831,58 +4831,6 @@ _syscall1(int, sys_setgid, gid_t, gid) _syscall3(int, sys_setresuid, uid_t, ruid, uid_t, euid, uid_t, suid) _syscall3(int, sys_setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid) -void syscall_init (void ) -{ -IOCTLEntry *ie; -const argtype *arg_type; -int size; -int i; - -thunk_init (STRUCT_MAX ); - -#define STRUCT (name, ...) thunk_register_struct(STRUCT_ ## name, #name, struct_ ## name ## _def); -#define STRUCT_SPECIAL (name) thunk_register_struct_direct(STRUCT_ ## name, #name, &struct_ ## name ## _def); -#include "syscall_types.h" -#undef STRUCT -#undef STRUCT_SPECIAL - -/* Build target_to_host_errno_table[] table from -* host_to_target_errno_table[]. */ -for (i =0 ; i <ERRNO_TABLE_SIZE ; i++) { - target_to_host_errno_table[host_to_target_errno_table[i]] = i; - } - -/* we patch the ioctl size if necessary. We rely on the fact that -no ioctl has all the bits at '1' in the size field */ - ie = ioctl_entries; -while (ie->target_cmd !=0 ) { -if (((ie->target_cmd >>TARGET_IOC_SIZESHIFT ) &TARGET_IOC_SIZEMASK ) == -TARGET_IOC_SIZEMASK ) { - arg_type = ie->arg_type; -if (arg_type[0 ] !=TYPE_PTR ) { -fprintf (stderr,"cannot patch size for ioctl 0x%x\n" , - ie->target_cmd); -exit (1 ); - } - arg_type++; - size =thunk_type_size (arg_type,0 ); - ie->target_cmd = (ie->target_cmd & - ~(TARGET_IOC_SIZEMASK <<TARGET_IOC_SIZESHIFT )) | - (size <<TARGET_IOC_SIZESHIFT ); - } - -/* automatic consistency check if same arch */ -#if (defined(__i386__) && defined(TARGET_I386 ) && defined(TARGET_ABI32 )) || \ - (defined(__x86_64__) && defined(TARGET_X86_64 )) -if (unlikely (ie->target_cmd != ie->host_cmd)) { -fprintf (stderr,"ERROR: ioctl(%s): target=0x%x host=0x%x\n" , - ie->name, ie->target_cmd, ie->host_cmd); - } -#endif - ie++; - } -} -static inline uint64_t target_offset64 (abi_ulong word0,abi_ulong word1) {#if TARGET_ABI_BITS ==64
@@ -9072,3 +9020,64 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,trace_guest_user_syscall_ret (cpu, num, ret);return ret; } + +void syscall_init (void ) +{ +IOCTLEntry *ie; +const argtype *arg_type; +int size; +int i; + +thunk_init (STRUCT_MAX ); + +#define STRUCT (name, ...) \ + thunk_register_struct(STRUCT_ ## name, #name, struct_ ## name ## _def); +#define STRUCT_SPECIAL (name) \ + thunk_register_struct_direct(STRUCT_ ## name, #name, \ + &struct_ ## name ## _def); + +#include "syscall_types.h" + +#undef STRUCT +#undef STRUCT_SPECIAL + +/* +* Build target_to_host_errno_table[] table from +* host_to_target_errno_table[]. +*/ +for (i =0 ; i <ERRNO_TABLE_SIZE ; i++) { + target_to_host_errno_table[host_to_target_errno_table[i]] = i; + } + +/* +* We patch the ioctl size if necessary. We rely on the fact that +* no ioctl has all the bits at '1' in the size field. +*/ + ie = ioctl_entries; +while (ie->target_cmd !=0 ) { +if (((ie->target_cmd >>TARGET_IOC_SIZESHIFT ) &TARGET_IOC_SIZEMASK ) == +TARGET_IOC_SIZEMASK ) { + arg_type = ie->arg_type; +if (arg_type[0 ] !=TYPE_PTR ) { +fprintf (stderr,"cannot patch size for ioctl 0x%x\n" , + ie->target_cmd); +exit (1 ); + } + arg_type++; + size =thunk_type_size (arg_type,0 ); + ie->target_cmd = (ie->target_cmd & + ~(TARGET_IOC_SIZEMASK <<TARGET_IOC_SIZESHIFT )) | + (size <<TARGET_IOC_SIZESHIFT ); + } + +/* automatic consistency check if same arch */ +#if (defined(__i386__) && defined(TARGET_I386 ) && defined(TARGET_ABI32 )) || \ + (defined(__x86_64__) && defined(TARGET_X86_64 )) +if (unlikely (ie->target_cmd != ie->host_cmd)) { +fprintf (stderr,"ERROR: ioctl(%s): target=0x%x host=0x%x\n" , + ie->name, ie->target_cmd, ie->host_cmd); + } +#endif + ie++; + } +}
Signature · 1 line
2.17.1
PATCH v7 47/74 linux-user: Split out ioctl
In reply to Richard Henderson---
v7: Do not accidentally change type of "cmd".
--- linux-user/syscall-defs.h | 1 + linux-user/syscall-ioctl.inc.c | 873 +++++++++++++++++++++++++++++++++ linux-user/syscall.c | 852 +------------------------------- linux-user/strace.list | 3 - 4 files changed, 875 insertions(+), 854 deletions(-) create mode 100644 linux-user/syscall-ioctl.inc.c
linux-user/syscall-defs.h +1 -0
@@ -61,6 +61,7 @@ SYSCALL_DEF(getppid);#ifdef TARGET_NR_getxpidSYSCALL_DEF (getxpid);#endif +SYSCALL_DEF (ioctl,ARG_DEC ,ARG_HEX );#ifdef TARGET_NR_ipcSYSCALL_DEF_ARGS (ipc,ARG_HEX ,ARG_DEC ,ARG_DEC ,ARG_HEX ,ARG_PTR ,ARG_HEX );#endif
linux-user/syscall-ioctl.inc.c new file +873 -0
873 lines not on this page · raw message
linux-user/syscall.c +1 -851
870 lines not on this page · raw message
linux-user/strace.list +0 -3
@@ -365,9 +365,6 @@ #ifdef TARGET_NR_io_cancel { TARGET_NR_io_cancel, "io_cancel" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_ioctl -{ TARGET_NR_ioctl, "ioctl" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_io_destroy { TARGET_NR_io_destroy, "io_destroy" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 48/74 linux-user: Fix types in ioctl logging
In reply to Richard HendersonThere is no need to cast "int" to "long"; just use the correct format in the first place.
--- linux-user/syscall-ioctl.inc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
linux-user/syscall-ioctl.inc.c +3 -3
@@ -791,7 +791,7 @@ SYSCALL_IMPL(ioctl)for (ie = ioctl_entries; ; ie++) {if (ie->target_cmd ==0 ) { -gemu_log ("Unsupported ioctl: cmd=0x%04lx\n" , (long )cmd); +gemu_log ("Unsupported ioctl: cmd=0x%04x\n" , cmd);return -TARGET_ENOSYS ; }if (ie->target_cmd == cmd) {
@@ -864,8 +864,8 @@ SYSCALL_IMPL(ioctl) }break ;default : -gemu_log ("Unsupported ioctl type: cmd=0x%04lx type=%d\n" , - (long )cmd, arg_type[0 ]); +gemu_log ("Unsupported ioctl type: cmd=0x%04x type=%d\n" , + cmd, arg_type[0 ]); ret = -TARGET_ENOSYS ;break ; }
Signature · 1 line
2.17.1
PATCH v7 49/74 linux-user: Remove sentinel from ioctl_entries
In reply to Richard HendersonIterate based on the size of the array instead.
--- linux-user/syscall-ioctl.inc.c | 14 +++++++------- linux-user/syscall.c | 6 ++---- 2 files changed, 9 insertions(+), 11 deletions(-)
linux-user/syscall-ioctl.inc.c +7 -7
@@ -773,7 +773,6 @@ static IOCTLEntry ioctl_entries[] = {#define IOCTL_IGNORE (cmd) \ { TARGET_ ## cmd, 0, #cmd },#include "ioctls.h" - { 0, 0, }, };/* ??? Implement proper locking for ioctls. */
@@ -789,16 +788,17 @@ SYSCALL_IMPL(ioctl)int target_size;void *argptr; -for (ie = ioctl_entries; ; ie++) { -if (ie->target_cmd ==0 ) { -gemu_log ("Unsupported ioctl: cmd=0x%04x\n" , cmd); -return -TARGET_ENOSYS ; - } +for (ie = ioctl_entries; + ie < ioctl_entries +ARRAY_SIZE (ioctl_entries); + ie++) {if (ie->target_cmd == cmd) { -break ; + goto found; } } +gemu_log ("Unsupported ioctl: cmd=0x%04x\n" , cmd); +return -TARGET_ENOSYS ; + found: arg_type = ie->arg_type;if (ie->do_ioctl) {return ie->do_ioctl (ie, buf_temp, fd, cmd, arg);
linux-user/syscall.c +2 -4
@@ -8173,7 +8173,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,void syscall_init (void ) { -IOCTLEntry *ie;const argtype *arg_type;int size;int i;
@@ -8203,8 +8202,8 @@ void syscall_init(void)* We patch the ioctl size if necessary. We rely on the fact that * no ioctl has all the bits at '1' in the size field. */ - ie = ioctl_entries; -while (ie->target_cmd !=0 ) { +for (i =0 ; i <ARRAY_SIZE (ioctl_entries); i++) { +IOCTLEntry *ie = &ioctl_entries[i];if (((ie->target_cmd >>TARGET_IOC_SIZESHIFT ) &TARGET_IOC_SIZEMASK ) ==TARGET_IOC_SIZEMASK ) { arg_type = ie->arg_type;
@@ -8228,6 +8227,5 @@ void syscall_init(void) ie->name, ie->target_cmd, ie->host_cmd); }#endif - ie++; } }
Signature · 1 line
2.17.1
PATCH v7 50/74 linux-user: Split out fcntl, fcntl64
In reply to Richard HendersonPreserving strace functionality is tricky with this one. Rearrange to lookup structures that contain the data for both execution and strace for each command.
Do not allow lookup of 64-bit fcntl commands from 32-bit fcntl.
--- linux-user/syscall-defs.h | 6 + linux-user/strace.c | 100 ---------- linux-user/syscall-fcntl.inc.c | 322 +++++++++++++++++++++++++++++++++ linux-user/syscall.c | 256 +------------------------- linux-user/strace.list | 6 - 5 files changed, 329 insertions(+), 361 deletions(-) create mode 100644 linux-user/syscall-fcntl.inc.c
linux-user/syscall-defs.h +6 -0
@@ -46,6 +46,12 @@ SYSCALL_DEF(execveat, ARG_ATDIRFD, ARG_STR, ARG_PTR, ARG_PTR, ARG_ATFLAG);SYSCALL_DEF (faccessat,ARG_ATDIRFD ,ARG_STR ,ARG_ACCESSFLAG );SYSCALL_DEF (fchmod,ARG_DEC ,ARG_MODEFLAG );SYSCALL_DEF (fchmodat,ARG_ATDIRFD ,ARG_STR ,ARG_MODEFLAG ); +#ifdef TARGET_NR_fcntl +SYSCALL_DEF_FULL(fcntl, .impl = impl_fcntl, .print = print_fcntl); +#endif +#if TARGET_ABI_BITS ==32 +SYSCALL_DEF_FULL(fcntl64, .impl = impl_fcntl64, .print = print_fcntl64); +#endif #ifdef TARGET_NR_futimesatSYSCALL_DEF (futimesat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR );#endif
linux-user/strace.c +0 -100
106 lines not on this page · raw message
linux-user/syscall-fcntl.inc.c new file +322 -0
322 lines not on this page · raw message
linux-user/syscall.c +1 -255
286 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -157,12 +157,6 @@ #ifdef TARGET_NR_fchownat { TARGET_NR_fchownat, "fchownat" , NULL, print_fchownat, NULL }, #endif -#ifdef TARGET_NR_fcntl -{ TARGET_NR_fcntl, "fcntl" , NULL, print_fcntl, NULL }, -#endif -#ifdef TARGET_NR_fcntl64 -{ TARGET_NR_fcntl64, "fcntl64" , NULL, print_fcntl64, NULL }, -#endif #ifdef TARGET_NR_fdatasync { TARGET_NR_fdatasync, "fdatasync" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 51/74 linux-user: Split out setpgid
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 5 +++++ linux-user/syscall.c | 2 -- linux-user/strace.list | 3 --- 4 files changed, 6 insertions(+), 5 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -187,6 +187,7 @@ SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semget)SYSCALL_DEF (semget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +SYSCALL_DEF (setpgid,ARG_DEC ,ARG_DEC );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semop)SYSCALL_DEF (semop,ARG_DEC ,ARG_PTR ,ARG_DEC );#endif
linux-user/syscall-proc.inc.c +5 -0
@@ -468,6 +468,11 @@ SYSCALL_IMPL(nice) }#endif +SYSCALL_IMPL (setpgid) +{ +return get_errno (setpgid (arg1, arg2)); +} +SYSCALL_IMPL (times) {abi_ulong target_buf = arg1;
linux-user/syscall.c +0 -2
@@ -4241,8 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_setpgid: -return get_errno (setpgid (arg1, arg2));case TARGET_NR_umask:return get_errno (umask (arg1));case TARGET_NR_chroot:
linux-user/strace.list +0 -3
@@ -1073,9 +1073,6 @@ #ifdef TARGET_NR_setns { TARGET_NR_setns, "setns" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_setpgid -{ TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setpgrp { TARGET_NR_setpgrp, "setpgrp" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 52/74 linux-user: Split out umask
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-file.inc.c | 5 +++++ linux-user/syscall.c | 2 -- linux-user/strace.list | 3 --- 4 files changed, 6 insertions(+), 5 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -214,6 +214,7 @@ SYSCALL_DEF(syncfs, ARG_DEC);SYSCALL_DEF (time,ARG_PTR );#endif SYSCALL_DEF (times,ARG_PTR ); +SYSCALL_DEF (umask,ARG_OCT );#ifdef TARGET_NR_umountSYSCALL_DEF (umount,ARG_STR );#endif
linux-user/syscall-file.inc.c +5 -0
@@ -1117,6 +1117,11 @@ SYSCALL_IMPL(rmdir) }#endif +SYSCALL_IMPL (umask) +{ +return get_errno (umask (arg1)); +} +SYSCALL_IMPL (unlinkat) {return do_unlinkat (arg1, arg2, arg3);
linux-user/syscall.c +0 -2
@@ -4241,8 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_umask: -return get_errno (umask (arg1));case TARGET_NR_chroot:if (!(p =lock_user_string (arg1)))return -TARGET_EFAULT ;
linux-user/strace.list +0 -3
@@ -1293,9 +1293,6 @@ #ifdef TARGET_NR_ulimit { TARGET_NR_ulimit, "ulimit" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_umask -{ TARGET_NR_umask, "umask" , "%s(%#o)", NULL, NULL }, -#endif #ifdef TARGET_NR_uname { TARGET_NR_uname, "uname" , "%s(%p)", NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 53/74 linux-user: Split out chroot
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/strace.c | 12 ------------ linux-user/syscall-file.inc.c | 13 +++++++++++++ linux-user/syscall.c | 6 ------ linux-user/strace.list | 3 --- 5 files changed, 14 insertions(+), 21 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -30,6 +30,7 @@ SYSCALL_DEF(chdir, ARG_STR);#ifdef TARGET_NR_chmodSYSCALL_DEF (chmod,ARG_STR ,ARG_MODEFLAG );#endif +SYSCALL_DEF (chroot,ARG_STR );SYSCALL_DEF_ARGS (clone,ARG_CLONEFLAG ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (close,ARG_DEC );#ifdef TARGET_NR_creat
linux-user/strace.c +0 -12
@@ -1130,18 +1130,6 @@ print_accept(const struct syscallname *name, }#endif -#ifdef TARGET_NR_chroot -static void -print_chroot (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_clock_adjtime static void print_clock_adjtime(const struct syscallname *name,
linux-user/syscall-file.inc.c +13 -0
@@ -88,6 +88,19 @@ SYSCALL_IMPL(chmod) }#endif +SYSCALL_IMPL (chroot) +{ +char *p =lock_user_string (arg1); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (chroot (p)); +unlock_user (p, arg1,0 ); +return ret; +} +SYSCALL_IMPL (close) {int fd = arg1;
linux-user/syscall.c +0 -6
@@ -4241,12 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_chroot: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (chroot (p)); -unlock_user (p, arg1,0 ); -return ret;#ifdef TARGET_NR_getpgrpcase TARGET_NR_getpgrp:return get_errno (getpgrp ());
linux-user/strace.list +0 -3
@@ -58,9 +58,6 @@ #ifdef TARGET_NR_chown32 { TARGET_NR_chown32, "chown32" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_chroot -{ TARGET_NR_chroot, "chroot" , NULL, print_chroot, NULL }, -#endif #ifdef TARGET_NR_clock_adjtime { TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 54/74 linux-user: Split out getpgid, getpgrp
In reply to Richard Henderson--- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall-proc.inc.c | 12 ++++++++++++ linux-user/syscall.c | 6 ------ linux-user/strace.list | 6 ------ 4 files changed, 16 insertions(+), 12 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -59,6 +59,10 @@ SYSCALL_DEF(futimesat, ARG_ATDIRFD, ARG_STR, ARG_PTR);#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif +SYSCALL_DEF (getpgid,ARG_DEC ); +#ifdef TARGET_NR_getpgrp +SYSCALL_DEF (getpgrp); +#endif #ifdef TARGET_NR_getpidSYSCALL_DEF (getpid);#endif
linux-user/syscall-proc.inc.c +12 -0
@@ -438,6 +438,18 @@ SYSCALL_IMPL(fork) }#endif +SYSCALL_IMPL (getpgid) +{ +return get_errno (getpgid (arg1)); +} + +#ifdef TARGET_NR_getpgrp +SYSCALL_IMPL (getpgrp) +{ +return get_errno (getpgrp ()); +} +#endif +#ifdef TARGET_NR_getpidSYSCALL_IMPL (getpid) {
linux-user/syscall.c +0 -6
@@ -4241,10 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_getpgrp -case TARGET_NR_getpgrp: -return get_errno (getpgrp ()); -#endif case TARGET_NR_setsid:return get_errno (setsid ());#ifdef TARGET_NR_sigaction
@@ -5388,8 +5384,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, }return ret;#endif -case TARGET_NR_getpgid: -return get_errno (getpgid (arg1));case TARGET_NR_fchdir:return get_errno (fchdir (arg1));case TARGET_NR_personality:
linux-user/strace.list +0 -6
@@ -262,12 +262,6 @@ #ifdef TARGET_NR_getpeername { TARGET_NR_getpeername, "getpeername" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getpgid -{ TARGET_NR_getpgid, "getpgid" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_getpgrp -{ TARGET_NR_getpgrp, "getpgrp" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getpmsg { TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 55/74 linux-user: Split out getsid, setsid
In reply to Richard Henderson--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-proc.inc.c | 10 ++++++++++ linux-user/syscall.c | 4 ---- linux-user/strace.list | 6 ------ 4 files changed, 12 insertions(+), 10 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -69,6 +69,7 @@ SYSCALL_DEF(getpid);#ifdef TARGET_NR_getppidSYSCALL_DEF (getppid);#endif +SYSCALL_DEF (getsid,ARG_DEC );#ifdef TARGET_NR_getxpidSYSCALL_DEF (getxpid);#endif
@@ -193,6 +194,7 @@ SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX);SYSCALL_DEF (semget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif SYSCALL_DEF (setpgid,ARG_DEC ,ARG_DEC ); +SYSCALL_DEF (setsid);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semop)SYSCALL_DEF (semop,ARG_DEC ,ARG_PTR ,ARG_DEC );#endif
linux-user/syscall-proc.inc.c +10 -0
@@ -464,6 +464,11 @@ SYSCALL_IMPL(getppid) }#endif +SYSCALL_IMPL (getsid) +{ +return get_errno (getsid (arg1)); +} +#ifdef TARGET_NR_getxpidSYSCALL_IMPL (getxpid) {
@@ -485,6 +490,11 @@ SYSCALL_IMPL(setpgid)return get_errno (setpgid (arg1, arg2)); } +SYSCALL_IMPL (setsid) +{ +return get_errno (setsid ()); +} +SYSCALL_IMPL (times) {abi_ulong target_buf = arg1;
linux-user/syscall.c +0 -4
@@ -4241,8 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_setsid: -return get_errno (setsid ());#ifdef TARGET_NR_sigactioncase TARGET_NR_sigaction: {
@@ -5664,8 +5662,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,/* NOTE: the flock constant seems to be the same for every Linux platform */ return get_errno (safe_flock (arg1, arg2)); -case TARGET_NR_getsid: -return get_errno (getsid (arg1));#if defined(TARGET_NR_fdatasync)/* Not on alpha (osf_datasync ?) */ case TARGET_NR_fdatasync:return get_errno (fdatasync (arg1));
linux-user/strace.list +0 -6
@@ -292,9 +292,6 @@ #ifdef TARGET_NR_getrusage { TARGET_NR_getrusage, "getrusage" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getsid -{ TARGET_NR_getsid, "getsid" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getsockname { TARGET_NR_getsockname, "getsockname" , NULL, NULL, NULL }, #endif
@@ -1100,9 +1097,6 @@ #ifdef TARGET_NR_set_robust_list { TARGET_NR_set_robust_list, "set_robust_list" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_setsid -{ TARGET_NR_setsid, "setsid" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setsockopt { TARGET_NR_setsockopt, "setsockopt" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 56/74 linux-user: Split out sigaction, rt_sigaction
In reply to Richard Henderson--- linux-user/syscall-defs.h | 10 ++ linux-user/strace.c | 14 --- linux-user/syscall-sig.inc.c | 172 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 160 -------------------------------- linux-user/strace.list | 6 -- 5 files changed, 182 insertions(+), 180 deletions(-)
linux-user/syscall-defs.h +10 -0
@@ -187,6 +187,13 @@ SYSCALL_DEF(readv, ARG_DEC, ARG_PTR, ARG_DEC);#ifdef TARGET_NR_rmdirSYSCALL_DEF (rmdir,ARG_STR );#endif +#if defined(TARGET_ALPHA ) +SYSCALL_DEF (rt_sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR ,ARG_DEC ,ARG_PTR ); +#elif defined(TARGET_SPARC ) +SYSCALL_DEF (rt_sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_DEC ); +#else +SYSCALL_DEF (rt_sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR ,ARG_DEC ); +#endif #if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
@@ -212,6 +219,9 @@ SYSCALL_DEF(shmdt, ARG_PTR);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_shmget)SYSCALL_DEF (shmget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +#ifdef TARGET_NR_sigaction +SYSCALL_DEF (sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR ); +#endif #ifdef TARGET_NR_stimeSYSCALL_DEF (stime,ARG_PTR );#endif
linux-user/strace.c +0 -14
@@ -1564,20 +1564,6 @@ print_fstat(const struct syscallname *name,#define print_fstat64 print_fstat#endif -#ifdef TARGET_NR_rt_sigaction -static void -print_rt_sigaction (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_signal (arg0,0 ); -print_pointer (arg1,0 ); -print_pointer (arg2,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_rt_sigprocmask static void print_rt_sigprocmask(const struct syscallname *name,
linux-user/syscall-sig.inc.c +172 -0
175 lines not on this page · raw message
linux-user/syscall.c +0 -160
166 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -926,9 +926,6 @@ #ifdef TARGET_NR_rmdir { TARGET_NR_rmdir, "rmdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigaction -{ TARGET_NR_rt_sigaction, "rt_sigaction" , NULL, print_rt_sigaction, NULL }, -#endif #ifdef TARGET_NR_rt_sigpending { TARGET_NR_rt_sigpending, "rt_sigpending" , NULL, NULL, NULL }, #endif
@@ -1125,9 +1122,6 @@ #ifdef TARGET_NR_shutdown { TARGET_NR_shutdown, "shutdown" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigaction -{ TARGET_NR_sigaction, "sigaction" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_sigaltstack { TARGET_NR_sigaltstack, "sigaltstack" , "%s(%p,%p)", NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 57/74 linux-user: Split out sgetmask, ssetmask
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 ++++++ linux-user/syscall-sig.inc.c | 32 ++++++++++++++++++++++++++++++++ linux-user/syscall.c | 27 --------------------------- linux-user/strace.list | 6 ------ 4 files changed, 38 insertions(+), 33 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -222,6 +222,12 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);#ifdef TARGET_NR_sigactionSYSCALL_DEF (sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR );#endif +#ifdef TARGET_NR_sgetmask +SYSCALL_DEF (sgetmask); +#endif +#ifdef TARGET_NR_ssetmask +SYSCALL_DEF (ssetmask,ARG_HEX ); +#endif #ifdef TARGET_NR_stimeSYSCALL_DEF (stime,ARG_PTR );#endif
linux-user/syscall-sig.inc.c +32 -0
@@ -211,3 +211,35 @@ SYSCALL_IMPL(sigaction) return ret; }#endif + +#ifdef TARGET_NR_sgetmask +SYSCALL_IMPL (sgetmask) +{ +sigset_t cur_set; +abi_ulong target_set; +abi_long ret =do_sigprocmask (0 ,NULL , &cur_set); + +if (!ret) { +host_to_target_old_sigset (&target_set, &cur_set); + ret = target_set; + } +return ret; +} +#endif + +#ifdef TARGET_NR_ssetmask +SYSCALL_IMPL (ssetmask) +{ +sigset_t set, oset; +abi_ulong target_set = arg1; +abi_long ret; + +target_to_host_old_sigset (&set, &target_set); + ret =do_sigprocmask (SIG_SETMASK , &set, &oset); +if (!ret) { +host_to_target_old_sigset (&target_set, &oset); + ret = target_set; + } +return ret; +} +#endif
linux-user/syscall.c +0 -27
@@ -4241,33 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_sgetmask/* not on alpha */ -case TARGET_NR_sgetmask: - { -sigset_t cur_set; -abi_ulong target_set; - ret =do_sigprocmask (0 ,NULL , &cur_set); -if (!ret) { -host_to_target_old_sigset (&target_set, &cur_set); - ret = target_set; - } - } -return ret; -#endif -#ifdef TARGET_NR_ssetmask/* not on alpha */ -case TARGET_NR_ssetmask: - { -sigset_t set, oset; -abi_ulong target_set = arg1; -target_to_host_old_sigset (&set, &target_set); - ret =do_sigprocmask (SIG_SETMASK , &set, &oset); -if (!ret) { -host_to_target_old_sigset (&target_set, &oset); - ret = target_set; - } - } -return ret; -#endif #ifdef TARGET_NR_sigprocmaskcase TARGET_NR_sigprocmask: {
linux-user/strace.list +0 -6
@@ -1116,9 +1116,6 @@ #ifdef TARGET_NR_setxattr { TARGET_NR_setxattr, "setxattr" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sgetmask -{ TARGET_NR_sgetmask, "sgetmask" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_shutdown { TARGET_NR_shutdown, "shutdown" , NULL, NULL, NULL }, #endif
@@ -1158,9 +1155,6 @@ #ifdef TARGET_NR_splice { TARGET_NR_splice, "splice" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_ssetmask -{ TARGET_NR_ssetmask, "ssetmask" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_stat { TARGET_NR_stat, "stat" , NULL, print_stat, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 58/74 linux-user: Split out sigprocmask, rt_sigprocmask
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 ++ linux-user/syscall.h | 1 + linux-user/strace.c | 44 +++++++------ linux-user/syscall-sig.inc.c | 123 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 109 ------------------------------- linux-user/strace.list | 6 -- 6 files changed, 154 insertions(+), 135 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -194,6 +194,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_PTR, ARG_DEC);#else SYSCALL_DEF (rt_sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR ,ARG_DEC );#endif +SYSCALL_DEF (rt_sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ,ARG_DEC );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
@@ -222,6 +223,11 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);#ifdef TARGET_NR_sigactionSYSCALL_DEF (sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR );#endif +#if defined(TARGET_ALPHA ) +SYSCALL_DEF (sigprocmask,ARG_SIGPROCMASKHOW ,ARG_HEX ); +#elif defined(TARGET_NR_sigprocmask) +SYSCALL_DEF (sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ); +#endif #ifdef TARGET_NR_sgetmaskSYSCALL_DEF (sgetmask);#endif
linux-user/syscall.h +1 -0
@@ -59,6 +59,7 @@ typedef enum {ARG_ATDIRFD ,ARG_SIGNAL ,ARG_LSEEKWHENCE , +ARG_SIGPROCMASKHOW ,/* These print as sets of flags. */ ARG_ACCESSFLAG,
linux-user/strace.c +24 -20
62 lines not on this page · raw message
linux-user/syscall-sig.inc.c +123 -0
135 lines not on this page · raw message
linux-user/syscall.c +0 -109
115 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -929,9 +929,6 @@ #ifdef TARGET_NR_rt_sigpending { TARGET_NR_rt_sigpending, "rt_sigpending" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigprocmask -{ TARGET_NR_rt_sigprocmask, "rt_sigprocmask" , NULL, print_rt_sigprocmask, NULL }, -#endif #ifdef TARGET_NR_rt_sigqueueinfo { TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL, print_rt_sigqueueinfo, NULL }, #endif
@@ -1134,9 +1131,6 @@ #ifdef TARGET_NR_sigpending { TARGET_NR_sigpending, "sigpending" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigprocmask -{ TARGET_NR_sigprocmask, "sigprocmask" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_sigreturn { TARGET_NR_sigreturn, "sigreturn" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 59/74 linux-user: Split out sigpending, rt_sigpending
In reply to Richard Henderson--- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall-sig.inc.c | 45 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 36 ----------------------------- linux-user/strace.list | 6 ----- 4 files changed, 49 insertions(+), 42 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -194,6 +194,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_PTR, ARG_DEC);#else SYSCALL_DEF (rt_sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR ,ARG_DEC );#endif +SYSCALL_DEF (rt_sigpending,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ,ARG_DEC );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );
@@ -223,6 +224,9 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);#ifdef TARGET_NR_sigactionSYSCALL_DEF (sigaction,ARG_SIGNAL ,ARG_PTR ,ARG_PTR );#endif +#ifdef TARGET_NR_sigpending +SYSCALL_DEF (sigpending,ARG_PTR ); +#endif #if defined(TARGET_ALPHA )SYSCALL_DEF (sigprocmask,ARG_SIGPROCMASKHOW ,ARG_HEX );#elif defined(TARGET_NR_sigprocmask)
linux-user/syscall-sig.inc.c +45 -0
57 lines not on this page · raw message
linux-user/syscall.c +0 -36
@@ -4241,42 +4241,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_sigpending -case TARGET_NR_sigpending: - { -sigset_t set; - ret =get_errno (sigpending (&set)); -if (!is_error (ret)) { -if (!(p =lock_user (VERIFY_WRITE , arg1,sizeof (target_sigset_t),0 ))) -return -TARGET_EFAULT ; -host_to_target_old_sigset (p, &set); -unlock_user (p, arg1,sizeof (target_sigset_t)); - } - } -return ret; -#endif -case TARGET_NR_rt_sigpending: - { -sigset_t set; - -/* Yes, this check is >, not != like most. We follow the kernel's -* logic and it does it like this because it implements -* NR_sigpending through the same code path, and in that case -* the old_sigset_t is smaller in size. -*/ -if (arg2 >sizeof (target_sigset_t)) { -return -TARGET_EINVAL ; - } - - ret =get_errno (sigpending (&set)); -if (!is_error (ret)) { -if (!(p =lock_user (VERIFY_WRITE , arg1,sizeof (target_sigset_t),0 ))) -return -TARGET_EFAULT ; -host_to_target_sigset (p, &set); -unlock_user (p, arg1,sizeof (target_sigset_t)); - } - } -return ret;#ifdef TARGET_NR_sigsuspendcase TARGET_NR_sigsuspend: {
linux-user/strace.list +0 -6
@@ -926,9 +926,6 @@ #ifdef TARGET_NR_rmdir { TARGET_NR_rmdir, "rmdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigpending -{ TARGET_NR_rt_sigpending, "rt_sigpending" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_rt_sigqueueinfo { TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL, print_rt_sigqueueinfo, NULL }, #endif
@@ -1128,9 +1125,6 @@ #ifdef TARGET_NR_signalfd4 { TARGET_NR_signalfd4, "signalfd4" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigpending -{ TARGET_NR_sigpending, "sigpending" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_sigreturn { TARGET_NR_sigreturn, "sigreturn" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 60/74 linux-user: Split out sigsuspend, rt_sigsuspend
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 +++++ linux-user/syscall-sig.inc.c | 51 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 42 ++--------------------------- linux-user/strace.list | 6 ----- 4 files changed, 59 insertions(+), 46 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -196,6 +196,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC);#endif SYSCALL_DEF (rt_sigpending,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (rt_sigsuspend,ARG_PTR ,ARG_DEC );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
@@ -232,6 +233,11 @@ SYSCALL_DEF(sigprocmask, ARG_SIGPROCMASKHOW, ARG_HEX);#elif defined(TARGET_NR_sigprocmask)SYSCALL_DEF (sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR );#endif +#if defined(TARGET_ALPHA ) +SYSCALL_DEF (sigsuspend,ARG_HEX ); +#elif defined(TARGET_NR_sigsuspend) +SYSCALL_DEF (sigsuspend,ARG_PTR ); +#endif #ifdef TARGET_NR_sgetmaskSYSCALL_DEF (sgetmask);#endif
linux-user/syscall-sig.inc.c +51 -0
63 lines not on this page · raw message
linux-user/syscall.c +2 -40
66 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -932,9 +932,6 @@ #ifdef TARGET_NR_rt_sigreturn { TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigsuspend -{ TARGET_NR_rt_sigsuspend, "rt_sigsuspend" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_rt_sigtimedwait { TARGET_NR_rt_sigtimedwait, "rt_sigtimedwait" , NULL, NULL, NULL }, #endif
@@ -1128,9 +1125,6 @@ #ifdef TARGET_NR_sigreturn { TARGET_NR_sigreturn, "sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigsuspend -{ TARGET_NR_sigsuspend, "sigsuspend" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_socket { TARGET_NR_socket, "socket" , NULL, print_socket, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 61/74 linux-user: Split out rt_sigtimedwait
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-sig.inc.c | 37 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 36 ----------------------------------- linux-user/strace.list | 3 --- 4 files changed, 38 insertions(+), 39 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -197,6 +197,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC);SYSCALL_DEF (rt_sigpending,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigsuspend,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (rt_sigtimedwait,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_DEC );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
linux-user/syscall-sig.inc.c +37 -0
@@ -215,6 +215,43 @@ SYSCALL_IMPL(rt_sigsuspend)return ret; } +SYSCALL_IMPL (rt_sigtimedwait) +{ +sigset_t set; +struct timespec uts, *puts =NULL ; +siginfo_t uinfo; +abi_long ret; +void *p; + +if (arg4 !=sizeof (target_sigset_t)) { +return -TARGET_EINVAL ; + } + p =lock_user (VERIFY_READ , arg1,sizeof (target_sigset_t),1 ); +if (!p) { +return -TARGET_EFAULT ; + } +target_to_host_sigset (&set, p); +unlock_user (p, arg1,0 ); +if (arg3) { + puts = &uts; +target_to_host_timespec (puts, arg3); + } + + ret =get_errno (safe_rt_sigtimedwait (&set, &uinfo, puts,SIGSET_T_SIZE )); +if (!is_error (ret)) { +if (arg2) { + p =lock_user (VERIFY_WRITE , arg2,sizeof (target_siginfo_t),0 ); +if (!p) { +return -TARGET_EFAULT ; + } +host_to_target_siginfo (p, &uinfo); +unlock_user (p, arg2,sizeof (target_siginfo_t)); + } + ret =host_to_target_signal (ret); + } +return ret; +} +#ifdef TARGET_NR_sigactionSYSCALL_IMPL (sigaction) {
linux-user/syscall.c +0 -36
@@ -4240,42 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_rt_sigtimedwait: - { -sigset_t set; -struct timespec uts, *puts; -siginfo_t uinfo; - -if (arg4 !=sizeof (target_sigset_t)) { -return -TARGET_EINVAL ; - } - -if (!(p =lock_user (VERIFY_READ , arg1,sizeof (target_sigset_t),1 ))) -return -TARGET_EFAULT ; -target_to_host_sigset (&set, p); -unlock_user (p, arg1,0 ); -if (arg3) { - puts = &uts; -target_to_host_timespec (puts, arg3); - }else { - puts =NULL ; - } - ret =get_errno (safe_rt_sigtimedwait (&set, &uinfo, puts, -SIGSET_T_SIZE )); -if (!is_error (ret)) { -if (arg2) { - p =lock_user (VERIFY_WRITE , arg2,sizeof (target_siginfo_t), -0 ); -if (!p) { -return -TARGET_EFAULT ; - } -host_to_target_siginfo (p, &uinfo); -unlock_user (p, arg2,sizeof (target_siginfo_t)); - } - ret =host_to_target_signal (ret); - } - } -return ret;case TARGET_NR_rt_sigqueueinfo: {siginfo_t uinfo;
linux-user/strace.list +0 -3
@@ -932,9 +932,6 @@ #ifdef TARGET_NR_rt_sigreturn { TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigtimedwait -{ TARGET_NR_rt_sigtimedwait, "rt_sigtimedwait" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_rt_tgsigqueueinfo { TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL, print_rt_tgsigqueueinfo, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 62/74 linux-user: Split out rt_sigqueueinfo, rt_tgsigqueueinfo
In reply to Richard HendersonThis does drop the (questionable) siginfo_t printing. But since we already do not handle more important things in this area like sigset_t, this does not feel a loss.
--- linux-user/syscall-defs.h | 2 + linux-user/strace.c | 138 ----------------------------------- linux-user/syscall-sig.inc.c | 30 ++++++++ linux-user/syscall.c | 26 ------- linux-user/strace.list | 6 -- 5 files changed, 32 insertions(+), 170 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -196,8 +196,10 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC);#endif SYSCALL_DEF (rt_sigpending,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (rt_sigqueueinfo,ARG_DEC ,ARG_SIGNAL ,ARG_PTR );SYSCALL_DEF (rt_sigsuspend,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigtimedwait,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (rt_tgsigqueueinfo,ARG_DEC ,ARG_DEC ,ARG_SIGNAL ,ARG_PTR );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
linux-user/strace.c +0 -138
150 lines not on this page · raw message
linux-user/syscall-sig.inc.c +30 -0
@@ -191,6 +191,21 @@ SYSCALL_IMPL(rt_sigprocmask)return ret; } +SYSCALL_IMPL (rt_sigqueueinfo) +{ +siginfo_t uinfo; +void *p; + + p =lock_user (VERIFY_READ , arg3,sizeof (target_siginfo_t),1 ); +if (!p) { +return -TARGET_EFAULT ; + } +target_to_host_siginfo (&uinfo, p); +unlock_user (p, arg3,0 ); + +return get_errno (sys_rt_sigqueueinfo (arg1, arg2, &uinfo)); +} +SYSCALL_IMPL (rt_sigsuspend) {CPUState *cpu =ENV_GET_CPU (cpu_env);
@@ -252,6 +267,21 @@ SYSCALL_IMPL(rt_sigtimedwait)return ret; } +SYSCALL_IMPL (rt_tgsigqueueinfo) +{ +siginfo_t uinfo; +void *p; + + p =lock_user (VERIFY_READ , arg4,sizeof (target_siginfo_t),1 ); +if (!p) { +return -TARGET_EFAULT ; + } +target_to_host_siginfo (&uinfo, p); +unlock_user (p, arg4,0 ); + +return get_errno (sys_rt_tgsigqueueinfo (arg1, arg2, arg3, &uinfo)); +} +#ifdef TARGET_NR_sigactionSYSCALL_IMPL (sigaction) {
linux-user/syscall.c +0 -26
@@ -4240,32 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_rt_sigqueueinfo: - { -siginfo_t uinfo; - - p =lock_user (VERIFY_READ , arg3,sizeof (target_siginfo_t),1 ); -if (!p) { -return -TARGET_EFAULT ; - } -target_to_host_siginfo (&uinfo, p); -unlock_user (p, arg3,0 ); - ret =get_errno (sys_rt_sigqueueinfo (arg1, arg2, &uinfo)); - } -return ret; -case TARGET_NR_rt_tgsigqueueinfo: - { -siginfo_t uinfo; - - p =lock_user (VERIFY_READ , arg4,sizeof (target_siginfo_t),1 ); -if (!p) { -return -TARGET_EFAULT ; - } -target_to_host_siginfo (&uinfo, p); -unlock_user (p, arg4,0 ); - ret =get_errno (sys_rt_tgsigqueueinfo (arg1, arg2, arg3, &uinfo)); - } -return ret;#ifdef TARGET_NR_sigreturncase TARGET_NR_sigreturn:if (block_signals ()) {
linux-user/strace.list +0 -6
@@ -926,15 +926,9 @@ #ifdef TARGET_NR_rmdir { TARGET_NR_rmdir, "rmdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigqueueinfo -{ TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL, print_rt_sigqueueinfo, NULL }, -#endif #ifdef TARGET_NR_rt_sigreturn { TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_tgsigqueueinfo -{ TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL, print_rt_tgsigqueueinfo, NULL }, -#endif #ifdef TARGET_NR_sched_getaffinity { TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH v7 62/74] linux-user: Split out rt_sigqueueinfo, rt_tgsigqueueinfo
Quoted 5 lines · Richard Henderson
This does drop the (questionable)
siginfo_tprinting. But since we already do not handle more important things in this area likesigset_t, this does not feel a loss.
What is the most questionable here is the reasoning “we don't handle one thing, therefore let's drop another”.
If you find siginfo_t printing questionable, then provide a better one, not remove it altogether.
I find that the current printing is useful in many circumstances, there is a lot of energy of former contributors invested into it, and should not be deleted just like that. It does feel like a loss.
Aleksandar
linux-user/syscall-defs.h SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR,
Quoted 14 lines
Signed-off-by Richard Henderson <[email protected]>--- linux-user/syscall-defs.h | 2 + linux-user/strace.c | 138 ----------------------------------- linux-user/syscall-sig.inc.c | 30 ++++++++ linux-user/syscall.c | 26 ------- linux-user/strace.list | 6 -- 5 files changed, 32 insertions(+), 170 deletions(-)linux-user/syscall-defs.h +0
-0@@ -196,8 +196,10 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR,
ARG_PTR, ARG_DEC);
linux-user/syscall-defs.h SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC);
Quoted 3 lines
linux-user/syscall-defs.h +0
-0#endif SYSCALL_DEF (rt_sigpending,ARG_PTR ,ARG_DEC ); SYSCALL_DEF(rt_sigprocmask, ARG_SIGPROCMASKHOW, ARG_PTR, ARG_PTR,
ARG_DEC);
Quoted 46 lines
linux-user/syscall-defs.h +2
-0+SYSCALL_DEF (rt_sigqueueinfo,ARG_DEC ,ARG_SIGNAL ,ARG_PTR );SYSCALL_DEF (rt_sigsuspend,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigtimedwait,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_DEC ); +SYSCALL_DEF (rt_tgsigqueueinfo,ARG_DEC ,ARG_DEC ,ARG_SIGNAL ,ARG_PTR );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif linux-user/strace.c +0
-31@@ -167,93 +167,6 @@ static void print_si_code(int arg)gemu_log ("%s" , codename); } -static void get_target_siginfo (target_siginfo_t *tinfo, -const target_siginfo_t *info) -{ -abi_ulong sival_ptr; - -int sig; -int si_errno; -int si_code; -int si_type; - -__get_user (sig, &info->si_signo); -__get_user (si_errno, &tinfo->si_errno); -__get_user (si_code, &info->si_code); - - tinfo->si_signo = sig; - tinfo->si_errno = si_errno; - tinfo->si_code = si_code; - -/* Ensure we don't leak random junk to the guest later */ -memset (tinfo->_sifields._pad,0 ,sizeof (tinfo->_sifields._pad)); - -/* This is awkward, because we have to use a combination of -* the si_code and si_signo to figure out which of the union's -* members are valid. (Within the host kernel it is always possible -* to tell, but the kernel carefully avoids giving userspace the -* high 16 bits of si_code, so we don't have the information to -* do this the easy way...) We therefore make our best guess, -* bearing in mind that a guest can spoof most of the si_codes -* via rt_sigqueueinfo() if it likes. -* -* Once we have made our guess, we record it in the top 16 bits of
linux-user/strace.c static void print_si_code(int arg) · line 210
Quoted 10 lines
linux-user/strace.c +0
-10-* the si_code, so that print_siginfo() later can use it. -* print_siginfo() will strip these top bits out before printing -* the si_code. -*/ - -switch (si_code) { -case SI_USER : -case SI_TKILL : -case SI_KERNEL : -/* Sent via kill(), tkill() or tgkill(), or direct from the
kernel.
linux-user/strace.c static void print_si_code(int arg)
Quoted 3 lines
linux-user/strace.c +0
-3-* These are the only unspoofable si_code values. -*/ - __get_user(tinfo->_sifields._kill._pid,
&info->_sifields._kill._pid);
linux-user/strace.c static void print_si_code(int arg) · line 214
Quoted 1 line
linux-user/strace.c +0
-1- __get_user(tinfo->_sifields._kill._uid,
&info->_sifields._kill._uid);
linux-user/strace.c static void print_si_code(int arg)
Quoted 4 lines
linux-user/strace.c +0
-4- si_type =QEMU_SI_KILL ; -break ; -default : -/* Everything else is spoofable. Make best guess based on signal
*/
Quoted 13 lines
linux-user/strace.c +0
-13-switch (sig) { -case TARGET_SIGCHLD : -__get_user (tinfo->_sifields._sigchld._pid, - &info->_sifields._sigchld._pid); -__get_user (tinfo->_sifields._sigchld._uid, - &info->_sifields._sigchld._uid); -__get_user (tinfo->_sifields._sigchld._status, - &info->_sifields._sigchld._status); -__get_user (tinfo->_sifields._sigchld._utime, - &info->_sifields._sigchld._utime); -__get_user (tinfo->_sifields._sigchld._stime, - &info->_sifields._sigchld._stime); - si_type =QEMU_SI_CHLD ;
linux-user/strace.c static void print_si_code(int arg)
Quoted 10 lines
linux-user/strace.c +0
-10-break ; -case TARGET_SIGIO : -__get_user (tinfo->_sifields._sigpoll._band, - &info->_sifields._sigpoll._band); -__get_user (tinfo->_sifields._sigpoll._fd, - &info->_sifields._sigpoll._fd); - si_type =QEMU_SI_POLL ; -break ; -default : -/* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source.
*/
linux-user/strace.c static void print_si_code(int arg) · line 242
Quoted 1 line
linux-user/strace.c +0
-1- __get_user(tinfo->_sifields._rt._pid,
&info->_sifields._rt._pid);
linux-user/strace.c static void print_si_code(int arg) · line 243
Quoted 1 line
linux-user/strace.c +0
-1- __get_user(tinfo->_sifields._rt._uid,
&info->_sifields._rt._uid);
linux-user/strace.c static void print_si_code(int arg) · line 245
Quoted 2 lines
linux-user/strace.c +0
-2-/* XXX: potential problem if 64 bit */ - __get_user(sival_ptr,
&info->_sifields._rt._sigval.sival_ptr);
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int
Quoted 125 lines
linux-user/strace.c +0
-62- tinfo->_sifields._rt._sigval.sival_ptr = sival_ptr; - - si_type =QEMU_SI_RT ; -break ; - } -break ; - } - - tinfo->si_code =deposit32 (si_code,16 ,16 , si_type); -} -static void print_siginfo (const target_siginfo_t *tinfo) {/* Print a target_siginfo_t in the format desired for printing @@ -1585,57 +1498,6 @@ print_fstat(const struct syscallname *name,#define print_fstat64 print_fstat#endif -#ifdef TARGET_NR_rt_sigqueueinfo -static void -print_rt_sigqueueinfo (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -void *p; -target_siginfo_t uinfo; - -print_syscall_prologue (name); -print_raw_param ("%d" , arg0,0 ); -print_signal (arg1,0 ); - p =lock_user (VERIFY_READ , arg2,sizeof (target_siginfo_t),1 ); -if (p) { -get_target_siginfo (&uinfo, p); -print_siginfo (&uinfo); - -unlock_user (p, arg2,0 ); - }else { -print_pointer (arg2,1 ); - } -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_rt_tgsigqueueinfo -static void -print_rt_tgsigqueueinfo (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -void *p; -target_siginfo_t uinfo; - -print_syscall_prologue (name); -print_raw_param ("%d" , arg0,0 ); -print_raw_param ("%d" , arg1,0 ); -print_signal (arg2,0 ); - p =lock_user (VERIFY_READ , arg3,sizeof (target_siginfo_t),1 ); -if (p) { -get_target_siginfo (&uinfo, p); -print_siginfo (&uinfo); - -unlock_user (p, arg3,0 ); - }else { -print_pointer (arg3,1 ); - } -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_syslogstatic void print_syslog_action (abi_ulong arg,int last)linux-user/syscall-sig.inc.c +30
-0@@ -191,6 +191,21 @@ SYSCALL_IMPL(rt_sigprocmask)return ret; } +SYSCALL_IMPL (rt_sigqueueinfo) +{ +siginfo_t uinfo; +void *p; + + p =lock_user (VERIFY_READ , arg3,sizeof (target_siginfo_t),1 ); +if (!p) { +return -TARGET_EFAULT ; + } +target_to_host_siginfo (&uinfo, p); +unlock_user (p, arg3,0 ); + +return get_errno (sys_rt_sigqueueinfo (arg1, arg2, &uinfo)); +} +SYSCALL_IMPL (rt_sigsuspend) {CPUState *cpu =ENV_GET_CPU (cpu_env);@@ -252,6 +267,21 @@ SYSCALL_IMPL(rt_sigtimedwait)return ret; } +SYSCALL_IMPL (rt_tgsigqueueinfo) +{ +siginfo_t uinfo; +void *p; + + p =lock_user (VERIFY_READ , arg4,sizeof (target_siginfo_t),1 ); +if (!p) { +return -TARGET_EFAULT ; + } +target_to_host_siginfo (&uinfo, p); +unlock_user (p, arg4,0 ); + +return get_errno (sys_rt_tgsigqueueinfo (arg1, arg2, arg3, &uinfo)); +} +#ifdef TARGET_NR_sigactionSYSCALL_IMPL (sigaction) {linux-user/syscall.c +0
-0@@ -4240,32 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int
num, abi_long arg1,
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
Quoted 8 lines
linux-user/syscall.c +0
-5void *p;switch (num) { -case TARGET_NR_rt_sigqueueinfo: - { -siginfo_t uinfo; - - p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t),
1);
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
Quoted 13 lines
linux-user/syscall.c +0
-13-if (!p) { -return -TARGET_EFAULT ; - } -target_to_host_siginfo (&uinfo, p); -unlock_user (p, arg3,0 ); - ret =get_errno (sys_rt_sigqueueinfo (arg1, arg2, &uinfo)); - } -return ret; -case TARGET_NR_rt_tgsigqueueinfo: - { -siginfo_t uinfo; - - p = lock_user(VERIFY_READ, arg4, sizeof(target_siginfo_t),
1);
linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
Quoted 6 lines
linux-user/syscall.c +0
-6-if (!p) { -return -TARGET_EFAULT ; - } -target_to_host_siginfo (&uinfo, p); -unlock_user (p, arg4,0 ); - ret = get_errno(sys_rt_tgsigqueueinfo(arg1, arg2, arg3,
&uinfo));
Quoted 10 lines
linux-user/syscall.c +0
-2- } -return ret;#ifdef TARGET_NR_sigreturncase TARGET_NR_sigreturn:if (block_signals ()) {linux-user/strace.list +0
-0
linux-user/strace.list line 930
Quoted 5 lines
linux-user/strace.list +0
-2@@ -926,15 +926,9 @@ #ifdef TARGET_NR_rmdir { TARGET_NR_rmdir, "rmdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigqueueinfo -{ TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL,
print_rt_sigqueueinfo, NULL },
linux-user/strace.list
Quoted 6 lines
linux-user/strace.list +0
-3-#endif #ifdef TARGET_NR_rt_sigreturn { TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_tgsigqueueinfo -{ TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL,
print_rt_tgsigqueueinfo, NULL },
Quoted 8 lines
linux-user/strace.list +0
-2-#endif #ifdef TARGET_NR_sched_getaffinity { TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL }, #endif --2.17.1
PATCH v7 63/74 linux-user: Split out sigreturn, rt_sigreturn
In reply to Richard Henderson--- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall-sig.inc.c | 18 ++++++++++++++++++ linux-user/syscall.c | 12 ------------ linux-user/strace.list | 6 ------ 4 files changed, 22 insertions(+), 18 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -197,6 +197,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC);SYSCALL_DEF (rt_sigpending,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigqueueinfo,ARG_DEC ,ARG_SIGNAL ,ARG_PTR ); +SYSCALL_DEF (rt_sigreturn);SYSCALL_DEF (rt_sigsuspend,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigtimedwait,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_tgsigqueueinfo,ARG_DEC ,ARG_DEC ,ARG_SIGNAL ,ARG_PTR );
@@ -236,6 +237,9 @@ SYSCALL_DEF(sigprocmask, ARG_SIGPROCMASKHOW, ARG_HEX);#elif defined(TARGET_NR_sigprocmask)SYSCALL_DEF (sigprocmask,ARG_SIGPROCMASKHOW ,ARG_PTR ,ARG_PTR );#endif +#ifdef TARGET_NR_sigreturn +SYSCALL_DEF (sigreturn); +#endif #if defined(TARGET_ALPHA )SYSCALL_DEF (sigsuspend,ARG_HEX );#elif defined(TARGET_NR_sigsuspend)
linux-user/syscall-sig.inc.c +18 -0
@@ -206,6 +206,14 @@ SYSCALL_IMPL(rt_sigqueueinfo)return get_errno (sys_rt_sigqueueinfo (arg1, arg2, &uinfo)); } +SYSCALL_IMPL (rt_sigreturn) +{ +if (block_signals ()) { +return -TARGET_ERESTARTSYS ; + } +return do_rt_sigreturn (cpu_env); +} +SYSCALL_IMPL (rt_sigsuspend) {CPUState *cpu =ENV_GET_CPU (cpu_env);
@@ -471,6 +479,16 @@ SYSCALL_IMPL(sigprocmask) }#endif +#ifdef TARGET_NR_sigreturn +SYSCALL_IMPL (sigreturn) +{ +if (block_signals ()) { +return -TARGET_ERESTARTSYS ; + } +return do_sigreturn (cpu_env); +} +#endif +#ifdef TARGET_NR_sigsuspendSYSCALL_IMPL (sigsuspend) {
linux-user/syscall.c +0 -12
@@ -4240,18 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_sigreturn -case TARGET_NR_sigreturn: -if (block_signals ()) { -return -TARGET_ERESTARTSYS ; - } -return do_sigreturn (cpu_env); -#endif -case TARGET_NR_rt_sigreturn: -if (block_signals ()) { -return -TARGET_ERESTARTSYS ; - } -return do_rt_sigreturn (cpu_env);case TARGET_NR_sethostname:if (!(p =lock_user_string (arg1)))return -TARGET_EFAULT ;
linux-user/strace.list +0 -6
@@ -926,9 +926,6 @@ #ifdef TARGET_NR_rmdir { TARGET_NR_rmdir, "rmdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigreturn -{ TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_sched_getaffinity { TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL }, #endif
@@ -1113,9 +1110,6 @@ #ifdef TARGET_NR_signalfd4 { TARGET_NR_signalfd4, "signalfd4" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigreturn -{ TARGET_NR_sigreturn, "sigreturn" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_socket { TARGET_NR_socket, "socket" , NULL, print_socket, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 64/74 linux-user: Split out gethostname, sethostname
In reply to Richard Henderson--- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall-proc.inc.c | 28 ++++++++++++++++++++++++++++ linux-user/syscall.c | 19 ------------------- linux-user/strace.list | 6 ------ 4 files changed, 32 insertions(+), 25 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -59,6 +59,9 @@ SYSCALL_DEF(futimesat, ARG_ATDIRFD, ARG_STR, ARG_PTR);#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif +#ifdef TARGET_NR_gethostname +SYSCALL_DEF (gethostname,ARG_PTR ,ARG_DEC ); +#endif SYSCALL_DEF (getpgid,ARG_DEC );#ifdef TARGET_NR_getpgrpSYSCALL_DEF (getpgrp);
@@ -207,6 +210,7 @@ SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semget)SYSCALL_DEF (semget,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif +SYSCALL_DEF (sethostname,ARG_STR );SYSCALL_DEF (setpgid,ARG_DEC ,ARG_DEC );SYSCALL_DEF (setsid);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semop)
linux-user/syscall-proc.inc.c +28 -0
@@ -438,6 +438,21 @@ SYSCALL_IMPL(fork) }#endif +#ifdef TARGET_NR_gethostname +SYSCALL_IMPL (gethostname) +{ +char *name =lock_user (VERIFY_WRITE , arg1, arg2,0 ); +abi_long ret; + +if (!name) { +return -TARGET_EFAULT ; + } + ret =get_errno (gethostname (name, arg2)); +unlock_user (name, arg1, arg2); +return ret; +} +#endif +SYSCALL_IMPL (getpgid) {return get_errno (getpgid (arg1));
@@ -485,6 +500,19 @@ SYSCALL_IMPL(nice) }#endif +SYSCALL_IMPL (sethostname) +{ +void *p =lock_user_string (arg1); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (sethostname (p, arg2)); +unlock_user (p, arg1,0 ); +return ret; +} +SYSCALL_IMPL (setpgid) {return get_errno (setpgid (arg1, arg2));
linux-user/syscall.c +0 -19
@@ -4240,12 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_sethostname: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (sethostname (p, arg2)); -unlock_user (p, arg1,0 ); -return ret;#ifdef TARGET_NR_setrlimitcase TARGET_NR_setrlimit: {
@@ -7078,19 +7072,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,return ret; }#endif -#ifdef TARGET_NR_gethostname -case TARGET_NR_gethostname: - { -char *name =lock_user (VERIFY_WRITE , arg1, arg2,0 ); -if (name) { - ret =get_errno (gethostname (name, arg2)); -unlock_user (name, arg1, arg2); - }else { - ret = -TARGET_EFAULT ; - } -return ret; - } -#endif #ifdef TARGET_NR_atomic_cmpxchg_32case TARGET_NR_atomic_cmpxchg_32: {
linux-user/strace.list +0 -6
@@ -244,9 +244,6 @@ #ifdef TARGET_NR_getgroups32 { TARGET_NR_getgroups32, "getgroups32" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_gethostname -{ TARGET_NR_gethostname, "gethostname" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getitimer { TARGET_NR_getitimer, "getitimer" , NULL, NULL, NULL }, #endif
@@ -1025,9 +1022,6 @@ #ifdef TARGET_NR_sethae { TARGET_NR_sethae, "sethae" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sethostname -{ TARGET_NR_sethostname, "sethostname" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setitimer { TARGET_NR_setitimer, "setitimer" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 65/74 linux-user: Split out getrlimit, setrlimit
In reply to Richard Henderson--- linux-user/syscall-defs.h | 6 ++++ linux-user/syscall-proc.inc.c | 52 +++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 46 ------------------------------- linux-user/strace.list | 6 ---- 4 files changed, 58 insertions(+), 52 deletions(-)
linux-user/syscall-defs.h +6 -0
@@ -72,6 +72,9 @@ SYSCALL_DEF(getpid);#ifdef TARGET_NR_getppidSYSCALL_DEF (getppid);#endif +#ifdef TARGET_NR_getrlimit +SYSCALL_DEF (getrlimit,ARG_DEC ,ARG_PTR ); +#endif SYSCALL_DEF (getsid,ARG_DEC );#ifdef TARGET_NR_getxpidSYSCALL_DEF (getxpid);
@@ -212,6 +215,9 @@ SYSCALL_DEF(semget, ARG_DEC, ARG_DEC, ARG_HEX);#endif SYSCALL_DEF (sethostname,ARG_STR );SYSCALL_DEF (setpgid,ARG_DEC ,ARG_DEC ); +#ifdef TARGET_NR_setrlimit +SYSCALL_DEF (setrlimit,ARG_DEC ,ARG_PTR ); +#endif SYSCALL_DEF (setsid);#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semop)SYSCALL_DEF (semop,ARG_DEC ,ARG_PTR ,ARG_DEC );
linux-user/syscall-proc.inc.c +52 -0
64 lines not on this page · raw message
linux-user/syscall.c +0 -46
52 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -280,9 +280,6 @@ #ifdef TARGET_NR_getresuid32 { TARGET_NR_getresuid32, "getresuid32" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getrlimit -{ TARGET_NR_getrlimit, "getrlimit" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_get_robust_list { TARGET_NR_get_robust_list, "get_robust_list" , NULL, NULL, NULL }, #endif
@@ -1061,9 +1058,6 @@ #ifdef TARGET_NR_setreuid32 { TARGET_NR_setreuid32, "setreuid32" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_setrlimit -{ TARGET_NR_setrlimit, "setrlimit" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_set_robust_list { TARGET_NR_set_robust_list, "set_robust_list" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 66/74 linux-user: Split out getrusage
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 12 ++++++++++++ linux-user/syscall.c | 9 --------- linux-user/strace.list | 3 --- 4 files changed, 13 insertions(+), 12 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -75,6 +75,7 @@ SYSCALL_DEF(getppid);#ifdef TARGET_NR_getrlimitSYSCALL_DEF (getrlimit,ARG_DEC ,ARG_PTR );#endif +SYSCALL_DEF (getrusage,ARG_DEC ,ARG_PTR );SYSCALL_DEF (getsid,ARG_DEC );#ifdef TARGET_NR_getxpidSYSCALL_DEF (getxpid);
linux-user/syscall-proc.inc.c +12 -0
@@ -499,6 +499,18 @@ SYSCALL_IMPL(getrlimit) return ret; }#endif + +SYSCALL_IMPL (getrusage) +{ +struct rusage rusage; +abi_long ret =get_errno (getrusage (arg1, &rusage)); + +if (!is_error (ret)) { + ret =host_to_target_rusage (arg2, &rusage); + } +return ret; +} +SYSCALL_IMPL (getsid) {return get_errno (getsid (arg1));
linux-user/syscall.c +0 -9
@@ -4240,15 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_getrusage: - { -struct rusage rusage; - ret =get_errno (getrusage (arg1, &rusage)); -if (!is_error (ret)) { - ret =host_to_target_rusage (arg2, &rusage); - } - } -return ret;case TARGET_NR_gettimeofday: {struct timeval tv;
linux-user/strace.list +0 -3
@@ -283,9 +283,6 @@ #ifdef TARGET_NR_get_robust_list { TARGET_NR_get_robust_list, "get_robust_list" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getrusage -{ TARGET_NR_getrusage, "getrusage" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getsockname { TARGET_NR_getsockname, "getsockname" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 67/74 linux-user: Split out gettimeofday, settimeofday
In reply to Richard Henderson--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-time.inc.c | 33 +++++++++++++++++++++++++++++++++ linux-user/syscall.c | 31 ------------------------------- linux-user/strace.list | 6 ------ 4 files changed, 35 insertions(+), 37 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -77,6 +77,7 @@ SYSCALL_DEF(getrlimit, ARG_DEC, ARG_PTR);#endif SYSCALL_DEF (getrusage,ARG_DEC ,ARG_PTR );SYSCALL_DEF (getsid,ARG_DEC ); +SYSCALL_DEF (gettimeofday,ARG_PTR );#ifdef TARGET_NR_getxpidSYSCALL_DEF (getxpid);#endif
@@ -220,6 +221,7 @@ SYSCALL_DEF(setpgid, ARG_DEC, ARG_DEC);SYSCALL_DEF (setrlimit,ARG_DEC ,ARG_PTR );#endif SYSCALL_DEF (setsid); +SYSCALL_DEF (settimeofday,ARG_PTR ,ARG_PTR );#if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semop)SYSCALL_DEF (semop,ARG_DEC ,ARG_PTR ,ARG_DEC );#endif
linux-user/syscall-time.inc.c +33 -0
@@ -16,6 +16,39 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ +SYSCALL_IMPL (gettimeofday) +{ +struct timeval tv; +abi_long ret =get_errno (gettimeofday (&tv,NULL )); + +if (!is_error (ret) &©_to_user_timeval (arg1, &tv)) { +return -TARGET_EFAULT ; + } +return ret; +} + +SYSCALL_IMPL (settimeofday) +{ +struct timeval tv, *ptv =NULL ; +struct timezone tz, *ptz =NULL ; + +if (arg1) { +if (copy_from_user_timeval (&tv, arg1)) { +return -TARGET_EFAULT ; + } + ptv = &tv; + } + +if (arg2) { +if (copy_from_user_timezone (&tz, arg2)) { +return -TARGET_EFAULT ; + } + ptz = &tz; + } + +return get_errno (settimeofday (ptv, ptz)); +} +#ifdef TARGET_NR_stimeSYSCALL_IMPL (stime) {
linux-user/syscall.c +0 -31
@@ -4240,37 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_gettimeofday: - { -struct timeval tv; - ret =get_errno (gettimeofday (&tv,NULL )); -if (!is_error (ret)) { -if (copy_to_user_timeval (arg1, &tv)) -return -TARGET_EFAULT ; - } - } -return ret; -case TARGET_NR_settimeofday: - { -struct timeval tv, *ptv =NULL ; -struct timezone tz, *ptz =NULL ; - -if (arg1) { -if (copy_from_user_timeval (&tv, arg1)) { -return -TARGET_EFAULT ; - } - ptv = &tv; - } - -if (arg2) { -if (copy_from_user_timezone (&tz, arg2)) { -return -TARGET_EFAULT ; - } - ptz = &tz; - } - -return get_errno (settimeofday (ptv, ptz)); - }#if defined(TARGET_NR_select)case TARGET_NR_select:#if defined(TARGET_WANT_NI_OLD_SELECT )
linux-user/strace.list +0 -6
@@ -296,9 +296,6 @@ #ifdef TARGET_NR_gettid { TARGET_NR_gettid, "gettid" , "%s()", NULL, NULL }, #endif -#ifdef TARGET_NR_gettimeofday -{ TARGET_NR_gettimeofday, "gettimeofday" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getuid { TARGET_NR_getuid, "getuid" , "%s()", NULL, NULL }, #endif
@@ -1068,9 +1065,6 @@ #ifdef TARGET_NR_set_tid_address { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_settimeofday -{ TARGET_NR_settimeofday, "settimeofday" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setuid { TARGET_NR_setuid, "setuid" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 68/74 linux-user: Split out select, _newselect
In reply to Richard HendersonThis removes the printing of the fdset outputs. It's hard to see how this could have been reliable in a multi-threaded program, saving syscall arguments to global variables.
--- linux-user/syscall-defs.h | 11 ++++ linux-user/strace.c | 80 ------------------------- linux-user/syscall-file.inc.c | 91 ++++++++++++++++++++++++++++ linux-user/syscall.c | 110 ++++------------------------------ linux-user/strace.list | 6 -- 5 files changed, 112 insertions(+), 186 deletions(-)
linux-user/syscall-defs.h +11 -0
@@ -143,6 +143,10 @@ SYSCALL_DEF(munlockall);SYSCALL_DEF (munmap,ARG_PTR ,ARG_DEC );SYSCALL_DEF (name_to_handle_at,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_PTR ,ARG_ATFLAG ); +#ifdef TARGET_NR__newselect +SYSCALL_DEF_FULL(_newselect, .impl = impl_select, + .arg_type = { ARG_DEC, ARG_PTR, ARG_PTR, ARG_PTR, ARG_PTR }); +#endif #ifdef TARGET_NR_niceSYSCALL_DEF (nice,ARG_DEC );#endif
@@ -209,6 +213,13 @@ SYSCALL_DEF(rt_sigreturn);SYSCALL_DEF (rt_sigsuspend,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_sigtimedwait,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_DEC );SYSCALL_DEF (rt_tgsigqueueinfo,ARG_DEC ,ARG_DEC ,ARG_SIGNAL ,ARG_PTR ); +#ifdef TARGET_NR_select +# if defined(TARGET_WANT_NI_OLD_SELECT ) +SYSCALL_DEF_NOSYS (select); +# else +SYSCALL_DEF_ARGS (select,ARG_DEC ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR ); +# endif +#endif #if !defined(SYSCALL_TABLE ) || defined(TARGET_NR_semctl)SYSCALL_DEF (semctl,ARG_DEC ,ARG_DEC ,ARG_DEC ,ARG_HEX );#endif
linux-user/strace.c +0 -80
92 lines not on this page · raw message
linux-user/syscall-file.inc.c +91 -0
97 lines not on this page · raw message
linux-user/syscall.c +10 -100
140 lines not on this page · raw message
linux-user/strace.list +0 -6
@@ -470,9 +470,6 @@ #ifdef TARGET_NR_newfstatat { TARGET_NR_newfstatat, "newfstatat" , NULL, print_newfstatat, NULL }, #endif -#ifdef TARGET_NR__newselect -{ TARGET_NR__newselect, "_newselect" , NULL, print_newselect, print_syscall_ret_newselect }, -#endif #ifdef TARGET_NR_nfsservctl { TARGET_NR_nfsservctl, "nfsservctl" , NULL, NULL, NULL }, #endif
@@ -962,9 +959,6 @@ #ifdef TARGET_NR_security { TARGET_NR_security, "security" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_select -{ TARGET_NR_select, "select" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_send { TARGET_NR_send, "send" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 69/74 linux-user: Split out pselect6
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-file.inc.c | 96 +++++++++++++++++++++++++++++++ linux-user/syscall.c | 103 ---------------------------------- linux-user/strace.list | 3 - 4 files changed, 97 insertions(+), 106 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -180,6 +180,7 @@ SYSCALL_DEF_FULL(preadv, .impl = impl_preadv, SYSCALL_DEF_FULL(pwritev, .impl = impl_pwritev, .args = args_preadv_pwritev, .arg_type = { ARG_DEC, ARG_PTR, ARG_DEC, ARG_DEC64 }); +SYSCALL_DEF (pselect6,ARG_DEC ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR ,ARG_PTR );SYSCALL_DEF (read,ARG_DEC ,ARG_PTR ,ARG_DEC );#ifdef TARGET_NR_readlinkSYSCALL_DEF (readlink,ARG_STR ,ARG_PTR ,ARG_DEC );
linux-user/syscall-file.inc.c +96 -0
102 lines not on this page · raw message
linux-user/syscall.c +0 -103
109 lines not on this page · raw message
linux-user/strace.list +0 -3
@@ -848,9 +848,6 @@ #ifdef TARGET_NR_profil { TARGET_NR_profil, "profil" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_pselect6 -{ TARGET_NR_pselect6, "pselect6" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_ptrace { TARGET_NR_ptrace, "ptrace" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 70/74 linux-user: Split out symlink, symlinkat
In reply to Richard Henderson--- linux-user/syscall-defs.h | 4 ++++ linux-user/strace.c | 27 --------------------------- linux-user/syscall-file.inc.c | 28 ++++++++++++++++++++++++++++ linux-user/syscall.c | 30 ------------------------------ linux-user/strace.list | 6 ------ 5 files changed, 32 insertions(+), 63 deletions(-)
linux-user/syscall-defs.h +4 -0
@@ -279,6 +279,10 @@ SYSCALL_DEF(ssetmask, ARG_HEX);#ifdef TARGET_NR_stimeSYSCALL_DEF (stime,ARG_PTR );#endif +#ifdef TARGET_NR_symlink +SYSCALL_DEF (symlink,ARG_STR ,ARG_STR ); +#endif +SYSCALL_DEF (symlinkat,ARG_STR ,ARG_ATDIRFD ,ARG_STR );SYSCALL_DEF (sync);SYSCALL_DEF (syncfs,ARG_DEC );#ifdef TARGET_NR_time
linux-user/strace.c +0 -27
@@ -1563,33 +1563,6 @@ print_statfs64(const struct syscallname *name, }#endif -#ifdef TARGET_NR_symlink -static void -print_symlink (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_string (arg1,1 ); -print_syscall_epilogue (name); -} -#endif - -#ifdef TARGET_NR_symlinkat -static void -print_symlinkat (const struct syscallname *name, -abi_long arg0,abi_long arg1,abi_long arg2, -abi_long arg3,abi_long arg4,abi_long arg5) -{ -print_syscall_prologue (name); -print_string (arg0,0 ); -print_at_dirfd (arg1,0 ); -print_string (arg2,1 ); -print_syscall_epilogue (name); -} -#endif -#ifdef TARGET_NR_utimensat static void print_utimensat(const struct syscallname *name,
linux-user/syscall-file.inc.c +28 -0
@@ -1254,6 +1254,34 @@ SYSCALL_IMPL(select) }#endif +static abi_long do_symlinkat (abi_ulong guest_target,int dirfd, +abi_ulong guest_path) +{ +char *target =lock_user_string (guest_target); +char *path =lock_user_string (guest_path); +abi_long ret = -TARGET_EFAULT ; + +if (target && path) { + ret =get_errno (symlinkat (target, dirfd, path)); + } +unlock_user (path, guest_path,0 ); +unlock_user (target, guest_target,0 ); + +return ret; +} + +#ifdef TARGET_NR_symlink +SYSCALL_IMPL (symlink) +{ +return do_symlinkat (arg1,AT_FDCWD , arg2); +} +#endif + +SYSCALL_IMPL (symlinkat) +{ +return do_symlinkat (arg1, arg2, arg3); +} +SYSCALL_IMPL (sync) {sync ();
linux-user/syscall.c +0 -30
@@ -4158,36 +4158,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_symlink -case TARGET_NR_symlink: - { -void *p2; - p =lock_user_string (arg1); - p2 =lock_user_string (arg2); -if (!p || !p2) - ret = -TARGET_EFAULT ; -else - ret =get_errno (symlink (p, p2)); -unlock_user (p2, arg2,0 ); -unlock_user (p, arg1,0 ); - } -return ret; -#endif -#if defined(TARGET_NR_symlinkat) -case TARGET_NR_symlinkat: - { -void *p2; - p =lock_user_string (arg1); - p2 =lock_user_string (arg3); -if (!p || !p2) - ret = -TARGET_EFAULT ; -else - ret =get_errno (symlinkat (p, arg2, p2)); -unlock_user (p2, arg3,0 ); -unlock_user (p, arg1,0 ); - } -return ret; -#endif #ifdef TARGET_NR_swaponcase TARGET_NR_swapon:if (!(p =lock_user_string (arg1)))
linux-user/strace.list +0 -6
@@ -1122,12 +1122,6 @@ #ifdef TARGET_NR_swapon { TARGET_NR_swapon, "swapon" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_symlink -{ TARGET_NR_symlink, "symlink" , NULL, print_symlink, NULL }, -#endif -#ifdef TARGET_NR_symlinkat -{ TARGET_NR_symlinkat, "symlinkat", NULL, print_symlinkat, NULL }, -#endif #ifdef TARGET_NR_syscall { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 71/74 linux-user: Split out swapon, swapoff
In reply to Richard Henderson--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-file.inc.c | 26 ++++++++++++++++++++++++++ linux-user/syscall.c | 16 ---------------- linux-user/strace.list | 6 ------ 4 files changed, 28 insertions(+), 22 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -279,6 +279,8 @@ SYSCALL_DEF(ssetmask, ARG_HEX);#ifdef TARGET_NR_stimeSYSCALL_DEF (stime,ARG_PTR );#endif +SYSCALL_DEF (swapoff,ARG_STR ); +SYSCALL_DEF (swapon,ARG_STR ,ARG_HEX );#ifdef TARGET_NR_symlinkSYSCALL_DEF (symlink,ARG_STR ,ARG_STR );#endif
linux-user/syscall-file.inc.c +26 -0
@@ -1254,6 +1254,32 @@ SYSCALL_IMPL(select) }#endif +SYSCALL_IMPL (swapoff) +{ +char *p =lock_user_string (arg1); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (swapoff (p)); +unlock_user (p, arg1,0 ); +return ret; +} + +SYSCALL_IMPL (swapon) +{ +char *p =lock_user_string (arg1); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (swapon (p, arg2)); +unlock_user (p, arg1,0 ); +return ret; +} +static abi_long do_symlinkat (abi_ulong guest_target,int dirfd,abi_ulong guest_path) {
linux-user/syscall.c +0 -16
@@ -4158,14 +4158,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_swapon -case TARGET_NR_swapon: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (swapon (p, arg2)); -unlock_user (p, arg1,0 ); -return ret; -#endif case TARGET_NR_reboot:if (arg3 ==LINUX_REBOOT_CMD_RESTART2 ) {/* arg4 must be ignored in all other cases */
@@ -4503,14 +4495,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,case TARGET_NR_syscall:return do_syscall (cpu_env, arg1 &0xffff , arg2, arg3, arg4, arg5, arg6, arg7, arg8,0 ); -#endif -#ifdef TARGET_NR_swapoff -case TARGET_NR_swapoff: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (swapoff (p)); -unlock_user (p, arg1,0 ); -return ret;#endif case TARGET_NR_sysinfo: {
linux-user/strace.list +0 -6
@@ -1116,12 +1116,6 @@ #ifdef TARGET_NR_swapcontext { TARGET_NR_swapcontext, "swapcontext" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_swapoff -{ TARGET_NR_swapoff, "swapoff" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_swapon -{ TARGET_NR_swapon, "swapon" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_syscall { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 72/74 linux-user: Split out reboot
In reply to Richard Henderson--- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 18 ++++++++++++++++++ linux-user/syscall.c | 13 ------------- linux-user/strace.list | 3 --- 4 files changed, 19 insertions(+), 16 deletions(-)
linux-user/syscall-defs.h +1 -0
@@ -188,6 +188,7 @@ SYSCALL_DEF(readlink, ARG_STR, ARG_PTR, ARG_DEC);#ifdef TARGET_NR_readlinkatSYSCALL_DEF (readlinkat,ARG_ATDIRFD ,ARG_STR ,ARG_PTR ,ARG_DEC );#endif +SYSCALL_DEF (reboot,ARG_HEX ,ARG_HEX ,ARG_DEC ,ARG_PTR );#ifdef TARGET_NR_renameSYSCALL_DEF (rename,ARG_STR ,ARG_STR );#endif
linux-user/syscall-proc.inc.c +18 -0
@@ -532,6 +532,24 @@ SYSCALL_IMPL(nice) }#endif +SYSCALL_IMPL (reboot) +{ +abi_long ret; + +if (arg3 ==LINUX_REBOOT_CMD_RESTART2 ) { +/* arg4 must be ignored in all other cases */ +char *p =lock_user_string (arg4); +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (reboot (arg1, arg2, arg3, p)); +unlock_user (p, arg4,0 ); + }else { + ret =get_errno (reboot (arg1, arg2, arg3,NULL )); + } +return ret; +} +SYSCALL_IMPL (sethostname) {void *p =lock_user_string (arg1);
linux-user/syscall.c +0 -13
@@ -4158,19 +4158,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_reboot: -if (arg3 ==LINUX_REBOOT_CMD_RESTART2 ) { -/* arg4 must be ignored in all other cases */ - p =lock_user_string (arg4); -if (!p) { -return -TARGET_EFAULT ; - } - ret =get_errno (reboot (arg1, arg2, arg3, p)); -unlock_user (p, arg4,0 ); - }else { - ret =get_errno (reboot (arg1, arg2, arg3,NULL )); - } -return ret;#ifdef TARGET_NR_truncatecase TARGET_NR_truncate:if (!(p =lock_user_string (arg1)))
linux-user/strace.list +0 -3
@@ -866,9 +866,6 @@ #ifdef TARGET_NR_readdir { TARGET_NR_readdir, "readdir" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_reboot -{ TARGET_NR_reboot, "reboot" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_recv { TARGET_NR_recv, "recv" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 73/74 linux-user: Split out truncate, truncate64, ftruncate, ftruncate64
In reply to Richard Henderson--- linux-user/syscall-defs.h | 16 +++++++++++++++ linux-user/syscall-file.inc.c | 32 +++++++++++++++++++++++++++++ linux-user/syscall.c | 38 ----------------------------------- linux-user/strace.list | 12 ----------- 4 files changed, 48 insertions(+), 50 deletions(-)
linux-user/syscall-defs.h +16 -0
@@ -59,6 +59,14 @@ SYSCALL_DEF(futimesat, ARG_ATDIRFD, ARG_STR, ARG_PTR);#ifdef TARGET_NR_forkSYSCALL_DEF (fork);#endif +#ifdef TARGET_NR_ftruncate +SYSCALL_DEF (ftruncate,ARG_DEC ,ARG_DEC ); +#endif +#ifdef TARGET_NR_ftruncate64 +SYSCALL_DEF_FULL(ftruncate64, .impl = impl_ftruncate, + .args = args_ftruncate64_truncate64, + .arg_type = { ARG_DEC, ARG_DEC64 }); +#endif #ifdef TARGET_NR_gethostnameSYSCALL_DEF (gethostname,ARG_PTR ,ARG_DEC );#endif
@@ -292,6 +300,14 @@ SYSCALL_DEF(syncfs, ARG_DEC);SYSCALL_DEF (time,ARG_PTR );#endif SYSCALL_DEF (times,ARG_PTR ); +#ifdef TARGET_NR_truncate +SYSCALL_DEF (truncate,ARG_STR ,ARG_DEC ); +#endif +#ifdef TARGET_NR_truncate64 +SYSCALL_DEF_FULL(truncate64, .impl = impl_truncate, + .args = args_ftruncate64_truncate64, + .arg_type = { ARG_STR, ARG_DEC64 }); +#endif SYSCALL_DEF (umask,ARG_OCT );#ifdef TARGET_NR_umountSYSCALL_DEF (umount,ARG_STR );
linux-user/syscall-file.inc.c +32 -0
@@ -182,6 +182,25 @@ SYSCALL_IMPL(fchmodat)return do_fchmodat (arg1, arg2, arg3); } +#ifdef TARGET_NR_ftruncate64 +# if TARGET_ABI_BITS ==32 +SYSCALL_ARGS (ftruncate64_truncate64) +{ +/* We have already assigned out[0]. */ +int off =regpairs_aligned (cpu_env, TARGET_NR_ftruncate64); + out[1 ] =target_offset64 (in[1 + off], in[2 + off]); +return def; +} +# else +# define args_ftruncate64_truncate64 NULL +# endif +#endif + +SYSCALL_IMPL (ftruncate) +{ +return get_errno (ftruncate (arg1, arg2)); +} +#ifdef TARGET_NR_futimesatSYSCALL_IMPL (futimesat) {
@@ -1319,6 +1338,19 @@ SYSCALL_IMPL(syncfs)return get_errno (syncfs (arg1)); } +SYSCALL_IMPL (truncate) +{ +char *p =lock_user_string (arg1); +abi_long ret; + +if (!p) { +return -TARGET_EFAULT ; + } + ret =get_errno (truncate (p, arg2)); +unlock_user (p, arg1,0 ); +return ret; +} +static abi_long do_umount2 (abi_ulong target_path,int flags) {char *p =lock_user_string (target_path);
linux-user/syscall.c +0 -38
@@ -3721,20 +3721,6 @@ static inline abi_long target_truncate64(void *cpu_env, const char *arg1, }#endif -#ifdef TARGET_NR_ftruncate64 -static inline abi_long target_ftruncate64 (void *cpu_env,abi_long arg1, -abi_long arg2, -abi_long arg3, -abi_long arg4) -{ -if (regpairs_aligned (cpu_env, TARGET_NR_ftruncate64)) { - arg2 = arg3; - arg3 = arg4; - } -return get_errno (ftruncate64 (arg1,target_offset64 (arg2, arg3))); -} -#endif -static inline abi_long target_to_host_timespec (struct timespec *host_ts,abi_ulong target_addr) {
@@ -4158,18 +4144,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -#ifdef TARGET_NR_truncate -case TARGET_NR_truncate: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =get_errno (truncate (p, arg2)); -unlock_user (p, arg1,0 ); -return ret; -#endif -#ifdef TARGET_NR_ftruncate -case TARGET_NR_ftruncate: -return get_errno (ftruncate (arg1, arg2)); -#endif case TARGET_NR_getpriority:/* Note that negative values are valid for getpriority, so we must differentiate based on errno settings. */
@@ -5371,18 +5345,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,return ret; }#endif -#ifdef TARGET_NR_truncate64 -case TARGET_NR_truncate64: -if (!(p =lock_user_string (arg1))) -return -TARGET_EFAULT ; - ret =target_truncate64 (cpu_env, p, arg2, arg3, arg4); -unlock_user (p, arg1,0 ); -return ret; -#endif -#ifdef TARGET_NR_ftruncate64 -case TARGET_NR_ftruncate64: -return target_ftruncate64 (cpu_env, arg1, arg2, arg3, arg4); -#endif #ifdef TARGET_NR_stat64case TARGET_NR_stat64:if (!(p =lock_user_string (arg1))) {
linux-user/strace.list +0 -12
@@ -193,12 +193,6 @@ #ifdef TARGET_NR_ftime { TARGET_NR_ftime, "ftime" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_ftruncate -{ TARGET_NR_ftruncate, "ftruncate" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_ftruncate64 -{ TARGET_NR_ftruncate64, "ftruncate64" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_futex { TARGET_NR_futex, "futex" , NULL, print_futex, NULL }, #endif
@@ -1173,12 +1167,6 @@ #ifdef TARGET_NR_tkill { TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL }, #endif -#ifdef TARGET_NR_truncate -{ TARGET_NR_truncate, "truncate" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_truncate64 -{ TARGET_NR_truncate64, "truncate64" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_tuxcall { TARGET_NR_tuxcall, "tuxcall" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
PATCH v7 74/74 linux-user: Split out getpriority, setpriority
In reply to Richard Henderson--- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-proc.inc.c | 28 ++++++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 6 ------ 4 files changed, 30 insertions(+), 24 deletions(-)
linux-user/syscall-defs.h +2 -0
@@ -80,6 +80,7 @@ SYSCALL_DEF(getpid);#ifdef TARGET_NR_getppidSYSCALL_DEF (getppid);#endif +SYSCALL_DEF (getpriority,ARG_DEC ,ARG_DEC );#ifdef TARGET_NR_getrlimitSYSCALL_DEF (getrlimit,ARG_DEC ,ARG_PTR );#endif
@@ -238,6 +239,7 @@ SYSCALL_DEF(semget, ARG_DEC, ARG_DEC, ARG_HEX);#endif SYSCALL_DEF (sethostname,ARG_STR );SYSCALL_DEF (setpgid,ARG_DEC ,ARG_DEC ); +SYSCALL_DEF (setpriority,ARG_DEC ,ARG_DEC ,ARG_DEC );#ifdef TARGET_NR_setrlimitSYSCALL_DEF (setrlimit,ARG_DEC ,ARG_PTR );#endif
linux-user/syscall-proc.inc.c +28 -0
@@ -479,6 +479,29 @@ SYSCALL_IMPL(getppid) }#endif +SYSCALL_IMPL (getpriority) +{ +abi_long ret; + +/* +* Note that negative values are valid for getpriority, so we must +* differentiate based on errno settings. +*/ + errno =0 ; + ret =getpriority (arg1, arg2); +if (ret ==-1 && errno !=0 ) { +return -host_to_target_errno (errno); + } +#ifdef TARGET_ALPHA +/* Return value is the unbiased priority. Signal no error. */ + ((CPUAlphaState *)cpu_env)->ir[IR_V0 ] =0 ; +#else +/* Return value is a biased priority to avoid negative numbers. */ + ret =20 - ret; +#endif +return ret; +} +#ifdef TARGET_NR_getrlimitSYSCALL_IMPL (getrlimit) {
@@ -568,6 +591,11 @@ SYSCALL_IMPL(setpgid)return get_errno (setpgid (arg1, arg2)); } +SYSCALL_IMPL (setpriority) +{ +return get_errno (setpriority (arg1, arg2, arg3)); +} +#ifdef TARGET_NR_setrlimitSYSCALL_IMPL (setrlimit) {
linux-user/syscall.c +0 -18
@@ -4144,24 +4144,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,void *p;switch (num) { -case TARGET_NR_getpriority: -/* Note that negative values are valid for getpriority, so we must -differentiate based on errno settings. */ - errno =0 ; - ret =getpriority (arg1, arg2); -if (ret ==-1 && errno !=0 ) { -return -host_to_target_errno (errno); - } -#ifdef TARGET_ALPHA -/* Return value is the unbiased priority. Signal no error. */ - ((CPUAlphaState *)cpu_env)->ir[IR_V0 ] =0 ; -#else -/* Return value is a biased priority to avoid negative numbers. */ - ret =20 - ret; -#endif -return ret; -case TARGET_NR_setpriority: -return get_errno (setpriority (arg1, arg2, arg3));#ifdef TARGET_NR_statfscase TARGET_NR_statfs:if (!(p =lock_user_string (arg1))) {
linux-user/strace.list +0 -6
@@ -256,9 +256,6 @@ #ifdef TARGET_NR_getpmsg { TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getpriority -{ TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL }, -#endif #ifdef TARGET_NR_getrandom { TARGET_NR_getrandom, "getrandom", NULL, NULL, NULL }, #endif
@@ -1007,9 +1004,6 @@ #ifdef TARGET_NR_setpgrp { TARGET_NR_setpgrp, "setpgrp" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_setpriority -{ TARGET_NR_setpriority, "setpriority" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setregid { TARGET_NR_setregid, "setregid" , NULL, NULL, NULL }, #endif
Signature · 1 line
2.17.1
Quoted 16 lines · Richard Henderson
Based-on: <[email protected]> Aka "linux-user: path, clone, sparc, shmat fixes"
Version 6 was
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg04794.htmlSince v5, I've fixed the ioctl failure that Laurent found, and have done a few more syscalls.
I've tried to do more testing with LTP, but it's a really annoying testsuite. There are at least 3 tests that hang forever (before and after this patch set), and the host kernel's OOM handler kills my login session, ending the test run. This seems to be different behaviour than I was seeing in January, when I did have test runs that completed successfully.
Quoted 7 lines
OTOH, looking back at the v6 cover letter, I now see that I was testing armhf and i386 as guests, whereas this time I was trying aarch64 and ppc64 as guests. 32-bit guests unable to trigger the host OOM killer?
Laurent, is there anything special that you're doing to see these tests run to completion?
I'm running them in a container ('unshare chroot') and aarch64 needs a patch that hasn't been merged:
"[PATCH] linux-user: check valid address in access_ok()"
https://patchew.org/QEMU/[email protected]/
I have a skipfile that contains:
futex_wait03
mmap13
mmap16
msgctl10
msgctl11
ptrace01
ptrace02
ptrace03
ptrace05remap_file_pages01remap_file_pages02
sendmsg01
fork13
fork14
creat07
mremap03
but I didn't update it for a while.
I will test as soon as possible your series in my environment.
Thanks,
Laurent
Quoted 10 lines · Richard Henderson
Based-on: <[email protected]> Aka "linux-user: path, clone, sparc, shmat fixes"
Version 6 was
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg04794.htmlSince v5, I've fixed the ioctl failure that Laurent found, and have done a few more syscalls.
Quoted 6 lines
I've tried to do more testing with LTP, but it's a really annoying testsuite. There are at least 3 tests that hang forever (before and after this patch set), and the host kernel's OOM handler kills my login session, ending the test run. This seems to be different behaviour than I was seeing in January, when I did have test runs that completed successfully.
If these are different from the ones we're already skipping in the skiplist documented at https://wiki.qemu.org/Testing/LTP
we should update that wiki page to also skip these new hanging-tests (and whatever it is that eats all the memory).
thanks
-- PMM
Quoted 20 lines · Peter Maydell
Quoted 10 lines · Richard Henderson
Based-on: <[email protected]> Aka "linux-user: path, clone, sparc, shmat fixes"
Version 6 was
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg04794.htmlSince v5, I've fixed the ioctl failure that Laurent found, and have done a few more syscalls.
Quoted 6 lines
I've tried to do more testing with LTP, but it's a really annoying testsuite. There are at least 3 tests that hang forever (before and after this patch set), and the host kernel's OOM handler kills my login session, ending the test run. This seems to be different behaviour than I was seeing in January, when I did have test runs that completed successfully.
Quoted 5 lines
If these are different from the ones we're already skipping in the skiplist documented at https://wiki.qemu.org/Testing/LTP
we should update that wiki page to also skip these new hanging-tests (and whatever it is that eats all the memory).
Peter, yes, it is definitely different. It has been a moving target lately. May I suggest that we use a stable version of QEMU, and a stable version of LTP, and create a skiplist for such stable configuration, include it in the docs, explicitely noting used versions? We can continue doing that for each QEMU release and whatever the latest LTP would be at the moment of that QEMU release (maybe even keeping the previous skiplists - which could be useful for debugging).
Regards,
Aleksandar
Quoted 3 lines
thanks
-- PMM
Quoted 17 lines · Richard Henderson
Based-on: <[email protected]> Aka "linux-user: path, clone, sparc, shmat fixes"
Version 6 was
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg04794.htmlSince v5, I've fixed the ioctl failure that Laurent found, and have done a few more syscalls.
I've tried to do more testing with LTP, but it's a really annoying testsuite. There are at least 3 tests that hang forever (before and after this patch set), and the host kernel's OOM handler kills my login session, ending the test run. This seems to be different behaviour than I was seeing in January, when I did have test runs that completed successfully.
Quoted 8 lines
OTOH, looking back at the v6 cover letter, I now see that I was testing armhf and i386 as guests, whereas this time I was trying aarch64 and ppc64 as guests. 32-bit guests unable to trigger the host OOM killer?
Laurent, is there anything special that you're doing to see these tests run to completion?
On surface, this series looks to be a refactoring series. However, this is not the case: burried in various patches, are removals of some features visible to the end user. Can you please list all such cases in the cover letter, so that they can be easier identified and evaluated by reviewers?
Thanks,
Aleksandar
Quoted 110 lines
r~
Richard Henderson (74):
linux-user: Setup split syscall infrastructure
linux-user: Split out open,open_at
linux-user: Share more code for open and openat
linux-user: Tidydo_openatloop over fakes
linux-user: Split out readlink, readlinkat
linux-user: Split out close
linux-user: Split out read, write
linux-user: Reduceregpairs_aligned&target_offset64ifdefs
linux-user: Split out readv, writev
linux-user: Split out pread64, pwrite64
linux-user: Split out preadv, pwritev
linux-user: Split outname_to_handle_at,open_by_handle_at
linux-user: Split out ipc syscalls
linux-user: Split out memory syscalls
linux-user: Split out exit
linux-user: Split out brk
linux-user: Split out clone, fork, vfork
linux-user: Split out wait4, waitid, waitpid
linux-user: Implement rusage argument to waitid
linux-user: Split out creat
linux-user: Split out link, linkat
linux-user: Split out unlink, unlinkat, rmdir
linux-user: Split out execve
linux-user: Implement execveat
linux-user: Split out chdir
linux-user: Split out time
linux-user: Split out mknod, mknodat
linux-user: Split out chmod, fchmod, fchmodat
linux-user: Split out lseek, llseek
linux-user: Split out getpid, getppid, getxpid
linux-user: Split out mount
linux-user: Split out umount, umount2
linux-user: Split out stime
linux-user: Split out alarm, pause
linux-user: Split out utime, utimes, futimesat
linux-user: Split out access, faccessat
linux-user: Split out nice
linux-user: Split out sync, syncfs
linux-user: Split out kill
linux-user: Split out rename, renameat, renameat2
linux-user: Split out mkdir, mkdirat
linux-user: Split out dup, dup2, dup3
linux-user: Split out pipe, pipe2
linux-user: Split out times
linux-user: Split out acct
linux-user: Movesyscall_initto the end
linux-user: Split out ioctl
linux-user: Fix types in ioctl logging
linux-user: Remove sentinel fromioctl_entries
linux-user: Split out fcntl, fcntl64
linux-user: Split out setpgid
linux-user: Split out umask
linux-user: Split out chroot
linux-user: Split out getpgid, getpgrp
linux-user: Split out getsid, setsid
linux-user: Split out sigaction,rt_sigaction
linux-user: Split out sgetmask, ssetmask
linux-user: Split out sigprocmask,rt_sigprocmask
linux-user: Split out sigpending,rt_sigpending
linux-user: Split out sigsuspend,rt_sigsuspend
linux-user: Split outrt_sigtimedwait
linux-user: Split outrt_sigqueueinfo,rt_tgsigqueueinfo
linux-user: Split out sigreturn,rt_sigreturn
linux-user: Split out gethostname, sethostname
linux-user: Split out getrlimit, setrlimit
linux-user: Split out getrusage
linux-user: Split out gettimeofday, settimeofday
linux-user: Split out select,_newselect
linux-user: Split out pselect6
linux-user: Split out symlink, symlinkat
linux-user: Split out swapon, swapoff
linux-user: Split out reboot
linux-user: Split out truncate, truncate64, ftruncate, ftruncate64
linux-user: Split out getpriority, setprioritylinux-user/syscall-defs.h | 338 +++ linux-user/syscall.h | 103 + linux-user/strace.c | 1569 +++------- linux-user/syscall-fcntl.inc.c | 322 ++ linux-user/syscall-file.inc.c | 1526 ++++++++++ linux-user/syscall-ioctl.inc.c | 873 ++++++ linux-user/syscall-ipc.inc.c | 1088 +++++++ linux-user/syscall-mem.inc.c | 244 ++ linux-user/syscall-proc.inc.c | 758 +++++ linux-user/syscall-sig.inc.c | 549 ++++ linux-user/syscall-time.inc.c | 77 + linux-user/syscall.c | 5045 ++------------------------------ configure | 20 - linux-user/strace.list | 414 --- 14 files changed, 6512 insertions(+), 6414 deletions(-) create mode 100644 linux-user/syscall-defs.h create mode 100644 linux-user/syscall.h create mode 100644 linux-user/syscall-fcntl.inc.c create mode 100644 linux-user/syscall-file.inc.c create mode 100644 linux-user/syscall-ioctl.inc.c create mode 100644 linux-user/syscall-ipc.inc.c create mode 100644 linux-user/syscall-mem.inc.c create mode 100644 linux-user/syscall-proc.inc.c create mode 100644 linux-user/syscall-sig.inc.c create mode 100644 linux-user/syscall-time.inc.c--
2.17.1
A message that is not in the archive (sent off-list or not yet received): CAL1e-=i_=EQ02A1DGmVgqNi1ik=h39FZTOsxkGWfMa4ZoM6rjg@mail.gmail.com
[Adding the mailing list back in.]
Quoted 11 lines · Aleksandar Markovic
Quoted 7 lines
Quoted 7 lines
Version 6 was
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg04794.htmlSince v5, I've fixed the ioctl failure that Laurent found, and have done a few more syscalls.
I've tried to do more testing with LTP....
Running LTP is certainly a very important way of testing this series. However, it is not sufficient. This is because this series completely replaces internal QEMU strace mechanism for involved system calls,
What you missed because of the very large time lag between iterations, and because I was lazy and only referenced v6 in this cover letter, is that in an early revision the major objection was that I *wasn't* replacing strace, and thus we were retaining lots of duplicate logic in multiple places.
Quoted 4 lines
and any bug in such
replacement would not be captured by LTP results. How did you test new strace bits and peaces? Can you provide logs of such tests (for example, before/after comparisons of strace output for relevant system calls, or similar)?
My strace testing is totally ad-hoc. Run something with -strace and eyeball it.
Here are before/after logs for busybox ls (aka linux-user-test-0.3, which has for some reason vanished from the qemu wiki?) for alpha-linux-user.
657 uname(0x40008014b8) = 0
657 brk(NULL) = 0x000000012006a000
657 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
657 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x000000400082e000
657 access("/etc/ld.so.preload",R_OK) = -1 errno=2 (No such file or directory)
657 open("/etc/ld.so.cache",O_RDONLY) = 3
657 fstat64(3,0x0000004000800c30) = 0
657 close(3) = 0
657 open("/lib/tls/libc.so.6.1",O_RDONLY) = -1 errno=2 (No such file or directory)
657 stat64("/lib/tls",0x0000004000800bb0) = -1 errno=2 (No such file or directory)
657 open("/lib/libc.so.6.1",O_RDONLY) = 3
657 read(3,0x800da8,640) = 640
657 fstat64(3,0x0000004000800c30) = 0
657 mmap(NULL,927824,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x0000004000830000
657 mprotect(0x00000040008f2000,133200,PROT_NONE) = 0
657 mmap(0x0000004000902000,65536,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0xc2000) = 0x0000004000902000 657 mmap(0x0000004000912000,2128,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x0000004000912000 657 close(3) = 0
657 mprotect(0x000000400082a000,8192,PROT_READ) = 0
657 getxuid(274886302098,4832112143,77,24,4831859744,274886356864) = 1000
657 getxgid(274886302098,4832112143,77,0,1000,274886356864) = 1000
657 setgid(1000,4832112143,77,0,1000,274886356864) = 0
657 setuid(1000,4832112143,77,0,1000,274886356864) = 0
657 ioctl(1,1074295912,274886301072,0,1000,274886356864) = 0
657 lstat64("dummyfile",0x0000004000801510) = 0
657 brk(NULL) = 0x000000012006a000
657 brk(0x000000012008c000) = 0x000000012008c000
657 open("/etc/localtime",O_RDONLY) = 3
657 fstat64(3,0x0000004000801360) = 0
657 fstat64(3,0x00000040008011f0) = 0
657 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x0000004000914000
657 read(3,0x914000,4096) = 3545
657 close(3) = 0
657 munmap(0x0000004000914000,8192) = 0
657 fstat64(1,0x0000004000800c70) = 0
657 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x0000004000916000
657 open("/etc/passwd",O_RDONLY) = 3
657 fstat64(3,0x0000004000801290) = 0
657 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x0000004000918000
657 read(3,0x918000,4096) = 2727
657 close(3) = 0
657 munmap(0x0000004000918000,8192) = 0
657 open("/etc/group",O_RDONLY) = 3
657 fstat64(3,0x0000004000801290) = 0
657 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x000000400091a000
657 read(3,0x91a000,4096) = 1043
657 close(3) = 0
657 munmap(0x000000400091a000,8192) = 0
657 gettimeofday(274886300912,0,1,0,103,1024) = 0
657 write(1,0x916000,66) = 66
657 munmap(0x0000004000916000,8192) = 0
657 exit_group(0)
17862 uname(0x40008014b8) = 0
17862 brk(NULL) = 0x000000012006a000
17862 access("/etc/ld.so.nohwcap", F_OK) = -1 errno=2 (No such file or directory)
17862 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x000000400082e000
17862 access("/etc/ld.so.preload", R_OK) = -1 errno=2 (No such file or directory)
17862 open("/etc/ld.so.cache", O_RDONLY, 01) = 3
17862 fstat64(3,0x0000004000800c30) = 0
17862 close(3) = 0
17862 open("/lib/tls/libc.so.6.1", O_RDONLY, 014) = -1 errno=2 (No such file or directory)
17862 stat64("/lib/tls",0x0000004000800bb0) = -1 errno=2 (No such file or directory)
17862 open("/lib/libc.so.6.1", O_RDONLY, 014) = 3
17862 read(3, 0x0000004000800da8, 640) = 640
17862 fstat64(3,0x0000004000800c30) = 0
17862 mmap(NULL, 927824, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x0000004000830000
17862 mprotect(0x00000040008f2000, 133200, PROT_NONE) = 0
17862 mmap(0x0000004000902000, 65536, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, 3, 794624) = 0x0000004000902000 17862 mmap(0x0000004000912000, 2128, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0) = 0x0000004000912000 17862 close(3) = 0
17862 mprotect(0x000000400082a000, 8192, PROT_READ) = 0
17862 getxuid(274886302098,4832112143,77,24,4831859744,274886356864) = 1000
17862 getxgid(274886302098,4832112143,77,0,1000,274886356864) = 1000
17862 setgid(1000,4832112143,77,0,1000,274886356864) = 0
17862 setuid(1000,4832112143,77,0,1000,274886356864) = 0
17862 ioctl(1, 40087468) = 0
17862 lstat64("dummyfile",0x0000004000801510) = 0
17862 brk(NULL) = 0x000000012006a000
17862 brk(0x000000012008c000) = 0x000000012008c000
17862 open("/etc/localtime", O_RDONLY, 0666) = 3
17862 fstat64(3,0x0000004000801360) = 0
17862 fstat64(3,0x00000040008011f0) = 0
17862 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x0000004000914000
17862 read(3, 0x0000004000914000, 4096) = 3545
17862 close(3) = 0
17862 munmap(0x0000004000914000, 8192) = 0
17862 fstat64(1,0x0000004000800c70) = 0
17862 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x0000004000916000
17862 open("/etc/passwd", O_RDONLY, 0666) = 3
17862 fstat64(3,0x0000004000801290) = 0
17862 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x0000004000918000
17862 read(3, 0x0000004000918000, 4096) = 2727
17862 close(3) = 0
17862 munmap(0x0000004000918000, 8192) = 0
17862 open("/etc/group", O_RDONLY, 0666) = 3
17862 fstat64(3,0x0000004000801290) = 0
17862 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x000000400091a000
17862 read(3, 0x000000400091a000, 4096) = 1043
17862 close(3) = 0
17862 munmap(0x000000400091a000, 8192) = 0
17862 gettimeofday(0x00000040008014f0) = 0
17862 write(1, 0x0000004000916000, 66) = 66
17862 munmap(0x0000004000916000, 8192) = 0
17862 exit_group(0)