Linux kernel /procfs中的文件大小不正确,/proc/[pid]/stat中的值不正确

Linux kernel /procfs中的文件大小不正确,/proc/[pid]/stat中的值不正确,linux-kernel,embedded-linux,Linux Kernel,Embedded Linux,ls-l/proc命令为/proc dir中的所有文件提供文件大小0 ls-l/proc/ dr-xr-xr-x 7根目录0 Dec 31 17:23 1 dr-xr-xr-x 7根目录0 Dec 31 17:24 10 dr-xr-xr-x 7根目录0 Dec 31 17:24 103 dr-xr-xr-x 7根目录0 Dec 31 17:24 105 where is this file size calculated in kernel? And also the /proc/[p

ls-l/proc命令为/proc dir中的所有文件提供文件大小0

ls-l/proc/ dr-xr-xr-x 7根目录0 Dec 31 17:23 1

dr-xr-xr-x 7根目录0 Dec 31 17:24 10

dr-xr-xr-x 7根目录0 Dec 31 17:24 103

dr-xr-xr-x 7根目录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.
cat/proc/1/stat Ð3 0 0 0 0 0 0 0 9688 403/01607 1 269 7 41 20 0 1 0 12Í7/60 109 2ÿp9 65536 403/Øß9¾Ý;^Cù7²0@

cat/proc/2/stat 2(kthread)s0 0 0 0 0-100.4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 12 0 0 2ÿp9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

cat/proc/112/stat 112(telnetd)S 1 112 112 0-1Ô",0 124 0 1 0 3 27 0 0 0 20 0 1 0 942 7136 104 2ÿp9 65536@6136 U?9∗T=J 253 7∗0/(25 d4288 0 0 0 0 0 0 0 0 0@3840@6136 C6608 #


flags字段有垃圾字符。因此,cat输出有垃圾字符。我使用的是3.4内核。stat文件中这个标志字段填充在哪里

hextump-vC/proc/1/stat 0000000031282696E69742920532032031 | 1(初始)S01|

000000102030202D 3120D4 2C22 2C302038382031 | 0-1.,“,0881|

000000 203839340312031372032032032312037 | 89417702717|

000000 3020343202030020302302302302302020320012|

000000 40 cd 37 2f 36 30 20 31 30 39 20 32 ff 70 03 39 20 | 7/60 109 2.p.9|

000000 50 36 35 33 36 20 85 34 30 33 2f 20 64 dc 91 3d | 65536.403/d=|

000000 60 ba 20 64 db 90 3e bc 20 43 18 f9 37 b2 20 30 20 | d..>C..7.0|

000000 70 30 20 20 40 0d 27 d0 33 20 30 20 20 20 0 0@'.3 0 0|

000000 80 32 30 20 30 20 30 20 30 20 20 84 | 20 0 0 0 0 0 0|

000000 90 39 36 38 20 85 34 30 33 2f 20 86 30 36 30 | 9688.403/.0160|

000000A00A ||

000000a1

Where all processes stat files are written with values in kernel source code?