diff options
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | os-posix.c | 2 | ||||
-rw-r--r-- | os-win32.c | 2 | ||||
-rw-r--r-- | osdep.h | 6 | ||||
-rw-r--r-- | vl.c | 2 |
5 files changed, 10 insertions, 4 deletions
@@ -3041,7 +3041,7 @@ if test "$trace_backend" = "simple"; then fi # Set the appropriate trace file. if test "$trace_backend" = "simple"; then - trace_file="\"$trace_file-%u\"" + trace_file="\"$trace_file-\" FMT_pid" fi if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak diff --git a/os-posix.c b/os-posix.c index 320419793a..7dfb27836b 100644 --- a/os-posix.c +++ b/os-posix.c @@ -368,7 +368,7 @@ int qemu_create_pidfile(const char *filename) if (lockf(fd, F_TLOCK, 0) == -1) { return -1; } - len = snprintf(buffer, sizeof(buffer), "%ld\n", (long)getpid()); + len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid()); if (write(fd, buffer, len) != len) { return -1; } diff --git a/os-win32.c b/os-win32.c index d6d54c60b9..b6652af7f3 100644 --- a/os-win32.c +++ b/os-win32.c @@ -258,7 +258,7 @@ int qemu_create_pidfile(const char *filename) if (file == INVALID_HANDLE_VALUE) { return -1; } - len = snprintf(buffer, sizeof(buffer), "%ld\n", (long)getpid()); + len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid()); ret = WriteFileEx(file, (LPCVOID)buffer, (DWORD)len, &overlap, NULL); if (ret == 0) { @@ -128,6 +128,12 @@ void qemu_vfree(void *ptr); int qemu_madvise(void *addr, size_t len, int advice); +#if defined(__HAIKU__) && defined(__i386__) +#define FMT_pid "%ld" +#else +#define FMT_pid "%d" +#endif + int qemu_create_pidfile(const char *filename); int qemu_get_thread_id(void); @@ -1197,7 +1197,7 @@ void qemu_kill_report(void) */ fputc('\n', stderr); } else { - fprintf(stderr, " from pid %d\n", shutdown_pid); + fprintf(stderr, " from pid " FMT_pid "\n", shutdown_pid); } shutdown_signal = -1; } |