1.\" $FreeBSD: src/share/man/man5/procfs.5,v 1.14.2.5 2001/08/17 13:08:47 ru Exp $ 2.\" Written by Garrett Wollman 3.\" This file is in the public domain. 4.\" 5.Dd March 7, 2024 6.Dt PROCFS 5 7.Os 8.Sh NAME 9.Nm procfs 10.Nd process file system 11.Sh SYNOPSIS 12.Bd -literal 13proc /proc procfs rw 0 0 14.Ed 15.Sh DESCRIPTION 16The process file system, or 17.Nm , 18implements a view of the system process table inside the file system. 19It is normally mounted on 20.Pa /proc , 21and is required for the complete operation of programs such as 22.Xr ps 1 23and 24.Xr w 1 . 25.Pp 26The 27.Nm 28provides a two-level view of process space, unlike the previous 29.Fx 1.1 30.Nm 31implementation. 32At the highest level, processes themselves are named, according to 33their process ids in decimal, with no leading zeros. There is also a 34special node called 35.Pa curproc 36which always refers to the process making the lookup request. 37.Pp 38Each node is a directory which contains the following entries: 39.Pp 40Each directory contains several files: 41.Bl -tag -width status 42.It Pa ctl 43a write-only file which supports a variety 44of control operations. 45Control commands are written as strings to the 46.Pa ctl 47file. 48The control commands are: 49.Bl -tag -width detach -compact 50.It attach 51stops the target process and arranges for the sending 52process to become the debug control process. 53.It detach 54continue execution of the target process and 55remove it from control by the debug process (which 56need not be the sending process). 57.It run 58continue running the target process until 59a signal is delivered, a breakpoint is hit, or the 60target process exits. 61.It step 62single step the target process, with no signal delivery. 63.It wait 64wait for the target process to come to a steady 65state ready for debugging. 66The target process must be in this state before 67any of the other commands are allowed. 68.El 69.Pp 70The string can also be the name of a signal, lower case 71and without the 72.Dv SIG 73prefix, 74in which case that signal is delivered to the process 75(see 76.Xr sigaction 2 ) . 77.It Pa dbregs 78The debug registers as defined by 79.Dv "struct dbregs" 80in 81.In machine/reg.h . 82.It Pa etype 83The type of the executable referenced by the 84.Pa file 85entry. 86.It Pa exe 87Identical to the 88.Pa file 89entry below. 90.It Pa file 91A reference to the vnode from which the process text was read. 92This can be used to gain access to the process' symbol table, 93or to start another copy of the process. 94.It Pa fpregs 95The floating point registers as defined by 96.Dv "struct fpregs" 97in 98.In machine/reg.h . 99.Pa fpregs 100is only implemented on machines which have distinct general 101purpose and floating point register sets. 102.It Pa map 103A map of the process' virtual memory. 104.It Pa mem 105The complete virtual memory image of the process. 106Only those address which exist in the process can be accessed. 107Reads and writes to this file modify the process. 108Writes to the text segment remain private to the process. 109.It Pa note 110Used for sending signals to the process. Not implemented. 111.It Pa notepg 112Used for sending signal to the process group. Not implemented. 113.It Pa regs 114Allows read and write access to the process' register set. 115This file contains a binary data structure 116.Dv "struct regs" 117defined in 118.In machine/reg.h . 119.Pa regs 120can only be written when the process is stopped. 121.It Pa rlimit 122This is a read-only file containing the process current and maximum 123limits. 124Each line is of the format 125.Ar rlimit current max , 126with -1 127indicating infinity. 128.It Pa status 129The process status. 130This file is read-only and returns a single line containing 131multiple space-separated fields as follows: 132.Pp 133.Bl -bullet -compact 134.It 135command name 136.It 137process id 138.It 139parent process id 140.It 141process group id 142.It 143session id 144.It 145.Ar major , Ns Ar minor 146of the controlling terminal, or 147.Dv -1,-1 148if there is no controlling terminal. 149.It 150a list of process flags: 151.Dv ctty 152if there is a controlling terminal, 153.Dv sldr 154if the process is a session leader, 155.Dv noflags 156if neither of the other two flags are set. 157.It 158the process start time in seconds and microseconds, 159comma separated. 160.It 161the user time in seconds and microseconds, 162comma separated. 163.It 164the system time in seconds and microseconds, 165comma separated. 166.It 167the wait channel message 168.It 169the process credentials consisting of 170the effective user id 171and the list of groups (whose first member 172is the effective group id) 173all comma separated. 174.El 175.El 176.Pp 177In a normal debugging environment, 178where the target is fork/exec'd by the debugger, 179the debugger should fork and the child should stop 180itself (with a self-inflicted 181.Dv SIGSTOP 182for example). 183The parent should issue a 184.Dv wait 185and then an 186.Dv attach 187command via the appropriate 188.Pa ctl 189file. 190The child process will receive a 191.Dv SIGTRAP 192immediately after the call to exec (see 193.Xr execve 2 ) . 194.Pp 195Each node is owned by the process's user, and belongs to that user's 196primary group, except for the 197.Pa mem 198node, which belongs to the 199.Li kmem 200group. 201.Sh FILES 202.Bl -tag -width /proc/curproc/XXXXXXX -compact 203.It Pa /proc 204normal mount point for the 205.Nm . 206.It Pa /proc/pid 207directory containing process information for process 208.Pa pid . 209.It Pa /proc/curproc 210directory containing process information for the current process 211.It Pa /proc/curproc/cmdline 212the process executable name 213.It Pa /proc/curproc/ctl 214used to send control messages to the process 215.It Pa /proc/curproc/etype 216executable type 217.It Pa /proc/curproc/exe 218identical to 219.Pa /proc/curproc/file 220below 221.It Pa /proc/curproc/file 222executable image 223.It Pa /proc/curproc/fpregs 224the process floating point register set 225.It Pa /proc/curproc/map 226virtual memory map of the process 227.It Pa /proc/curproc/mem 228the complete virtual address space of the process 229.It Pa /proc/curproc/note 230used for signaling the process 231.It Pa /proc/curproc/notepg 232used for signaling the process group 233.It Pa /proc/curproc/regs 234the process register set 235.It Pa /proc/curproc/rlimit 236the process current and maximum rlimit 237.It Pa /proc/curproc/status 238the process' current status 239.It Pa /proc/self 240another symlink that's the same as 241.Pa /proc/curproc 242.El 243.Sh SEE ALSO 244.Xr mount 2 , 245.Xr sigaction 2 , 246.Xr unmount 2 , 247.Xr mount_procfs 8 248.Sh AUTHORS 249.An -nosplit 250This manual page written by 251.An Garrett Wollman , 252based on the description 253provided by 254.An Jan-Simon Pendry , 255and revamped later by 256.An Mike Pritchard . 257