* [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements
@ 2012-07-25 22:10 Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling Richard Henderson
` (10 more replies)
0 siblings, 11 replies; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Changes v3-v4:
Split patch 4 as per PMM feedback
Fix patch 9 is_error usage as per PPM feedback.
Changes v2-v3:
Fix fcntl translation table in O_CLOEXEC patch. The O_LARGEFILE
entry could result in an end-of-table {0,0,0,0} marker.
Handle sigprocmask and getpriority properly for alpha.
Changes v1-v2:
Dropped -stracefile patch. That clearly needs more iteration in
order to make everyone happy. I don't want the rest of this to
get caught up in that.
Two patches that fix all of the mmap problems I've been able to
find in the glibc testsuite. The iconv tests that load lots of
shared libraries are particularly good at triggering both problems.
Handle O_CLOEXEC et al properly.
Handle pipe2 properly.
r~
Richard Henderson (10):
alpha-linux-user: Fix signal handling
alpha-linux-user: Work around hosted mmap allocation problems
alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
linux-user: Sync fcntl.h bits with the kernel
linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
linux-user: Allocate the right amount of space for non-fixed file
maps
linux-user: Translate pipe2 flags; add to strace
alpha-linux-user: Fix a3 error return with v0 error bypass.
alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
alpha-linux-user: Fix the getpriority syscall
linux-user/alpha/syscall_nr.h | 2 +-
linux-user/main.c | 15 ++--
linux-user/mmap.c | 30 ++++--
linux-user/strace.c | 12 ++-
linux-user/strace.list | 3 +
linux-user/syscall.c | 102 ++++++++++++++----
linux-user/syscall_defs.h | 236 +++++++++++++++++++++++------------------
target-alpha/cpu.h | 11 ++
8 files changed, 269 insertions(+), 142 deletions(-)
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:07 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 02/10] alpha-linux-user: Work around hosted mmap allocation problems Richard Henderson
` (9 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Proper signal numbers were not defined, and EXCP_INTERRUPT
was unhandled, leading to all sorts of subtle confusion.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/main.c | 3 +++
linux-user/syscall_defs.h | 41 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index d0e0e4f..5787432 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2834,6 +2834,9 @@ void cpu_loop(CPUAlphaState *env)
case EXCP_STQ_C:
do_store_exclusive(env, env->error_code, trapnr - EXCP_STL_C);
break;
+ case EXCP_INTERRUPT:
+ /* Just indicate that signals should be handled asap. */
+ break;
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index a79b67d..02fe4f6 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -363,7 +363,46 @@ int do_sigaction(int sig, const struct target_sigaction *act,
#define TARGET_SA_RESTORER 0x04000000
#endif
-#if defined(TARGET_SPARC)
+#if defined(TARGET_ALPHA)
+
+#define TARGET_SIGHUP 1
+#define TARGET_SIGINT 2
+#define TARGET_SIGQUIT 3
+#define TARGET_SIGILL 4
+#define TARGET_SIGTRAP 5
+#define TARGET_SIGABRT 6
+#define TARGET_SIGSTKFLT 7 /* actually SIGEMT */
+#define TARGET_SIGFPE 8
+#define TARGET_SIGKILL 9
+#define TARGET_SIGBUS 10
+#define TARGET_SIGSEGV 11
+#define TARGET_SIGSYS 12
+#define TARGET_SIGPIPE 13
+#define TARGET_SIGALRM 14
+#define TARGET_SIGTERM 15
+#define TARGET_SIGURG 16
+#define TARGET_SIGSTOP 17
+#define TARGET_SIGTSTP 18
+#define TARGET_SIGCONT 19
+#define TARGET_SIGCHLD 20
+#define TARGET_SIGTTIN 21
+#define TARGET_SIGTTOU 22
+#define TARGET_SIGIO 23
+#define TARGET_SIGXCPU 24
+#define TARGET_SIGXFSZ 25
+#define TARGET_SIGVTALRM 26
+#define TARGET_SIGPROF 27
+#define TARGET_SIGWINCH 28
+#define TARGET_SIGPWR 29 /* actually SIGINFO */
+#define TARGET_SIGUSR1 30
+#define TARGET_SIGUSR2 31
+#define TARGET_SIGRTMIN 32
+
+#define TARGET_SIG_BLOCK 1
+#define TARGET_SIG_UNBLOCK 2
+#define TARGET_SIG_SETMASK 3
+
+#elif defined(TARGET_SPARC)
#define TARGET_SIGHUP 1
#define TARGET_SIGINT 2
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 02/10] alpha-linux-user: Work around hosted mmap allocation problems
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 03/10] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly Richard Henderson
` (8 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
target-alpha/cpu.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 99f9ee1..0d87fa7 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -40,9 +40,20 @@
#define TARGET_PAGE_BITS 13
+#ifdef CONFIG_USER_ONLY
+/* ??? The kernel likes to give addresses in high memory. If the host has
+ more virtual address space than the guest, this can lead to impossible
+ allocations. Honor the long-standing assumption that only kernel addrs
+ are negative, but otherwise allow allocations anywhere. This could lead
+ to tricky emulation problems for programs doing tagged addressing, but
+ that's far fewer than encounter the impossible allocation problem. */
+#define TARGET_PHYS_ADDR_SPACE_BITS 63
+#define TARGET_VIRT_ADDR_SPACE_BITS 63
+#else
/* ??? EV4 has 34 phys addr bits, EV5 has 40, EV6 has 44. */
#define TARGET_PHYS_ADDR_SPACE_BITS 44
#define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS)
+#endif
/* Alpha major type */
enum {
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 03/10] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 02/10] alpha-linux-user: Work around hosted mmap allocation problems Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:11 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel Richard Henderson
` (7 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
We weren't aggregating the exceptions, nor raising signals properly.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/syscall.c | 61 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 539af3f..1cbbfbf 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7699,13 +7699,13 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = -TARGET_EOPNOTSUPP;
switch (arg1) {
case TARGET_SSI_IEEE_FP_CONTROL:
- case TARGET_SSI_IEEE_RAISE_EXCEPTION:
{
uint64_t swcr, fpcr, orig_fpcr;
- if (get_user_u64 (swcr, arg2))
+ if (get_user_u64 (swcr, arg2)) {
goto efault;
- orig_fpcr = cpu_alpha_load_fpcr (cpu_env);
+ }
+ orig_fpcr = cpu_alpha_load_fpcr(cpu_env);
fpcr = orig_fpcr & FPCR_DYN_MASK;
/* Copied from linux ieee_swcr_to_fpcr. */
@@ -7719,16 +7719,57 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
fpcr |= (swcr & SWCR_MAP_UMZ ? FPCR_UNDZ | FPCR_UNFD : 0);
fpcr |= (~swcr & SWCR_TRAP_ENABLE_DNO) << 41;
- cpu_alpha_store_fpcr (cpu_env, fpcr);
+ cpu_alpha_store_fpcr(cpu_env, fpcr);
ret = 0;
+ }
+ break;
+
+ case TARGET_SSI_IEEE_RAISE_EXCEPTION:
+ {
+ uint64_t exc, fpcr, orig_fpcr;
+ int si_code;
+
+ if (get_user_u64(exc, arg2)) {
+ goto efault;
+ }
- if (arg1 == TARGET_SSI_IEEE_RAISE_EXCEPTION) {
- /* Old exceptions are not signaled. */
- fpcr &= ~(orig_fpcr & FPCR_STATUS_MASK);
+ orig_fpcr = cpu_alpha_load_fpcr(cpu_env);
- /* If any exceptions set by this call, and are unmasked,
- send a signal. */
- /* ??? FIXME */
+ /* We only add to the exception status here. */
+ fpcr = orig_fpcr | ((exc & SWCR_STATUS_MASK) << 35);
+
+ cpu_alpha_store_fpcr(cpu_env, fpcr);
+ ret = 0;
+
+ /* Old exceptions are not signaled. */
+ fpcr &= ~(orig_fpcr & FPCR_STATUS_MASK);
+
+ /* If any exceptions set by this call,
+ and are unmasked, send a signal. */
+ si_code = 0;
+ if ((fpcr & (FPCR_INE | FPCR_INED)) == FPCR_INE) {
+ si_code = TARGET_FPE_FLTRES;
+ }
+ if ((fpcr & (FPCR_UNF | FPCR_UNFD)) == FPCR_UNF) {
+ si_code = TARGET_FPE_FLTUND;
+ }
+ if ((fpcr & (FPCR_OVF | FPCR_OVFD)) == FPCR_OVF) {
+ si_code = TARGET_FPE_FLTOVF;
+ }
+ if ((fpcr & (FPCR_DZE | FPCR_DZED)) == FPCR_DZE) {
+ si_code = TARGET_FPE_FLTDIV;
+ }
+ if ((fpcr & (FPCR_INV | FPCR_INVD)) == FPCR_INV) {
+ si_code = TARGET_FPE_FLTINV;
+ }
+ if (si_code != 0) {
+ target_siginfo_t info;
+ info.si_signo = SIGFPE;
+ info.si_errno = 0;
+ info.si_code = si_code;
+ info._sifields._sigfault._addr
+ = ((CPUArchState *)cpu_env)->pc;
+ queue_signal((CPUArchState *)cpu_env, info.si_signo, &info);
}
}
break;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (2 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 03/10] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:34 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 05/10] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH Richard Henderson
` (6 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
For each target, only define the bits that appear in
arch/target/include/asm/fcntl.h. Mirror the kernel's
asm-generic layout by handling anything undefined afterward.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/syscall_defs.h | 195 +++++++++++++++++++++-----------------------
1 files changed, 93 insertions(+), 102 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 02fe4f6..974d6f5 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2012,135 +2012,126 @@ struct target_statfs64 {
#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
-#define TARGET_O_WRONLY 01
-#define TARGET_O_RDWR 02
-#define TARGET_O_CREAT 0100 /* not fcntl */
-#define TARGET_O_EXCL 0200 /* not fcntl */
-#define TARGET_O_NOCTTY 0400 /* not fcntl */
-#define TARGET_O_TRUNC 01000 /* not fcntl */
-#define TARGET_O_APPEND 02000
-#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
-#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
+#if defined(TARGET_ALPHA)
+#define TARGET_O_NONBLOCK 04
+#define TARGET_O_APPEND 010
+#define TARGET_O_CREAT 01000 /* not fcntl */
+#define TARGET_O_TRUNC 02000 /* not fcntl */
+#define TARGET_O_EXCL 04000 /* not fcntl */
+#define TARGET_O_NOCTTY 010000 /* not fcntl */
+#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
+#define TARGET_O_DSYNC 040000
+#define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */
+#define TARGET_O_DIRECTORY 0100000 /* must be a directory */
+#define TARGET_O_NOFOLLOW 0200000 /* don't follow links */
+#define TARGET_O_DIRECT 02000000 /* direct disk access hint */
+#define TARGET_O_NOATIME 04000000
+#define TARGET_O_CLOEXEC 010000000
+#define TARGET___O_SYNC 020000000
+#define TARGET_O_PATH 040000000
+#elif defined (TARGET_ARM)
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
#define TARGET_O_LARGEFILE 0400000
+#elif defined(TARGET_MIPS)
+#define TARGET_O_APPEND 0x0008
+#define TARGET_O_DSYNC 0x0010
+#define TARGET_O_NONBLOCK 0x0080
+#define TARGET_O_CREAT 0x0100 /* not fcntl */
+#define TARGET_O_TRUNC 0x0200 /* not fcntl */
+#define TARGET_O_EXCL 0x0400 /* not fcntl */
+#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
+#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
+#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
+#define TARGET___O_SYNC 0x4000
+#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
#elif defined (TARGET_PPC)
-#define TARGET_O_ACCMODE 0003
-#define TARGET_O_RDONLY 00
-#define TARGET_O_WRONLY 01
-#define TARGET_O_RDWR 02
-#define TARGET_O_CREAT 0100 /* not fcntl */
-#define TARGET_O_EXCL 0200 /* not fcntl */
-#define TARGET_O_NOCTTY 0400 /* not fcntl */
-#define TARGET_O_TRUNC 01000 /* not fcntl */
-#define TARGET_O_APPEND 02000
-#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
-#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
-#define TARGET_O_DIRECTORY 040000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
-#define TARGET_O_LARGEFILE 0200000
-#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
-#elif defined (TARGET_MICROBLAZE)
-#define TARGET_O_ACCMODE 0003
-#define TARGET_O_RDONLY 00
-#define TARGET_O_WRONLY 01
-#define TARGET_O_RDWR 02
-#define TARGET_O_CREAT 0100 /* not fcntl */
-#define TARGET_O_EXCL 0200 /* not fcntl */
-#define TARGET_O_NOCTTY 0400 /* not fcntl */
-#define TARGET_O_TRUNC 01000 /* not fcntl */
-#define TARGET_O_APPEND 02000
-#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
-#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
#define TARGET_O_LARGEFILE 0200000
#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
#elif defined (TARGET_SPARC)
-#define TARGET_O_RDONLY 0x0000
-#define TARGET_O_WRONLY 0x0001
-#define TARGET_O_RDWR 0x0002
-#define TARGET_O_ACCMODE 0x0003
-#define TARGET_O_APPEND 0x0008
-#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
-#define TARGET_O_CREAT 0x0200 /* not fcntl */
-#define TARGET_O_TRUNC 0x0400 /* not fcntl */
-#define TARGET_O_EXCL 0x0800 /* not fcntl */
-#define TARGET_O_SYNC 0x2000
-#define TARGET_O_NONBLOCK 0x4000
-#define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
-#define TARGET_O_NOCTTY 0x8000 /* not fcntl */
-#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
+#define TARGET_O_APPEND 0x0008
+#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
+#define TARGET_O_CREAT 0x0200 /* not fcntl */
+#define TARGET_O_TRUNC 0x0400 /* not fcntl */
+#define TARGET_O_EXCL 0x0800 /* not fcntl */
+#define TARGET_O_DSYNC 0x2000
+#define TARGET_O_NONBLOCK 0x4000
+# ifdef TARGET_SPARC64
+# define TARGET_O_NDELAY 0x0004
+# else
+# define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
+# endif
+#define TARGET_O_NOCTTY 0x8000 /* not fcntl */
#define TARGET_O_LARGEFILE 0x40000
-#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
-#elif defined(TARGET_MIPS)
-#define TARGET_O_ACCMODE 0x0003
-#define TARGET_O_RDONLY 0x0000
-#define TARGET_O_WRONLY 0x0001
-#define TARGET_O_RDWR 0x0002
-#define TARGET_O_APPEND 0x0008
-#define TARGET_O_SYNC 0x0010
-#define TARGET_O_NONBLOCK 0x0080
-#define TARGET_O_CREAT 0x0100 /* not fcntl */
-#define TARGET_O_TRUNC 0x0200 /* not fcntl */
-#define TARGET_O_EXCL 0x0400 /* not fcntl */
-#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
-#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
-#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
-#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
-#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
-#define TARGET_O_NOATIME 0x40000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#elif defined(TARGET_ALPHA)
-#define TARGET_O_ACCMODE 0x0003
-#define TARGET_O_RDONLY 0x0000
-#define TARGET_O_WRONLY 0x0001
-#define TARGET_O_RDWR 0x0002
-#define TARGET_O_APPEND 0x0008
-#define TARGET_O_SYNC 0x4000
-#define TARGET_O_NONBLOCK 0x0004
-#define TARGET_O_CREAT 0x0200 /* not fcntl */
-#define TARGET_O_TRUNC 0x0400 /* not fcntl */
-#define TARGET_O_EXCL 0x0800 /* not fcntl */
-#define TARGET_O_NOCTTY 0x1000 /* not fcntl */
-#define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */
-#define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */
-#define TARGET_O_DIRECT 0x80000 /* direct disk access hint */
-#define TARGET_O_DIRECTORY 0x8000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */
-#define TARGET_O_NOATIME 0x100000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#else
+#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
+#define TARGET_O_NOATIME 0x200000
+#define TARGET_O_CLOEXEC 0x400000
+#define TARGET___O_SYNC 0x800000
+#define TARGET_O_PATH 0x1000000
+#endif
+
+/* <asm-generic/fcntl.h> values follow. */
#define TARGET_O_ACCMODE 0003
#define TARGET_O_RDONLY 00
#define TARGET_O_WRONLY 01
#define TARGET_O_RDWR 02
+#ifndef TARGET_O_CREAT
#define TARGET_O_CREAT 0100 /* not fcntl */
+#endif
+#ifndef TARGET_O_EXCL
#define TARGET_O_EXCL 0200 /* not fcntl */
+#endif
+#ifndef TARGET_O_NOCTTY
#define TARGET_O_NOCTTY 0400 /* not fcntl */
+#endif
+#ifndef TARGET_O_TRUNC
#define TARGET_O_TRUNC 01000 /* not fcntl */
+#endif
+#ifndef TARGET_O_APPEND
#define TARGET_O_APPEND 02000
+#endif
+#ifndef TARGET_O_NONBLOCK
#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
+#endif
+#ifndef TARGET_O_DSYNC
+#define TARGET_O_DSYNC 010000
+#endif
+#ifndef TARGET_FASYNC
#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
+#endif
+#ifndef TARGET_O_DIRECT
#define TARGET_O_DIRECT 040000 /* direct disk access hint */
+#endif
+#ifndef TARGET_O_LARGEFILE
#define TARGET_O_LARGEFILE 0100000
+#endif
+#ifndef TARGET_O_DIRECTORY
#define TARGET_O_DIRECTORY 0200000 /* must be a directory */
+#endif
+#ifndef TARGET_O_NOFOLLOW
#define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
#endif
+#ifndef TARGET_O_NOATIME
+#define TARGET_O_NOATIME 01000000
+#endif
+#ifndef TARGET_O_CLOEXEC
+#define TARGET_O_CLOEXEC 02000000
+#endif
+#ifndef TARGET___O_SYNC
+#define TARGET___O_SYNC 04000000
+#endif
+#ifndef TARGET_O_PATH
+#define TARGET_O_PATH 010000000
+#endif
+#ifndef TARGET_O_NDELAY
+#define TARGET_O_NDELAY TARGET_O_NONBLOCK
+#endif
+#ifndef TARGET_O_SYNC
+#define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC)
+#endif
struct target_flock {
short l_type;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 05/10] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (3 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:38 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 06/10] linux-user: Allocate the right amount of space for non-fixed file maps Richard Henderson
` (5 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/strace.c | 12 +++++++++++-
linux-user/syscall.c | 15 ++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 05a0d3e..6ec90e8 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -371,11 +371,21 @@ UNUSED static struct flags open_flags[] = {
FLAG_TARGET(O_NOCTTY),
FLAG_TARGET(O_NOFOLLOW),
FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */
- FLAG_TARGET(O_SYNC),
+ FLAG_TARGET(O_DSYNC),
+ FLAG_TARGET(__O_SYNC),
FLAG_TARGET(O_TRUNC),
#ifdef O_DIRECT
FLAG_TARGET(O_DIRECT),
#endif
+#ifdef O_NOATIME
+ FLAG_TARGET(O_NOATIME),
+#endif
+#ifdef O_CLOEXEC
+ FLAG_TARGET(O_CLOEXEC),
+#endif
+#ifdef O_PATH
+ FLAG_TARGET(O_PATH),
+#endif
FLAG_END,
};
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1cbbfbf..8a454cc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -261,14 +261,27 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_TRUNC, TARGET_O_TRUNC, O_TRUNC, O_TRUNC, },
{ TARGET_O_APPEND, TARGET_O_APPEND, O_APPEND, O_APPEND, },
{ TARGET_O_NONBLOCK, TARGET_O_NONBLOCK, O_NONBLOCK, O_NONBLOCK, },
+ { TARGET_O_SYNC, TARGET_O_DSYNC, O_SYNC, O_DSYNC, },
{ TARGET_O_SYNC, TARGET_O_SYNC, O_SYNC, O_SYNC, },
{ TARGET_FASYNC, TARGET_FASYNC, FASYNC, FASYNC, },
{ TARGET_O_DIRECTORY, TARGET_O_DIRECTORY, O_DIRECTORY, O_DIRECTORY, },
{ TARGET_O_NOFOLLOW, TARGET_O_NOFOLLOW, O_NOFOLLOW, O_NOFOLLOW, },
- { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, },
#if defined(O_DIRECT)
{ TARGET_O_DIRECT, TARGET_O_DIRECT, O_DIRECT, O_DIRECT, },
#endif
+#if defined(O_NOATIME)
+ { TARGET_O_NOATIME, TARGET_O_NOATIME, O_NOATIME, O_NOATIME },
+#endif
+#if defined(O_CLOEXEC)
+ { TARGET_O_CLOEXEC, TARGET_O_CLOEXEC, O_CLOEXEC, O_CLOEXEC },
+#endif
+#if defined(O_PATH)
+ { TARGET_O_PATH, TARGET_O_PATH, O_PATH, O_PATH },
+#endif
+ /* Don't terminate the list prematurely on 64-bit host+guest. */
+#if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0
+ { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, },
+#endif
{ 0, 0, 0, 0 }
};
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 06/10] linux-user: Allocate the right amount of space for non-fixed file maps
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (4 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 05/10] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 07/10] linux-user: Translate pipe2 flags; add to strace Richard Henderson
` (4 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
If we let the kernel handle the implementation of mmap_find_vma,
via an anon mmap, we must use the size as indicated by the user
and not the size truncated to the filesize.
This happens often in ld.so, where we initially mmap the file to
the size of the text+data+bss to reserve an area, then mmap+fixed
over the top to properly handle data and bss.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/mmap.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index d9468fe..b412e3f 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -382,7 +382,6 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
int flags, int fd, abi_ulong offset)
{
abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len;
- unsigned long host_start;
mmap_lock();
#ifdef DEBUG_MMAP
@@ -421,6 +420,19 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
if (len == 0)
goto the_end;
real_start = start & qemu_host_page_mask;
+ host_offset = offset & qemu_host_page_mask;
+
+ /* If the user is asking for the kernel to find a location, do that
+ before we truncate the length for mapping files below. */
+ if (!(flags & MAP_FIXED)) {
+ host_len = len + offset - host_offset;
+ host_len = HOST_PAGE_ALIGN(host_len);
+ start = mmap_find_vma(real_start, host_len);
+ if (start == (abi_ulong)-1) {
+ errno = ENOMEM;
+ goto fail;
+ }
+ }
/* When mapping files into a memory area larger than the file, accesses
to pages beyond the file size will cause a SIGBUS.
@@ -453,27 +465,23 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
}
if (!(flags & MAP_FIXED)) {
- abi_ulong mmap_start;
+ unsigned long host_start;
void *p;
- host_offset = offset & qemu_host_page_mask;
+
host_len = len + offset - host_offset;
host_len = HOST_PAGE_ALIGN(host_len);
- mmap_start = mmap_find_vma(real_start, host_len);
- if (mmap_start == (abi_ulong)-1) {
- errno = ENOMEM;
- goto fail;
- }
+
/* Note: we prefer to control the mapping address. It is
especially important if qemu_host_page_size >
qemu_real_host_page_size */
- p = mmap(g2h(mmap_start),
- host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
+ p = mmap(g2h(start), host_len, prot,
+ flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
if (p == MAP_FAILED)
goto fail;
/* update start so that it points to the file position at 'offset' */
host_start = (unsigned long)p;
if (!(flags & MAP_ANONYMOUS)) {
- p = mmap(g2h(mmap_start), len, prot,
+ p = mmap(g2h(start), len, prot,
flags | MAP_FIXED, fd, host_offset);
host_start += offset - host_offset;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 07/10] linux-user: Translate pipe2 flags; add to strace
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (5 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 06/10] linux-user: Allocate the right amount of space for non-fixed file maps Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:40 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 08/10] alpha-linux-user: Fix a3 error return with v0 error bypass Richard Henderson
` (3 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/strace.list | 3 +++
linux-user/syscall.c | 3 ++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/linux-user/strace.list b/linux-user/strace.list
index a7eeaef..af3c6a0 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1527,3 +1527,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
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8a454cc..1a12f14 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5595,7 +5595,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#ifdef TARGET_NR_pipe2
case TARGET_NR_pipe2:
- ret = do_pipe(cpu_env, arg1, arg2, 1);
+ ret = do_pipe(cpu_env, arg1,
+ target_to_host_bitmask(arg2, fcntl_flags_tbl), 1);
break;
#endif
case TARGET_NR_times:
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 08/10] alpha-linux-user: Fix a3 error return with v0 error bypass.
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (6 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 07/10] linux-user: Translate pipe2 flags; add to strace Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 09/10] alpha-linux-user: Properly handle the non-rt sigprocmask syscall Richard Henderson
` (2 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
We were failing to initialize a3 for syscalls that bypass the
negative return value error check.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/main.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 5787432..343b85c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2759,13 +2759,11 @@ void cpu_loop(CPUAlphaState *env)
break;
}
/* Syscall writes 0 to V0 to bypass error check, similar
- to how this is handled internal to Linux kernel. */
- if (env->ir[IR_V0] == 0) {
- env->ir[IR_V0] = sysret;
- } else {
- env->ir[IR_V0] = (sysret < 0 ? -sysret : sysret);
- env->ir[IR_A3] = (sysret < 0);
- }
+ to how this is handled internal to Linux kernel.
+ (Ab)use trapnr temporarily as boolean indicating error. */
+ trapnr = (env->ir[IR_V0] != 0 && sysret < 0);
+ env->ir[IR_V0] = (trapnr ? -sysret : sysret);
+ env->ir[IR_A3] = trapnr;
break;
case 0x86:
/* IMB */
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 09/10] alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (7 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 08/10] alpha-linux-user: Fix a3 error return with v0 error bypass Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:41 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall Richard Henderson
2012-08-01 23:24 ` [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Name the syscall properly for QEMU, kernel source notwithstanding.
Fix syntax errors in the code thus enabled within do_syscall.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/alpha/syscall_nr.h | 2 +-
linux-user/syscall.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
index f6284db..49648a1 100644
--- a/linux-user/alpha/syscall_nr.h
+++ b/linux-user/alpha/syscall_nr.h
@@ -46,7 +46,7 @@
#define TARGET_NR_open 45
#define TARGET_NR_osf_old_sigaction 46 /* not implemented */
#define TARGET_NR_getxgid 47
-#define TARGET_NR_osf_sigprocmask 48
+#define TARGET_NR_sigprocmask 48
#define TARGET_NR_osf_getlogin 49 /* not implemented */
#define TARGET_NR_osf_setlogin 50 /* not implemented */
#define TARGET_NR_acct 51
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1a12f14..2e1c1c0 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5881,11 +5881,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
target_to_host_old_sigset(&set, &mask);
ret = get_errno(sigprocmask(how, &set, &oldset));
-
if (!is_error(ret)) {
host_to_target_old_sigset(&mask, &oldset);
ret = mask;
- ((CPUAlphaState *)cpu_env)->[IR_V0] = 0; /* force no error */
+ ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0; /* force no error */
}
#else
sigset_t set, oldset, *set_ptr;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (8 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 09/10] alpha-linux-user: Properly handle the non-rt sigprocmask syscall Richard Henderson
@ 2012-07-25 22:10 ` Richard Henderson
2012-08-02 14:48 ` Peter Maydell
2012-08-01 23:24 ` [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
10 siblings, 1 reply; 22+ messages in thread
From: Richard Henderson @ 2012-07-25 22:10 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Alpha uses unbiased priority values in the syscall, with the a3
return value signaling error conditions. Therefore, properly
interpret the libc getpriority as needed for the guest rather
than passing the host value through unchanged.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/syscall.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2e1c1c0..b487635 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -218,7 +218,6 @@ _syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count)
#if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
#endif
-_syscall2(int, sys_getpriority, int, which, int, who);
#if defined(TARGET_NR__llseek) && defined(__NR_llseek)
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
loff_t *, res, uint, wh);
@@ -6445,10 +6444,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#endif
case TARGET_NR_getpriority:
- /* 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 = get_errno(sys_getpriority(arg1, arg2));
+ /* 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) {
+ ret = get_errno(errno);
+ break;
+ }
+#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
break;
case TARGET_NR_setpriority:
ret = get_errno(setpriority(arg1, arg2, arg3));
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
` (9 preceding siblings ...)
2012-07-25 22:10 ` [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall Richard Henderson
@ 2012-08-01 23:24 ` Richard Henderson
10 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-08-01 23:24 UTC (permalink / raw)
To: qemu-devel; +Cc: riku.voipio
Ping.
r~
On 2012-07-25 15:10, Richard Henderson wrote:
> Changes v3-v4:
> Split patch 4 as per PMM feedback
> Fix patch 9 is_error usage as per PPM feedback.
>
> Changes v2-v3:
> Fix fcntl translation table in O_CLOEXEC patch. The O_LARGEFILE
> entry could result in an end-of-table {0,0,0,0} marker.
>
> Handle sigprocmask and getpriority properly for alpha.
>
> Changes v1-v2:
> Dropped -stracefile patch. That clearly needs more iteration in
> order to make everyone happy. I don't want the rest of this to
> get caught up in that.
>
> Two patches that fix all of the mmap problems I've been able to
> find in the glibc testsuite. The iconv tests that load lots of
> shared libraries are particularly good at triggering both problems.
>
> Handle O_CLOEXEC et al properly.
>
> Handle pipe2 properly.
>
>
> r~
>
>
>
> Richard Henderson (10):
> alpha-linux-user: Fix signal handling
> alpha-linux-user: Work around hosted mmap allocation problems
> alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
> linux-user: Sync fcntl.h bits with the kernel
> linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
> linux-user: Allocate the right amount of space for non-fixed file
> maps
> linux-user: Translate pipe2 flags; add to strace
> alpha-linux-user: Fix a3 error return with v0 error bypass.
> alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
> alpha-linux-user: Fix the getpriority syscall
>
> linux-user/alpha/syscall_nr.h | 2 +-
> linux-user/main.c | 15 ++--
> linux-user/mmap.c | 30 ++++--
> linux-user/strace.c | 12 ++-
> linux-user/strace.list | 3 +
> linux-user/syscall.c | 102 ++++++++++++++----
> linux-user/syscall_defs.h | 236 +++++++++++++++++++++++------------------
> target-alpha/cpu.h | 11 ++
> 8 files changed, 269 insertions(+), 142 deletions(-)
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling
2012-07-25 22:10 ` [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling Richard Henderson
@ 2012-08-02 14:07 ` Peter Maydell
0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:07 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> Proper signal numbers were not defined, and EXCP_INTERRUPT
> was unhandled, leading to all sorts of subtle confusion.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 03/10] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
2012-07-25 22:10 ` [Qemu-devel] [PATCH 03/10] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly Richard Henderson
@ 2012-08-02 14:11 ` Peter Maydell
0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:11 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> We weren't aggregating the exceptions, nor raising signals properly.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
No idea about the alpha details, but looks plausible and it's
in a TARGET_ALPHA only bit of code anyway.
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel
2012-07-25 22:10 ` [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel Richard Henderson
@ 2012-08-02 14:34 ` Peter Maydell
2012-08-02 15:17 ` Richard Henderson
0 siblings, 1 reply; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:34 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> For each target, only define the bits that appear in
> arch/target/include/asm/fcntl.h. Mirror the kernel's
> asm-generic layout by handling anything undefined afterward.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> linux-user/syscall_defs.h | 195 +++++++++++++++++++++-----------------------
> 1 files changed, 93 insertions(+), 102 deletions(-)
>
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 02fe4f6..974d6f5 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2012,135 +2012,126 @@ struct target_statfs64 {
> #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
> #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
>
No entries for TARGET_M68K? I checked and I think that's the
only supported arch which isn't listed here and isn't only using
the asm-generic values. (It's the same 4 defines as TARGET_ARM.)
> -#if defined (TARGET_ARM)
> -#define TARGET_O_ACCMODE 0003
> -#define TARGET_O_RDONLY 00
> -#define TARGET_O_WRONLY 01
> -#define TARGET_O_RDWR 02
> -#define TARGET_O_CREAT 0100 /* not fcntl */
> -#define TARGET_O_EXCL 0200 /* not fcntl */
> -#define TARGET_O_NOCTTY 0400 /* not fcntl */
> -#define TARGET_O_TRUNC 01000 /* not fcntl */
> -#define TARGET_O_APPEND 02000
> -#define TARGET_O_NONBLOCK 04000
> -#define TARGET_O_NDELAY TARGET_O_NONBLOCK
> -#define TARGET_O_SYNC 010000
> -#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
> +#if defined(TARGET_ALPHA)
> +#define TARGET_O_NONBLOCK 04
> +#define TARGET_O_APPEND 010
> +#define TARGET_O_CREAT 01000 /* not fcntl */
> +#define TARGET_O_TRUNC 02000 /* not fcntl */
> +#define TARGET_O_EXCL 04000 /* not fcntl */
> +#define TARGET_O_NOCTTY 010000 /* not fcntl */
> +#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
> +#define TARGET_O_DSYNC 040000
> +#define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */
> +#define TARGET_O_DIRECTORY 0100000 /* must be a directory */
> +#define TARGET_O_NOFOLLOW 0200000 /* don't follow links */
> +#define TARGET_O_DIRECT 02000000 /* direct disk access hint */
> +#define TARGET_O_NOATIME 04000000
> +#define TARGET_O_CLOEXEC 010000000
> +#define TARGET___O_SYNC 020000000
> +#define TARGET_O_PATH 040000000
The other targets were all straightforward to review but I had a
little difficulty with the Alpha bits here.
(1) O_LARGEFILE is 0 here but not in the kernel. Does the "not
necessary" comment here mean "not necessary for QEMU" ?
(ie is the difference because we are taking a different approach to
the kernel's "always set this bit on entry" one ?)
(2) where has the TARGET_FASYNC entry come from?
There are also a couple of hardcoded tabs lurking in some of
these lines which it would be nice to get rid of since we're
changing the code anyway. (checkpatch will tell you where they are.)
> +#elif defined (TARGET_ARM)
Not having the space between 'defined' and '(' would be consistent
with the TARGET_ALPHA one, be consistent with the lion's share of
defined() uses elswhere and also shut checkpatch up :-)
Otherwise good and I've checked all the numbers against the kernel
headers.
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 05/10] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
2012-07-25 22:10 ` [Qemu-devel] [PATCH 05/10] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH Richard Henderson
@ 2012-08-02 14:38 ` Peter Maydell
0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:38 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 07/10] linux-user: Translate pipe2 flags; add to strace
2012-07-25 22:10 ` [Qemu-devel] [PATCH 07/10] linux-user: Translate pipe2 flags; add to strace Richard Henderson
@ 2012-08-02 14:40 ` Peter Maydell
0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:40 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 09/10] alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
2012-07-25 22:10 ` [Qemu-devel] [PATCH 09/10] alpha-linux-user: Properly handle the non-rt sigprocmask syscall Richard Henderson
@ 2012-08-02 14:41 ` Peter Maydell
0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:41 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> Name the syscall properly for QEMU, kernel source notwithstanding.
> Fix syntax errors in the code thus enabled within do_syscall.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall
2012-07-25 22:10 ` [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall Richard Henderson
@ 2012-08-02 14:48 ` Peter Maydell
2012-08-02 15:23 ` Richard Henderson
0 siblings, 1 reply; 22+ messages in thread
From: Peter Maydell @ 2012-08-02 14:48 UTC (permalink / raw)
To: Richard Henderson; +Cc: riku.voipio, qemu-devel
On 25 July 2012 23:10, Richard Henderson <rth@twiddle.net> wrote:
> Alpha uses unbiased priority values in the syscall, with the a3
> return value signaling error conditions. Therefore, properly
> interpret the libc getpriority as needed for the guest rather
> than passing the host value through unchanged.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> linux-user/syscall.c | 20 +++++++++++++++-----
> 1 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 2e1c1c0..b487635 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -218,7 +218,6 @@ _syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count)
> #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
> _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
> #endif
> -_syscall2(int, sys_getpriority, int, which, int, who);
> #if defined(TARGET_NR__llseek) && defined(__NR_llseek)
> _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
> loff_t *, res, uint, wh);
> @@ -6445,10 +6444,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> break;
> #endif
> case TARGET_NR_getpriority:
> - /* 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 = get_errno(sys_getpriority(arg1, arg2));
> + /* 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) {
> + ret = get_errno(errno);
> + break;
> + }
> +#ifdef TARGET_ALPHA
> + /* Return value is the unbiased priority. Signal no error. */
> + ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0;
Having do_syscall fish around in the cpu register struct seems a
bit ugly, but we do it elsewhere so I guess this is OK.
> +#else
> + /* Return value is a biased priority to avoid negative numbers. */
> + ret = 20 - ret;
> +#endif
> break;
> case TARGET_NR_setpriority:
> ret = get_errno(setpriority(arg1, arg2, arg3));
Sanity check -- it is only getpriority that has the biasing, not
setpriority?
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel
2012-08-02 14:34 ` Peter Maydell
@ 2012-08-02 15:17 ` Richard Henderson
0 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-08-02 15:17 UTC (permalink / raw)
To: Peter Maydell; +Cc: riku.voipio, qemu-devel
On 2012-08-02 07:34, Peter Maydell wrote:
> No entries for TARGET_M68K? I checked and I think that's the
> only supported arch which isn't listed here and isn't only using
> the asm-generic values. (It's the same 4 defines as TARGET_ARM.)
I didn't notice because it was missing beforehand.
> The other targets were all straightforward to review but I had a
> little difficulty with the Alpha bits here.
> (1) O_LARGEFILE is 0 here but not in the kernel. Does the "not
> necessary" comment here mean "not necessary for QEMU" ?
> (ie is the difference because we are taking a different approach to
> the kernel's "always set this bit on entry" one ?)
Yes. The fact that the kernel forces O_LARGEFILE set means that
from an ABI perspective it might as well be zero. The fact that
it is defined to non-zero in kernel headers is merely historical,
and probably to document that the bit was used once.
>
> (2) where has the TARGET_FASYNC entry come from?
You mean why isn't it using the default below? Good question...
r~
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall
2012-08-02 14:48 ` Peter Maydell
@ 2012-08-02 15:23 ` Richard Henderson
0 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-08-02 15:23 UTC (permalink / raw)
To: Peter Maydell; +Cc: riku.voipio, qemu-devel
On 2012-08-02 07:48, Peter Maydell wrote:
> Sanity check -- it is only getpriority that has the biasing, not setpriority?
Correct.
r~
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel
2012-08-03 22:40 [Qemu-devel] [PATCH v5 " Richard Henderson
@ 2012-08-03 22:40 ` Richard Henderson
0 siblings, 0 replies; 22+ messages in thread
From: Richard Henderson @ 2012-08-03 22:40 UTC (permalink / raw)
To: qemu-devel
For each target, only define the bits that appear in
arch/target/include/asm/fcntl.h. Mirror the kernel's
asm-generic layout by handling anything undefined afterward.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/syscall_defs.h | 194 +++++++++++++++++++++------------------------
1 files changed, 92 insertions(+), 102 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 308831f..ba9a58c 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2046,135 +2046,125 @@ struct target_statfs64 {
#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
-#define TARGET_O_WRONLY 01
-#define TARGET_O_RDWR 02
-#define TARGET_O_CREAT 0100 /* not fcntl */
-#define TARGET_O_EXCL 0200 /* not fcntl */
-#define TARGET_O_NOCTTY 0400 /* not fcntl */
-#define TARGET_O_TRUNC 01000 /* not fcntl */
-#define TARGET_O_APPEND 02000
-#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
-#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
+#if defined(TARGET_ALPHA)
+#define TARGET_O_NONBLOCK 04
+#define TARGET_O_APPEND 010
+#define TARGET_O_CREAT 01000 /* not fcntl */
+#define TARGET_O_TRUNC 02000 /* not fcntl */
+#define TARGET_O_EXCL 04000 /* not fcntl */
+#define TARGET_O_NOCTTY 010000 /* not fcntl */
+#define TARGET_O_DSYNC 040000
+#define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */
+#define TARGET_O_DIRECTORY 0100000 /* must be a directory */
+#define TARGET_O_NOFOLLOW 0200000 /* don't follow links */
+#define TARGET_O_DIRECT 02000000 /* direct disk access hint */
+#define TARGET_O_NOATIME 04000000
+#define TARGET_O_CLOEXEC 010000000
+#define TARGET___O_SYNC 020000000
+#define TARGET_O_PATH 040000000
+#elif defined(TARGET_ARM) || defined(TARGET_M68K)
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
#define TARGET_O_LARGEFILE 0400000
+#elif defined(TARGET_MIPS)
+#define TARGET_O_APPEND 0x0008
+#define TARGET_O_DSYNC 0x0010
+#define TARGET_O_NONBLOCK 0x0080
+#define TARGET_O_CREAT 0x0100 /* not fcntl */
+#define TARGET_O_TRUNC 0x0200 /* not fcntl */
+#define TARGET_O_EXCL 0x0400 /* not fcntl */
+#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
+#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
+#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
+#define TARGET___O_SYNC 0x4000
+#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
#elif defined (TARGET_PPC)
-#define TARGET_O_ACCMODE 0003
-#define TARGET_O_RDONLY 00
-#define TARGET_O_WRONLY 01
-#define TARGET_O_RDWR 02
-#define TARGET_O_CREAT 0100 /* not fcntl */
-#define TARGET_O_EXCL 0200 /* not fcntl */
-#define TARGET_O_NOCTTY 0400 /* not fcntl */
-#define TARGET_O_TRUNC 01000 /* not fcntl */
-#define TARGET_O_APPEND 02000
-#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
-#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
-#define TARGET_O_DIRECTORY 040000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
-#define TARGET_O_LARGEFILE 0200000
-#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
-#elif defined (TARGET_MICROBLAZE)
-#define TARGET_O_ACCMODE 0003
-#define TARGET_O_RDONLY 00
-#define TARGET_O_WRONLY 01
-#define TARGET_O_RDWR 02
-#define TARGET_O_CREAT 0100 /* not fcntl */
-#define TARGET_O_EXCL 0200 /* not fcntl */
-#define TARGET_O_NOCTTY 0400 /* not fcntl */
-#define TARGET_O_TRUNC 01000 /* not fcntl */
-#define TARGET_O_APPEND 02000
-#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
-#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
#define TARGET_O_LARGEFILE 0200000
#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
#elif defined (TARGET_SPARC)
-#define TARGET_O_RDONLY 0x0000
-#define TARGET_O_WRONLY 0x0001
-#define TARGET_O_RDWR 0x0002
-#define TARGET_O_ACCMODE 0x0003
-#define TARGET_O_APPEND 0x0008
-#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
-#define TARGET_O_CREAT 0x0200 /* not fcntl */
-#define TARGET_O_TRUNC 0x0400 /* not fcntl */
-#define TARGET_O_EXCL 0x0800 /* not fcntl */
-#define TARGET_O_SYNC 0x2000
-#define TARGET_O_NONBLOCK 0x4000
-#define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
-#define TARGET_O_NOCTTY 0x8000 /* not fcntl */
-#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
+#define TARGET_O_APPEND 0x0008
+#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
+#define TARGET_O_CREAT 0x0200 /* not fcntl */
+#define TARGET_O_TRUNC 0x0400 /* not fcntl */
+#define TARGET_O_EXCL 0x0800 /* not fcntl */
+#define TARGET_O_DSYNC 0x2000
+#define TARGET_O_NONBLOCK 0x4000
+# ifdef TARGET_SPARC64
+# define TARGET_O_NDELAY 0x0004
+# else
+# define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
+# endif
+#define TARGET_O_NOCTTY 0x8000 /* not fcntl */
#define TARGET_O_LARGEFILE 0x40000
-#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
-#elif defined(TARGET_MIPS)
-#define TARGET_O_ACCMODE 0x0003
-#define TARGET_O_RDONLY 0x0000
-#define TARGET_O_WRONLY 0x0001
-#define TARGET_O_RDWR 0x0002
-#define TARGET_O_APPEND 0x0008
-#define TARGET_O_SYNC 0x0010
-#define TARGET_O_NONBLOCK 0x0080
-#define TARGET_O_CREAT 0x0100 /* not fcntl */
-#define TARGET_O_TRUNC 0x0200 /* not fcntl */
-#define TARGET_O_EXCL 0x0400 /* not fcntl */
-#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
-#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
-#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
-#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
-#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
-#define TARGET_O_NOATIME 0x40000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#elif defined(TARGET_ALPHA)
-#define TARGET_O_ACCMODE 0x0003
-#define TARGET_O_RDONLY 0x0000
-#define TARGET_O_WRONLY 0x0001
-#define TARGET_O_RDWR 0x0002
-#define TARGET_O_APPEND 0x0008
-#define TARGET_O_SYNC 0x4000
-#define TARGET_O_NONBLOCK 0x0004
-#define TARGET_O_CREAT 0x0200 /* not fcntl */
-#define TARGET_O_TRUNC 0x0400 /* not fcntl */
-#define TARGET_O_EXCL 0x0800 /* not fcntl */
-#define TARGET_O_NOCTTY 0x1000 /* not fcntl */
-#define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */
-#define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */
-#define TARGET_O_DIRECT 0x80000 /* direct disk access hint */
-#define TARGET_O_DIRECTORY 0x8000 /* must be a directory */
-#define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */
-#define TARGET_O_NOATIME 0x100000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#else
+#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
+#define TARGET_O_NOATIME 0x200000
+#define TARGET_O_CLOEXEC 0x400000
+#define TARGET___O_SYNC 0x800000
+#define TARGET_O_PATH 0x1000000
+#endif
+
+/* <asm-generic/fcntl.h> values follow. */
#define TARGET_O_ACCMODE 0003
#define TARGET_O_RDONLY 00
#define TARGET_O_WRONLY 01
#define TARGET_O_RDWR 02
+#ifndef TARGET_O_CREAT
#define TARGET_O_CREAT 0100 /* not fcntl */
+#endif
+#ifndef TARGET_O_EXCL
#define TARGET_O_EXCL 0200 /* not fcntl */
+#endif
+#ifndef TARGET_O_NOCTTY
#define TARGET_O_NOCTTY 0400 /* not fcntl */
+#endif
+#ifndef TARGET_O_TRUNC
#define TARGET_O_TRUNC 01000 /* not fcntl */
+#endif
+#ifndef TARGET_O_APPEND
#define TARGET_O_APPEND 02000
+#endif
+#ifndef TARGET_O_NONBLOCK
#define TARGET_O_NONBLOCK 04000
-#define TARGET_O_NDELAY TARGET_O_NONBLOCK
-#define TARGET_O_SYNC 010000
+#endif
+#ifndef TARGET_O_DSYNC
+#define TARGET_O_DSYNC 010000
+#endif
+#ifndef TARGET_FASYNC
#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
+#endif
+#ifndef TARGET_O_DIRECT
#define TARGET_O_DIRECT 040000 /* direct disk access hint */
+#endif
+#ifndef TARGET_O_LARGEFILE
#define TARGET_O_LARGEFILE 0100000
+#endif
+#ifndef TARGET_O_DIRECTORY
#define TARGET_O_DIRECTORY 0200000 /* must be a directory */
+#endif
+#ifndef TARGET_O_NOFOLLOW
#define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
#endif
+#ifndef TARGET_O_NOATIME
+#define TARGET_O_NOATIME 01000000
+#endif
+#ifndef TARGET_O_CLOEXEC
+#define TARGET_O_CLOEXEC 02000000
+#endif
+#ifndef TARGET___O_SYNC
+#define TARGET___O_SYNC 04000000
+#endif
+#ifndef TARGET_O_PATH
+#define TARGET_O_PATH 010000000
+#endif
+#ifndef TARGET_O_NDELAY
+#define TARGET_O_NDELAY TARGET_O_NONBLOCK
+#endif
+#ifndef TARGET_O_SYNC
+#define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC)
+#endif
struct target_flock {
short l_type;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2012-08-03 22:41 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 22:10 [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 01/10] alpha-linux-user: Fix signal handling Richard Henderson
2012-08-02 14:07 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 02/10] alpha-linux-user: Work around hosted mmap allocation problems Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 03/10] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly Richard Henderson
2012-08-02 14:11 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel Richard Henderson
2012-08-02 14:34 ` Peter Maydell
2012-08-02 15:17 ` Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 05/10] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH Richard Henderson
2012-08-02 14:38 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 06/10] linux-user: Allocate the right amount of space for non-fixed file maps Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 07/10] linux-user: Translate pipe2 flags; add to strace Richard Henderson
2012-08-02 14:40 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 08/10] alpha-linux-user: Fix a3 error return with v0 error bypass Richard Henderson
2012-07-25 22:10 ` [Qemu-devel] [PATCH 09/10] alpha-linux-user: Properly handle the non-rt sigprocmask syscall Richard Henderson
2012-08-02 14:41 ` Peter Maydell
2012-07-25 22:10 ` [Qemu-devel] [PATCH 10/10] alpha-linux-user: Fix the getpriority syscall Richard Henderson
2012-08-02 14:48 ` Peter Maydell
2012-08-02 15:23 ` Richard Henderson
2012-08-01 23:24 ` [Qemu-devel] [PATCH v4 00/10] {alpha-}linux user improvements Richard Henderson
2012-08-03 22:40 [Qemu-devel] [PATCH v5 " Richard Henderson
2012-08-03 22:40 ` [Qemu-devel] [PATCH 04/10] linux-user: Sync fcntl.h bits with the kernel Richard Henderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.