[PATCH v2 0/2] Fix /proc/*/stat parsing

Martin Kletzander posted 2 patches 2 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1637449173.git.mkletzan@redhat.com
There is a newer version of this series
src/libvirt_linux.syms                |   3 +
src/qemu/qemu_driver.c                |  33 ++-----
src/util/virprocess.c                 | 126 +++++++++++++++++---------
src/util/virprocess.h                 |   4 +
tests/meson.build                     |   1 +
tests/virprocessstatdata/complex/stat |   2 +
tests/virprocessstatdata/simple/stat  |   1 +
tests/virprocessstattest.c            |  84 +++++++++++++++++
8 files changed, 185 insertions(+), 69 deletions(-)
create mode 100644 tests/virprocessstatdata/complex/stat
create mode 100644 tests/virprocessstatdata/simple/stat
create mode 100644 tests/virprocessstattest.c
[PATCH v2 0/2] Fix /proc/*/stat parsing
Posted by Martin Kletzander 2 years, 5 months ago
While working on some polkit stuff I found out that we are inconsistent with the
way we parse /proc/*/stat files, so I added a new helper instead along with some
tests.  Unfortunately using it for the thing I wanted is not really viable in
the end, so it "violates" the Rule of three, but at least it does something
correctly.

v2:
- Fixed open64 by just using virFileReadAllQuiet instead of g_file_get_contents
- Removed some leftover unused variables
- Still do not know why my cirrus builds fail

v1:
- https://listman.redhat.com/archives/libvir-list/2021-November/msg00580.html

Martin Kletzander (2):
  util: Add virProcessGetStat
  Use virProcessGetStat

 src/libvirt_linux.syms                |   3 +
 src/qemu/qemu_driver.c                |  33 ++-----
 src/util/virprocess.c                 | 126 +++++++++++++++++---------
 src/util/virprocess.h                 |   4 +
 tests/meson.build                     |   1 +
 tests/virprocessstatdata/complex/stat |   2 +
 tests/virprocessstatdata/simple/stat  |   1 +
 tests/virprocessstattest.c            |  84 +++++++++++++++++
 8 files changed, 185 insertions(+), 69 deletions(-)
 create mode 100644 tests/virprocessstatdata/complex/stat
 create mode 100644 tests/virprocessstatdata/simple/stat
 create mode 100644 tests/virprocessstattest.c

-- 
2.34.0

Re: [PATCH v2 0/2] Fix /proc/*/stat parsing
Posted by Martin Kletzander 2 years, 5 months ago
On Sun, Nov 21, 2021 at 12:04:24AM +0100, Martin Kletzander wrote:
>While working on some polkit stuff I found out that we are inconsistent with the
>way we parse /proc/*/stat files, so I added a new helper instead along with some
>tests.  Unfortunately using it for the thing I wanted is not really viable in
>the end, so it "violates" the Rule of three, but at least it does something
>correctly.
>
>v2:
>- Fixed open64 by just using virFileReadAllQuiet instead of g_file_get_contents
>- Removed some leftover unused variables
>- Still do not know why my cirrus builds fail

SNACK again, I managed to make all the builds run on GitLab finally, but
failed to notice that the last change was not fixed completely, v3 is
already getting tested with the whole pipeline, will send it once it
goes through without an error.

>
>v1:
>- https://listman.redhat.com/archives/libvir-list/2021-November/msg00580.html
>
>Martin Kletzander (2):
>  util: Add virProcessGetStat
>  Use virProcessGetStat
>
> src/libvirt_linux.syms                |   3 +
> src/qemu/qemu_driver.c                |  33 ++-----
> src/util/virprocess.c                 | 126 +++++++++++++++++---------
> src/util/virprocess.h                 |   4 +
> tests/meson.build                     |   1 +
> tests/virprocessstatdata/complex/stat |   2 +
> tests/virprocessstatdata/simple/stat  |   1 +
> tests/virprocessstattest.c            |  84 +++++++++++++++++
> 8 files changed, 185 insertions(+), 69 deletions(-)
> create mode 100644 tests/virprocessstatdata/complex/stat
> create mode 100644 tests/virprocessstatdata/simple/stat
> create mode 100644 tests/virprocessstattest.c
>
>-- 
>2.34.0
>