public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/1] fhandler_process.cc(format_process_stat): fix /proc/pid/stat issues
@ 2022-05-10 14:44 Brian Inglis
  2022-05-10 14:44 ` [PATCH 1/1] " Brian Inglis
  2022-05-11 14:55 ` [PATCH 0/1] " Mohammad HOQUE
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Inglis @ 2022-05-10 14:44 UTC (permalink / raw)
  To: Cygwin Patches

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-11 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 14:44 [PATCH 0/1] fhandler_process.cc(format_process_stat): fix /proc/pid/stat issues Brian Inglis
2022-05-10 14:44 ` [PATCH 1/1] " Brian Inglis
2022-05-11  8:03   ` Corinna Vinschen
2022-05-11 14:55 ` [PATCH 0/1] " Mohammad HOQUE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).