__curproc built-in variable
__curproc is a special built-in using which the user can access some of the process related information for the current process. The information can be accessed using the ->operator on the __curproc built-in. This built-in cannot be used in systrace, BEGIN and END probes. Also, it can be used in interval probes only if PID is mentioned. This built-in will basically provide functionality similar to getproc but only limited to the current process. The data that can be accessed are
- pid
- Process ID.
- ppid
- Parent Process ID
- pgid
- Process Group ID
- uid
- Real user ID
- suid
- Saved user ID
- pri
- Priority
- nice
- Nice value
- cpu
- Processor usage
- adspace
- Process Address Space
- majflt
- I/O Page Fault
- minflt
- Non I/O Page Fault
- size
- Size of image in pages
- sigpend
- Signals pending on the process
- sigignore
- Signals ignored by the process
- sigcatch
- Signals being caught by the process
- forktime
- Creation time of the process
- threadcount
- No of threads in the process
- cwd
- Current working directory. If a free page fault context is not available or the per-CPU computation stack size is less than 96 KB, or in a probe where a page fault is not allowed (for example, interval probe), then this built-in returns a null string
Usage Example
Parent process id of the current process can be accessed using __curproc->ppid.