diff options
author | Eric Blake <eblake@redhat.com> | 2012-02-10 16:52:01 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-02 06:57:57 -0700 |
commit | 355ec28167cb1826d7a5d9e8fc0cb3126a96f20d (patch) | |
tree | 8e81739732b241b7f2cd328b813c1ab6ba3ba085 /src | |
parent | build: use correct type for pid and similar types (diff) | |
download | libvirt-355ec28167cb1826d7a5d9e8fc0cb3126a96f20d.tar.gz libvirt-355ec28167cb1826d7a5d9e8fc0cb3126a96f20d.tar.bz2 libvirt-355ec28167cb1826d7a5d9e8fc0cb3126a96f20d.zip |
build: fix output of pid values
Nuke the last vestiges of printing pid_t values with the wrong
types, at least in code compiled on mingw64. There may be other
places, but for now they are only compiled on systems where the
existing %d doesn't trigger gcc warnings.
* src/rpc/virnetsocket.c (virNetSocketNew): Use %lld and casting,
rather than assuming any particular int type for pid_t.
* src/util/command.c (virCommandRunAsync, virPidWait)
(virPidAbort): Likewise.
(verify): Drop a now stale assertion.
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc/virnetsocket.c | 12 | ||||
-rw-r--r-- | src/util/command.c | 20 |
2 files changed, 15 insertions, 17 deletions
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 67d33b7fc..af3f9ac4b 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1,7 +1,7 @@ /* * virnetsocket.c: generic network socket handling * - * Copyright (C) 2006-2011 Red Hat, Inc. + * Copyright (C) 2006-2012 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -114,9 +114,9 @@ static virNetSocketPtr virNetSocketNew(virSocketAddrPtr localAddr, virNetSocketPtr sock; int no_slow_start = 1; - VIR_DEBUG("localAddr=%p remoteAddr=%p fd=%d errfd=%d pid=%d", + VIR_DEBUG("localAddr=%p remoteAddr=%p fd=%d errfd=%d pid=%lld", localAddr, remoteAddr, - fd, errfd, pid); + fd, errfd, (long long) pid); if (virSetCloseExec(fd) < 0) { virReportSystemError(errno, "%s", @@ -174,9 +174,9 @@ static virNetSocketPtr virNetSocketNew(virSocketAddrPtr localAddr, sock->client = isClient; PROBE(RPC_SOCKET_NEW, - "sock=%p refs=%d fd=%d errfd=%d pid=%d localAddr=%s, remoteAddr=%s", - sock, sock->refs, fd, errfd, - pid, NULLSTR(sock->localAddrStr), NULLSTR(sock->remoteAddrStr)); + "sock=%p refs=%d fd=%d errfd=%d pid=%lld localAddr=%s, remoteAddr=%s", + sock, sock->refs, fd, errfd, (long long) pid, + NULLSTR(sock->localAddrStr), NULLSTR(sock->remoteAddrStr)); return sock; diff --git a/src/util/command.c b/src/util/command.c index a2d5f842d..b752b2a23 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -42,7 +42,6 @@ #include "virpidfile.h" #include "buf.h" #include "ignore-value.h" -#include "verify.h" #define VIR_FROM_THIS VIR_FROM_NONE @@ -50,9 +49,6 @@ virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) -/* We have quite a bit of changes to make if this doesn't hold. */ -verify(sizeof(pid_t) <= sizeof(int)); - /* Flags for virExecWithHook */ enum { VIR_EXEC_NONE = 0, @@ -2152,8 +2148,8 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid) if (cmd->pid != -1) { virCommandError(VIR_ERR_INTERNAL_ERROR, - _("command is already running as pid %d"), - cmd->pid); + _("command is already running as pid %lld"), + (long long) cmd->pid); return -1; } @@ -2228,7 +2224,8 @@ virPidWait(pid_t pid, int *exitstatus) int status; if (pid <= 0) { - virReportSystemError(EINVAL, _("unable to wait for process %d"), pid); + virReportSystemError(EINVAL, _("unable to wait for process %lld"), + (long long) pid); return -1; } @@ -2237,7 +2234,8 @@ virPidWait(pid_t pid, int *exitstatus) errno == EINTR); if (ret == -1) { - virReportSystemError(errno, _("unable to wait for process %d"), pid); + virReportSystemError(errno, _("unable to wait for process %lld"), + (long long) pid); return -1; } @@ -2245,8 +2243,8 @@ virPidWait(pid_t pid, int *exitstatus) if (status != 0) { char *st = virCommandTranslateStatus(status); virCommandError(VIR_ERR_INTERNAL_ERROR, - _("Child process (%d) status unexpected: %s"), - pid, NULLSTR(st)); + _("Child process (%lld) status unexpected: %s"), + (long long) pid, NULLSTR(st)); VIR_FREE(st); return -1; } @@ -2371,7 +2369,7 @@ virPidAbort(pid_t pid) } } } - VIR_DEBUG("failed to reap child %d, abandoning it", pid); + VIR_DEBUG("failed to reap child %lld, abandoning it", (long long) pid); cleanup: VIR_FREE(tmp); |