[PATCH v3 1/2] util: Add virProcessGetStat

Ján Tomko jtomko at redhat.com
Tue Nov 23 15:24:08 UTC 2021


On a Tuesday in 2021, Martin Kletzander wrote:
>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 at redhat.com>
>---
> src/libvirt_private.syms              |  1 +
> src/util/virprocess.c                 | 77 +++++++++++++++++++++++
> src/util/virprocess.h                 | 66 ++++++++++++++++++++
> tests/meson.build                     |  1 +
> tests/virprocessstatdata/complex/stat |  2 +
> tests/virprocessstatdata/simple/stat  |  1 +
> tests/virprocessstattest.c            | 88 +++++++++++++++++++++++++++
> 7 files changed, 236 insertions(+)
> create mode 100644 tests/virprocessstatdata/complex/stat
> create mode 100644 tests/virprocessstatdata/simple/stat
> create mode 100644 tests/virprocessstattest.c
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20211123/8d25de8e/attachment-0001.sig>


More information about the libvir-list mailing list