ls -l / proc命令为/ proc目录中的所有文件提供文件大小0。
dr-xr-xr-x 7 root root 0 Dec 31 17:23 1
dr-xr-xr-x 7 root root 0 Dec 31 17:24 10
dr-xr-xr-x 7 root root 0 Dec 31 17:24 103
dr-xr-xr-x 7 root root 0 Dec 31 17:24 105
where is this file size calculated in kernel?
And also the /proc/[pid]/stat has junk characters. Because of this all processes are not listed in ps command output. But the /proc/[pid]/status has valid information.
'Ð300 0 20 0 0 0 0 0 0 9688 403/01607 1 269 7 41 20 0 1 012Í7/ 601092ÿp965536403 /Øß9¾ØÝ;¶Cù7²00 0 @
2(kthreadd)S 0 0 0 0 -1 00.4 0 0 0 0 0 0 0 0 20 0 1 0 12 0 02ÿp900 0 0 0 0 02ÿp900 0 0 0 0 0 0 0 0 0 0 0 0
112(telnetd)S 1 112 112 0-1Ô,“,0 124 0 1 0 3 27 0 0 20 0 1 0 942 71361042ÿp965536@ 6136 U?9¶T?=¶Jý7¶00 /(25 d4288 0 0 0 20 0 0 0 0 0 0 @ 3840 @ 6136 C6608 #
Where all processes stat files are written with values in kernel source code?
答案 0 :(得分:0)
flags字段有垃圾字符。因此,猫输出有垃圾字符。我使用的是3.4内核。这个标志字段填写在stat文件中的哪个位置?
00000000 31 20 28 69 6e 69 74 29 20 53 20 30 20 31 20 31 | 1(init)S 0 1 1 |
00000010 20 30 20 2d 31 20 d4 2c 22 2c 30 20 38 38 20 31 | 0 -1。,",0 88 1 |
00000020 38 39 34 20 31 37 20 37 20 30 20 32 37 31 20 37 | 894 17 7 0 271 7 |
00000030 20 34 32 20 32 30 20 30 20 31 20 30 20 31 32 20 | 42 20 0 1 0 12 |
00000040 cd 37 2f 36 30 20 31 30 39 20 32 ff 70 03 39 20 | .7 / 60 109 2.p.9 |
00000050 36 35 35 33 36 20 85 34 30 33 2f 20 64 dc 91 3d | 65536 .403 / d .. = |
<00> 00000060 ba 20 64 db 90 3e bc 20 43 18 f9 37 b2 20 30 20 |。 d ..取代。 C..7。 0 |00000070 30 20 30 20 40 0d 27 d0 33 20 30 20 30 20 30 20 | 0 0 @。&#39; .3 0 0 0 |
00000080 32 30 20 30 20 30 20 30 20 30 20 30 20 30 20 84 | 20 0 0 0 0 0 0。|
00000090 39 36 38 38 20 85 34 30 33 2f 20 86 30 31 36 30 | 9688 .403 / .0160 |
000000a0 0a |。|
000000a1