rename QEMU device model log file by dom id and redirect stdout/stderr only if
spawning device model background.
Signed-off-by: Zhai Edwin <edwin.zhai@xxxxxxxxx>
diff -r c4ae9456a459 tools/ioemu/exec.c
--- a/tools/ioemu/exec.c Fri Jan 20 20:31:09 2006 +0100
+++ b/tools/ioemu/exec.c Mon Jan 23 11:02:47 2006 +0800
@@ -143,8 +143,10 @@
setvbuf(logfile, NULL, _IOLBF, 0);
#endif
- stdout = logfile;
- stderr = logfile;
+ if ( !isatty( fileno(stdout))) {
+ stdout = logfile;
+ stderr = logfile;
+ }
}
}
diff -r c4ae9456a459 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c Fri Jan 20 20:31:09 2006 +0100
+++ b/tools/ioemu/vl.c Mon Jan 23 11:02:47 2006 +0800
@@ -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;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|