Howdy, The following patch improves the -pidfile a fair bit. -pidfile isn't terribly usable at the moment with -daemonize as the wrong pid gets written to the file. Furthermore, there's a race in -pidfile between the stat() and initial create. For a management tool, there's no 100% reliable way to know whether there's a stale pidfile or whether another QEMU process is running. The attached patch uses a common technique for dealing with pidfiles. An advisory lock is taken once the pidfile is opened. The nice thing about advisory locks is that the file is unlocked if a process dies. This allows for a truly atomic pidfile to be implemented. AFAIK, lockf() exists on Windows. I do not know if it works as one would expect though. Regards, Anthony Liguori