On Tue, May 10, 2022, 8:45 PM Brian Inglis <brian.ing...@systematicsw.ab.ca> wrote:
> Noticed some issues with x86 32 bit procps and checked /proc/pid/stat which > looked misaligned compared to x86_64 64 bit, due to int64_t format > mismatches. > There were also issues with the tty_nr encoding (uses ctty which has major > in > top 16 bits and minor in bottom 16 bits, where tty_nr is specified to have > major in bits 15:8 and minor across 31:20 and 7:0) and rsslim units in > bytes > not pages. > This patch fixes those issues. > Below are the old and new /proc/pid/stat values and decoded listings for 32 > bit; only tty_nr and rsslim values changed in 64 bit; tty_nr listing > decoding > was also changed after. > > ==> proc-pid-stat-old-32.log <== > 1025 (bash) S 1024 1025 1025 8912896 -1 0 147513 147513 0 0 49546 0 45000 > 49546 45000 0 20 0 0 4115675647 0 7397376 > > ==> proc-pid-stat-new-32.log <== > 27991 (bash) S 1 27991 1025 34816 -1 0 9662 9662 0 0 312 562 312 562 20 0 > 0 0 5113740411 7241728 2901 1413120 > > ==> proc-pid-stat-list-old-32.log <== > CLK_TCK 1000 PAGE_SIZE 65536 boot time 5110786.43 > 1 pid 1025 process > 2 comm (bash) executable > 3 state S ? > 4 ppid 1024 parent > 5 pgrp 1025 group > 6 session 1025 id > 7 tty_nr 136 0 15:8,31:20,7:0 > 8 tpgid -1 group > 9 flags 0 sys > 10 minflt 147425 minor > 11 cminflt 147425 minorchild > 12 majflt 0 major > 13 cmajflt 0 majorchild > 14 utime 49.546 user > 15 stime 0.000 sys > 16 cutime 44.984 userchild > 17 cstime 49.546 syschild > 18 priority 44984 0..39->-20..19 > 19 nice 0 -20..19 > 20 num_threads 20 threads > 21 itrealvalue 0 timer > 22 starttime 59 3:39:46.430 start > 23 vsize 4115675647 memory > 24 rss 0 pages > 25 rsslim 7397376 limit > > ==> proc-pid-stat-list-new-32.log <== > CLK_TCK 1000 PAGE_SIZE 65536 boot time 5114365.42 > 1 pid 27991 process > 2 comm (bash) executable > 3 state S ? > 4 ppid 1 parent > 5 pgrp 27991 group > 6 session 1025 id > 7 tty_nr 136 0 15:8,31:20,7:0 > 8 tpgid -1 group > 9 flags 0 sys > 10 minflt 9662 minor > 11 cminflt 9662 minorchild > 12 majflt 0 major > 13 cmajflt 0 majorchild > 14 utime 0.312 user > 15 stime 0.562 sys > 16 cutime 0.312 userchild > 17 cstime 0.562 syschild > 18 priority 20 0..39->-20..19 > 19 nice 0 -20..19 > 20 num_threads 0 threads > 21 itrealvalue 0 timer > 22 starttime 10:25.009 start > 23 vsize 7241728 memory > 24 rss 2901 pages > 25 rsslim 1413120 limit > > Brian Inglis (1): > fhandler_process.cc(format_process_stat): fix /proc/pid/stat issues > > winsup/cygwin/fhandler_process.cc | 33 +++++++++++++++++++------------ > 1 file changed, 20 insertions(+), 13 deletions(-) > > -- > 2.36.0 > >