From 7f9cf4b90244659451a9b8d97ef17099fb2d83e4 Mon Sep 17 00:00:00 2001 From: Nir Date: Mon, 7 Aug 2023 12:22:26 +0000 Subject: [PATCH] Add NSpid to proc status Signed-off-by: Nir Levy --- proc_status.go | 4 ++++ proc_status_test.go | 1 + 2 files changed, 5 insertions(+) diff --git a/proc_status.go b/proc_status.go index c055d075..58c78cd1 100644 --- a/proc_status.go +++ b/proc_status.go @@ -32,6 +32,8 @@ type ProcStatus struct { // Thread group ID. TGID int + // Pid namespace. + NSpid int // Peak virtual memory size. VmPeak uint64 // nolint:revive @@ -127,6 +129,8 @@ func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintByt copy(s.UIDs[:], strings.Split(vString, "\t")) case "Gid": copy(s.GIDs[:], strings.Split(vString, "\t")) + case "NSpid": + s.NSpid = int(vUint) case "VmPeak": s.VmPeak = vUintBytes case "VmSize": diff --git a/proc_status_test.go b/proc_status_test.go index 2f0884ff..383c1653 100644 --- a/proc_status_test.go +++ b/proc_status_test.go @@ -36,6 +36,7 @@ func TestProcStatus(t *testing.T) { }{ {name: "Pid", want: 26231, have: s.PID}, {name: "Tgid", want: 26231, have: s.TGID}, + {name: "NSpid", want: 1, have: s.NSpid}, {name: "VmPeak", want: 58472 * 1024, have: int(s.VmPeak)}, {name: "VmSize", want: 58440 * 1024, have: int(s.VmSize)}, {name: "VmLck", want: 0 * 1024, have: int(s.VmLck)},