diff mbox

make qemu.log name unique

Message ID 4C29B2DC.2030309@st.com
State New
Headers show

Commit Message

Christophe Lyon June 29, 2010, 8:46 a.m. UTC
Hello,

I propose this small patch so that the qemu log file has a unique name, 
to help running several QEmu processes at once (or with different users).

Is it OK?

Thanks

Christophe.

Comments

Kevin Wolf June 29, 2010, 8:59 a.m. UTC | #1
Am 29.06.2010 10:46, schrieb Christophe LYON:
> Hello,
> 
> I propose this small patch so that the qemu log file has a unique name, 
> to help running several QEmu processes at once (or with different users).
> 
> Is it OK?

I don't think it's a good idea. When debugging things I usually run qemu
several times, and each time I'd have to look up which of all the
/tmp/qemu.log.* files is the current one instead of just refreshing the
qemu.log that I'm viewing.

Maybe adding a -logfile option would allow what you're trying to achieve
without affecting other use cases? I've always thought that it's strange
that you can only change the logfile location in the monitor and not on
the command line.

Kevin
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 5969eb2..5ba8d7e 100644
--- a/exec.c
+++ b/exec.c
@@ -1516,7 +1516,10 @@  void cpu_set_log(int log_flags)

  void cpu_set_log_filename(const char *filename)
  {
-    logfilename = strdup(filename);
+    /* Assume 10 chars is enough to hold pid */
+    int len = strlen(filename) + 10 + 1;
+    logfilename = malloc(len);
+    sprintf((char*)logfilename, "%s.%d", filename, getpid());
      if (logfile) {
          fclose(logfile);
          logfile = NULL;