1.\" $NetBSD: mount_procfs.8,v 1.39 2023/04/18 18:42:20 jkoshy Exp $ 2.\" 3.\" Copyright (c) 1992, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" All rights reserved. 6.\" 7.\" This code is derived from software donated to Berkeley by 8.\" Jan-Simon Pendry. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)mount_procfs.8 8.3 (Berkeley) 6/1/94 35.\" 36.\" 37.Dd April 18, 2023 38.Dt MOUNT_PROCFS 8 39.Os 40.Sh NAME 41.Nm mount_procfs 42.Nd mount the process file system 43.Sh SYNOPSIS 44.Nm 45.Op Fl o Ar options 46.Pa /proc 47.Pa mount_point 48.Sh DESCRIPTION 49The 50.Nm 51command attaches an instance of the process 52namespace to the global filesystem namespace. 53The conventional mount point is 54.Pa /proc . 55The directory specified by 56.Ar mount_point 57is converted to an absolute path before use. 58This command is normally executed by 59.Xr mount 8 60at boot time. 61.Pp 62The options are as follows: 63.Bl -tag -width indent 64.It Fl o Cm nolinux 65Do not support nodes which are not part of the original procfs 66implementation but have been added for compatibility with the Linux 67procfs namespace. 68See 69.Sx FILES 70for more information. 71.El 72.Pp 73The root of the process filesystem 74contains an entry for each active process. 75These processes are visible as a directory whose 76name is the process' pid. 77In addition, the special entries 78.Pa curproc 79and 80.Pa self 81reference the current process. 82The 83.Pa self 84symlink appears for compatibility with the Linux procfs implementation. 85.Pp 86Each directory contains several files. 87.Bl -tag -width status 88.It Pa cmdline 89This file is readonly and returns null-terminated strings 90corresponding to the process' command line arguments. 91For a system or zombie process, this file contains only a string 92with the name of the process. 93.It Pa cwd 94A symbolic link that points to the current working directory of the 95process. 96If the target process's current working directory is not available or 97is not at or below the current process's root directory, this link 98will point to 99.Dq / . 100.It Pa fd/# 101File descriptors which can be accessed through the file system. 102See 103.Xr fd 4 104for more information. 105.It Pa file 106A reference to the vnode from which the process text was read. 107This can be used to gain access to the process' symbol table, 108or to start another copy of the process. 109.It Pa map 110A map of the process' virtual memory. 111This file comprises lines describing the memory regions of the process, 112where each line contains the following fields: 113.Pp 114.Bl -tag -compact -width max-protection 115.It start-address 116The starting address of the region (inclusive). 117.It end-address 118The ending address of the region (exclusive). 119.It protection 120The access permissions for the region, represented as 121a three-character string using the characters 122.Sq r , 123.Sq w 124and 125.Sq x 126to denote read, write, and execute permission respectively. 127The lack of a permission is represented by a 128.Sq - . 129.It max-protection 130The maximum access permissions for the region represented as 131a three character string using the characters 132.Sq r , 133.Sq w 134and 135.Sq x 136to denote read, write, and execute permission respectively. 137The lack of a permission is represented by a 138.Sq - . 139.It copy-on-write 140Whether the region is copy-on-write. 141One of: 142.Bl -tag -compact -width NCOW 143.It COW 144A region that is copy-on-write. 145.It NCOW 146A region that is not copy-on-write. 147.El 148.It needs-copy 149Whether the region needs a copy. 150One of: 151.Bl -tag -compact -width NNC 152.It NC 153The region needs a copy. 154.It NNC 155The region does not need a copy. 156.El 157.It inheritance 158The inheritance code for the region, as set by 159.Xr minherit 2 . 160.It wired-count 161The wired count for the region. 162The region can be paged out if its wired count is zero. 163.It advice 164The advice value set by a prior call to 165.Xr madvise 2 166for the region. 167.El 168.It Pa maps 169A map of the process' virtual memory in a form like the 170proc filesystem as implemented in Linux. 171This file comprises lines describing the memory regions of 172the process, where each line contains the following fields: 173.Pp 174.Bl -tag -compact -width start-address 175.It start-address 176The starting address of the region (inclusive). 177.It end-address 178The ending address of the region (exclusive). 179.It protection 180The access permissions for the region, represented as 181a three-character string using the characters 182.Sq r , 183.Sq w 184and 185.Sq x 186to denote read, write, and execute permission respectively. 187The lack of a permission is represented by a 188.Sq - . 189.It copy-on-write 190Whether the region is copy-on-write. 191One of: 192.Bl -tag -compact -width ".Sq p" 193.It Sq p 194The region is copy-on-write. 195.It Sq s 196The region is shared. 197.El 198.It offset 199The offset into the file being mapped by the region. 200.It device-id 201The major and minor number of the device containing the file 202being mapped by the region. 203.It fileid 204The inode for the file associated with the region. 205.It path 206The pathname to the file associated with the region. 207.El 208.It Pa mem 209The complete virtual memory image of the process. 210Only those addresses which exist in the process can be accessed. 211Writes to this file modify the process. 212Writes to the text segment normally remain private to the process, 213since the text segment is mapped with MAP_PRIVATE; however, this is 214not guaranteed. 215.It Pa note 216Not implemented. 217.It Pa notepg 218Not implemented. 219.It Pa regs 220Allows read and write access to the process' register set. 221This file contains a binary data structure 222.Dv "struct regs" 223defined in 224.Pa <machine/reg.h> . 225.Pa regs 226can only be written when the process is stopped. 227.It Pa fpregs 228The floating point registers as defined by 229.Dv "struct fpregs" 230in 231.Pa <machine/reg.h> . 232.Pa fpregs 233is only implemented on machines which have distinct general 234purpose and floating point register sets. 235.It Pa root 236A symbolic link that points to the root directory of the process. 237If the target process's root directory is not available or is not at 238or below the current process's root directory, this link will point to 239.Dq / . 240.It Pa status 241The process status. 242This file is readonly and returns a single line containing 243multiple space-separated fields as follows: 244.Pp 245.Bl -bullet -compact 246.It 247command name 248.It 249process id 250.It 251parent process id 252.It 253process group id 254.It 255session id 256.It 257.Ar major,minor 258of the controlling terminal, or 259.Dv -1,-1 260if there is no controlling terminal. 261.It 262a list of process flags: 263.Dv ctty 264if there is a controlling terminal, 265.Dv sldr 266if the process is a session leader, 267.Dv noflags 268if neither of the other two flags are set. 269.It 270the process start time in seconds and microseconds, 271comma separated. 272.It 273the user time in seconds and microseconds, 274comma separated. 275.It 276the system time in seconds and microseconds, 277comma separated. 278.It 279the wait channel message 280.It 281the process credentials consisting of 282the effective user id 283and the list of groups (whose first member 284is the effective group id) 285all comma separated. 286.El 287.El 288.Sh FILES 289.Bl -tag -width /proc/curproc -compact 290.It Pa /proc/# 291.It Pa /proc/#/cmdline 292.It Pa /proc/#/cwd 293.It Pa /proc/#/exe 294.It Pa /proc/#/file 295.It Pa /proc/#/fpregs 296.It Pa /proc/#/map 297.It Pa /proc/#/maps 298.It Pa /proc/#/mem 299.It Pa /proc/#/note 300.It Pa /proc/#/notepg 301.It Pa /proc/#/regs 302.It Pa /proc/#/root 303.It Pa /proc/#/status 304.It Pa /proc/curproc 305.It Pa /proc/self 306.El 307.Pp 308If the 309.Cm linux 310mount option is used, the following files are also available: 311.Pp 312.Bl -tag -width /proc/meminfo -compact 313.It Pa /proc/#/stat 314.It Pa /proc/cpuinfo 315.It Pa /proc/devices 316.It Pa /proc/meminfo 317.It Pa /proc/mounts 318.It Pa /proc/uptime 319.El 320.Sh SEE ALSO 321.Xr mount 2 , 322.Xr sigaction 2 , 323.Xr unmount 2 324.Sh HISTORY 325The 326.Nm 327utility first appeared in 328.Bx 4.4 . 329.Sh BUGS 330This filesystem may not be NFS-exported 331since most of the functionality of 332.Dv procfs 333requires that state be maintained. 334