qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: haikuports-devs@ports.haiku-files.org,
	"Blue Swirl" <blauwirbel@gmail.com>,
	"Andreas Färber" <andreas.faerber@web.de>,
	"Ingo Weinhold" <ingo_weinhold@gmx.de>,
	"Stefan Hajnoczi" <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v2] trace: Adapt trace file name for Haiku
Date: Sun, 10 Oct 2010 13:45:16 +0200	[thread overview]
Message-ID: <1286711116-431-1-git-send-email-andreas.faerber@web.de> (raw)
In-Reply-To: <20101009231804.356.1@knochen-vm.localdomain>

Cast the getpid() return value and adapt the format string.
Avoids the following warning:

  CC    simpletrace.o
/Data/QEMU/qemu/simpletrace.c: In function 'st_set_trace_file':
/Data/QEMU/qemu/simpletrace.c:77: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'pid_t'

v2:
* Don't use %lu for getpid() on Haiku since on x86_64 it returns an int.
  Always cast to long (largest allowed pid_t type) and use %ld instead.
  Suggested by Ingo Weinhold.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Ingo Weinhold <ingo_weinhold@gmx.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 configure     |    2 +-
 simpletrace.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d303061..457d98c 100755
--- a/configure
+++ b/configure
@@ -2609,7 +2609,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-%ld\""
 fi
 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
 
diff --git a/simpletrace.c b/simpletrace.c
index f849e42..9ee5c3b 100644
--- a/simpletrace.c
+++ b/simpletrace.c
@@ -74,7 +74,7 @@ bool st_set_trace_file(const char *file)
     free(trace_file_name);
 
     if (!file) {
-        if (asprintf(&trace_file_name, CONFIG_TRACE_FILE, getpid()) < 0) {
+        if (asprintf(&trace_file_name, CONFIG_TRACE_FILE, (long)getpid()) < 0) {
             trace_file_name = NULL;
             return false;
         }
-- 
1.7.3

  reply	other threads:[~2010-10-10 11:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09 19:55 [Qemu-devel] [PATCH] trace: Adapt trace file name for Haiku Andreas Färber
2010-10-09 21:18 ` [Qemu-devel] Re: [HaikuPorts-devs] " Ingo Weinhold
2010-10-10 11:45   ` Andreas Färber [this message]
2010-10-11  9:23     ` [Qemu-devel] [PATCH v2] " Stefan Hajnoczi
2011-06-02 17:58       ` [Qemu-devel] [PATCH v3] Introduce format string for pid_t Andreas Färber
2011-06-15 20:26         ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286711116-431-1-git-send-email-andreas.faerber@web.de \
    --to=andreas.faerber@web.de \
    --cc=blauwirbel@gmail.com \
    --cc=haikuports-devs@ports.haiku-files.org \
    --cc=ingo_weinhold@gmx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).