summaryrefslogtreecommitdiffstats
path: root/os-win32.c
Commit message (Collapse)AuthorAgeFilesLines
* shutdown: Add source information to SHUTDOWN and RESETEric Blake2017-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch. It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers. Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests. Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts] Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part] Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts] Message-Id: <20170515214114.15442-5-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* all: Clean up includesPeter Maydell2016-02-041-6/+1Star
| | | | | | | | | | Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
* maint: remove unused include for signal.hDaniel P. Berrange2015-09-111-1/+0Star
| | | | | | | | | A number of files were including signal.h but not using any of the functions it provides Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* pidfile: stop making pidfile error a special caseMichael Tokarev2014-11-021-5/+0Star
| | | | | | | | | | | | | | | | | | In case of -daemonize, we write non-zero to the daemon pipe only if pidfile creation failed, so the parent will report error about pidfile problem. There's no need to make special case for this, since all other errors are reported by the child just fine. Let the parent report error and simplify logic in os_daemonize(). This way, we don't need os_pidfile_error() function, since it only prints error now, so put the error reporting printf into the only place where qemu_create_pidfile() is called, in vl.c. While at it, fix wrong indentation in os_daemonize(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* util: Split out exec_dir from os_find_datadirFam Zheng2014-02-201-19/+2Star
| | | | | | | | | With this change, main() calls qemu_init_exec_dir and uses argv[0] to init exec_dir. The saved value can be retrieved with qemu_get_exec_dir later. It will be reused by module loading. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-timer: move timeBeginPeriod/timeEndPeriod to os-win32Paolo Bonzini2013-04-121-0/+11
| | | | | | | | | | | | These are needed for any of the Win32 alarm timer implementations. They are not tied to mmtimer exclusively. Jacob tested this patch with both mmtimer and Win32 timers. Cc: qemu-stable@nongnu.org Tested-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Release SMP restriction on WindowsFabien Chouteau2013-04-121-18/+0Star
| | | | | | | | | The previous patches make QEMU SMP safe on Windows, we can now release the restriction. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Prevent disk data loss when closing qemuPavel Dovgaluk2012-06-151-1/+7
| | | | | | | | | | Prevent disk data loss when closing qemu console window under Windows 7. v3. Comment for Sleep() parameter was updated. Signed-off-by: Pavel Dovgalyuk<pavel.dovgaluk@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* link the main loop and its dependencies into the toolsPaolo Bonzini2011-12-221-5/+0Star
| | | | | | | | 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>
* win32: fix memory leakZhi Hui Li2011-12-061-0/+7
| | | | | | | | | | | | | | | | | | | | string is allocated by g_malloc, will not be used after putenv, should be free before return. Paolo Bonzini <pbonzini@redhat.com> confirmed this is safe under Wine: "1) the underlying Win32 APIs require separate arguments for the variable and value; 2) even though in the end Wine stores the environment as name=value (http://source.winehq.org/source/dlls/ntdll/env.c), it does so in a single consecutive block of memory, not as a char* array like POSIX does. While (2) might apply only to Wine, (1) surely applies to Windows as well." Tested-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Replace WriteFileEx with WriteFile in qemu_create_pidfileFabien Chouteau2011-11-091-3/+4
| | | | | | | | | | | | The function that writes pidfile for win32 uses WriteFileEx which is an asynchronous IO function. The arguments given to WriteFileEx are allocated on the stack and one of them is "in out". When the IO operation is actually executed the calling function has already returned, so the arguments are no longer allocated or allocated to another frame. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* main-loop: create main-loop.cPaolo Bonzini2011-10-211-123/+0Star
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* w32: Fix format string regressionStefan Weil2011-08-211-1/+1
| | | | | | | | | Commit 953ffe0f935f40c0d6061d69e76e0339393b54f8 introduced FMT_pid which is wrong for w32 and w64 getpid(): those getpid() implementations always return an int value. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-211-4/+4
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce format string for pid_tAndreas Färber2011-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | BeOS and Haiku on i386 use long for 32-bit types, including pid_t. Using %d with pid_t therefore results in a warning. Unfortunately POSIX:2008 does not define a PRId* string for pid_t. In some places pid_t was previously casted to long and %ld hardcoded. The predecessor of this patch added another upcast for the simpletrace filename but was not applied to date. Since new uses of pid_t with %d keep creeping in, let's instead define an OS-dependent format string and use that consistently. Cc: Stefan Hajnoczi <stefanha@gmail.com> Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Ingo Weinhold <ingo_weinhold@gmx.de> Cc: Gleb Natapov <gleb@redhat.com> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Expose thread_id in info cpusJan Kiszka2011-03-161-0/+5
| | | | | | | | | | | Based on patch by Glauber Costa: To allow management applications like libvirt to apply CPU affinities to the VCPU threads, expose their ID via info cpus. This patch provides the pre-existing and used interface from qemu-kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* unlock iothread during WaitForMultipleObjectsPaolo Bonzini2011-03-131-0/+2
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* w32: Fix arguments for GetProcessAffinityMask, SetProcessAffinityMaskStefan Weil2011-02-201-1/+1
| | | | | | | | | These functions take arguments of type PDWORD_PTR which is a pointer to a DWORD_PTR, not a pointer to a DWORD. Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Separate qemu_pidfile() into OS specific versionsJes Sorensen2010-10-301-0/+24
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* win32: Set unbuffered stdoutStefan Weil2010-10-091-0/+6
| | | | | | | | | | | | | | | Win32 does not support line-buffering, but it allows unbuffered output. Unbuffered output is a good approximation. For typical output statements which usually end with '\n', it's even identical. Buffered output is unusable for program traces because of its large delay. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* win32: Add missing function setenvStefan Weil2010-08-151-0/+15
| | | | | | | | Mingw32 does not provide a declaration and implementation of function setenv (which is used in sdl.c), so this patch adds both. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move daemonize handling to OS specific filesJes Sorensen2010-06-121-0/+5
| | | | | | | | | | Move daemonize handling from vl.c to OS specific files. Provide dummy stubs for Win32. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Introduce OS specific cmdline argument handling and move SMB arg to os-posix.cJes Sorensen2010-06-121-0/+10
| | | | | | | | | | | | | | Introduce OS specific cmdline argument handling by calling os_parse_cmd_args() at the end of switch() statement. Move option enum to qemu-options.h and have it included from os-posix.c and os-win32.c in addition to vl.c. In addition move SMB argument to os-posix.c Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move find_datadir to OS specific files.Jes Sorensen2010-06-121-0/+23
| | | | | | | | | | This moves the win32 and POSIX versions of find_datadir() to OS specific files, and removes some #ifdef clutter from vl.c Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Rename os_setup_signal_handling() to os_setup_early_signal_handling()Jes Sorensen2010-06-121-1/+1
| | | | | | | | | Rename os_setup_signal_handling() to os_setup_early_signal_handling() Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move win32 early signal handling setup to os_setup_signal_handling()Jes Sorensen2010-06-121-0/+29
| | | | | | | | | Move win32 early signal handling setup to os_setup_signal_handling() Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* vl.c: Move host_main_loop_wait() to OS specific files.Jes Sorensen2010-06-121-0/+43
| | | | | | | | | | Move host_main_loop_wait() to OS specific files. Create qemu-os-posix.h and provide empty inline for the POSIX case. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Introduce os-win32.c and move polling functions from vl.cJes Sorensen2010-06-121-0/+111
This introduces os-win32.c. It is meant to carry win32 specific functions thata are not relevant for all of QEMU as well as win32 versions of various pieces like signal handling etc. Move win32 polling handler helper functions from vl.c to os-win32.c Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>