Statistics
| Branch: | Revision:

root / linux-user / syscall.c @ 1de7afc9

History | View | Annotate | Download (274.4 kB)

# Date Author Comment
1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

24c35a50 12/08/2012 08:49 pm Peter Maydell

linux-user: Merge pread/pwrite into pread64/pwrite64

The Linux syscalls underlying pread() and pwrite() take a 64 bit
offset on all architectures, even if some of them name the syscall
"pread/pwrite" rather than "pread64/pwrite64" for historical reasons....

41a05a45 10/19/2012 09:28 pm Aurelien Jarno

Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu

  • 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu:
    linux-user: register align p{read, write}64
    linux-user: ppc: mark as long long aligned
    tcg: Remove TCG_TARGET_HAS_GUEST_BASE define...
a5b3bdcb 10/19/2012 02:24 pm Edgar E. Iglesias

microblaze: Support setting of TLS ptr

Signed-off-by: Edgar E. Iglesias <>

ae017a5b 10/12/2012 02:42 pm Alexander Graf

linux-user: register align p{read, write}64

pread64 and pwrite64 pass 64bit parameters which for some architectures need
to be aligned to special argument pairs, creating a gap argument.

Handle this special case the same way we handle it in other places of the code....

4a1def4e 10/12/2012 02:38 pm Alexander Graf

linux-user: ppc: mark as long long aligned

The SysV PPC32 ABI dictates that long long (64bit) parameters are pass in odd/even
register pairs. Because unlike ARM and MIPS we start at an odd register number,
we can reuse the same aligning code that ARM and MIPS use....

a05c6409 10/12/2012 02:01 pm Richard Henderson

linux-user: Fix siginfo handling

Compare signal numbers in the proper domain.
Convert all of the fields for SIGIO and SIGCHLD.

Signed-off-by: Richard Henderson <>
Signed-off-by: Riku Voipio <>

3d21d29c 10/12/2012 01:59 pm Richard Henderson

linux-user: Implement gethostname

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>
Signed-off-by: Riku Voipio <>

f287b2c2 10/12/2012 01:59 pm Richard Henderson

linux-user: Perform more checks on iovec lists

Validate count between 0 and IOV_MAX. Limit total length of
operation in the same way the kernel does.

Signed-off-by: Richard Henderson <>
Signed-off-by: Riku Voipio <>

229d3376 10/12/2012 01:58 pm Alexander Graf

linux-user: fix statfs

The statfs syscall should always memset(0) its full struct extent before
writing to it. Newer versions of the syscall use one of the reserved fields
for flags, which would otherwise get stale values from uncleaned memory.

This fixes libarchive for me, which got confused about the return value of...

1bdd7c7e 10/12/2012 01:58 pm Alexander Graf

linux-user: fix multi-threaded /proc/self/maps

When reading our faked /proc/self/maps from a secondary thread,
we get an invalid stack entry. This is because ts->stack_base is not
initialized in non-primary threads.

However, ts->info is, and the stack layout information we're looking...

ad11ad77 09/23/2012 09:35 am Stefan Weil

linux-user: Remove redundant null check and replace free by g_free

Report from smatch:

linux-user/syscall.c:3632 do_ioctl_dm(220) info:
redundant null check on big_buf calling free()

'big_buf' was allocated by g_malloc0, therefore free was also
replaced by g_free....

333858b7 08/27/2012 10:17 am Dmitry V. Levin

linux-user: fix emulation of getdents

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)....

0d07fe47 08/22/2012 06:47 pm Jim Meyering

linux-user: do_msgrcv: don't leak host_mb upon TARGET_EFAULT failure

Also, use g_malloc to avoid NULL-deref upon OOM.

Signed-off-by: Jim Meyering <>
Signed-off-by: Anthony Liguori <>

ca619067 08/14/2012 10:26 pm Jing Huang

linux-user: pass sockaddr from host to target

