Next: Process Argument List
Up: Process Information
Previous: Process Information
Contents
- One additional entry in the /proc file system makes it easy for a program to use /proc to find information about its own process.
- The entry /proc/self is a symbolic link to the /proc directory corresponding to the current process.
- The destination of the /proc/self link depends on which process looks at it: Each process sees its own process directory as the target of the link.
- The http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/get-pid.cprogram in Fig. 10.2 reads the target of the /proc/self link to
determine its process ID.
Figure 10.2:
Obtain the Process ID from /proc/self.
 |
Cem Ozdogan
2007-05-16