1.\" $NetBSD: mount_procfs.8,v 1.37 2017/08/28 05:58:08 wiz 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 August 28, 2017 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. 111.It Pa maps 112A map of the process' virtual memory in a form like the 113proc filesystem as implemented in Linux. 114Note that the paths corresponding to file backed mappings will 115not be present unless the kernel was built with the 116NAMECACHE_ENTER_REVERSE option. 117.It Pa mem 118The complete virtual memory image of the process. 119Only those addresses which exist in the process can be accessed. 120Writes to this file modify the process. 121Writes to the text segment normally remain private to the process, 122since the text segment is mapped with MAP_PRIVATE; however, this is 123not guaranteed. 124.It Pa note 125Not implemented. 126.It Pa notepg 127Not implemented. 128.It Pa regs 129Allows read and write access to the process' register set. 130This file contains a binary data structure 131.Dv "struct regs" 132defined in 133.Pa <machine/reg.h> . 134.Pa regs 135can only be written when the process is stopped. 136.It Pa fpregs 137The floating point registers as defined by 138.Dv "struct fpregs" 139in 140.Pa <machine/reg.h> . 141.Pa fpregs 142is only implemented on machines which have distinct general 143purpose and floating point register sets. 144.It Pa root 145A symbolic link that points to the root directory of the process. 146If the target process's root directory is not available or is not at 147or below the current process's root directory, this link will point to 148.Dq / . 149.It Pa status 150The process status. 151This file is readonly and returns a single line containing 152multiple space-separated fields as follows: 153.Pp 154.Bl -bullet -compact 155.It 156command name 157.It 158process id 159.It 160parent process id 161.It 162process group id 163.It 164session id 165.It 166.Ar major,minor 167of the controlling terminal, or 168.Dv -1,-1 169if there is no controlling terminal. 170.It 171a list of process flags: 172.Dv ctty 173if there is a controlling terminal, 174.Dv sldr 175if the process is a session leader, 176.Dv noflags 177if neither of the other two flags are set. 178.It 179the process start time in seconds and microseconds, 180comma separated. 181.It 182the user time in seconds and microseconds, 183comma separated. 184.It 185the system time in seconds and microseconds, 186comma separated. 187.It 188the wait channel message 189.It 190the process credentials consisting of 191the effective user id 192and the list of groups (whose first member 193is the effective group id) 194all comma separated. 195.El 196.El 197.Sh FILES 198.Bl -tag -width /proc/curproc -compact 199.It Pa /proc/# 200.It Pa /proc/#/cmdline 201.It Pa /proc/#/cwd 202.It Pa /proc/#/exe 203.It Pa /proc/#/file 204.It Pa /proc/#/fpregs 205.It Pa /proc/#/map 206.It Pa /proc/#/maps 207.It Pa /proc/#/mem 208.It Pa /proc/#/note 209.It Pa /proc/#/notepg 210.It Pa /proc/#/regs 211.It Pa /proc/#/root 212.It Pa /proc/#/status 213.It Pa /proc/curproc 214.It Pa /proc/self 215.El 216.Pp 217If the 218.Cm linux 219mount option is used, the following files are also available: 220.Pp 221.Bl -tag -width /proc/meminfo -compact 222.It Pa /proc/#/stat 223.It Pa /proc/cpuinfo 224.It Pa /proc/devices 225.It Pa /proc/meminfo 226.It Pa /proc/mounts 227.It Pa /proc/uptime 228.El 229.Sh SEE ALSO 230.Xr mount 2 , 231.Xr sigaction 2 , 232.Xr unmount 2 233.Sh HISTORY 234The 235.Nm 236utility first appeared in 237.Bx 4.4 . 238.Sh BUGS 239This filesystem may not be NFS-exported 240since most of the functionality of 241.Dv procfs 242requires that state be maintained. 243