Codebase list golang-procfs / upstream/0.2.0
Add GIDs to ProcStatus struct Signed-off-by: Andrei Volnin <wolandr@gmail.com> Andrei Volnin authored 3 years ago Johannes 'fish' Ziemke committed 3 years ago
3 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
466466 PPid: 1
467467 TracerPid: 0
468468 Uid: 1000 1000 1000 0
469 Gid: 0 0 0 0
469 Gid: 1001 1001 1001 0
470470 FDSize: 128
471471 Groups:
472472 NStgid: 1
7171 // Number of involuntary context switches.
7272 NonVoluntaryCtxtSwitches uint64
7373
74 // UIDs of the process (Real, effective, saved set, and filesystem UIDs (GIDs))
74 // UIDs of the process (Real, effective, saved set, and filesystem UIDs)
7575 UIDs [4]string
76 // GIDs of the process (Real, effective, saved set, and filesystem GIDs)
77 GIDs [4]string
7678 }
7779
7880 // NewStatus returns the current status information of the process.
118120 s.Name = vString
119121 case "Uid":
120122 copy(s.UIDs[:], strings.Split(vString, "\t"))
123 case "Gid":
124 copy(s.GIDs[:], strings.Split(vString, "\t"))
121125 case "VmPeak":
122126 s.VmPeak = vUintBytes
123127 case "VmSize":
9090 t.Errorf("want uids %s, have %s", want, have)
9191 }
9292 }
93
94 func TestProcStatusGIDs(t *testing.T) {
95 p, err := getProcFixtures(t).Proc(26231)
96 if err != nil {
97 t.Fatal(err)
98 }
99
100 s, err := p.NewStatus()
101 if err != nil {
102 t.Fatal(err)
103 }
104
105 if want, have := [4]string{"1001", "1001", "1001", "0"}, s.GIDs; want != have {
106 t.Errorf("want uids %s, have %s", want, have)
107 }
108 }