* [Qemu-devel] [PATCH 0/7] linux-user syscall fixes @ 2009-07-24 17:10 Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Ulrich Hecht 0 siblings, 1 reply; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio Couple of syscall issues I ran into while using LTP to test my s390x target. Ulrich Hecht (7): linux-user: dup3, fallocate syscalls linux-user: fcntl fixes for LTP linux-user: enable getdents for > 32-bit systems linux-user: define a couple of syscalls for non-uid16 targets linux-user: getpriority errno fix linux-user: fadvise64 implementation linux-user: zero fstat buffer to initialize nsec fields configure | 18 ++++ linux-user/syscall.c | 195 +++++++++++++++++++++++++++++++++++---------- linux-user/syscall_defs.h | 7 ++ 3 files changed, 179 insertions(+), 41 deletions(-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls 2009-07-24 17:10 [Qemu-devel] [PATCH 0/7] linux-user syscall fixes Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 2/7] linux-user: fcntl fixes for LTP Ulrich Hecht 2009-07-25 22:37 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Jan-Simon Möller 0 siblings, 2 replies; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio implementations of dup3 and fallocate that are good enough to fool LTP Signed-off-by: Ulrich Hecht <uli@suse.de> --- configure | 18 ++++++++++++++++++ linux-user/syscall.c | 10 ++++++++++ 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 09c8443..68a18f5 100755 --- a/configure +++ b/configure @@ -1371,6 +1371,21 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then splice=yes fi +# check for fallocate +fallocate=no +cat > $TMPC << EOF +#include <fcntl.h> + +int main(void) +{ + fallocate(0, 0, 0, 0); + return 0; +} +EOF +if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then + fallocate=yes +fi + # Check if tools are available to build documentation. if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then build_docs="no" @@ -1720,6 +1735,9 @@ fi if test "$splice" = "yes" ; then echo "#define CONFIG_SPLICE 1" >> $config_host_h fi +if test "$fallocate" = "yes" ; then + echo "#define CONFIG_FALLOCATE 1" >> $config_host_h +fi if test "$inotify" = "yes" ; then echo "#define CONFIG_INOTIFY 1" >> $config_host_h fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ca57dd9..b03e879 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4723,6 +4723,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_NR_dup2: ret = get_errno(dup2(arg1, arg2)); break; +#ifdef TARGET_NR_dup3 + case TARGET_NR_dup3: + ret = get_errno(dup3(arg1, arg2, arg3)); + break; +#endif #ifdef TARGET_NR_getppid /* not on alpha */ case TARGET_NR_getppid: ret = get_errno(getppid()); @@ -6975,6 +6980,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif #endif /* CONFIG_SPLICE */ +#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate) + case TARGET_NR_fallocate: + ret = get_errno(fallocate(arg1, arg2, arg3, arg4)); + break; +#endif default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num); -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 2/7] linux-user: fcntl fixes for LTP 2009-07-24 17:10 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 3/7] linux-user: enable getdents for > 32-bit systems Ulrich Hecht 2009-07-25 22:37 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Jan-Simon Möller 1 sibling, 1 reply; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio Fixes swaps on l_pid which were pretty much of random size. Implements F_SETLEASE, F_GETLEASE. Now passes all LTP fcntl tests. Signed-off-by: Ulrich Hecht <uli@suse.de> --- linux-user/syscall.c | 34 ++++++++++++++++++++++------------ linux-user/syscall_defs.h | 7 +++++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b03e879..d9c4af0 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3678,6 +3678,14 @@ static int target_to_host_fcntl_cmd(int cmd) case TARGET_F_SETLKW64: return F_SETLKW64; #endif + case TARGET_F_SETLEASE: + return F_SETLEASE; + case TARGET_F_GETLEASE: + return F_GETLEASE; + case TARGET_F_DUPFD_CLOEXEC: + return F_DUPFD_CLOEXEC; + case TARGET_F_NOTIFY: + return F_NOTIFY; default: return -TARGET_EINVAL; } @@ -3704,7 +3712,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) fl.l_whence = tswap16(target_fl->l_whence); fl.l_start = tswapl(target_fl->l_start); fl.l_len = tswapl(target_fl->l_len); - fl.l_pid = tswapl(target_fl->l_pid); + fl.l_pid = tswap32(target_fl->l_pid); unlock_user_struct(target_fl, arg, 0); ret = get_errno(fcntl(fd, host_cmd, &fl)); if (ret == 0) { @@ -3714,7 +3722,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) target_fl->l_whence = tswap16(fl.l_whence); target_fl->l_start = tswapl(fl.l_start); target_fl->l_len = tswapl(fl.l_len); - target_fl->l_pid = tswapl(fl.l_pid); + target_fl->l_pid = tswap32(fl.l_pid); unlock_user_struct(target_fl, arg, 1); } break; @@ -3727,7 +3735,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) fl.l_whence = tswap16(target_fl->l_whence); fl.l_start = tswapl(target_fl->l_start); fl.l_len = tswapl(target_fl->l_len); - fl.l_pid = tswapl(target_fl->l_pid); + fl.l_pid = tswap32(target_fl->l_pid); unlock_user_struct(target_fl, arg, 0); ret = get_errno(fcntl(fd, host_cmd, &fl)); break; @@ -3739,7 +3747,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) fl64.l_whence = tswap16(target_fl64->l_whence); fl64.l_start = tswapl(target_fl64->l_start); fl64.l_len = tswapl(target_fl64->l_len); - fl64.l_pid = tswap16(target_fl64->l_pid); + fl64.l_pid = tswap32(target_fl64->l_pid); unlock_user_struct(target_fl64, arg, 0); ret = get_errno(fcntl(fd, host_cmd, &fl64)); if (ret == 0) { @@ -3749,7 +3757,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) target_fl64->l_whence = tswap16(fl64.l_whence); target_fl64->l_start = tswapl(fl64.l_start); target_fl64->l_len = tswapl(fl64.l_len); - target_fl64->l_pid = tswapl(fl64.l_pid); + target_fl64->l_pid = tswap32(fl64.l_pid); unlock_user_struct(target_fl64, arg, 1); } break; @@ -3761,7 +3769,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) fl64.l_whence = tswap16(target_fl64->l_whence); fl64.l_start = tswapl(target_fl64->l_start); fl64.l_len = tswapl(target_fl64->l_len); - fl64.l_pid = tswap16(target_fl64->l_pid); + fl64.l_pid = tswap32(target_fl64->l_pid); unlock_user_struct(target_fl64, arg, 0); ret = get_errno(fcntl(fd, host_cmd, &fl64)); break; @@ -3781,6 +3789,8 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) case TARGET_F_GETOWN: case TARGET_F_SETSIG: case TARGET_F_GETSIG: + case TARGET_F_SETLEASE: + case TARGET_F_GETLEASE: ret = get_errno(fcntl(fd, host_cmd, arg)); break; @@ -6601,7 +6611,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, fl.l_whence = tswap16(target_efl->l_whence); fl.l_start = tswap64(target_efl->l_start); fl.l_len = tswap64(target_efl->l_len); - fl.l_pid = tswapl(target_efl->l_pid); + fl.l_pid = tswap32(target_efl->l_pid); unlock_user_struct(target_efl, arg3, 0); } else #endif @@ -6612,7 +6622,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, fl.l_whence = tswap16(target_fl->l_whence); fl.l_start = tswap64(target_fl->l_start); fl.l_len = tswap64(target_fl->l_len); - fl.l_pid = tswapl(target_fl->l_pid); + fl.l_pid = tswap32(target_fl->l_pid); unlock_user_struct(target_fl, arg3, 0); } ret = get_errno(fcntl(arg1, cmd, &fl)); @@ -6625,7 +6635,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, target_efl->l_whence = tswap16(fl.l_whence); target_efl->l_start = tswap64(fl.l_start); target_efl->l_len = tswap64(fl.l_len); - target_efl->l_pid = tswapl(fl.l_pid); + target_efl->l_pid = tswap32(fl.l_pid); unlock_user_struct(target_efl, arg3, 1); } else #endif @@ -6636,7 +6646,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, target_fl->l_whence = tswap16(fl.l_whence); target_fl->l_start = tswap64(fl.l_start); target_fl->l_len = tswap64(fl.l_len); - target_fl->l_pid = tswapl(fl.l_pid); + target_fl->l_pid = tswap32(fl.l_pid); unlock_user_struct(target_fl, arg3, 1); } } @@ -6652,7 +6662,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, fl.l_whence = tswap16(target_efl->l_whence); fl.l_start = tswap64(target_efl->l_start); fl.l_len = tswap64(target_efl->l_len); - fl.l_pid = tswapl(target_efl->l_pid); + fl.l_pid = tswap32(target_efl->l_pid); unlock_user_struct(target_efl, arg3, 0); } else #endif @@ -6663,7 +6673,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, fl.l_whence = tswap16(target_fl->l_whence); fl.l_start = tswap64(target_fl->l_start); fl.l_len = tswap64(target_fl->l_len); - fl.l_pid = tswapl(target_fl->l_pid); + fl.l_pid = tswap32(target_fl->l_pid); unlock_user_struct(target_fl, arg3, 0); } ret = get_errno(fcntl(arg1, cmd, &fl)); diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 3056997..2771fae 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1824,6 +1824,13 @@ struct target_statfs64 { #define TARGET_F_SETLK64 13 #define TARGET_F_SETLKW64 14 #endif + +#define TARGET_F_LINUX_SPECIFIC_BASE 1024 +#define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) +#define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) +#define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) +#define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) + #if defined (TARGET_ARM) #define TARGET_O_ACCMODE 0003 #define TARGET_O_RDONLY 00 -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 3/7] linux-user: enable getdents for > 32-bit systems 2009-07-24 17:10 ` [Qemu-devel] [PATCH 2/7] linux-user: fcntl fixes for LTP Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 4/7] linux-user: define a couple of syscalls for non-uid16 targets Ulrich Hecht 0 siblings, 1 reply; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio works perfectly fine with the example from getdents(2) and passes the LTP tests (tested with s390x on x86_64 emulation) Signed-off-by: Ulrich Hecht <uli@suse.de> --- linux-user/syscall.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d9c4af0..c9e0194 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -194,9 +194,7 @@ static int gettid(void) { return -ENOSYS; } #endif -#if TARGET_ABI_BITS == 32 _syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count); -#endif #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64) _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count); #endif @@ -5791,9 +5789,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif case TARGET_NR_getdents: -#if TARGET_ABI_BITS != 32 - goto unimplemented; -#elif TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 +#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 { struct target_dirent *target_dirp; struct linux_dirent *dirp; -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 4/7] linux-user: define a couple of syscalls for non-uid16 targets 2009-07-24 17:10 ` [Qemu-devel] [PATCH 3/7] linux-user: enable getdents for > 32-bit systems Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 5/7] linux-user: getpriority errno fix Ulrich Hecht 0 siblings, 1 reply; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio Quite a number of syscalls are only defined on systems with USE_UID16 defined; this patch defines them on other systems as well. Fixes a large number of uid/gid-related testcases on the s390x target (and most likely on other targets as well) Signed-off-by: Ulrich Hecht <uli@suse.de> --- linux-user/syscall.c | 125 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 105 insertions(+), 20 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c9e0194..6892880 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -305,7 +305,7 @@ static int sys_fchmodat(int dirfd, const char *pathname, mode_t mode) return (fchmodat(dirfd, pathname, mode, 0)); } #endif -#if defined(TARGET_NR_fchownat) && defined(USE_UID16) +#if defined(TARGET_NR_fchownat) static int sys_fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags) { @@ -414,7 +414,7 @@ _syscall3(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode) #if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat) _syscall3(int,sys_fchmodat,int,dirfd,const char *,pathname, mode_t,mode) #endif -#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) && defined(USE_UID16) +#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) _syscall5(int,sys_fchownat,int,dirfd,const char *,pathname, uid_t,owner,gid_t,group,int,flags) #endif @@ -6353,18 +6353,35 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_NR_setfsgid: ret = get_errno(setfsgid(arg1)); break; +#else /* USE_UID16 */ +#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) + case TARGET_NR_fchownat: + if (!(p = lock_user_string(arg2))) + goto efault; + ret = get_errno(sys_fchownat(arg1, p, arg3, arg4, arg5)); + unlock_user(p, arg2, 0); + break; +#endif #endif /* USE_UID16 */ -#ifdef TARGET_NR_lchown32 +#if defined(TARGET_NR_lchown32) || !defined(USE_UID16) +#if defined(TARGET_NR_lchown32) case TARGET_NR_lchown32: +#else + case TARGET_NR_lchown: +#endif if (!(p = lock_user_string(arg1))) goto efault; ret = get_errno(lchown(p, arg2, arg3)); unlock_user(p, arg1, 0); break; #endif -#ifdef TARGET_NR_getuid32 +#if defined(TARGET_NR_getuid32) || (defined(TARGET_NR_getuid) && !defined(USE_UID16)) +#if defined(TARGET_NR_getuid32) case TARGET_NR_getuid32: +#else + case TARGET_NR_getuid: +#endif ret = get_errno(getuid()); break; #endif @@ -6392,33 +6409,57 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif -#ifdef TARGET_NR_getgid32 +#if defined(TARGET_NR_getgid32) || (defined(TARGET_NR_getgid) && !defined(USE_UID16)) +#if defined(TARGET_NR_getgid32) case TARGET_NR_getgid32: +#else + case TARGET_NR_getgid: +#endif ret = get_errno(getgid()); break; #endif -#ifdef TARGET_NR_geteuid32 +#if defined(TARGET_NR_geteuid32) || (defined(TARGET_NR_geteuid) && !defined(USE_UID16)) +#if defined(TARGET_NR_geteuid32) case TARGET_NR_geteuid32: +#else + case TARGET_NR_geteuid: +#endif ret = get_errno(geteuid()); break; #endif -#ifdef TARGET_NR_getegid32 +#if defined(TARGET_NR_getegid32) || (defined(TARGET_NR_getegid) && !defined(USE_UID16)) +#if defined(TARGET_NR_getegid32) case TARGET_NR_getegid32: +#else + case TARGET_NR_getegid: +#endif ret = get_errno(getegid()); break; #endif -#ifdef TARGET_NR_setreuid32 +#if defined(TARGET_NR_setreuid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setreuid32) case TARGET_NR_setreuid32: +#else + case TARGET_NR_setreuid: +#endif ret = get_errno(setreuid(arg1, arg2)); break; #endif -#ifdef TARGET_NR_setregid32 +#if defined(TARGET_NR_setregid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setregid32) case TARGET_NR_setregid32: +#else + case TARGET_NR_setregid: +#endif ret = get_errno(setregid(arg1, arg2)); break; #endif -#ifdef TARGET_NR_getgroups32 +#if defined(TARGET_NR_getgroups32) || !defined(USE_UID16) +#if defined(TARGET_NR_getgroups32) case TARGET_NR_getgroups32: +#else + case TARGET_NR_getgroups: +#endif { int gidsetsize = arg1; uint32_t *target_grouplist; @@ -6442,8 +6483,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } break; #endif -#ifdef TARGET_NR_setgroups32 +#if defined(TARGET_NR_setgroups32) || !defined(USE_UID16) +#if defined(TARGET_NR_setgroups32) case TARGET_NR_setgroups32: +#else + case TARGET_NR_setgroups: +#endif { int gidsetsize = arg1; uint32_t *target_grouplist; @@ -6463,18 +6508,30 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } break; #endif -#ifdef TARGET_NR_fchown32 +#if defined(TARGET_NR_fchown32) || !defined(USE_UID16) +#if defined(TARGET_NR_fchown32) case TARGET_NR_fchown32: +#else + case TARGET_NR_fchown: +#endif ret = get_errno(fchown(arg1, arg2, arg3)); break; #endif -#ifdef TARGET_NR_setresuid32 +#if defined(TARGET_NR_setresuid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setresuid32) case TARGET_NR_setresuid32: +#else + case TARGET_NR_setresuid: +#endif ret = get_errno(setresuid(arg1, arg2, arg3)); break; #endif -#ifdef TARGET_NR_getresuid32 +#if defined(TARGET_NR_getresuid32) || !defined(USE_UID16) +#if defined(TARGET_NR_getresuid32) case TARGET_NR_getresuid32: +#else + case TARGET_NR_getresuid: +#endif { uid_t ruid, euid, suid; ret = get_errno(getresuid(&ruid, &euid, &suid)); @@ -6487,13 +6544,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } break; #endif -#ifdef TARGET_NR_setresgid32 +#if defined(TARGET_NR_setresgid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setresgid32) case TARGET_NR_setresgid32: +#else + case TARGET_NR_setresgid: +#endif ret = get_errno(setresgid(arg1, arg2, arg3)); break; #endif +#if defined(TARGET_NR_getresgid32) || !defined(USE_UID16) #ifdef TARGET_NR_getresgid32 case TARGET_NR_getresgid32: +#else + case TARGET_NR_getresgid: +#endif { gid_t rgid, egid, sgid; ret = get_errno(getresgid(&rgid, &egid, &sgid)); @@ -6506,31 +6571,51 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } break; #endif -#ifdef TARGET_NR_chown32 +#if defined(TARGET_NR_chown32) || !defined(USE_UID16) +#if defined(TARGET_NR_chown32) case TARGET_NR_chown32: +#else + case TARGET_NR_chown: +#endif if (!(p = lock_user_string(arg1))) goto efault; ret = get_errno(chown(p, arg2, arg3)); unlock_user(p, arg1, 0); break; #endif -#ifdef TARGET_NR_setuid32 +#if defined(TARGET_NR_setuid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setuid32) case TARGET_NR_setuid32: +#else + case TARGET_NR_setuid: +#endif ret = get_errno(setuid(arg1)); break; #endif -#ifdef TARGET_NR_setgid32 +#if defined(TARGET_NR_setgid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setgid32) case TARGET_NR_setgid32: +#else + case TARGET_NR_setgid: +#endif ret = get_errno(setgid(arg1)); break; #endif -#ifdef TARGET_NR_setfsuid32 +#if defined(TARGET_NR_setfsuid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setfsuid32) case TARGET_NR_setfsuid32: +#else + case TARGET_NR_setfsuid: +#endif ret = get_errno(setfsuid(arg1)); break; #endif -#ifdef TARGET_NR_setfsgid32 +#if defined(TARGET_NR_setfsgid32) || !defined(USE_UID16) +#if defined(TARGET_NR_setfsgid32) case TARGET_NR_setfsgid32: +#else + case TARGET_NR_setfsgid: +#endif ret = get_errno(setfsgid(arg1)); break; #endif -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 5/7] linux-user: getpriority errno fix 2009-07-24 17:10 ` [Qemu-devel] [PATCH 4/7] linux-user: define a couple of syscalls for non-uid16 targets Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 6/7] linux-user: fadvise64 implementation Ulrich Hecht 0 siblings, 1 reply; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio getpriority returned wrong errno; fixes LTP test getpriority02. Signed-off-by: Ulrich Hecht <uli@suse.de> --- linux-user/syscall.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6892880..6417cbb 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5298,7 +5298,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, /* libc does special remapping of the return value of * sys_getpriority() so it's just easiest to call * sys_getpriority() directly rather than through libc. */ - ret = sys_getpriority(arg1, arg2); + ret = get_errno(sys_getpriority(arg1, arg2)); break; case TARGET_NR_setpriority: ret = get_errno(setpriority(arg1, arg2, arg3)); -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 6/7] linux-user: fadvise64 implementation 2009-07-24 17:10 ` [Qemu-devel] [PATCH 5/7] linux-user: getpriority errno fix Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 7/7] linux-user: zero fstat buffer to initialize nsec fields Ulrich Hecht 0 siblings, 1 reply; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio good enough to pass all LTP fadvise64 tests Signed-off-by: Ulrich Hecht <uli@suse.de> --- linux-user/syscall.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6417cbb..2dc86ff 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6651,12 +6651,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, arg4 = temp; } #endif -#if defined(TARGET_NR_fadvise64_64) || defined(TARGET_NR_arm_fadvise64_64) +#if defined(TARGET_NR_fadvise64_64) || defined(TARGET_NR_arm_fadvise64_64) || defined(TARGET_NR_fadvise64) #ifdef TARGET_NR_fadvise64_64 case TARGET_NR_fadvise64_64: #endif - /* This is a hint, so ignoring and returning success is ok. */ - ret = get_errno(0); +#ifdef TARGET_NR_fadvise64 + case TARGET_NR_fadvise64: +#endif +#ifdef TARGET_S390X + switch (arg4) { + case 4: arg4 = POSIX_FADV_NOREUSE + 1; break; /* make sure it's an invalid value */ + case 5: arg4 = POSIX_FADV_NOREUSE + 2; break; /* ditto */ + case 6: arg4 = POSIX_FADV_DONTNEED; break; + case 7: arg4 = POSIX_FADV_NOREUSE; break; + default: break; + } +#endif + ret = -posix_fadvise(arg1, arg2, arg3, arg4); break; #endif #ifdef TARGET_NR_madvise -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH 7/7] linux-user: zero fstat buffer to initialize nsec fields 2009-07-24 17:10 ` [Qemu-devel] [PATCH 6/7] linux-user: fadvise64 implementation Ulrich Hecht @ 2009-07-24 17:10 ` Ulrich Hecht 0 siblings, 0 replies; 9+ messages in thread From: Ulrich Hecht @ 2009-07-24 17:10 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio The fstat implementation does not initialize the nanosecond fields in the stat buffer; this caused funny values to turn up there, preventing, for instance, cp -p from preserving timestamps because utimensat rejected the out-of-bounds nanosecond values. Resetting the entire structure to zero fixes that. Signed-off-by: Ulrich Hecht <uli@suse.de> --- linux-user/syscall.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2dc86ff..b413b08 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5523,6 +5523,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, if (!lock_user_struct(VERIFY_WRITE, target_st, arg2, 0)) goto efault; + memset(target_st, 0, sizeof(*target_st)); __put_user(st.st_dev, &target_st->st_dev); __put_user(st.st_ino, &target_st->st_ino); __put_user(st.st_mode, &target_st->st_mode); -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls 2009-07-24 17:10 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 2/7] linux-user: fcntl fixes for LTP Ulrich Hecht @ 2009-07-25 22:37 ` Jan-Simon Möller 1 sibling, 0 replies; 9+ messages in thread From: Jan-Simon Möller @ 2009-07-25 22:37 UTC (permalink / raw) To: qemu-devel; +Cc: riku.voipio Am Freitag 24 Juli 2009 19:10:26 schrieb Ulrich Hecht: > +#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate) > + case TARGET_NR_fallocate: > + ret = get_errno(fallocate(arg1, arg2, arg3, arg4)); > + break; > +#endif This might need checking for the glibc version, of it will fail to build e.g. on FC11 or with "older" glibc. See https://bugzilla.redhat.com/show_bug.cgi?id=500487 buildlog: LINK i386-linux-user/qemu-i386 /usr/lib/gcc/i586-redhat-linux/4.4.0/../../../libpthread.a(libpthread.o): In function `sem_open': (.text+0x69da): warning: the use of `mktemp' is dangerous, better use `mkstemp' /usr/bin/ld: Dwarf Error: Offset (9067) greater than or equal to .debug_str size (7930). syscall.o: In function `do_syscall': /home/abuild/rpmbuild/BUILD/qemu-0.11git2009.07.24.0516/linux-user/syscall.c:6989: undefined reference to `fallocate64' collect2: ld returned 1 exit status make[1]: *** [qemu-i386] Error 1 make: *** [subdir-i386-linux-user] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.Tjmyt9 (%build) Best, Jan-Simon ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-07-25 22:36 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-24 17:10 [Qemu-devel] [PATCH 0/7] linux-user syscall fixes Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 2/7] linux-user: fcntl fixes for LTP Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 3/7] linux-user: enable getdents for > 32-bit systems Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 4/7] linux-user: define a couple of syscalls for non-uid16 targets Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 5/7] linux-user: getpriority errno fix Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 6/7] linux-user: fadvise64 implementation Ulrich Hecht 2009-07-24 17:10 ` [Qemu-devel] [PATCH 7/7] linux-user: zero fstat buffer to initialize nsec fields Ulrich Hecht 2009-07-25 22:37 ` [Qemu-devel] [PATCH 1/7] linux-user: dup3, fallocate syscalls Jan-Simon Möller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).