Signed-off-by: Jing Huang <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Peter Maydell <>

920394db 08/14/2012 10:26 pm Jing Huang

linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option

Signed-off-by: Jing Huang <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Peter Maydell <>

aebf5bc7 08/14/2012 10:26 pm Jing Huang

linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type

Signed-off-by: Jing Huang <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Peter Maydell <>

dd6e957a 08/13/2012 02:45 pm Peter Maydell

linux-user: Move target_to_host_errno_table[] setup out of ioctl loop

The code to initialise the target_to_host_errno_table[] array was
accidentally inside the loop through checking and initialising all
the supported ioctls. This was harmless but meant that we reinitialised the...

95c09828 08/04/2012 07:37 pm Richard Henderson

alpha-linux-user: Fix the getpriority syscall

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....

6e06d515 08/04/2012 07:37 pm Richard Henderson

alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly

We weren't aggregating the exceptions, nor raising signals properly.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

afc8763f 08/04/2012 07:37 pm Richard Henderson

linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

e7ea6cbe 08/04/2012 07:37 pm Richard Henderson

linux-user: Translate pipe2 flags; add to strace

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

0229f5a3 08/04/2012 07:37 pm Richard Henderson

alpha-linux-user: Properly handle the non-rt sigprocmask syscall.

Name the syscall properly for QEMU, kernel source notwithstanding.
Fix syntax errors in the code thus enabled within do_syscall.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

d962783e 07/28/2012 12:13 am Jia Liu

target-or32: Add linux user support

Add QEMU OpenRISC linux user support.

Signed-off-by: Jia Liu <>
Signed-off-by: Blue Swirl <>

ff18b762 06/05/2012 12:00 am Andreas Färber

linux-user: Use cpu_reset() after cpu_init() / cpu_copy()

Eliminates cpu_state_reset() usage.

Signed-off-by: Andreas Färber <>

1a49ef2a 05/03/2012 05:31 pm Alexander Graf

linux-user: fix emulation of /proc/self/maps

Improve the emulation of /proc/self/maps by reading the underlying
host maps file and passing lines through with addresses adjusted
to be guest addresses. This is necessary to avoid false triggers
of the glibc check that a format string containing '%n' is not in...

209c4849 05/03/2012 05:31 pm Andreas Färber

linux-user: Clean up interim solution for exit syscall

After all target CPUs have been QOM'ified, we no longer need an #ifdef
to switch between object_delete() and g_free() in NPTL thread exit.

Signed-off-by: Andreas Färber <>
Signed-off-by: Riku Voipio <>

11ea4090 04/15/2012 07:54 pm Andreas Färber

linux-user: Fix exit syscall with QOM CPU

For QOM'ified CPUs we cannot g_free() CPUArchState, we must
object_delete() the object it is embedded into.

Fixes LP#982321 (invalid free() while executing pacman with qemu-arm).

Reported-by: Serge Schneider <>...

56e904ec 04/06/2012 06:49 pm Alexander Graf

linux-user: implement device mapper ioctls

This patch implements all ioctls currently implemented by device mapper,
enabling us to run dmsetup and kpartx inside of linux-user.

Signed-off-by: Alexander Graf <>
Signed-off-by: Riku Voipio <>

20249ae1 04/06/2012 06:49 pm Alexander Graf

linux-user: fix fallocate

Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.

Signed-off-by: Alexander Graf <>


v1 -> v2:

- unbreak 64-bit guests

Signed-off-by: Riku Voipio <>

1e6722f8 04/06/2012 06:49 pm Peter Maydell

linux-user/syscall.c: Fix indentation in prctl handling

Clean up the odd indentation of this switch statement before
we double its size by adding new cases to it.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

db9526b1 04/06/2012 06:49 pm Peter Maydell

linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME

Add support for the prctl options PR_GET_NAME and PR_SET_NAME,
which take or return a name in a 16 byte buffer pointed to by arg2.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

