summaryrefslogtreecommitdiffstats
path: root/util/osdep.c
Commit message (Collapse)AuthorAgeFilesLines
* osdep: Change default value of qemu_hw_version() to "2.5+"Eduardo Habkost2015-11-251-1/+8
| | | | | | | | | | | | | | | | | | | | | | | There are two issues with qemu_hw_version() today: 1) If a machine has hw_version set, the value returned by it is not very useful, because it is not the actual QEMU version. 2) If a machine does't set hw_version, the return value of qemu_hw_version() is broken, because it will change when upgrading QEMU. For those reasons, using qemu_hw_version() is strongly discouraged, and should be used only in code that used QEMU_VERSION in the past and needs to keep compatibility. To fix (2), instead of making every machine broken by default unless they set hw_version, make qemu_hw_version() simply return "2.5+" if qemu_set_hw_version() is not called. Suggested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* osdep: Rename qemu_{get, set}_version() to qemu_{, set_}hw_version()Eduardo Habkost2015-11-041-5/+5
| | | | | | | | | | | | | | | This makes the purpose of the function clearer: it is not about the version of QEMU that's running, but the version string exposed in the emulated hardware. Cc: Andrzej Zaborowski <balrogg@gmail.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: John Snow <jsnow@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1446233769-7892-3-git-send-email-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qerror: Move #include out of qerror.hMarkus Armbruster2015-06-221-0/+1
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* util: Remove unused functionsThomas Huth2015-04-301-66/+0
| | | | | | | | Delete the unused functions qemu_signalfd_available(), qemu_send_full() and qemu_recv_full(). Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* do not call g_thread_init() for glib >= 2.31Michael Tokarev2014-05-071-12/+9
| | | | | | | | | | | | glib >= 2.31 always enables thread support and g_thread_supported() is #defined to 1, there's no need to call g_thread_init() anymore, and it definitely does not need to report error which never happens. Keep code for old < 2.31 glibc anyway for now, just #ifdef it differently. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Cc: qemu-trivial@nongnu.org
* osdep: initialize glib threads in all QEMU toolsStefan Hajnoczi2014-03-251-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | glib versions prior to 2.31.0 require an explicit g_thread_init() call to enable multi-threading. Failure to initialize threading causes glib to take single-threaded code paths without synchronization. For example, the g_slice allocator will crash due to race conditions. Fix this for all QEMU tool programs (qemu-nbd, qemu-io, qemu-img) by moving the g_thread_init() call from vl.c:main() into a new osdep.c:thread_init() constructor function. thread_init() has __attribute__((constructor)) and is automatically invoked by the runtime during startup. We can now drop the "simple" trace backend's g_thread_init() call since thread_init() already called it. Note that we must keep coroutine-gthread.c's g_thread_init() call which is located in a constructor function. There is no guarantee for constructor function ordering so thread_init() may only be called later. Reported-by: Mario de Chenno <mario.dechenno@unina2.it> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* osdep: drop unused #include "trace.h"Stefan Hajnoczi2014-02-011-1/+0
| | | | | | | | osdep.c does not use trace_*() so we can just drop the include. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* osdep: warn if open(O_DIRECT) on fails with EINVALStefan Hajnoczi2013-09-181-0/+7
| | | | | | | | | | Print a warning when opening a file O_DIRECT fails with EINVAL. This saves users a lot of time trying to figure out the EINVAL error, which is typical when attempting to open a file O_DIRECT on Linux tmpfs. Reported-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* win32: add readv/writev emulationPaolo Bonzini2013-04-291-0/+43
| | | | | | | | | | | | | | | Commit e9d8fbf (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27) introduced a usage of writev, which mingw32 does not have. Even though qemu_fdopen itself is not used on mingw32, the future-proof solution is to add an implementation of it. This is simple and similar to how we emulate sendmsg/recvmsg in util/iov.c. Some files include osdep.h without qemu-common.h, so move the definition of iovec to osdep.h too, and include osdep.h from qemu-common.h unconditionally (protection against including files when NEED_CPU_H is defined is not needed since the removal of AREG0). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* util: move socket_init() to osdep.cMarc-André Lureau2013-04-241-0/+23
| | | | | | | | vscclient needs to call socket_init() for portability. Moving to osdep.c since it has no internal dependency. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com>
* osdep: replace setsockopt by qemu_setsockoptLei Li2013-03-081-2/+2
| | | | | | | | | | | | | | | | | | Fix the compiler warning when cross build qemu-ga for windows by using qemu_setsockopt() instead of setsockopt(). util/osdep.c: In function 'socket_set_nodelay': util/osdep.c:69:5: warning: passing argument 4 of 'setsockopt' from incompatible pointer type [enabled by default] In file included from /home/lei/qemu_b/include/sysemu/os-win32.h:30:0, from /home/lei/qemu_b/include/qemu-common.h:46, from util/osdep.c:48: /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:990:63: note: expected 'const char *' but argument is of type 'int *' Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* move socket_set_nodelay to osdep.cMORITA Kazutaka2013-03-041-0/+6
| | | | | Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* build: move libqemuutil.a components to util/Paolo Bonzini2013-01-121-0/+402
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud