pstatus_t no found in procfs.h (LINUX)

2019-08-28 21:29发布

问题:

I am reading the /proc/PID/status file using my C program and I want to use the pstatus_t struct to directly read the values from the file into this struct. However, my compiler is showing that this file is not present in the procfs.h. I have checked few examples on internet where they are using the same header file but in my case, it is not working.

回答1:

When you say "reading /proc/PID/status", I'm assuming that you are running in userspace (as opposed to in the kernel). In this case, the pstatus_t structure is worthless to you. Most files under /proc, including status, are a text-formatted representation of the kernel data structures. There is no way to directly get the binary contents of a kernel pstatus_t structure.



标签: c linux