/proc/[pid]/cmdline file size

扶醉桌前 提交于 2019-12-01 14:10:06

That's normal. /proc files (most of them, there are a few exceptions) are generated by the kernel at the moment you read from them. That means it's impossible to know the size before reading from the file. Think of it as Quantum Mechanics on files. You won't get a state unless you read the information, but there's no guarantee that reading again will give you the same information twice ;-)

In other words, the EOF is only generated when you try to read it. It's not there before that, so there's no way a file size can be determined.

This is really just communication with the kernel disguised as file I/O.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!