11687d771SAlexander Ziaee.\" Written by Garrett Wollman 21687d771SAlexander Ziaee.\" This file is in the public domain. 31687d771SAlexander Ziaee.\" 4*b75d14d6SMark Johnston.Dd June 23, 2024 51687d771SAlexander Ziaee.Dt PROCFS 4 61687d771SAlexander Ziaee.Os 71687d771SAlexander Ziaee.Sh NAME 81687d771SAlexander Ziaee.Nm procfs 91687d771SAlexander Ziaee.Nd process file system 101687d771SAlexander Ziaee.Sh SYNOPSIS 111687d771SAlexander Ziaee.Bd -literal 121687d771SAlexander Ziaeeproc /proc procfs rw 0 0 131687d771SAlexander Ziaee.Ed 141687d771SAlexander Ziaee.Sh DESCRIPTION 151687d771SAlexander Ziaee.Bf -symbolic 161687d771SAlexander ZiaeeThis functionality is deprecated. 171687d771SAlexander ZiaeeUsers are advised to use 181687d771SAlexander Ziaee.Xr libprocstat 3 191687d771SAlexander Ziaeeand 201687d771SAlexander Ziaee.Xr kvm 3 211687d771SAlexander Ziaeeinstead. 221687d771SAlexander Ziaee.Ef 231687d771SAlexander Ziaee.Pp 241687d771SAlexander ZiaeeThe process file system, or 251687d771SAlexander Ziaee.Nm , 261687d771SAlexander Ziaeeimplements a view of the system process table inside the file system. 271687d771SAlexander ZiaeeIt is normally mounted on 281687d771SAlexander Ziaee.Pa /proc . 291687d771SAlexander Ziaee.Pp 301687d771SAlexander ZiaeeThe 311687d771SAlexander Ziaee.Nm 321687d771SAlexander Ziaeeprovides a two-level view of process space, unlike the previous 331687d771SAlexander Ziaee.Fx 1.1 341687d771SAlexander Ziaee.Nm 351687d771SAlexander Ziaeeimplementation. 361687d771SAlexander ZiaeeAt the highest level, processes themselves are named, according to 371687d771SAlexander Ziaeetheir process ids in decimal, with no leading zeros. 381687d771SAlexander ZiaeeThere is also a 391687d771SAlexander Ziaeespecial node called 401687d771SAlexander Ziaee.Pa curproc 411687d771SAlexander Ziaeewhich always refers to the process making the lookup request. 421687d771SAlexander Ziaee.Pp 431687d771SAlexander ZiaeeEach node is a directory which contains the following entries: 441687d771SAlexander Ziaee.Bl -tag -width status 451687d771SAlexander Ziaee.It Pa dbregs 461687d771SAlexander ZiaeeThe debug registers as defined by 471687d771SAlexander Ziaee.Dv "struct dbregs" 481687d771SAlexander Ziaeein 491687d771SAlexander Ziaee.In machine/reg.h . 501687d771SAlexander Ziaee.Pa dbregs 511687d771SAlexander Ziaeeis currently only implemented on the i386 architecture. 521687d771SAlexander Ziaee.It Pa etype 531687d771SAlexander ZiaeeThe type of the executable referenced by the 541687d771SAlexander Ziaee.Pa file 551687d771SAlexander Ziaeeentry. 561687d771SAlexander Ziaee.It Pa file 571687d771SAlexander ZiaeeA symbolic link to the file from which the process text was read. 581687d771SAlexander ZiaeeThis can be used to gain access to the process' symbol table, 591687d771SAlexander Ziaeeor to start another copy of the process. 601687d771SAlexander ZiaeeIf the file cannot be found, the link target is 611687d771SAlexander Ziaee.Ql unknown . 621687d771SAlexander Ziaee.It Pa fpregs 631687d771SAlexander ZiaeeThe floating point registers as defined by 641687d771SAlexander Ziaee.Dv "struct fpregs" 651687d771SAlexander Ziaeein 661687d771SAlexander Ziaee.In machine/reg.h . 671687d771SAlexander Ziaee.Pa fpregs 681687d771SAlexander Ziaeeis only implemented on machines which have distinct general 691687d771SAlexander Ziaeepurpose and floating point register sets. 701687d771SAlexander Ziaee.It Pa map 711687d771SAlexander ZiaeeA collection of lines describing the memory regions of the process, 721687d771SAlexander Ziaeewhere each line contains the following fields: 731687d771SAlexander Ziaee.Bl -tag -compact -width private-resident 741687d771SAlexander Ziaee.It start-address 751687d771SAlexander ZiaeeThe starting address for the region (inclusive). 761687d771SAlexander Ziaee.It end-address 771687d771SAlexander ZiaeeThe ending address for the region (exclusive). 781687d771SAlexander Ziaee.It resident 791687d771SAlexander ZiaeeThe number of resident pages. 801687d771SAlexander Ziaee.It private-resident 811687d771SAlexander ZiaeeThe number of resident pages that were private to the process. 821687d771SAlexander Ziaee.It obj 831687d771SAlexander ZiaeeThe virtual address of the 841687d771SAlexander Ziaee.Vt struct vm_object 851687d771SAlexander Ziaeekernel data structure describing the memory region. 861687d771SAlexander Ziaee.It access 871687d771SAlexander ZiaeeA three character string comprising the characters 881687d771SAlexander Ziaee.Sq r , 891687d771SAlexander Ziaee.Sq w 901687d771SAlexander Ziaeeand 911687d771SAlexander Ziaee.Sq x , 921687d771SAlexander Ziaeedenoting read, write, and execute permissions respectively. 931687d771SAlexander ZiaeeThe lack of a permission is represented by 941687d771SAlexander Ziaee.Sq - . 951687d771SAlexander Ziaee.It ref_count 961687d771SAlexander ZiaeeThe number of references to the region. 971687d771SAlexander Ziaee.It shadow_count 981687d771SAlexander ZiaeeThe number of VM objects that this region is a shadow for. 991687d771SAlexander Ziaee.It flags 1001687d771SAlexander ZiaeeThe flags for the object, see the flags named 1011687d771SAlexander Ziaee.Sy OBJ_* 1021687d771SAlexander Ziaeein 1031687d771SAlexander Ziaee.In vm/vm_object.h . 1041687d771SAlexander Ziaee.It copy-on-write 1051687d771SAlexander ZiaeeWhether the region is copy-on-write. 1061687d771SAlexander ZiaeeOne of: 1071687d771SAlexander Ziaee.Bl -tag -compact -width NCOW 1081687d771SAlexander Ziaee.It COW 1091687d771SAlexander ZiaeeA copy-on-write region. 1101687d771SAlexander Ziaee.It NCOW 1111687d771SAlexander ZiaeeA non-copy-on-write region. 1121687d771SAlexander Ziaee.El 1131687d771SAlexander Ziaee.It needs-copy 1141687d771SAlexander ZiaeeWhether the region needs a copy. 1151687d771SAlexander ZiaeeOne of: 1161687d771SAlexander Ziaee.Bl -tag -compact -width NNC 1171687d771SAlexander Ziaee.It NC 1181687d771SAlexander ZiaeeThe region needs a copy. 1191687d771SAlexander Ziaee.It NNC 1201687d771SAlexander ZiaeeThe region does not need a copy. 1211687d771SAlexander Ziaee.El 1221687d771SAlexander Ziaee.It type 1231687d771SAlexander ZiaeeThe type of the region. 1241687d771SAlexander ZiaeeOne of: 1251687d771SAlexander Ziaee.Bl -tag -compact -width unknown 1261687d771SAlexander Ziaee.It dead 1271687d771SAlexander ZiaeeA region associated with a dead VM object. 1281687d771SAlexander Ziaee.It device 1291687d771SAlexander ZiaeeA region backed by device memory. 1301687d771SAlexander Ziaee.It none 1311687d771SAlexander ZiaeeA region not backed by anything. 1321687d771SAlexander Ziaee.It phys 1331687d771SAlexander ZiaeeA region backed by physical memory. 1341687d771SAlexander Ziaee.It swap 1351687d771SAlexander ZiaeeA region backed by swap. 1361687d771SAlexander Ziaee.It unknown 1371687d771SAlexander ZiaeeA region of unknown type. 1381687d771SAlexander Ziaee.It vnode 1391687d771SAlexander ZiaeeA region backed by a file. 1401687d771SAlexander Ziaee.El 1411687d771SAlexander Ziaee.It fullpath 1421687d771SAlexander ZiaeeThe path to the file backing the memory region, or 1431687d771SAlexander Ziaee.Sq - 1441687d771SAlexander Ziaeeif there is no such file. 1451687d771SAlexander Ziaee.It cred 1461687d771SAlexander ZiaeeOne of: 1471687d771SAlexander Ziaee.Bl -tag -compact -width NCH 1481687d771SAlexander Ziaee.It CH 1491687d771SAlexander ZiaeeThe region is being charged to the user specified in the 1501687d771SAlexander Ziaee.Sq charged-uid 1511687d771SAlexander Ziaeefield. 1521687d771SAlexander Ziaee.It NCH 1531687d771SAlexander ZiaeeThe region is not being charged to any user. 1541687d771SAlexander Ziaee.El 1551687d771SAlexander Ziaee.It charged-uid 1561687d771SAlexander ZiaeeThe UID of the user being charged, or -1 if no user is being charged. 1571687d771SAlexander Ziaee.El 1581687d771SAlexander Ziaee.It Pa mem 1591687d771SAlexander ZiaeeThe complete virtual memory image of the process. 1601687d771SAlexander ZiaeeOnly those address which exist in the process can be accessed. 1611687d771SAlexander ZiaeeReads and writes to this file modify the process. 1621687d771SAlexander ZiaeeWrites to the text segment remain private to the process. 1631687d771SAlexander Ziaee.It Pa note 1641687d771SAlexander ZiaeeUsed for sending signals to the process. 1651687d771SAlexander ZiaeeNot implemented. 1661687d771SAlexander Ziaee.It Pa notepg 1671687d771SAlexander ZiaeeUsed for sending signal to the process group. 1681687d771SAlexander ZiaeeNot implemented. 1691687d771SAlexander Ziaee.It Pa osrel 1701687d771SAlexander ZiaeeAllows read and write of the kernel osrel value assigned to the process. 1711687d771SAlexander ZiaeeIt affects the compatibility shims that are turned on and off 1721687d771SAlexander Ziaeedepending on the value. 1731687d771SAlexander ZiaeeInitial process value is read from the ABI note tag in the executed ELF image, 1741687d771SAlexander Ziaeeand is zero if the tag not supported by binary format or was not found. 1751687d771SAlexander Ziaee.It Pa regs 1761687d771SAlexander ZiaeeAllows read and write access to the process' register set. 1771687d771SAlexander ZiaeeThis file contains a binary data structure 1781687d771SAlexander Ziaee.Dv "struct regs" 1791687d771SAlexander Ziaeedefined in 1801687d771SAlexander Ziaee.In machine/reg.h . 1811687d771SAlexander Ziaee.Pa regs 1821687d771SAlexander Ziaeecan only be written when the process is stopped. 1831687d771SAlexander Ziaee.It Pa rlimit 1841687d771SAlexander ZiaeeThis is a read-only file containing the process current and maximum 1851687d771SAlexander Ziaeelimits. 1861687d771SAlexander ZiaeeEach line is of the format 1871687d771SAlexander Ziaee.Ar rlimit current max , 1881687d771SAlexander Ziaeewith -1 1891687d771SAlexander Ziaeeindicating infinity. 1901687d771SAlexander Ziaee.It Pa status 1911687d771SAlexander ZiaeeThe process status. 1921687d771SAlexander ZiaeeThis file is read-only and returns a single line containing 1931687d771SAlexander Ziaeemultiple space-separated fields as follows: 1941687d771SAlexander Ziaee.Pp 1951687d771SAlexander Ziaee.Bl -bullet -compact 1961687d771SAlexander Ziaee.It 1971687d771SAlexander Ziaeecommand name 1981687d771SAlexander Ziaee.It 1991687d771SAlexander Ziaeeprocess id 2001687d771SAlexander Ziaee.It 2011687d771SAlexander Ziaeeparent process id 2021687d771SAlexander Ziaee.It 2031687d771SAlexander Ziaeeprocess group id 2041687d771SAlexander Ziaee.It 2051687d771SAlexander Ziaeesession id 2061687d771SAlexander Ziaee.It 2071687d771SAlexander Ziaeedevice name 2081687d771SAlexander Ziaeeof the controlling terminal, or 2091687d771SAlexander Ziaeea minus sign 2101687d771SAlexander Ziaee.Pq Dq - 2111687d771SAlexander Ziaeeif there is no controlling terminal. 2121687d771SAlexander Ziaee.It 2131687d771SAlexander Ziaeea list of process flags: 2141687d771SAlexander Ziaee.Dv ctty 2151687d771SAlexander Ziaeeif there is a controlling terminal, 2161687d771SAlexander Ziaee.Dv sldr 2171687d771SAlexander Ziaeeif the process is a session leader, 2181687d771SAlexander Ziaee.Dv noflags 2191687d771SAlexander Ziaeeif neither of the other two flags are set. 2201687d771SAlexander Ziaee.It 2211687d771SAlexander Ziaeethe process start time in seconds and microseconds, 2221687d771SAlexander Ziaeecomma separated. 2231687d771SAlexander Ziaee.It 2241687d771SAlexander Ziaeethe user time in seconds and microseconds, 2251687d771SAlexander Ziaeecomma separated. 2261687d771SAlexander Ziaee.It 2271687d771SAlexander Ziaeethe system time in seconds and microseconds, 2281687d771SAlexander Ziaeecomma separated. 2291687d771SAlexander Ziaee.It 2301687d771SAlexander Ziaeethe wait channel message 2311687d771SAlexander Ziaee.It 232*b75d14d6SMark Johnstonthe process effective UID 233*b75d14d6SMark Johnston.It 234*b75d14d6SMark Johnstonthe process real UID 235*b75d14d6SMark Johnston.It 236*b75d14d6SMark Johnstongroup list, starting with the effective GID, comma-separated 2371687d771SAlexander Ziaee.It 2381687d771SAlexander Ziaeethe hostname of the jail in which the process runs, or 2391687d771SAlexander Ziaee.Ql - 2401687d771SAlexander Ziaeeto indicate that the process is not running within a jail. 2411687d771SAlexander Ziaee.El 2421687d771SAlexander Ziaee.El 2431687d771SAlexander Ziaee.Pp 2441687d771SAlexander ZiaeeEach node is owned by the process's user, and belongs to that user's 2451687d771SAlexander Ziaeeprimary group. 2461687d771SAlexander Ziaee.Sh FILES 2471687d771SAlexander Ziaee.Bl -tag -width /proc/curproc/XXXXXXX -compact 2481687d771SAlexander Ziaee.It Pa /proc 2491687d771SAlexander Ziaeenormal mount point for the 2501687d771SAlexander Ziaee.Nm . 2511687d771SAlexander Ziaee.It Pa /proc/pid 2521687d771SAlexander Ziaeedirectory containing process information for process 2531687d771SAlexander Ziaee.Pa pid . 2541687d771SAlexander Ziaee.It Pa /proc/curproc 2551687d771SAlexander Ziaeedirectory containing process information for the current process 2561687d771SAlexander Ziaee.It Pa /proc/self 2571687d771SAlexander Ziaeedirectory containing process information for the current process 2581687d771SAlexander Ziaee.It Pa /proc/curproc/cmdline 2591687d771SAlexander Ziaeethe process executable name 2601687d771SAlexander Ziaee.It Pa /proc/curproc/etype 2611687d771SAlexander Ziaeeexecutable type 2621687d771SAlexander Ziaee.It Pa /proc/curproc/exe 2631687d771SAlexander Ziaeeexecutable image 2641687d771SAlexander Ziaee.It Pa /proc/curproc/file 2651687d771SAlexander Ziaeeexecutable image 2661687d771SAlexander Ziaee.It Pa /proc/curproc/fpregs 2671687d771SAlexander Ziaeethe process floating point register set 2681687d771SAlexander Ziaee.It Pa /proc/curproc/map 2691687d771SAlexander Ziaeevirtual memory map of the process 2701687d771SAlexander Ziaee.It Pa /proc/curproc/mem 2711687d771SAlexander Ziaeethe complete virtual address space of the process 2721687d771SAlexander Ziaee.It Pa /proc/curproc/note 2731687d771SAlexander Ziaeeused for signaling the process 2741687d771SAlexander Ziaee.It Pa /proc/curproc/notepg 2751687d771SAlexander Ziaeeused for signaling the process group 2761687d771SAlexander Ziaee.It Pa /proc/curproc/osrel 2771687d771SAlexander Ziaeethe process osrel value 2781687d771SAlexander Ziaee.It Pa /proc/curproc/regs 2791687d771SAlexander Ziaeethe process register set 2801687d771SAlexander Ziaee.It Pa /proc/curproc/rlimit 2811687d771SAlexander Ziaeethe process current and maximum rlimit 2821687d771SAlexander Ziaee.It Pa /proc/curproc/status 2831687d771SAlexander Ziaeethe process' current status 2841687d771SAlexander Ziaee.El 2851687d771SAlexander Ziaee.Sh EXAMPLES 2861687d771SAlexander ZiaeeTo mount a 2871687d771SAlexander Ziaee.Nm 2881687d771SAlexander Ziaeefile system on 2891687d771SAlexander Ziaee.Pa /proc : 2901687d771SAlexander Ziaee.Pp 2911687d771SAlexander Ziaee.Dl "mount -t procfs proc /proc" 2921687d771SAlexander Ziaee.Sh SEE ALSO 2931687d771SAlexander Ziaee.Xr procstat 1 , 2941687d771SAlexander Ziaee.Xr mount 2 , 2951687d771SAlexander Ziaee.Xr sigaction 2 , 2961687d771SAlexander Ziaee.Xr unmount 2 , 2971687d771SAlexander Ziaee.Xr kvm 3 , 2981687d771SAlexander Ziaee.Xr libprocstat 3 , 2991687d771SAlexander Ziaee.Xr pseudofs 9 3001687d771SAlexander Ziaee.Sh AUTHORS 3011687d771SAlexander Ziaee.An -nosplit 3021687d771SAlexander ZiaeeThis manual page written by 3031687d771SAlexander Ziaee.An Garrett Wollman , 3041687d771SAlexander Ziaeebased on the description 3051687d771SAlexander Ziaeeprovided by 3061687d771SAlexander Ziaee.An Jan-Simon Pendry , 3071687d771SAlexander Ziaeeand revamped later by 3081687d771SAlexander Ziaee.An Mike Pritchard . 309