1.\" $NetBSD: mount_procfs.8,v 1.34 2009/02/24 12:45:37 pooka 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 February 24, 2009 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 ctl 94a writeonly file which supports a variety of control operations. 95Control commands are written as strings to the 96.Pa ctl 97file. 98The control commands are: 99.Bl -tag -width detach -compact 100.It attach 101stops the target process and arranges for the sending 102process to become the debug control process. 103.It detach 104continue execution of the target process and 105remove it from control by the debug process. 106.It run 107continue running the target process until 108a signal is delivered, a breakpoint is hit, or the 109target process exits. 110.It step 111single step the target process, with no signal delivery. 112.It wait 113wait for the target process to stop. 114The target process must be stopped before 115any of the run, step, or signal commands are allowed. 116.El 117.Pp 118The string can also be the name of a signal, lower case 119and without the 120.Dv SIG 121prefix, 122in which case that signal is delivered to the process 123(see 124.Xr sigaction 2 ) . 125.It Pa cwd 126A symbolic link that points to the current working directory of the 127process. 128If the target process's current working directory is not available or 129is not at or below the current process's root directory, this link 130will point to 131.Dq / . 132.It Pa fd/# 133File descriptors which can be accessed through the file system. 134See 135.Xr fd 4 136for more information. 137.It Pa file 138A reference to the vnode from which the process text was read. 139This can be used to gain access to the process' symbol table, 140or to start another copy of the process. 141.It Pa map 142A map of the process' virtual memory. 143.It Pa maps 144A map of the process' virtual memory in a form like the 145proc filesystem as implemented in Linux. 146Note that the paths corresponding to file backed mappings will 147not be present unless the kernel was built with the 148NAMECACHE_ENTER_REVERSE option. 149.It Pa mem 150The complete virtual memory image of the process. 151Only those addresses which exist in the process can be accessed. 152Writes to this file modify the process. 153Writes to the text segment normally remain private to the process, 154since the text segment is mapped with MAP_PRIVATE; however, this is 155not guaranteed. 156.It Pa note 157Not implemented. 158.It Pa notepg 159Not implemented. 160.It Pa regs 161Allows read and write access to the process' register set. 162This file contains a binary data structure 163.Dv "struct regs" 164defined in 165.Pa \*[Lt]machine/reg.h\*[Gt] . 166.Pa regs 167can only be written when the process is stopped. 168.It Pa fpregs 169The floating point registers as defined by 170.Dv "struct fpregs" 171in 172.Pa \*[Lt]machine/reg.h\*[Gt] . 173.Pa fpregs 174is only implemented on machines which have distinct general 175purpose and floating point register sets. 176.It Pa root 177A symbolic link that points to the root directory of the process. 178If the target process's root directory is not available or is not at 179or below the current process's root directory, this link will point to 180.Dq / . 181.It Pa status 182The process status. 183This file is readonly and returns a single line containing 184multiple space-separated fields as follows: 185.Pp 186.Bl -bullet -compact 187.It 188command name 189.It 190process id 191.It 192parent process id 193.It 194process group id 195.It 196session id 197.It 198.Ar major,minor 199of the controlling terminal, or 200.Dv -1,-1 201if there is no controlling terminal. 202.It 203a list of process flags: 204.Dv ctty 205if there is a controlling terminal, 206.Dv sldr 207if the process is a session leader, 208.Dv noflags 209if neither of the other two flags are set. 210.It 211the process start time in seconds and microseconds, 212comma separated. 213.It 214the user time in seconds and microseconds, 215comma separated. 216.It 217the system time in seconds and microseconds, 218comma separated. 219.It 220the wait channel message 221.It 222the process credentials consisting of 223the effective user id 224and the list of groups (whose first member 225is the effective group id) 226all comma separated. 227.El 228.El 229.Pp 230In a normal debugging environment, 231where the target is fork/exec'd by the debugger, 232the debugger should fork and the child should stop 233itself (with a self-inflicted 234.Dv SIGSTOP 235for example). 236The parent should issue a 237.Dv wait 238and then an 239.Dv attach 240command via the appropriate 241.Pa ctl 242file. 243The child process will receive a 244.Dv SIGTRAP 245immediately after the call to exec (see 246.Xr execve 2 ) . 247.Sh FILES 248.Bl -tag -width /proc/curproc -compact 249.It Pa /proc/# 250.It Pa /proc/#/cmdline 251.It Pa /proc/#/ctl 252.It Pa /proc/#/cwd 253.It Pa /proc/#/exe 254.It Pa /proc/#/file 255.It Pa /proc/#/fpregs 256.It Pa /proc/#/map 257.It Pa /proc/#/maps 258.It Pa /proc/#/mem 259.It Pa /proc/#/note 260.It Pa /proc/#/notepg 261.It Pa /proc/#/regs 262.It Pa /proc/#/root 263.It Pa /proc/#/status 264.It Pa /proc/curproc 265.It Pa /proc/self 266.El 267.Pp 268If the 269.Cm linux 270mount option is used, the following files are also available: 271.Pp 272.Bl -tag -width /proc/meminfo -compact 273.It Pa /proc/#/stat 274.It Pa /proc/cpuinfo 275.It Pa /proc/devices 276.It Pa /proc/meminfo 277.It Pa /proc/mounts 278.It Pa /proc/uptime 279.El 280.Sh SEE ALSO 281.Xr mount 2 , 282.Xr sigaction 2 , 283.Xr unmount 2 284.Sh HISTORY 285The 286.Nm 287utility first appeared in 288.Bx 4.4 . 289.Sh BUGS 290This filesystem may not be NFS-exported 291since most of the functionality of 292.Dv procfs 293requires that state be maintained. 294