danburkert / procinfo-rs

A Rust library for accessing Linux process and system information
Apache License 2.0
91 stars 39 forks source link

cannot parse /proc/pid/status on Linux 4.17.19 #40

Open symphorien opened 6 years ago

symphorien commented 6 years ago

Error:

Err(Custom { kind: InvalidInput, error: StringError("unable to parse whole input, remaining: Ok(\"CoreDumping:\\t0\\nThreads:\\t1\\nSigQ:\\t0/31394\\nSigPnd:\\t0000000000000000\\nShdPnd:\\t0000000000000000\\nSigBlk:\\t0000000000000000\\nSigIgn:\\t0000000000004006\\nSigCgt:\\t0000000180000000\\nCapInh:\\t0000000000000000\\nCapPrm:\\t0000003fffffffff\\nCapEff:\\t0000003fffffffff\\nCapBnd:\\t0000003fffffffff\\nCapAmb:\\t0000000000000000\\nNoNewPrivs:\\t0\\nSeccomp:\\t0\\nSpeculation_Store_Bypass:\\tthread vulnerable\\nCpus_allowed:\\tff\\nCpus_allowed_list:\\t0-7\\nMems_allowed:\\t00000000,00000001\\nMems_allowed_list:\\t0\\nvoluntary_ctxt_switches:\\t3\\nnonvoluntary_ctxt_switches:\\t0\\n\")") })

corresponding /proc/pid/status

Name:   cat
Umask:  0022
State:  S (sleeping)
Tgid:   17417
Ngid:   0
Pid:    17417
PPid:   2011
TracerPid:  0
Uid:    0   0   0   0
Gid:    0   0   0   0
FDSize: 64
Groups: 0 
NStgid: 17417
NSpid:  17417
NSpgid: 2011
NSsid:  2011
VmPeak:    16016 kB
VmSize:    16016 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:       440 kB
VmRSS:       440 kB
RssAnon:          80 kB
RssFile:         360 kB
RssShmem:          0 kB
VmData:      440 kB
VmStk:       136 kB
VmExe:      1428 kB
VmLib:      2036 kB
VmPTE:        68 kB
VmSwap:        0 kB
HugetlbPages:          0 kB
CoreDumping:    0
Threads:    1
SigQ:   0/31394
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000004006
SigCgt: 0000000180000000
CapInh: 0000000000000000
CapPrm: 0000003fffffffff
CapEff: 0000003fffffffff
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
NoNewPrivs: 0
Seccomp:    0
Speculation_Store_Bypass:   thread vulnerable
Cpus_allowed:   ff
Cpus_allowed_list:  0-7
Mems_allowed:   00000000,00000001
Mems_allowed_list:  0
voluntary_ctxt_switches:    3
nonvoluntary_ctxt_switches: 0

System: 4.17.19

rendaw commented 5 years ago

PR #38 seems to address this.

symphorien commented 5 years ago

I am now on linux 5.1.11 and it #38 does not solve the problem:

unable to parse whole input, remaining: Ok("THP_enabled:\t1\nThreads:\t1\nSigQ:\t0/31381\nSigPnd:\t0000000000000000\nShdPnd:\t0000000000000000\nSigBlk:\t0000000000000000\nSigIgn:\t0000000000001000\nSigCgt:\t0000000000000000\nCapInh:\t0000000000000000\nCapPrm:\t00000000200534e2\nCapEff:\t00000000200534e2\nCapBnd:\t00000000200534e2\nCapAmb:\t0000000000000000\nNoNewPrivs:\t0\nSeccomp:\t0\nSpeculation_Store_Bypass:\tthread vulnerable\nCpus_allowed:\tff\nCpus_allowed_list:\t0-7\nMems_allowed:\t00000000,00000001\nMems_allowed_list:\t0\nvoluntary_ctxt_switches:\t10\nnonvoluntary_ctxt_switches:\t2\n")
rendaw commented 5 years ago

Ah, thanks for trying it. I guess I'll just go with regex myself then, at least for now.