« 结婚了。。。。 | Main | My city from the satellite »
July 19, 2005
procfs
In order to know the command line of a process, one can open /proc/pid/cmdline. If a program needs to know its own command line, it can read from /proc/self/cmdline.
The file contains null-terminated strings of the command line.
For example, if you run "./a.out 33 44", the file will be
. / a . o u t \0 3 3 \0 4 4 \0
You can't use stat function to know the size though.
For more details, see the manual page for proc.
Posted by Roy at July 19, 2005 05:59 PM