/proc/statのサイズが0で表示されるのはなぜですか? [コピー]

/proc/statのサイズが0で表示されるのはなぜですか? [コピー]
ls -rlth /proc/stat
-r--r--r-- 1 root root 0 Feb 21 04:25 /proc/stat

そうしてもcat内容は十分です。

ベストアンサー1

事前定義された既知のサイズがない仮想ファイルであるため、実際のサイズ、つまり返されるデータの量は、読み取る時点によって異なります。

いくつかの/procファイルはあらかじめ知られているので、null以外のサイズを持つことができます。

   /proc/kcore
          This  file  represents the physical memory of the system and is stored in the ELF core file for-
          mat.  With this pseudo-file, and an unstripped kernel (/usr/src/linux/vmlinux) binary,  GDB  can
          be used to examine the current state of any kernel data structures.

          The total length of the file is the size of physical memory (RAM) plus 4KB.

ただし、マイコンピュータに128 TBのRAMがないため、報告された値と可能な読み取りサイズはドキュメントと一致しません。

$ ls -lh /proc/kcore
-r--------. 1 root root 128T Feb 23 16:10 /proc/kcore

おすすめ記事