summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2009-06-16raw-posix: Remove O_RDWR when attempting to open a file read-onlyAvi Kivity1-0/+1
When we open a file, we first attempt to open it read-write, then fall back to read-only. Unfortunately we reuse the flags from the previous attempt, so both attempts try to open the file with write permissions, and fail. Fix by clearing the O_RDWR flag from the previous attempt. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16raw-posix: open flags use BDRV_ namespace, not posix namespaceAvi Kivity1-1/+1
The flags argument to raw_common_open() contain bits defined by the BDRV_O_* namespace, not the posix O_* namespace. Adjust to use the correct constants. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16qdev: Fix regression in "pci_add ... storage if=virtio, ..."Markus Armbruster1-1/+0
qemu_pci_hot_add_storage() runs qdev_init() twice. Broken in commit 07e3af9a "Virtio-blk qdev conversion". Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16Make sure to use SDL_CFLAGS everywhere we include SDL headersAnthony Liguori2-1/+3
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16linux-user: remove duplicate tswap32() from do_getsockopt()Laurent Vivier1-1/+0
This issue has been detected with tests/linux-tests.c: linux-test.c:330: getsockopt 327 len = sizeof(val); 328 chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len)); 329 if (val != SOCK_STREAM) 330 error("getsockopt"); In linux-user/syscall.c:do_getsockopt(), we have: ... val = tswap32(val); ... if (put_user_u32(val, optval_addr)) ... whereas "put_user_u32" calls in the end "__put_user" which uses "tswap32". So the "val = tswap32(val);" is useless and wrong. This patch removes it. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user/syscall.c: define _ATFILE_SOURCEEduardo Habkost1-0/+1
Needed to make sure the xxxat() functions are available. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: initialize mmap_mutex properlyNathan Froyd1-1/+1
We initialize mmap_mutex in any child threads/processes, but we need to correctly statically initialize it for the original process. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16RFC: fix fcntl support in linux-user - new tryArnaud Patard (Rtp)2-24/+73
Hi, This is a new try to fix the fcntl support in linux-user. I tried to adress all comments but as the previous version is several weeks old, it's possible that I've missed some. This patch doesn't handle linux specific fcntl flags. My plan is to get this version of the patch reviewed/fixed and then, add them if wanted. Thanks, Arnaud Signed-off-by: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: add tee, splice and vmsplicevibisreenivasan2-0/+63
Add support for tee, splice and vmsplice. Originally from: vibi sreenivasan <vibi_sreenivasan@cms.com> Riku: squashed patches together, added a test to configure and removed compliler warning by picking up correct type for splice param Signed-off-by: vibisreenivasan <vibi_sreenivasan@cms.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: implement pipe2 [v3]Riku Voipio2-18/+58
implement pipe2 syscall. [v2] fix do_pipe on mips and sh4 [v3] use pipe2 to ensure atomicity, but only when it is available. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: update syscall listRiku Voipio11-0/+96
In preparation for supporting pipe2() Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16add futex wake opRiku Voipio1-0/+2
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: support private futexesMartin Mohring1-5/+9
Implemented the same way as in the kernel. From: Martin Mohring <martin.mohring@opensuse.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: include linux/fs.hMartin Mohring1-0/+1
defines FIGETBSZ FIBMAP, allowing the respective ioctl's to be implemented. From: Martin Mohring <martin.mohring@opensuse.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags ↵Lionel Landwerlin2-0/+20
to setsockopt linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockoptLionel Landwerlin2-0/+45
linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockopt Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16Return EOPNOTSUPP instead of ENOSYS for *xattr* syscallsArnaud Patard1-1/+2
In current code, we're sending ENOSYS to target when a syscall for the xattrs is done. This makes applications like ls complain loudly about that and breaks scripts parsing the output. Moreover, iirc, implemented features of filesystems are are sending EOPNOTSUPP (I've not checked so I may be a little bit wrong on that...). So, I'm proposing to return -EOPNOTSUPP and make ls happy Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16Fix struct termios host - target translationArnaud Patard1-0/+2
When converting the termios structure between host and target in target_to_host_termios and host_to_target_termios, the c_cc[] array is never initialised. Calling memset() before using it allows to run successfully "stty echo / stty -echo" on arm-linux-user target (host being x86 and mips). Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: fix utimensatRiku Voipio2-14/+46
The glibc function for utimensat glibc returns -EINVAL when the path is null which is a different behaviour with the syscall. path can be null because internally the glibc is using utimensat with path null when implmenting futimens. If path is null, call futimes instead. don't try to copy timespec from user if is NULL. Add configure check for older systems Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: strace now handles guest strings correctly [v2]Mika Westerberg4-77/+1118
- to not to break strace with GUEST_BASE is set: - Strace now can load and print guest strings correctly. - Added printing support for commonly used flags in some syscalls (e.g open, creat, mmap etc.) v2: - fix strace.c build on etch - add futex print to strace Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: added x86 and x86_64 support for ELF coredumpMika Westerberg1-0/+83
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16linux-user: implemented ELF coredump support for ARM targetMika Westerberg9-68/+1101
When target process is killed with signal (such signal that should dump core) a coredump file is created. This file is similar than coredump generated by Linux (there are few exceptions though). Riku Voipio: added support for rlimit Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16Implement shm* syscalls and fix 64/32bit errorsRiku Voipio1-49/+250
No regressions were observed on either 64bit or 32bit IA hosts. Patch based on original patches by: Kirill A. Shutemov <kirill@shutemov.name> - Implement shm* syscalls - Fix and cleanup IPCOP_shm* ipc calls handling Depends on "export mmap_find_vma for shmat" patch. Various whitespace uglifications applied to minimize patch size. Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16export mmap_find_vma for shmatRiku Voipio2-1/+2
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-15Incorporate changes from v2 of Gleb's RTC reset patchAnthony Liguori1-4/+8
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-15etrax: Don't pass CPUState to peripherals.Edgar E. Iglesias6-20/+10
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-06-15Merge commit 'block/master' into stagingAnthony Liguori6-332/+408
* commit 'block/master': raw-posix: cleanup ioctl methods block: add bdrv_probe_device method raw-posix: split hdev drivers raw-posix: add a raw_open_common helper raw-posix: always store open flags fix qemu_aio_flush Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-15Fix warning in qemu-nbd.cAnthony Liguori1-2/+6
qemu-nbd.c:349: error: ignoring return value of 'daemon', declared with attribute warn_unused_result Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-15raw-posix: cleanup ioctl methodsChristoph Hellwig1-34/+8
Rename raw_ioctl and raw_aio_ioctl to hdev_ioctl and hdev_aio_ioctl as they are only used for the host device. Also only add them to the method table for the cases where we need them (generic hdev if linux and linux CDROM) instead of declaring stubs and always add them. Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15block: add bdrv_probe_device methodChristoph Hellwig4-32/+74
Add a bdrv_probe_device method to all BlockDriver instances implementing host devices to move matching of host device types into the actual drivers. For now we keep exacly the old matching behaviour based on the devices names, although we really should have better detetion methods based on device information in the future. Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15raw-posix: split hdev driversChristoph Hellwig2-277/+347
Instead of declaring one BlockDriver for all host devices declared one for each type: a generic one for normal disk devices, a Linux floppy driver and a CDROM driver for Linux and FreeBSD. This gets rid of a lot of messy ifdefs and switching based on the type in the various removal device methods. block.c grows a new method to find the correct host device driver based on OS-sepcific criteria, which will later into the actual drivers in a later patch in this series. Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15raw-posix: add a raw_open_common helperChristoph Hellwig1-29/+19
raw_open and hdev_open contain the same basic logic. Add a new raw_open_common helper containing the guts of the open routine and call it from raw_open and hdev_open. We use the new open_flags field in BDRVRawState to allow passing additional open flags to raw_open_common from both. Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15raw-posix: always store open flagsChristoph Hellwig1-26/+21
Both the Linux floppy and the FreeBSD CDROM host device need to store the open flags so that they can re-open the device later. Store the open flags unconditionally to remove the ifdef mess and simply the calling conventions for the later patches in the series. Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15fix qemu_aio_flushAndrea Arcangeli2-5/+10
qemu_aio_wait by invoking the bh or one of the aio completion callbacks, could end up submitting new pending aio, breaking the invariant that qemu_aio_flush returns only when no pending aio is outstanding (possibly a problem for migration as such). Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Kevin Wolf <kwolf@redhat.com>
2009-06-14Add rtc reset function.Gleb Natapov1-0/+19
On reset: Periodic Interrupt Enable (PIE) bit is cleared to zero Alarm Interrupt Enable (AIE) bit is cleared to zero Update ended Interrupt Flag (UF) bit is cleared to zero Interrupt Request status Flag (IRQF) bit is cleared to zero Periodic Interrupt Flag (PF) bit is cleared to zero Alarm Interrupt Flag (AF) bit is cleared to zero Square Wave output Enable (SQWE) zero Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13migrate_fd_close: delete associated io-handler before closing the fdUri Lublin1-0/+2
It may happen that the io-handler is still registered. That causes select() to return with EBADF, not calling handlers for other fds. The io-handler would be registered when (on the source) the whole state was written but not yet flushed. For example when using QEMUFileBuffered, (tcp-migration) there may be data left in a buffer waiting to be transferred. In such a case buffered_close() calls buffered_flush() which calls migrate_fd_put_buffer, which may, upon EAGAIN, register migrate_fd_put_notify as a handler. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13exec-migration: handle EINTR in popen_get_buffer()Uri Lublin1-1/+8
Sometimes, upon interrupt, fread returns with no data, and the (incoming exec) migration fails. Fix by retrying on such a case. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Fix prototype of function zfree.Stefan Weil1-2/+2
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Add static to local machine declaration.Stefan Weil1-1/+1
Variable akitapda_machine is only used locally, so the static attribute avoids a compiler warning. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Don't use cpu_index as apic_id.Gleb Natapov3-13/+40
(patch is on top of "Apic creation should not depend on pci" series) Currently cpu_index is used as cpu apic id on x86. This is incorrect since apic ids not have to be continuous (they can also encode cpu hierarchy information). This patch uses cpuid_apic_id for initial apic id value. For now cpuid_apic_id is set to be equal to cpu_index so behaviour is fully backward compatible, but it allows us to add qemu option to provide other values for cpu apic id. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Apic creation should not depend on pciGleb Natapov1-8/+2
It should depend on whether cpu has APIC. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Add -no-virtio-balloon command-line optionEduardo Habkost4-1/+15
This new option may be used to disable the virtio-balloon device. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Fix SDL include path.Stefan Weil2-2/+2
SDL header files can be included in two different ways: * like this: #include <SDL/SDL.h> * like this: #include <SDL.h> The 1st alternative is simple and works in many cases. The 2nd alternative needs sdl-config to get the correct compiler flags. It is the recommended way to write SDL includes and standard for QEMU. The patch fixes two non-standard SDL includes. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13Really enable -WerrorBlue Swirl1-13/+14
487fefdb.. did not actually enable -Werror despite the claims made by configure output. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13Avoid collision with system NGROUPS definitionBlue Swirl1-3/+3
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13Fix a warning: uint_fast8_t is not 8 bits on OpenBSD/Sparc64Blue Swirl1-2/+6
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13Avoid a gcc 3 format warningBlue Swirl2-12/+4
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13Avoid gcc 4.4 warning about uninitialized fieldBlue Swirl1-0/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13Fix signedness problemsBlue Swirl1-3/+3
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-13xen nic: check tx queue after connect.Gerd Hoffmann1-0/+2
Needed for savevm/loadvm + migration: In that case the queue might already have packets on (re-)connect. The guest wouldn't notify us because notifications are only sent when stuffing a packet into an empty queue. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>