summaryrefslogtreecommitdiff
path: root/linux-user/syscall_defs.h
AgeCommit message (Collapse)AuthorFilesLines
2016-10-21linux-user: Fix definition of target_sigevent for 32-bit guestsPeter Maydell1-6/+10
The sigevent structure includes a union with some fields which are pointers. For the QEMU target_sigevent structure we must represent these as abi_ulongs, not host function pointers. This error was causing the compiler to believe it should 8-align the _sigev_un union on a 64-bit host, which meant that the code in target_to_host_sigevent() was looking at the wrong offset to find the _tid field, and timer_create() would spuriously fail with EINVAL. This fixes the final loose end noted in LP:1042388. While we're editing the structure, switch the 'int32_t' fields to 'abi_int'; this will only matter for guests with non-standard integer alignment like m68k. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Fix syslog() syscall supportAleksandar Markovic1-0/+25
There are currently several problems related to syslog() support. For example, if the second argument "bufp" of target syslog() syscall is NULL, the current implementation always returns error code EFAULT. However, NULL is a perfectly valid value for the second argument for many use cases of this syscall. This is, for example, visible from this excerpt of man page for syslog(2): > EINVAL Bad arguments (e.g., bad type; or for type 2, 3, or 4, buf is > NULL, or len is less than zero; or for type 8, the level is > outside the range 1 to 8). Moreover, the argument "bufp" is ignored for all cases of values of the first argument, except 2, 3 and 4. This means that for such cases (the first argument is not 2, 3 or 4), there is no need to pass "buf" between host and target, and it can be set to NULL while calling host's syslog(), without loss of emulation accuracy. Note also that if "bufp" is NULL and the first argument is 2, 3 or 4, the correct returned error code is EINVAL, not EFAULT. All these details are reflected in this patch. "#ifdef TARGET_NR_syslog" is also proprerly inserted when needed. Support for Qemu's "-strace" switch for syslog() syscall is included too. LTP tests syslog11 and syslog12 pass with this patch (while fail without it), on any platform. Changes to original patch by Riku Voipio: fixed error paths in TARGET_SYSLOG_ACTION_READ_ALL to match http://lxr.free-electrons.com/source/kernel/printk/printk.c?v=4.7#L1335 Should fix also the build error in: https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg03721.html Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Fix socketcall() syscall supportAleksandar Markovic1-20/+22
Since not all Linux host platforms support socketcall() (most notably Intel), do_socketcall() function in Qemu's syscalls.c is implemented to mirror the corespondant implementation of socketcall() in Linux kernel, and to utilise individual socket operations that are supported on all Linux platforms. (see kernel source file net/socket.c, definition of socketcall). However, error codes produced by Qemu implementation are wrong for the cases of invalid values of the first argument. Also, naming of constants is not consistent with kernel one, and not consistant with Qemu convention of prefixing such constants with "TARGET_". This patch in that light brings do_socketcall() closer to its kernel counterpart, and in that way fixes the errors and yields more consisrtent Qemu code. There were also three missing cases (among 20) for strace support for socketcall(). The array that contains pointers for appropriate printing functions is updated with 3 elements, however pointers to functions are left NULL, and its implementation is left for future. Also, this patch fixes failure of LTP test socketcall02, if executed on some Qemu emulated sywstems (uer mode). Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Add support for adjtimex() syscallAleksandar Markovic1-0/+28
This patch implements Qemu user mode adjtimex() syscall support. Syscall adjtimex() reads and optionally sets parameters for a clock adjustment algorithm used in network synchonization or similar scenarios. Its declaration is: int adjtimex(struct timex *buf); The correspondent source code in the Linux kernel is at kernel/time.c, line 206. The Qemu implementation is based on invocation of host's adjtimex(), and its key part is in the "TARGET_NR_adjtimex" case segment of the the main switch statement of the function do_syscall(), in linux-user/syscalls.c. All necessary conversions of the data structures from target to host and from host to target are covered. Two new functions, target_to_host_timex() and host_to_target_timex(), are provided for the purpose of such conversions. For that purpose, the support for related structure "timex" had tp be added to the file linux-user/syscall_defs.h, based on its definition in Linux kernel. Also, the relevant support for "-strace" Qemu option is included in files linux-user/strace.c and linux-user/strace.list. This patch also fixes failures of LTP tests adjtimex01 and adjtimex02, if executed in Qemu user mode. Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-09-23linux-user: Fix structure target_flock definition for MipsAleksandar Markovic1-0/+6
Structure flock is defined for Mips in a way different from any other platform. For reference, see Linux kernel source code files: arch/mips/include/uapi/asm/fcntl.h, line 63 (for Mips) include/uapi/asm-generic/fcntl.h, line 195 (for all other platforms) This patch fix this problem, by amending structure target_flock, for Mips only. Besides, this patch fixes LTP tests fcntl11, fcntl17, fcntl19, fcntl20, and fcntl21, which are currently failing, if executed in Qemu user mode for Mips platforms. Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2016-09-23linux-user: Fix TARGET_F_GETOWN definition for MipsAleksandar Markovic1-1/+1
For some reason, Qemu's TARGET_F_GETOWN constant for Mips does not match the correct value of correspondent F_GETOWN. This patch fixes this problem. For reference, see Mips' F_GETOWN definition in Linux kernel at arch/mips/include/uapi/asm/fcntl.h#L44. This patch also fixes some fcntl()-related LTP tests for Qemu user mode for Mips. Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2016-09-23linux-user: Fix TARGET_SIOCATMARK definition for MipsAleksandar Markovic1-0/+4
This patch fixes wrong definition of TARGET_SIOCATMARK for mips, alpha, and sh4. The current definition is: #define SIOCATMARK 0x8905 while the correct definition is: #define SIOCATMARK TARGET_IOR('s', 7, int) See Linux kernel source file arch/mips/include/uapi/asm/sockios.h#L19 for reference. This patch also a fixes LTP test failure for test sockioctl01, for mips, alpha, and sh4. Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com> Acked-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
2016-09-21linux-user: Check for bad event numbers in epoll_waitPeter Maydell1-0/+3
The kernel checks that the maxevents parameter to epoll_wait is non-negative and not larger than EP_MAX_EVENTS. Add this check to our implementation, so that: * we fail these cases EINVAL rather than EFAULT * we don't pass negative or overflowing values to the lock_user() size calculation Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-09-21linux-user: Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctlsPeter Maydell1-0/+6
Implement the FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls, as used by chattr. Note that the type information encoded in these ioctl numbers is at odds with the actual type the kernel accesses, as discussed in http://thread.gmane.org/gmane.linux.file-systems/80164. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-09-15Remove remainders of HPPA backendThomas Huth1-2/+2
The HPPA backend has been removed by the following commit: 802b5081233a6b643a8b135a5facaf14bafaa77d tcg-hppa: Remove tcg backend But some small pieces of the HPPA backend still survived until today. Since we also do not have support for a HPPA target in QEMU, we can nowadays safely remove the remaining HPPA parts (like the disassembler code, or the detection of HPPA in the configure script). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-07-19linux-user: Add some new blk ioctlsPeter Maydell1-0/+11
Add some new blk ioctls (these are 0x12,119 through to 0x12,127). Several of these are used by mke2fs; this silences the warnings: mke2fs 1.42.12 (29-Aug-2014) Unsupported ioctl: cmd=0x127b Unsupported ioctl: cmd=0x127a warning: Unable to get device geometry for /dev/loop5 Unsupported ioctl: cmd=0x127c Unsupported ioctl: cmd=0x127c Unsupported ioctl: cmd=0x1277 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Add loop control ioctlsPeter Maydell1-0/+4
Add support for the /dev/loop-control ioctls: LOOP_CTL_ADD LOOP_CTL_REMOVE LOOP_CTL_GET_FREE [RV: fixed to apply to new header guards] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-12linux-user: Fix broken header guard in syscall_defs.hMarkus Armbruster1-4/+3
Found with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-06-26linux-user: add socketcall() straceLaurent Vivier1-4/+18
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: Support F_GETPIPE_SZ and F_SETPIPE_SZ fcntlsPeter Maydell1-0/+2
Support the F_GETPIPE_SZ and F_SETPIPE_SZ fcntl operations. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-08linux-user: Correct signedness of target_flock l_start and l_len fieldsPeter Maydell1-17/+17
The l_start and l_len fields in the various target_flock structures are supposed to be '__kernel_off_t' or '__kernel_loff_t', which means they should be signed, not unsigned. Correcting the structure definitions means that __get_user() and __put_user() will correctly sign extend them if the guest is using 32 bit offsets and the host is using 64 bit offsets. This fixes failures in the LTP 'fcntl14' tests where it checks that negative seek offsets work correctly. We reindent the structures to drop hard tabs since we're touching 40% of the fields anyway. RV: long long -> abi_llong as suggested by Laurent Vivier <laurent@vivier.eu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-07linux-user: Use both si_code and si_signo when converting siginfo_tPeter Maydell1-0/+15
The siginfo_t struct includes a union. The correct way to identify which fields of the union are relevant is complicated, 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 the si_code, so that tswap_siginfo() later can use it. tswap_siginfo() then strips these top bits out before writing si_code to the guest (sign-extending the lower bits). This fixes a bug where fields were sometimes wrong; in particular the LTP kill10 test went into an infinite loop because its signal handler got a si_pid value of 0 rather than the pid of the sending process. As part of this change, we switch to using __put_user() in the tswap_siginfo code which writes out the byteswapped values to the target memory, in case the target memory pointer is not sufficiently aligned for the host CPU's requirements. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-05-27linux-user: x86_64: Don't use 16-bit UIDsPeter Maydell1-1/+2
The 64-bit x86 syscall ABI uses 32-bit UIDs; only define USE_UID16 for 32-bit x86. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-01-11linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.John Paul Adrian Glaubitz1-0/+2
Adds the definitions for the socket calls SOCKOP_sendmmsg and SOCKOP_recvmmsg and wires them up with the rest of the code. The necessary function do_sendrecvmmsg() is already present in linux-user/syscall.c. After adding these two definitions and wiring them up, I no longer receive an error message about the unimplemented socket calls when running "apt-get update" on Debian unstable running on qemu with glibc_2.21 on m68k. Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-01-08linux-user: correctly align target_epoll_eventLaurent Vivier1-8/+11
According to comments in /usr/include/linux/eventpoll.h, poll_event is packed only on x86_64. And to be sure fields are correctly aligned in epoll_data, use abi_XXX types for all of them. Moreover, fd type is wrong: fd is int, not ulong. This has been tested with a ppc guest on an x86_64 host: without this patch, systemd crashes (core). CC: Alexander Graf <agraf@suse.de> CC: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-10-07linux-user/syscall_defs.h: Sync the latest si_code from Linux kernelChen Gang1-0/+11
They content several new macro members, also contents TARGET_N*. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Message-Id: <1443240605-2924-1-git-send-email-gang.chen.5i5j@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-09-28linux-user: fix cmsg conversion in case of multiple headersJonathan Neuschäfer1-5/+9
Currently, __target_cmsg_nxthdr compares a pointer derived from target_cmsg against the msg_control field of target_msgh (through subtraction). This failed for me when emulating i386 code under x86_64, because pointers in the host address space and pointers in the guest address space were not the same. This patch passes the initial value of target_cmsg into __target_cmsg_nxthdr. I found and fixed two more related bugs: - __target_cmsg_nxthdr now returns the new cmsg pointer instead of the old one. - tgt_space (in host_to_target_cmsg) doesn't count "sizeof (struct target_cmsghdr)" twice anymore. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-15linux-user: Support tilegx architecture in linux-userChen Gang1-5/+9
Add main working flow feature, system call processing feature, and elf64 tilegx binary loading feature, based on Linux kernel tilegx 64-bit implementation. [rth: Moved all of the implementation of atomic instructions to a later patch.] Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <BLU436-SMTP938552D42808AA60634582B9660@phx.gbl> Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-09-11typofixes - v4Veres Lajos1-2/+2
Signed-off-by: Veres Lajos <vlajos@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-02-13linux-user: correct stat structure in MIPS N32Leon Alrae1-67/+19
Simple "hello world" MIPS N32 userland program crashes with segfault due to incorrectly defined stat structure in QEMU. Correct "target_stat" definition to match kernel's "stat64" as in MIPS N32 there are only plain "stat" syscalls using 64-bit structure. Reported-by: Daniel Sanders <daniel.sanders@imgtec.com> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com> Tested-by: Daniel Sanders <daniel.sanders@imgtec.com> Reviewed-by: James Hogan <james.hogan@imgtec.com>
2015-02-10linux-user: wrong TARGET_SI_PAD_SIZE value for some targets.Maxim Ostapenko1-1/+8
Fix TARGET_SI_PAD_SIZE calculation to match the way the kernel does it. Use different TARGET_SI_PREAMBLE_SIZE for 32-bit and 64-bit targets. Signed-off-by: Maxim Ostapenko <m.ostapenko@partner.samsung.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-11-11linux-user: Fix up timer id handlingAlexander Graf1-4/+1
When creating a timer handle, we give the timer id a special magic offset of 0xcafe0000. However, we never mask that offset out of the timer id before we start using it to dereference our timer array. So we always end up aborting timer operations because the timer id is out of bounds. This was not an issue before my patch e52a99f756e ("linux-user: Simplify timerid checks on g_posix_timers range") because before we would blindly mask anything above the first 16 bits. This patch simplifies the code around timer id creation by introducing a proper target_timer_id typedef that is s32, just like Linux has it. It also changes the magic offset to a value that makes all timer ids be positive. Reported-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Tom Musta <tommusta@gmail.com> Tested-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-07-15linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddrJoakim Tjernlund1-0/+10
Implement conversion of the AF_PACKET sockaddr subtype in target_to_host_sockaddr. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-06-29linux-user: support the SIOCGIFINDEX ioctlPaul Burton1-0/+1
Add a definition of the SIOCGIFINDEX ioctl, allowing its use by target programs. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-06-29linux-user: support the KDSIGACCEPT ioctlPaul Burton1-0/+1
Add a definition of the KDSIGACCEPT ioctl & allow its use by target programs. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-06-29linux-user: respect timezone for settimeofdayPaul Burton1-0/+5
The settimeofday syscall accepts a tz argument indicating the desired timezone to the kernel. QEMU previously ignored any argument provided by the target program & always passed NULL to the kernel. Instead, translate the argument & pass along the data userland provided. Although this argument is described by the settimeofday man page as obsolete, it is used by systemd as of version 213. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-06-29linux-user: fix struct target_epoll_event layout for MIPSPaul Burton1-1/+1
MIPS requires the pad field to 64b-align the data field just as ARM does. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-05-02linux-user: avoid using glibc internals in _syscall5 and in definition of ↵Natanael Copa1-1/+15
target_sigevent struct Use the public sigset_t instead of the glibc specific internal __sigset_t in _syscall. Calculate the sigevent pad size is calculated in similar way as kernel does it instead of using glibc internal field _pad. This is needed for building with musl libc. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-17linux-user: Implement capget, capsetPeter Maydell1-0/+11
Implement the capget and capset syscalls. This is useful because simple programs like 'ls' try to use it in AArch64, and otherwise we emit a lot of noise about it being unimplemented. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-03-17linux-user: implement F_[GS]ETOWN_EXAndreas Schwab1-0/+7
F_GETOWN is replaced by F_GETOWN_EX inside the glibc fcntl wrapper Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-03-03linux-user: Implement sendmmsg syscallAlexander Graf1-0/+4
Glibc when built for newer kernels assumes that the sendmmsg syscall is available. Without it, dns resolution simply fails to work. Wrap the syscall with existing infrastructure so that we don't have a host dependency on sendmmsg. To avoid locking the same area of guest memory twice (which will break if DEBUG_REMAP is defined) we pull the lock/unlock part of do_sendrecvmsg() out into its own function so the actual implementation can be shared. Signed-off-by: Alexander Graf <agraf@suse.de> [PMM: add recvmmsg support; handle errors (which also implies support for non-blocking operations); cap the vector length as the kernel implementation does; don't lock guest memory twice; support MSG_WAITFORONE flag] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
2014-03-03linux-user: Don't use UID16 on AArch64Andreas Schwab1-1/+2
The AArch64 kernel defines its __kernel_uid_t type as 32 bits, unlike 32 bit ARM, so don't enable our 16-bit UID wrapper handling. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
2014-02-19linux-user: Implement BLKPG ioctlAndreas Färber1-0/+1
Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-01-10linux-user: Support the accept4 socketcallAndré Hentschel1-0/+1
Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: André Hentschel <nerv@dawncrow.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-11-29linux-user: Add target struct defs needed for POSIX timer syscalls.Erik de Castro Lopo1-0/+25
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-11-07linux-user: Fix stat64 syscall for SPARC64Stefan Weil1-0/+14
Some targets use a stat64 structure for the stat64 syscall while others use a stat structure. SPARC64 used the wrong kind. Instead of extending the conditional compilation in syscall.c, now a macro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a target_stat64. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2013-09-24linux-user: Add setsockopt(SO_ATTACH_FILTER)Laurent Vivier1-0/+12
This is needed to be able to run dhclient. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-09-10linux-user: Fix up AArch64 syscall handlersAlexander Graf1-2/+26
Some syscall handlers have special code for ARM enabled that we don't need on AArch64. Exclude AArch64 in those cases. In other places we can share struct definitions with other targets or have to provide our own. With this patch applied, most syscall definitions in linux-user should be sound for AArch64. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1378235544-22290-16-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-9-git-send-email-john.rigby@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-07-23linux-user: Fix epoll on ARM hostsAlexander Graf1-1/+4
The epoll emulation uses data structures without packing them, so the compiler might choose to add padding inside. This patch makes the most offending one (target_epoll_event) a packed structure to make sure we don't pad it by accident. ARM would pad it, so declare the padding mandatory for ARM targets. This fixes i386-on-ARM epoll emulation for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-07-23linux-user: Fix target_stat and target_stat64 for OpenRISCPeter Maydell1-12/+37
OpenRISC uses the asm-generic versions of target_stat and target_stat64, but it was incorrectly using the x86/ARM/etc version due to a misplaced defined(TARGET_OPENRISC). The previously unused OpenRISC section of the ifdef ladder also defined an incorrect target_stat and omitted the target_stat64 definition. Fix target_stat, provide target_stat64, and add a comment noting that these are the asm-generic versions for the benefit of future ports. Reviewed-by: Jia Liu <proljc@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-01-16alpha-linux-user: Translate fcntl l_typeLaurent Vivier1-0/+18
The values of F_RDLCK, F_WRLCK, F_UNLCK, F_EXLCK, F_SHLCK differ between alpha and other linux architectures. This patch allows to run "dpkg" (database lock). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-12alpha-linux-user: Fix sigactionRichard Henderson1-1/+1
Unconditional bswap replaced by __get_user/__put_user. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-19janitor: add guards to headersPaolo Bonzini1-0/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-08-27linux-user: fix emulation of getdentsDmitry V. Levin1-4/+4
In case when TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64, the last byte of the target dirent structure (aka d_type byte) was never copied from the host dirent structure, thus breaking everything that relies on valid d_type value, e.g. glob(3). Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-08-13linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitionsPeter Maydell1-2/+2
Fix the SNDCTL_DSP_MAP{IN,OUT}BUF ioctl definitions so that they refer to a suitably defined target struct layout rather than hardcoding the ioctl number. This fixes complaints from the syscall_init() consistency check when running an x86_64-to-x86_64 linux-user qemu. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>