1.\" 2.\" Copyright (c) 1992, 1993 3.\" The Regents of the University of California. All rights reserved. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software donated to Berkeley by 7.\" Jan-Simon Pendry. 8.\" 9.\" %sccs.include.redist.roff% 10.\" 11.\" @(#)mount_procfs.8 8.3 (Berkeley) 06/01/94 12.\" 13.\" 14.Dd 15.Dt MOUNT_PROCFS 8 16.Os BSD 4.4 17.Sh NAME 18.Nm mount_procfs 19.Nd mount the process file system 20.Sh SYNOPSIS 21.Nm mount_procfs 22.Op Fl o Ar options 23.Pa /proc 24.Pa mount_point 25.Sh DESCRIPTION 26The 27.Nm mount_procfs 28command attaches an instance of the process 29namespace to the global filesystem namespace. 30The conventional mount point is 31.Pa /proc . 32This command is normally executed by 33.Xr mount 8 34at boot time. 35.Pp 36The options are as follows: 37.Bl -tag -width indent 38.It Fl o 39Options are specified with a 40.Fl o 41flag followed by a comma separated string of options. 42See the 43.Xr mount 8 44man page for possible options and their meanings. 45.El 46.Pp 47The root of the process filesystem 48contains an entry for each active process. 49These processes are visible as a directory whose 50name is the process' pid. 51In addition, the special entry 52.Pa curproc 53references the current process. 54.Pp 55Each directory contains several files. 56.Bl -tag -width status 57.It Pa ctl 58a writeonly file which supports a variety 59of control operations. 60Control commands are written as strings to the 61.Pa ctl 62file. 63The control commands are: 64.Bl -tag -width detach -compact 65.It attach 66stops the target process and arranges for the sending 67process to become the debug control process. 68.It detach 69continue execution of the target process and 70remove it from control by the debug process (which 71need not be the sending process). 72.It run 73continue running the target process until 74a signal is delivered, a breakpoint is hit, or the 75target process exits. 76.It step 77single step the target process, with no signal delivery. 78.It wait 79wait for the target process to come to a steady 80state ready for debugging. 81The target process must be in this state before 82any of the other commands are allowed. 83.El 84.Pp 85The string can also be the name of a signal, lower case 86and without the 87.Dv SIG 88prefix, 89in which case that signal is delivered to the process 90(see 91.Xr sigaction 2 ). 92.It Pa file 93A reference to the vnode from which the process text was read. 94This can be used to gain access to the process' symbol table, 95or to start another copy of the process. 96.It Pa mem 97The complete virtual memory image of the process. 98Only those address which exist in the process can be accessed. 99Reads and writes to this file modify the process. 100Writes to the text segment remain private to the process. 101.It Pa note 102Not implemented. 103.It Pa notepg 104Not implemented. 105.It Pa regs 106Allows read and write access to the process' register set. 107This file contains a binary data structure 108.Dv "struct regs" 109defined in 110.Pa <machine/reg.h> . 111.Pa regs 112can only be written when the process is stopped. 113.ne 1i 114.It Pa fpregs 115The floating point registers as defined by 116.Dv "struct fpregs" 117in 118.Pa <machine/reg.h> . 119.Pa fpregs 120is only implemented on machines which have distinct general 121purpose and floating point register sets. 122.It Pa status 123The process status. 124This file is readonly and returns a single line containing 125multiple space-separated fields as follows: 126.Pp 127.Bl -bullet -compact 128.It 129command name 130.It 131process id 132.It 133parent process id 134.It 135process group id 136.It 137session id 138.It 139.Ar major,minor 140of the controlling terminal, or 141.Dv -1,-1 142if there is no controlling terminal. 143.It 144a list of process flags: 145.Dv ctty 146if there is a controlling terminal, 147.Dv sldr 148if the process is a session leader, 149.Dv noflags 150if neither of the other two flags are set. 151.It 152the process start time in seconds and microseconds, 153comma separated. 154.It 155the user time in seconds and microseconds, 156comma separated. 157.It 158the system time in seconds and microseconds, 159comma separated. 160.It 161the wait channel message 162.It 163the process credentials consisting of 164the effective user id 165and the list of groups (whose first member 166is the effective group id) 167all comma separated. 168.El 169.El 170.Pp 171In a normal debugging environment, 172where the target is fork/exec'd by the debugger, 173the debugger should fork and the child should stop 174itself (with a self-inflicted 175.Dv SIGSTOP 176for example). 177The parent should issue a 178.Dv wait 179and then an 180.Dv attach 181command via the appropriate 182.Pa ctl 183file. 184The child process will receive a 185.Dv SIGTRAP 186immediately after the call to exec (see 187.Xr execve 2 ). 188.Sh FILES 189.Bl -tag -width /proc/curproc -compact 190.It Pa /proc/# 191.It Pa /proc/curproc 192.It Pa /proc/curproc/ctl 193.It Pa /proc/curproc/file 194.It Pa /proc/curproc/mem 195.It Pa /proc/curproc/note 196.It Pa /proc/curproc/notepg 197.It Pa /proc/curproc/regs 198.It Pa /proc/curproc/fpregs 199.It Pa /proc/curproc/status 200.El 201.Sh SEE ALSO 202.Xr sigaction 2 , 203.Xr mount 2 , 204.Xr unmount 2 , 205.Sh CAVEATS 206No 207.Pa . 208and 209.Pa .. 210entries appear when listing the contents of the 211.Pa /proc 212directory. 213This makes sense in the context of this filesystem, but is inconsistent 214with usual filesystem conventions. 215However, it is still possible to refer to both 216.Pa . 217and 218.Pa .. 219in a pathname. 220.Pp 221This filesystem may not be NFS-exported 222since most of the functionality of 223.Dv procfs 224requires that state be maintained. 225.Sh HISTORY 226The 227.Nm mount_procfs 228utility first appeared in 4.4BSD. 229