Statistics
| Branch: | Revision:

root / osdep.c @ 949d31e6

History | View | Annotate | Download (5.7 kB)

# Date Author Comment
70e72ce4 10/30/2010 11:02 am Jes Sorensen

qemu_pipe() is used only by POSIX code, so move to oslib-posix.c

Signed-off-by: Jes Sorensen <>
Signed-off-by: Blue Swirl <>

949d31e6 10/30/2010 11:02 am Jes Sorensen

We only support eventfd under POSIX, move qemu_eventfd() to os-posix.c

Signed-off-by: Jes Sorensen <>
Signed-off-by: Blue Swirl <>

c1b0b93b 10/30/2010 11:02 am Jes Sorensen

Move QEMU OS dependant library functions to OS specific files

This moves library functions used by both QEMU and the QEMU tools,
such as qemu-img, qemu-nbd etc. from osdep.c to oslib-{posix,win32}.c

In addition it introduces oslib-obj.y to the Makefile set to be...

9549e764 10/30/2010 11:02 am Jes Sorensen

Move osdep socket code to oslib-{posix,win32}.c

Signed-off-by: Jes Sorensen <>
Signed-off-by: Blue Swirl <>

e78815a5 09/25/2010 02:26 pm Andreas Färber

Introduce qemu_madvise()

vl.c has a Sun-specific hack to supply a prototype for madvise(),
but the call site has apparently moved to arch_init.c.

Haiku doesn't implement madvise() in favor of posix_madvise().
OpenBSD and Solaris 10 don't implement posix_madvise() but madvise()....

cd245a19 09/10/2010 12:22 am Stefan Hajnoczi

trace: Trace qemu_malloc() and qemu_vmalloc()

It is often useful to instrument memory management functions in order to
find leaks or performance problems. This patch adds trace events for
the memory allocation primitives.

Signed-off-by: Stefan Hajnoczi <>

4972d592 06/27/2010 07:25 pm Stefan Weil

win32: Add missing function ffs

mingw32 does not include function ffs.

Commit c6d29ad6e24533cc3762e1d654275607e1d03058 added a
declaration for ffs, but an implementation was missing.

For compilations with optimization, the compiler creates
inline code, so the implementation is not always needed....

1298cb68 03/09/2010 07:23 pm Juan Quintela

documentation: qemu_write_full don't work with non-blocking fd's

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

153ceefb 02/23/2010 07:22 pm Avi Kivity

Fix qemu_eventfd compile when !CONFIG_EVENTFD

Signed-off-by: Avi Kivity <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

f3dfda61 02/17/2010 02:59 pm Paolo Bonzini

use eventfd for iothread

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Avi Kivity <>

f582af58 02/10/2010 07:56 pm Paolo Bonzini

fix placement of config-host.h inclusion

The #ifdef CONFIG_SOLARIS below was useless without this patch.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

d2d5adcb 01/27/2010 12:28 am Stefan Weil

Tell users about out-of-memory errors

Aborting without an error message when memory is short
is not helpful, so print the reason for the abort.

Try
qemu -m 1000000
or
qemu -m 2000 (win32)

to force an out-of-memory error.

v2:
  • Fix error message for win32....
7b5f699d 01/26/2010 10:59 pm Kirill A. Shutemov

Introduce qemu_write_full()

A variant of write(2) which handles partial write.

Signed-off-by: Kirill A. Shutemov <>
Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

347ed55c 01/14/2010 01:14 am Kevin Wolf

osdep.c: Fix accept4 fallback

