From 953ffe0f935f40c0d6061d69e76e0339393b54f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 2 Jun 2011 19:58:06 +0200 Subject: Introduce format string for pid_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BeOS and Haiku on i386 use long for 32-bit types, including pid_t. Using %d with pid_t therefore results in a warning. Unfortunately POSIX:2008 does not define a PRId* string for pid_t. In some places pid_t was previously casted to long and %ld hardcoded. The predecessor of this patch added another upcast for the simpletrace filename but was not applied to date. Since new uses of pid_t with %d keep creeping in, let's instead define an OS-dependent format string and use that consistently. Cc: Stefan Hajnoczi Cc: Blue Swirl Cc: Ingo Weinhold Cc: Gleb Natapov Signed-off-by: Andreas Färber Signed-off-by: Blue Swirl --- osdep.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'osdep.h') diff --git a/osdep.h b/osdep.h index 6eb9a49..a817017 100644 --- a/osdep.h +++ b/osdep.h @@ -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); -- cgit v1.1