e0e65bee 04/06/2012 06:49 pm Fabio Erculiani

linux-user: improve fake /proc/self/stat making `ps` not segfault.

With the current fake /proc/self/stat implementation `ps` is
segfaulting because it expects to read PID and argv0 as first and
second field respectively, with the latter being enclosed between...

9349b4f9 03/14/2012 11:20 pm Andreas Färber

Rename CPUState -> CPUArchState

Scripted conversion:
for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do
sed -i "s/CPUState/CPUArchState/g" $file
done...

1bba0dc9 03/14/2012 11:20 pm Andreas Färber

Rename cpu_reset() to cpu_state_reset()

Frees the identifier cpu_reset for QOM CPUs (manual rename).

Don't hide the parameter type behind explicit casts, use static
functions with strongly typed argument to indirect.

Signed-off-by: Andreas Färber <>...

3a0c6c4a 02/10/2012 12:48 pm Paul Brook

linux-user: brk() debugging

Fix format type mismatches in do_brk debug printfs.

Signed-off-by: Paul Brook <>
Signed-off-by: Stefan Hajnoczi <>

a6f79cc9 02/10/2012 12:44 pm Ulrich Hecht

linux-user: fail execve() if env/args too big

If the host's page size is equal to or smaller than the target's, native
execve() will fail appropriately with E2BIG if called with too big an
environment for the target to handle. It may falsely succeed, however, if...

36c08d49 02/02/2012 05:51 pm Alexander Graf

linux-user: fake /proc/self/maps

glibc's pthread_attr_getstack tries to find the stack range from
/proc/self/maps. Unfortunately, /proc is usually the host's /proc
which means linux-user guests see qemu's stack there.

Fake the file with a constructed maps entry that exposes the guest's...

480b8e7d 02/02/2012 05:51 pm Alexander Graf

linux-user: fake /proc/self/stat

The boehm gc finds the program's stack starting pointer by
checking /proc/self/stat. Unfortunately, so far it reads
qemu's stack pointer which clearly is wrong.

So let's instead fake the file so the guest program sees the...

257450ee 02/02/2012 05:51 pm Alexander Graf

linux-user: fake /proc/self/auxv

Gtk tries to read /proc/self/auxv to find its auxv table instead of
taking it from its own program memory space.

However, when running with linux-user, we see the host's auxv which
clearly exposes wrong information. so let's instead expose the guest...

583359a6 02/02/2012 05:51 pm Akos PASZTORY

linux-user: add SO_PEERCRED support for getsockopt

Signed-off-by: Akos PASZTORY <>
Signed-off-by: Riku Voipio <>

962b289e 02/02/2012 05:51 pm Alexander Graf

linux-user: fix QEMU_STRACE=1 segfault

While debugging some issues with QEMU_STRACE I stumbled over segmentation
faults that were pretty reproducible. Turns out we tried to treat a
normal return value as errno, resulting in an access over array boundaries...

5379557b 02/02/2012 05:51 pm Alexander Graf

linux-user: fix wait* syscall status returns

When calling wait4 or waitpid with a status pointer and WNOHANG, the
syscall can potentially not modify the status pointer input. Now if we
have guest code like:

int status = 0;
waitpid(pid, &status, WNOHANG);...
e3c33ec6 02/02/2012 05:51 pm Peter Maydell

linux-user: Allow NULL value pointer in setxattr and getxattr

It's valid to pass a NULL value pointer to setxattr, so don't
fail this case EFAULT.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

30297b55 02/02/2012 05:51 pm Peter Maydell

linux-user/syscall.c: Implement f and l versions of set/get/removexattr