Commit 3a03bfa5 added a fallback in case the Linux kernel running qemu is older
than the kernel of the build system. Unfortunately, v1 was committed instead of
v2, so the code has a bug that was revealed in the review (checking for the...

099fe236 12/19/2009 12:23 am Juha Riihimäki

fix pidfile option to work in WIN32

Explicit read/write locking pidfile under WIN32 is bit extreme
nobody get the chance to read the pidfile. Convert to a write-only lock.

Also, creating pidfile was disabled along with daemonize under
WIN32. Enable it, but do not enable daemon support which doesn't...

3a03bfa5 12/18/2009 05:29 pm Andre Przywara

osdep: Fix runtime failure on older Linux kernels

If QEMU finds newer kernel header files on compilation time, it will use
advertised features like pipe2 or SOCK_CLOEXEC by just doing a compile test.
If later the executables are executed on an older kernel (<2.6.27,...

40ff6d7e 12/03/2009 07:45 pm Kevin Wolf

Don't leak file descriptors

We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
descriptors that don't need to be passed to children to stop this misbehaviour.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

d741429a 09/12/2009 03:36 pm Blue Swirl

Add #defines needed by OpenSolaris, fix breakage by the #defines

We need to define XOPEN_SOURCE and EXTENSIONS macros in order to get
CMSG
and TIOCWIN macros defined. But then _POSIX_C_SOURCE gets defined, which
is (incorrectly) used as an indicator for existence of posix_memalign() in osdep.c....

4a1418e0 08/24/2009 04:02 pm Anthony Liguori

Unbreak large mem support by removing kqemu

kqemu introduces a number of restrictions on the i386 target. The worst is that
it prevents large memory from working in the default build.

Furthermore, kqemu is fundamentally flawed in a number of ways. It relies on...

a25a0ef5 08/24/2009 04:02 pm Anthony Liguori

Only build osdep once

We no longer need hackery to work around kqemu

Signed-off-by: Anthony Liguori <>

71e72a19 07/27/2009 10:09 pm Juan Quintela

rename HOST_BSD to CONFIG_BSD

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

dfe5fff3 07/27/2009 10:09 pm Juan Quintela

change HOST_SOLARIS to CONFIG_SOLARIS{_VERSION}

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

d644f8be 07/08/2009 05:24 pm malc

Add out of memory and zero size argument checks to be consistent with
the qemu_malloc routines

88ca2a59 05/14/2009 12:21 am Paul Brook

Add tool_osdep.c

osdep.c is built in both as a toplevel target independant object, and
as a per-target object because of kqemu dependencies. Under some
circumstances make picks up the wrong one.

Build the former as tool-osdep to avoid this conflict.

Signed-off-by: Paul Brook <>

640f42e4 04/19/2009 01:18 pm blueswir1

kqemu: merge CONFIG_KQEMU and USE_KQEMU

Basically a recursive ":%s/USE_KQEMU/CONFIG_KQEMU/g".

Signed-off-by: Paul Bolle <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7189 c046a42c-6fe2-441c-8c8c-71466251a162

49dc768d 03/08/2009 06:26 pm aliguori

Fix windows build and clean up use of <windows.h>

We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so
let's do it in OS_CFLAGS.

Then, we can pepper in windows.h includes where using #includes that require it.

Signed-off-by: Anthony Liguori <>...

179a2c19 03/08/2009 10:23 am blueswir1

Rename _BSD to HOST_BSD so that it's more obvious that it's defined by configure

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6775 c046a42c-6fe2-441c-8c8c-71466251a162

c5e97233 03/07/2009 10:06 pm blueswir1

Support for DragonFly BSD (Hasso Tepper)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6746 c046a42c-6fe2-441c-8c8c-71466251a162

d40cdb10 03/07/2009 06:52 pm blueswir1

Fix BSD breakage from r6736

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6742 c046a42c-6fe2-441c-8c8c-71466251a162

511d2b14 03/07/2009 05:32 pm blueswir1

Sparse fixes: NULL use, header order, ANSI prototypes, static

Fix Sparse warnings: * use NULL instead of plain 0 * rearrange header include order to avoid redefining types accidentally * ANSIfy SLIRP * avoid "restrict" keyword * add static

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162

d456ae3e 12/11/2008 09:39 pm blueswir1

Remove redundant #ifdef _BSD

since _BSD if already handled in osdep.c:qemu_memalign(), we don't need to
check it in the calling function again. getpagesize() is available in BSD.

Signed-off-by: Andre Przywara <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5983 c046a42c-6fe2-441c-8c8c-71466251a162

5f8712aa 11/22/2008 10:43 pm blueswir1

Use MAP_ANON also for FreeBSD (Juergen Lock)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5778 c046a42c-6fe2-441c-8c8c-71466251a162

48253bd8 11/18/2008 03:42 am malc

Use qemu_memalign instead of memalign in qemu_vmalloc

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5730 c046a42c-6fe2-441c-8c8c-71466251a162

c2b48b69 11/12/2008 12:06 am aliguori

Fix -linux-user build by reverting r5701

Unfortunately, -linux-user doesn't use osdep as it replaces some of those
functions with specific ones. The code #ifdef code in exec.c needs to
remain in place so instead of introducing a qemu_getpagesize() let's just...

6f7af85d 11/11/2008 11:50 pm aliguori

Allocate guest memory on host page boundaries (Hollis Blanchard)

Signed-off-by: Hollis Blanchard <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5702 c046a42c-6fe2-441c-8c8c-71466251a162

15ed71ba 11/11/2008 11:48 pm aliguori

Define OS-dependent qemu_getpagesize() (Hollis Blanchard)

Signed-off-by: Hollis Blanchard <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5701 c046a42c-6fe2-441c-8c8c-71466251a162

03ff3ca3 09/15/2008 06:51 pm aliguori

Use common objects for qemu-img and qemu-nbd

Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the
code. It's ugly and causes us to have to build multiple object files for
linking against qemu and the tools.

This patch introduces a new file, qemu-tool.c which contains enough for...

128ab2ff 08/15/2008 09:33 pm blueswir1

Preliminary OpenBSD host support (based on OpenBSD patches by Todd T. Fries)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5012 c046a42c-6fe2-441c-8c8c-71466251a162

00f82b8a 04/28/2008 12:12 am aurel32

Use correct types to enable > 2G support, based on a patch from
Anthony Liguori.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4265 c046a42c-6fe2-441c-8c8c-71466251a162

03875444 04/22/2008 11:45 pm aurel32

Revert "Use correct types to enable > 2G support" (r4238), it is
not yet ready.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4240 c046a42c-6fe2-441c-8c8c-71466251a162

967032c3 04/22/2008 11:37 pm aurel32

Use correct types to enable > 2G support, based on a patch from
Anthony Liguori.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4238 c046a42c-6fe2-441c-8c8c-71466251a162

2520c665 04/21/2008 12:10 am aurel32

Use "mount -o remount" instead of "umount" and "mount /dev/shm",
which results in emptying this virtual file system.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4228 c046a42c-6fe2-441c-8c8c-71466251a162

ca10f867 04/12/2008 12:35 am aurel32

Remove osdep.c/qemu-img code duplication

(Kevin Wolf)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4191 c046a42c-6fe2-441c-8c8c-71466251a162

33f00271 12/24/2007 04:33 pm balrog

Add "cache" parameter to "-drive" (Laurent Vivier).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3848 c046a42c-6fe2-441c-8c8c-71466251a162

4fddf62a 12/17/2007 06:42 am ths

Use WIN32_LEAN_AND_MEAN, by Stefan Weil.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3832 c046a42c-6fe2-441c-8c8c-71466251a162

9596ebb7 11/18/2007 03:44 am pbrook

Add statics and missing #includes for prototypes.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3683 c046a42c-6fe2-441c-8c8c-71466251a162

87ecb68b 11/17/2007 07:14 pm pbrook

Break up vl.h.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162

5fafdf24 09/17/2007 12:08 am ths

find -type f | xargs sed -i 's/[\t ]$//g' # on most files

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162

29b3a662 06/08/2007 02:09 am pbrook

Windows build fixes.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2959 c046a42c-6fe2-441c-8c8c-71466251a162

aa26bb2d 03/26/2007 12:33 am ths

qemu_create_pidfile implementation for Win32, based on a patch by
Carlos O'Donell.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2540 c046a42c-6fe2-441c-8c8c-71466251a162

605686cd 01/18/2007 01:31 am ths

Kqemu support for Solaris, by Ben Taylor.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2329 c046a42c-6fe2-441c-8c8c-71466251a162

243a273e 08/17/2006 07:19 pm bellard

fd leak fix (Igor Kovalenko)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2118 c046a42c-6fe2-441c-8c8c-71466251a162

7f1a8398 08/03/2006 08:53 pm bellard

removed unused code

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2080 c046a42c-6fe2-441c-8c8c-71466251a162

d62ca2bb 08/01/2006 06:50 pm bellard

removed unused code

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2072 c046a42c-6fe2-441c-8c8c-71466251a162

6cb7ee85 05/22/2006 05:10 pm pbrook

Only use /dev/shm hack when kqemu is enabled.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1930 c046a42c-6fe2-441c-8c8c-71466251a162

6bae7ed8 04/23/2005 11:44 pm bellard

informative message about low memory on /dev/shm

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1388 c046a42c-6fe2-441c-8c8c-71466251a162

6e4255f6 04/17/2005 09:33 pm bellard

windows support for kqemu (Filip Navara)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1366 c046a42c-6fe2-441c-8c8c-71466251a162

194884dd 02/21/2005 10:10 pm bellard

win32 + Mac OS X compile fix

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1304 c046a42c-6fe2-441c-8c8c-71466251a162

49b470eb 02/10/2005 11:59 pm bellard

shared pages memory allocation

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1279 c046a42c-6fe2-441c-8c8c-71466251a162

d2bfb39a 08/04/2004 01:09 am bellard

use the kernel sigaction syscall to avoid relying on glibc one

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1044 c046a42c-6fe2-441c-8c8c-71466251a162

2571929a 07/14/2004 08:21 pm bellard

added qemu_strdup()

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1021 c046a42c-6fe2-441c-8c8c-71466251a162

57c30724 04/04/2004 11:36 pm bellard

fixing free

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@707 c046a42c-6fe2-441c-8c8c-71466251a162

67b915a5 04/01/2004 02:37 am bellard

win32 port (initial patch by kazu)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@692 c046a42c-6fe2-441c-8c8c-71466251a162

07d89866 03/14/2004 11:41 pm bellard

added qemu_mallocz()

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@660 c046a42c-6fe2-441c-8c8c-71466251a162

ea88812f 02/17/2004 12:12 am bellard

added OS dependent functions (temporary as most functions are generic in fact)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@624 c046a42c-6fe2-441c-8c8c-71466251a162