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
71 | 71 |
// Number of involuntary context switches.
|
72 | 72 |
NonVoluntaryCtxtSwitches uint64
|
73 | 73 |
|
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)
|
75 | 75 |
UIDs [4]string
|
|
76 |
// GIDs of the process (Real, effective, saved set, and filesystem GIDs)
|
|
77 |
GIDs [4]string
|
76 | 78 |
}
|
77 | 79 |
|
78 | 80 |
// NewStatus returns the current status information of the process.
|
|
118 | 120 |
s.Name = vString
|
119 | 121 |
case "Uid":
|
120 | 122 |
copy(s.UIDs[:], strings.Split(vString, "\t"))
|
|
123 |
case "Gid":
|
|
124 |
copy(s.GIDs[:], strings.Split(vString, "\t"))
|
121 | 125 |
case "VmPeak":
|
122 | 126 |
s.VmPeak = vUintBytes
|
123 | 127 |
case "VmSize":
|
90 | 90 |
t.Errorf("want uids %s, have %s", want, have)
|
91 | 91 |
}
|
92 | 92 |
}
|
|
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 |
}
|