Implement the f and l versions (operate on fd, don't follow links)
of the setxattr, getxattr and removexattr syscalls.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

fb5590f7 02/02/2012 05:51 pm Peter Maydell

linux-user: Implement *listxattr syscalls

Implement listxattr, flistxattr and llistxattr syscalls.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

3be14d05 02/02/2012 05:51 pm Alexander Graf

linux-user: add open() hijack infrastructure

There are a number of files in /proc that expose host information
to the guest program. This patch adds infrastructure to override
the open() syscall for guest programs to enable us to on the fly
generate guest sensible files....

31b63193 12/06/2011 12:08 pm Peter Maydell

linux-user/syscall.c: Don't skip stracing for fcntl64 failure case

In an fcntl64 failure path, we were returning directly rather than
simply breaking out of the switch statement. This skips the strace
code for printing the syscall return value, so don't do that....

3a93113a 12/06/2011 11:56 am Dong Xu Wang

fix typo: delete redundant semicolon

Double semicolons should be single.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>

4f26f2b6 11/09/2011 08:06 pm Avi Kivity

configure: fix detection for xattr.h on modern distributions

Modern distributions place xattr.h in /usr/include/sys, and fold
libattr.so into libc. They also don't have an ENOATTR.

Make configure detect this, and add a qemu-xattr.h file that
directs the #include to the right place....

0f6b4d21 10/27/2011 02:42 pm Alexander Graf

linux-user: implement reboot syscall

For OBS, we're running a full cross-guest inside of a VM. When a build
is done there, we reboot the guest as shutdown mechanism.

Unfortunately, reboot is not implemented in linux-user. So this mechanism
fails, spilling unpretty warnings. This patch implements sys_reboot()...

cbb21eed 10/27/2011 02:42 pm Matthias Braun

linux-user: fix abi_(u)long, target_ulong mismatch

abi_(u)long might be different from target_ulong, so don't use tswapl
but introduce a new tswapal

Signed-off-by: Matthias Braun <>
Signed-off-by: Riku Voipio <>

f4c69010 10/27/2011 02:42 pm Alexander Graf

linux-user: fix openat

When running openat using qemu-arm, we stumbled over invalid permissions
on the created files. The reason for this is that the mode parameter gets
treates as an O_... flag, which it isn't - it's a permission bitmask.

This patch removes the needless translation of the mode parameter,...

11ddeea9 09/26/2011 03:59 pm Anthony Liguori

Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

b2bedb21 09/16/2011 04:25 pm Stefan Weil

Remove blanks before \n in output strings

Those blanks violate the coding conventions, see
scripts/checkpatch.pl.

Blanks missing after colons in the changed lines were added.

This patch does not try to fix tabs, long lines and other
problems in the changed lines, therefore checkpatch.pl reports...

5a61cb60 09/09/2011 11:56 am Stefan Weil

Fix include statements for qemu-common.h

  • qemu-common.h is not a system include file, so it should be included
    with "" instead of <>. Otherwise incremental builds might fail
    because only local include files are checked for changes.
  • linux-user/syscall.c included the file twice....
a790ae38 09/09/2011 10:48 am An-Cheng Huang

linux-user: Implement setxattr/getxattr/removexattr syscalls

This patch implements the setxattr, getxattr, and removexattr syscalls
if CONFIG_ATTR is enabled.

Note that since libattr uses indirect syscalls for these, this change
depends on the fix for indirect syscall handling on MIPS....

70afc343 09/09/2011 10:45 am Cédric VINCENT

linux-user: Fix initialization of the heap contents when allocating new pages

Technically the new mmapped pages are already initialized to zero
since they are anonymous, however we have to take care with the
contents that come from the remaining part of the previous page: it...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

00aa0040 07/25/2011 05:38 pm Blue Swirl

Wrap recv to avoid warnings

Avoid warnings like these by wrapping recv():
CC slirp/ip_icmp.o
/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':
/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...

48e515d4 07/13/2011 05:38 pm Riku Voipio

linux-user: make MIPS and ARM eabi use same argument reordering

MIPS uses similar calling convention than ARM eabi, where when using
64-bit values some registers are skipped. This patch makes MIPS and ARM
eabi share the argument reordering code.

This affects ftruncate64, creating insane sized fails (or just failing)....

e22b7015 07/12/2011 02:42 pm Wesley W. Terpstra

mips: rlimit codes are not the same

The codes for get/setrlimit differ between linux target platforms.
This patch adds conversion.
This is important else programs (rsyslog, python, ...) can go into a
near infinite loop trying to close all the file descriptors from 0 to...

95b33b2f 07/12/2011 02:38 pm Wesley W. Terpstra

mips: rlimit incorrectly converts values

Byte swap was applied in the wrong order with testing for
RLIM_INFINITY. On mips bigendian from an amd64 system this results in
infinity being misinterpretted as 2^31-1.

This is a serious bug because it causes setrlimit stack size to kill...

8f04eeb3 07/11/2011 04:35 pm Peter Maydell

linux-user/syscall.c: Enforce pselect6 sigset size restrictions

Enforce the same restriction on the size of the sigset passed to
pselect6 as the Linux kernel does. This is both correct and silences
a gcc 4.6 warning about a write-only variable.

Signed-off-by: Peter Maydell <>...

163a05a8 07/11/2011 04:34 pm Peter Maydell

linux-user: Implement prlimit64 syscall

Implement the prlimit64 syscall.

Slightly modified to apply upstream -Riku

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

bc088ba1 06/21/2011 08:30 pm Juan Quintela

linux-user: syscall should use sanitized arg1

Looking at the other architectures, we should be using "how" not "arg1".

Signed-off-by: Juan Quintela <>
[: remove unnecessary initialisation of how]
Signed-off-by: Peter Maydell <>...

5945cfcb 06/21/2011 08:30 pm Peter Maydell

linux-user: Bump do_syscall() up to 8 syscall arguments

On 32 bit MIPS a few syscalls have 7 arguments, and so to call
them via NR_syscall the guest needs to be able to pass 8 arguments
to do_syscall(). Raise the number of arguments do_syscall() takes
accordingly....

bfcedc57 06/21/2011 08:30 pm Riku Voipio

linux-user: Fix sync_file_range on 32bit mips

As noticed while looking at "Bump do_syscall() up to 8 syscall arguments"
patch, sync_file_range uses a pad argument on 32bit mips. Deal with it
by reading the correct arguments when on mips.

Signed-off-by: Riku Voipio <>

4d1de87c 06/21/2011 08:30 pm vincent

linux-user: Fix the computation of the requested heap size

There were several remaining bugs in the previous implementation of
do_brk():

1. the value of "new_alloc_size" was one page too large when the
requested brk was aligned on a host page boundary....
055e0906 06/21/2011 08:30 pm Mike Frysinger

linux-user: add pselect6 syscall support

Some architectures (like Blackfin) only implement pselect6 (and skip
select/newselect). So add support for it.

Signed-off-by: Mike Frysinger <>
Signed-off-by: Riku Voipio <>

1add8698 06/21/2011 08:30 pm Juan Quintela

syscall: really return ret code

We assign ret with the error code, but then return 0 unconditionally.

Signed-off-by: Juan Quintela <>
Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

00faf08c 06/21/2011 08:29 pm Peter Maydell

linux-user: Don't use MAP_FIXED in do_brk()

Since mmap() with MAP_FIXED will map over the top of existing mappings,
it's a bad idea to use it to implement brk(), because brk() with a
large size is likely to overwrite important things like qemu itself
or the host libc. So we drop MAP_FIXED and handle "mapped but at...

a4c075f1 05/20/2011 06:35 pm Ulrich Hecht

s390x: s390x-linux-user support

This patch adds support for running s390x binaries in the linux-user emulation
code.

Signed-off-by: Ulrich Hecht <>
Signed-off-by: Alexander Graf <>

67bd9ede 05/08/2011 12:59 pm Stefan Weil

linux-user: Replace deprecated function

Function bzero is deprecated, so replace it by function memset.

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

e95d3bf0 05/02/2011 10:00 am Mike McCormack

Fix buffer overrun in sched_getaffinity

Zeroing of the cpu array should start from &cpus[kernel_ret]
not &cpus[num_zeros_to_fill].

This fixes a crash in EFL's edje_cc running under qemu-arm.

Signed-off-by: Mike McCormack <>
Reviewed-by: Stefan Hajnoczi <>...

cd18f05e 05/02/2011 10:00 am Mike McCormack

Don't zero out buffer in sched_getaffinity

The kernel doesn't fill the buffer provided to sched_getaffinity
with zero bytes, so neither should QEMU.

Signed-off-by: Mike McCormack <>
Reviewed-by: Stefan Hajnoczi <>...

86fcd946 04/26/2011 10:15 am Laurent Vivier

linux-user: add ioctl(SIOCGIWNAME, ...) support.

Allow to run properly following program from linux-user:

/* cc -o wifi wifi.c */

#include &lt;stdio.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;linux/wireless.h&gt;
#include &lt;netinet/in.h&gt;...
42a39fbe 04/26/2011 10:15 am Alexander Graf

linux-user: add s390x to llseek list

We keep a list of host architectures that do llseek with the same
syscall as lseek. S390x is one of them, so let's add it to the list.

Original-patch-by: Ulrich Hecht <>
Signed-off-by: Alexander Graf <>...

0c866a7e 04/26/2011 10:15 am Riku Voipio

linux-user: untie syscalls from UID16

Quite a number of uid/gid related syscalls are only defined on systems
with USE_UID16 defined. This is apperently based on the idea that these
system calls would never be called on non-UID16 systems. Make these
syscalls available for all architectures that define them....

05098a93 04/26/2011 10:15 am Riku Voipio

[v2] linux-user: bigger default stack

PTHREAD_STACK_MIN (16KB) is somewhat inadequate for a new stack for new
QEMU threads. Set new limit to 256K which should be enough, yet doesn't
increase memory pressure significantly.

Signed-off-by: Riku Voipio <>...

059c2f2c 04/26/2011 10:15 am Laurent Vivier

linux-user: convert ioctl(SIOCGIFCONF, ...) result.

The result needs to be converted as it is stored in an array of struct
ifreq and sizeof(struct ifreq) differs according to target and host
alignment rules.

This patch allows to execute correctly the following program on arm...

30cb4cde 03/22/2011 08:46 am Peter Maydell

linux-user: Fix unlock_user() call in return from poll()

Correct the broken attempt to calculate the third argument
to unlock_user() in the code path which unlocked the pollfd
array on return from poll() and ppoll() emulation. (This
only caused a problem if unlock_user() wasn't a no-op, eg...

0c1592d9 03/06/2011 08:06 pm Peter Maydell

linux-user: Fix large seeks by 32 bit guest on 64 bit host

When emulating a 32 bit Linux user-mode program on a 64 bit target
we implement the llseek syscall in terms of lseek. Correct a bug
which meant we were silently casting the result of host lseek()...

3b6edd16 02/17/2011 11:46 am Peter Maydell

linux-user: Support the epoll syscalls

Support the epoll family of syscalls: epoll_create(), epoll_create1(),
epoll_ctl(), epoll_wait() and epoll_pwait(). Note that epoll_create1()
and epoll_pwait() are later additions, so we have to test separately
in configure for their presence....

d8035d4c 02/09/2011 10:33 am Mike Frysinger

linux-user: add ppoll syscall support

Some architectures (like Blackfin) only implement ppoll (and skip poll).
So add support for it using existing poll code.

Reviewed-by: Peter Maydell <>
Signed-off-by: Mike Frysinger <>...

737de1d1 02/09/2011 10:33 am Mike Frysinger

linux-user: implement sched_{g,s}etaffinity

Signed-off-by: Mike Frysinger <>
Signed-off-by: Riku Voipio <>

73160d95 02/09/2011 10:33 am Mike Frysinger

linux-user: fix sizeof handling for getsockopt

Signed-off-by: Mike Frysinger <>
Signed-off-by: Riku Voipio <>

dace20dc 01/12/2011 01:06 am Peter Maydell

linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP

Add a configure check for the existence of linux/fiemap.h and the
IOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linux
systems which don't have that header file.

Signed-off-by: Peter Maydell <>...

285da2b9 01/07/2011 05:20 pm Peter Maydell

linux-user: Implement FS_IOC_FIEMAP ioctl

Implement the FS_IOC_FIEMAP ioctl using the new support for
custom handling of ioctls; this is needed because the struct
that is passed includes a variable-length array.

Signed-off-by: Peter Maydell <>...

d2ef05bb 01/07/2011 05:20 pm Peter Maydell

linux-user: Support ioctls whose parameter size is not constant

Some ioctls (for example FS_IOC_FIEMAP) use structures whose size is
not constant. The generic argument conversion code in do_ioctl()
cannot handle this, so add support for implementing a special-case...

c727f47d 01/07/2011 05:13 pm Peter Maydell

linux-user: Implement sync_file_range{,2} syscalls

Implement the missing syscalls sync_file_range and sync_file_range2.
The latter in particular is used by newer versions of apt on Ubuntu
for ARM.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

f3b974cd 12/03/2010 03:09 pm Jamie Lentin

linux-user: Translate getsockopt level option

n setsockopt, the socket level options are translated to the hosts'
architecture before the real syscall is called, e.g.
TARGET_SO_TYPE -> SO_TYPE. This patch does the same with getsockopt.

Tested on a x86 host emulating MIPS. Without it:-...

9190749f 12/03/2010 03:09 pm Riku Voipio

linux-user: fix compiler error on nptl

Some compilers detect that new_stack isnt used after dd75d784

Signed-off-by: Riku Voipio <>

48e15fc2 12/03/2010 03:09 pm Nathan Froyd

linux-user: fix memory leaks with NPTL emulation

Running programs that create large numbers of threads, such as this
snippet from libstdc++'s pthread7-rope.cc:

const int max_thread_count = 4;
const int max_loop_count = 10000;
...
for (int j = 0; j < max_loop_count; j++)...
38724253 09/18/2010 08:53 am Blue Swirl

linux-user: fix socklen_t comparisons

On many systems, socklen_t is defined as unsigned. This means that
checks for negative values are not meaningful.

Fix by explicitly casting to a signed integer.

This also avoids some warnings with GCC flag -Wtype-limits....

97374d38 06/16/2010 03:03 pm Paul Brook

Usermode exec-stack fix

When loading a shared library that requires an executable stack,
glibc uses the mprotext PROT_GROWSDOWN flag to achieve this.
We don't support PROT_GROWSDOWN.
Add a special case to handle changing the stack permissions in this way....

d35b261c 06/11/2010 07:15 pm Richard Henderson

s390x: Avoid _llseek.

There's no _llseek on s390x either. Replace the existing
test for x86_64 with a functional test for __NR_llseek.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

9e42382f 05/21/2010 07:42 pm Riku Voipio

linux-user: do not warn for missing pselect6

Libc will fallback gracefully if pselect6 is not available. Thus put
pselect6 to nowarn until the atomicity issues of the original pselect6
patch are dealt with.

Signed-off-by: Riku Voipio <>...

f43ce12b 05/21/2010 07:22 pm Richard Henderson

alpha-linux-user: Fix sigsuspend parameters.

Alpha passes the signal set in a register, not by reference.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

a5b3b13b 05/21/2010 07:22 pm Richard Henderson

alpha-linux-user: Fix sigprocmask.

Alpha passes oldset by value in a register, and returns the newset
as the return value; as compared to the standard implementation in
which both are passed by reference. This requires being able to
distinguish negative return values that are not errors. Do this in...