Skip to content

Commit 15960ea

Browse files
committed
feat: parse StartCode, EndCode, and StartStack in /proc/pid/stat
1 parent 09209a4 commit 15960ea

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Diff for: proc_stat.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ type ProcStat struct {
101101
RSS int
102102
// Soft limit in bytes on the rss of the process.
103103
RSSLimit uint64
104+
// The address above which program text can run.
105+
StartCode uint64
106+
// The address below which program text can run.
107+
EndCode uint64
108+
// The address of the start (i.e., bottom) of the stack.
109+
StartStack uint64
104110
// CPU number last executed on.
105111
Processor uint
106112
// Real-time scheduling priority, a number in the range 1 to 99 for processes
@@ -177,9 +183,9 @@ func (p Proc) Stat() (ProcStat, error) {
177183
&s.VSize,
178184
&s.RSS,
179185
&s.RSSLimit,
180-
&ignoreUint64,
181-
&ignoreUint64,
182-
&ignoreUint64,
186+
&s.StartCode,
187+
&s.EndCode,
188+
&s.StartStack,
183189
&ignoreUint64,
184190
&ignoreUint64,
185191
&ignoreUint64,

Diff for: proc_stat_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ func TestProcStat(t *testing.T) {
5555
have uint64
5656
}{
5757
{name: "RSS Limit", want: 18446744073709551615, have: s.RSSLimit},
58+
{name: "Start Code", want: 4194304, have: s.StartCode},
59+
{name: "End Code", want: 6294284, have: s.EndCode},
60+
{name: "Start Stack", want: 140736914091744, have: s.StartStack},
5861
{name: "delayacct_blkio_ticks", want: 31, have: s.DelayAcctBlkIOTicks},
5962
} {
6063
if test.want != test.have {

0 commit comments

Comments
 (0)