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