[libvirt] [PATCH] virCgroupDetect: Print pid as long long

Pavel Hrdina phrdina at redhat.com
Thu Oct 6 15:18:11 UTC 2016


On Thu, Oct 06, 2016 at 04:58:40PM +0200, Michal Privoznik wrote:
> Pids are signed, report them as such.
> 
> Before:
> Detected mount/mapping 2:cpuset at /sys/fs/cgroup/cpuset in /machine/qemu-4-fedora.libvirt-qemu/vcpu0 for pid 18446744073709551615
> 
> After:
> Detected mount/mapping 2:cpuset at /sys/fs/cgroup/cpuset in /machine/qemu-4-fedora.libvirt-qemu/vcpu0 for pid -1
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/util/vircgroup.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> index 8b52816..0a06a8a 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -732,11 +732,12 @@ virCgroupDetect(virCgroupPtr group,
>              return -1;
>          }
>  
> -        VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %llu", i,
> +        VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %lld",
> +                  i,
>                    virCgroupControllerTypeToString(i),
>                    group->controllers[i].mountPoint,
>                    group->controllers[i].placement,
> -                  (unsigned long long)pid);
> +                  (long long) pid);
>      }
>  
>      return 0;

Printing -1 instead of long number is better, but there are lot of
other places where we print pids as unsigned:

  git grep "unsigned long long.*pid"

it would be worth to change them too.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161006/00eb7794/attachment-0001.sig>


More information about the libvir-list mailing list