ia64/xen-unstable

changeset 17022:fbbc0523779e

ioemu stubdom: make daemonize optional
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 11 10:03:48 2008 +0000 (2008-02-11)
parents b0119e24d900
children f8b855ffa470
files tools/ioemu/vl.c
line diff
     1.1 --- a/tools/ioemu/vl.c	Mon Feb 11 10:03:19 2008 +0000
     1.2 +++ b/tools/ioemu/vl.c	Mon Feb 11 10:03:48 2008 +0000
     1.3 @@ -80,6 +80,7 @@
     1.4  #include <windows.h>
     1.5  #define getopt_long_only getopt_long
     1.6  #define memalign(align, size) malloc(size)
     1.7 +#define NO_DAEMONIZE 1
     1.8  #endif
     1.9  
    1.10  #include "qemu_socket.h"
    1.11 @@ -186,7 +187,9 @@ const char *vnc_display;
    1.12  int acpi_enabled = 0;
    1.13  int fd_bootchk = 1;
    1.14  int no_reboot = 0;
    1.15 +#ifndef NO_DAEMONIZE
    1.16  int daemonize = 0;
    1.17 +#endif
    1.18  const char *option_rom[MAX_OPTION_ROMS];
    1.19  int nb_option_roms;
    1.20  int semihosting_enabled = 0;
    1.21 @@ -6510,7 +6513,7 @@ void help(void)
    1.22  	   "-vnc display    start a VNC server on display\n"
    1.23             "-vncviewer      start a vncviewer process for this domain\n"
    1.24             "-vncunused      bind the VNC server to an unused port\n"
    1.25 -#ifndef _WIN32
    1.26 +#ifndef NO_DAEMONIZE
    1.27  	   "-daemonize      daemonize QEMU after initializing\n"
    1.28  #endif
    1.29  	   "-option-rom rom load a file, rom, into the option ROM space\n"
    1.30 @@ -6600,7 +6603,9 @@ enum {
    1.31      QEMU_OPTION_vnc,
    1.32      QEMU_OPTION_no_acpi,
    1.33      QEMU_OPTION_no_reboot,
    1.34 +#ifndef NO_DAEMONIZE
    1.35      QEMU_OPTION_daemonize,
    1.36 +#endif
    1.37      QEMU_OPTION_option_rom,
    1.38      QEMU_OPTION_semihosting
    1.39      ,
    1.40 @@ -6698,7 +6703,9 @@ const QEMUOption qemu_options[] = {
    1.41      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
    1.42      { "no-acpi", 0, QEMU_OPTION_no_acpi },
    1.43      { "no-reboot", 0, QEMU_OPTION_no_reboot },
    1.44 +#ifndef NO_DAEMONIZE
    1.45      { "daemonize", 0, QEMU_OPTION_daemonize },
    1.46 +#endif
    1.47      { "option-rom", HAS_ARG, QEMU_OPTION_option_rom },
    1.48  #if defined(TARGET_ARM)
    1.49      { "semihosting", 0, QEMU_OPTION_semihosting },
    1.50 @@ -7496,9 +7503,11 @@ int main(int argc, char **argv)
    1.51              case QEMU_OPTION_no_reboot:
    1.52                  no_reboot = 1;
    1.53                  break;
    1.54 +#ifndef NO_DAEMONIZE
    1.55  	    case QEMU_OPTION_daemonize:
    1.56  		daemonize = 1;
    1.57  		break;
    1.58 +#endif
    1.59  	    case QEMU_OPTION_option_rom:
    1.60  		if (nb_option_roms >= MAX_OPTION_ROMS) {
    1.61  		    fprintf(stderr, "Too many option ROMs\n");
    1.62 @@ -7542,7 +7551,7 @@ int main(int argc, char **argv)
    1.63      sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm-%d.log", domid);
    1.64      cpu_set_log_filename(qemu_dm_logfilename);
    1.65  
    1.66 -#ifndef _WIN32
    1.67 +#ifndef NO_DAEMONIZE
    1.68      if (daemonize && !nographic && vnc_display == NULL && vncunused == 0) {
    1.69  	fprintf(stderr, "Can only daemonize if using -nographic or -vnc\n");
    1.70  	daemonize = 0;
    1.71 @@ -7863,6 +7872,7 @@ int main(int argc, char **argv)
    1.72          }
    1.73      }
    1.74  
    1.75 +#ifndef NO_DAEMONIZE
    1.76      if (daemonize) {
    1.77  	uint8_t status = 0;
    1.78  	ssize_t len;
    1.79 @@ -7886,6 +7896,7 @@ int main(int argc, char **argv)
    1.80  
    1.81  	close(fd);
    1.82      }
    1.83 +#endif
    1.84  
    1.85      /* Unblock SIGTERM, which may have been blocked by the caller */
    1.86      sigemptyset(&set);