Skip to contentSkip to conversation

rename QEMU device model log file by dom id and redirect stdout/stderr only if spawning device model background.

PATCH New Edwin Zhai 1 participant 1 message Jan 23, 2006

lore
Share & tools
lore

Edwin Zhai

author
#0 lore raw

PATCH 1/1 rename QEMU device model log file by dom id and redirect stdout/stderr only if spawning device model background.

rename QEMU device model log file by dom id and redirect stdout/stderr only if spawning device model background.

tools/ioemu/exec.c +4 -2
diff -r c4ae9456a459 tools/ioemu/exec.c
@@ -143,8 +143,10 @@
         setvbuf(logfile, NULL, _IOLBF, 0);
 #endif
 
-        stdout = logfile;
-        stderr = logfile;
+        if ( !isatty( fileno(stdout))) {
+            stdout = logfile;
+            stderr = logfile;
+        }
     }
 }
 
tools/ioemu/vl.c +6 -5
diff -r c4ae9456a459 tools/ioemu/vl.c
@@ -2699,11 +2699,6 @@
     macaddr[4] = 0x34;
     macaddr[5] = 0x56;
 
-    /* init debug */
-    sprintf(qemu_dm_logfilename, "/var/log/qemu-dm.%d.log", getpid());
-    cpu_set_log_filename(qemu_dm_logfilename);
-    cpu_set_log(0);
-
     optind = 1;
     for(;;) {
         if (optind >= argc)
@@ -2913,6 +2908,12 @@
             case QEMU_OPTION_d:
                 {
                     domid = atoi(optarg);
+
+                    /* init debug */
+                    sprintf(qemu_dm_logfilename, "/var/log/qemu-dm.dom%d.log", domid);
+                    cpu_set_log_filename(qemu_dm_logfilename);
+                    cpu_set_log(0);
+
                     fprintf(logfile, "domid: %d\n", domid);
                 }
                 break;