diff options
author | Eric Blake <eblake@redhat.com> | 2012-02-10 16:08:11 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-02 06:57:43 -0700 |
commit | 3e2c3d8f6d5ca4a6135101cda3e73c51304af683 (patch) | |
tree | e586d4a1a39ff74a95fdc3c08b1eb47833ae148e /src/uml | |
parent | build: prohibit cross-inclusion (diff) | |
download | libvirt-3e2c3d8f6d5ca4a6135101cda3e73c51304af683.tar.gz libvirt-3e2c3d8f6d5ca4a6135101cda3e73c51304af683.tar.bz2 libvirt-3e2c3d8f6d5ca4a6135101cda3e73c51304af683.zip |
build: use correct type for pid and similar types
No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
constructs like 'int pid'. Our API in libvirt-qemu cannot be
changed without breaking ABI; but then again, libvirt-qemu can
only be used on systems that support UNIX sockets, which rules
out Windows (even if qemu could be compiled there) - so for all
points on the call chain that interact with this API decision,
we require a different variable name to make it clear that we
audited the use for safety.
Adding a syntax-check rule only solves half the battle; anywhere
that uses printf on a pid_t still needs to be converted, but that
will be a separate patch.
* cfg.mk (sc_correct_id_types): New syntax check.
* src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
use pid_t for pid, and validate for overflow.
* include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
for syntax check.
* src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
* src/driver.h (virDrvDomainQemuAttach): Likewise.
* tools/virsh.c (cmdQemuAttach): Likewise.
* src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
* src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
* src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
Likewise.
* src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
(qemuParseCommandLinePid): Use pid_t for pid.
* daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
* src/conf/domain_conf.h (_virDomainObj): Likewise.
* src/probes.d (rpc_socket_new): Likewise.
* src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
* src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
Likewise.
* src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
* src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
* src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
* tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
* src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
and gid_t rather than int.
* src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
* src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
compiler warning.
Diffstat (limited to 'src/uml')
-rw-r--r-- | src/uml/uml_driver.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index cbb2c0ed4..378dffcc3 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1,7 +1,7 @@ /* * uml_driver.c: core driver methods for managing UML guests * - * Copyright (C) 2006-2011 Red Hat, Inc. + * Copyright (C) 2006-2012 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -1240,13 +1240,13 @@ static char *umlGetCapabilities(virConnectPtr conn) { -static int umlGetProcessInfo(unsigned long long *cpuTime, int pid) +static int umlGetProcessInfo(unsigned long long *cpuTime, pid_t pid) { char *proc; FILE *pidinfo; unsigned long long usertime, systime; - if (virAsprintf(&proc, "/proc/%d/stat", pid) < 0) { + if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0) { return -1; } |