summaryrefslogtreecommitdiffstats
path: root/oslib-win32.c
Commit message (Collapse)AuthorAgeFilesLines
* build: replace weak symbols with a static libraryPaolo Bonzini2012-11-181-7/+0Star
| | | | | | | | | | | | | | | | | | | | | | Weak symbols were a nice idea, but they turned out not to be a good one. Toolchain support is just too sparse, in particular llvm-gcc is totally broken. This patch uses a surprisingly low-tech approach: a static library. Symbols in a static library are always overridden by symbols in an object file. Furthermore, if you place each function in a separate source file, object files for unused functions will not be taken in. This means that each function can use all the dependencies that it needs (especially QAPI stuff such as error_setg). Thus, all stubs are placed in separate object files and put together in a static library. The library then is linked to all programs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* compiler: support Darwin weak referencesPaolo Bonzini2012-11-021-5/+7
| | | | | | | | | | | Weakrefs only tell you if the symbol was defined elsewhere, so you need a further check at runtime to pick the default definition when needed. This could be automated by the compiler, but it does not do it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* win32: add weak version of qemu_fd_registerPaolo Bonzini2012-10-301-0/+5
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* w32: Add implementation of gmtime_r, localtime_rStefan Weil2012-09-231-0/+24
| | | | | | | | | | | | | | | | Those functions are missing in MinGW. Some versions of MinGW-w64 include defines for gmtime_r and localtime_r. Older versions of these macros are buggy (they return a pointer to a static variable), therefore we don't want them. Newer versions are similar to the code used here, but without the memset. The implementation which is used here is not strictly reentrant, but sufficiently good for QEMU on w32 or w64. Signed-off-by: Stefan Weil <sw@weilnetz.de> [blauwirbel@gmail.com: added comment about locking] Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* main-loop: interrupt wait when data arrives on a socketPaolo Bonzini2012-04-071-0/+3
| | | | | | | | | | | | | | | | | | | Right now, the main loop is not interrupted when data arrives on a socket. To fix this, register each socket to interrupt the main loop with WSAEventSelect. This does not replace select, it only communicates a change in socket state that requires a select call. Since the interrupt fires only once per recv call, or only once after a send call returns EWOULDBLOCK we can activate it on all events unconditionally. If QEMU is momentarily uninterested on some condition, the main loop will not busy wait. Instead, it may get one extra wakeup, but then it will ignore the condition until progress occurs and/or qemu_set_fd_handler is called to set a callback. At this point the condition will be tested via select and the callback will be invoked even if it is still disabled on the event. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* link the main loop and its dependencies into the toolsPaolo Bonzini2011-12-221-0/+5
| | | | | | | | Using the main loop code from QEMU enables tools to operate fully asynchronously. Advantages include better Windows portability (for some definition of portability) over glib's. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* add socket_set_blockPaolo Bonzini2011-10-211-0/+6
| | | | | | Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* w32: Remove implementation of function ffsStefan Weil2011-02-201-7/+0Star
| | | | | | | | | | | This implementation is no longer needed. ffs is either a built-in function (for compilations with optimisation) or taken from libiberty.a (which was added by the previous patch). Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Consolidate oom_check() functionsJes Sorensen2010-10-301-3/+3
| | | | | | | | | This consolidates the duplicated oom_check() functions, as well as splitting them into OS dependant versions to avoid the #ifdef grossness that was present in the old osdep.c version. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move qemu_gettimeofday() to OS specific filesJes Sorensen2010-10-301-0/+27
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move osdep socket code to oslib-{posix,win32}.cJes Sorensen2010-10-301-0/+21
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move QEMU OS dependant library functions to OS specific filesJes Sorensen2010-10-301-0/+73
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 included by the various targets, instead of relying on these library functions magically getting included via block-obj-y. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>