ioemu: make daemonize optional Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> diff -r f5493972d237 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Thu Feb 07 14:15:19 2008 +0000 +++ b/tools/ioemu/vl.c Thu Feb 07 14:15:34 2008 +0000 @@ -80,6 +80,7 @@ #include <windows.h> #define getopt_long_only getopt_long #define memalign(align, size) malloc(size) +#define NO_DAEMONIZE 1 #endif #include "qemu_socket.h" @@ -186,7 +187,9 @@ int acpi_enabled = 0; int fd_bootchk = 1; int no_reboot = 0; +#ifndef NO_DAEMONIZE int daemonize = 0; +#endif const char *option_rom[MAX_OPTION_ROMS]; int nb_option_roms; int semihosting_enabled = 0; @@ -6510,7 +6513,7 @@ "-vnc display start a VNC server on display\n" "-vncviewer start a vncviewer process for this domain\n" "-vncunused bind the VNC server to an unused port\n" -#ifndef _WIN32 +#ifndef NO_DAEMONIZE "-daemonize daemonize QEMU after initializing\n" #endif "-option-rom rom load a file, rom, into the option ROM space\n" @@ -6600,7 +6603,9 @@ QEMU_OPTION_vnc, QEMU_OPTION_no_acpi, QEMU_OPTION_no_reboot, +#ifndef NO_DAEMONIZE QEMU_OPTION_daemonize, +#endif QEMU_OPTION_option_rom, QEMU_OPTION_semihosting , @@ -6698,7 +6703,9 @@ { "cirrusvga", 0, QEMU_OPTION_cirrusvga }, { "no-acpi", 0, QEMU_OPTION_no_acpi }, { "no-reboot", 0, QEMU_OPTION_no_reboot }, +#ifndef NO_DAEMONIZE { "daemonize", 0, QEMU_OPTION_daemonize }, +#endif { "option-rom", HAS_ARG, QEMU_OPTION_option_rom }, #if defined(TARGET_ARM) { "semihosting", 0, QEMU_OPTION_semihosting }, @@ -7496,9 +7503,11 @@ case QEMU_OPTION_no_reboot: no_reboot = 1; break; +#ifndef NO_DAEMONIZE case QEMU_OPTION_daemonize: daemonize = 1; break; +#endif case QEMU_OPTION_option_rom: if (nb_option_roms >= MAX_OPTION_ROMS) { fprintf(stderr, "Too many option ROMs\n"); @@ -7542,7 +7551,7 @@ sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm-%d.log", domid); cpu_set_log_filename(qemu_dm_logfilename); -#ifndef _WIN32 +#ifndef NO_DAEMONIZE if (daemonize && !nographic && vnc_display == NULL && vncunused == 0) { fprintf(stderr, "Can only daemonize if using -nographic or -vnc\n"); daemonize = 0; @@ -7863,6 +7872,7 @@ } } +#ifndef NO_DAEMONIZE if (daemonize) { uint8_t status = 0; ssize_t len; @@ -7886,6 +7896,7 @@ close(fd); } +#endif /* Unblock SIGTERM, which may have been blocked by the caller */ sigemptyset(&set); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel P. Berrange
2008-Feb-07 14:37 UTC
Re: [Xen-devel] [PATCH] ioemu: make daemonize optional
On Thu, Feb 07, 2008 at 02:22:51PM +0000, Samuel Thibault wrote:> ioemu: make daemonize optionalWhy ? Littering up the source code with lots of #ifdef isn''t very nice for maintainance. Can we at least have some explanation of the actual need for these changes along with the patch. NB, I''m not against the patch - when looking through changelogs it just helps to have good description of the reasoning behind the change, and in this case ''make daemonize optional'' doesn''t tell me anything over and above what the diff itself shows. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=| _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Samuel Thibault
2008-Feb-07 14:47 UTC
Re: [Xen-devel] [PATCH] ioemu: make daemonize optional
Daniel P. Berrange, le Thu 07 Feb 2008 14:37:54 +0000, a écrit :> On Thu, Feb 07, 2008 at 02:22:51PM +0000, Samuel Thibault wrote: > > ioemu: make daemonize optional > > Why ? Littering up the source code with lots of #ifdef isn''t > very nice for maintainance.instead of #ifndef _WIN32, yes :)> Can we at least have some explanation > of the actual need for these changes along with the patch.All my patches are needed for stub domains, where fork()ing doesn''t even make sense for instance. Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stephen C. Tweedie
2008-Feb-08 12:52 UTC
Re: [Xen-devel] [PATCH] ioemu: make daemonize optional
Hi, On Thu, 2008-02-07 at 14:37 +0000, Daniel P. Berrange wrote:> On Thu, Feb 07, 2008 at 02:22:51PM +0000, Samuel Thibault wrote: > > ioemu: make daemonize optional > > Why ? Littering up the source code with lots of #ifdef isn''t > very nice for maintainance. Can we at least have some explanation > of the actual need for these changes along with the patch.Seconded --- when going through patch history in mercurial, it is often hugely helpful to have the rationale in the patch commit log, rather than having to dig through email archives to get it. --Stephen _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel