Keywords: lpg

Next: 10.4.3 Process control under Up: 10.4 Process information and Previous: 10.4.1 kvm routines

## 10.4.2 ptrace and the /proc filesystem

The ptrace system call is used in 4.3BSD and SVID to control a process and read information from it. It is classically used by debuggers to, say, trap execution of a running process or examine its state. Under SVR4, ptrace is superseded by the /proc filesystem, which appears as a directory containing a single file entry for each running process, named by process ID. The user program can open the file corresponding to the process of interest and issue various ioctl calls on it to control its execution or obtain information from the kernel on the process. Similarly, the program can read or write data directly in the process's address space through the file descriptor into the /proc filesystem.