]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: Add virProcessGetStat
authorMartin Kletzander <mkletzan@redhat.com>
Thu, 18 Nov 2021 15:13:52 +0000 (16:13 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 23 Nov 2021 15:43:08 +0000 (16:43 +0100)
commite370d4056b0071584b41ff4eba164245161a9ddd
tree5965eb8e468ce15524dbac0a93b28d578ed0d0fa
parent2fe7622d19d41292c12c48370e110e334008c38a
util: Add virProcessGetStat

This reads and separates all fields from /proc/<pid>/stat or
/proc/<pid>/task/<tid>/stat as there are easy mistakes to be done in the
implementation.  Some tests are added to show it works correctly.  No number
parsing is done as it would be unused for most of the fields most, if not all,
of the time.  No struct is used for the result as the length can vary (new
fields can be added in the future).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libvirt_private.syms
src/util/virprocess.c
src/util/virprocess.h
tests/meson.build
tests/virprocessstatdata/complex/stat [new file with mode: 0644]
tests/virprocessstatdata/simple/stat [new file with mode: 0644]
tests/virprocessstattest.c [new file with mode: 0644]