xref: /netbsd/sbin/mount_procfs/mount_procfs.8 (revision bf9ec67e)
1.\"	$NetBSD: mount_procfs.8,v 1.21 2002/02/08 01:30:45 ross 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. All advertising materials mentioning features or use of this software
19.\"    must display the following acknowledgement:
20.\"	This product includes software developed by the University of
21.\"	California, Berkeley and its contributors.
22.\" 4. Neither the name of the University nor the names of its contributors
23.\"    may be used to endorse or promote products derived from this software
24.\"    without specific prior written permission.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36.\" SUCH DAMAGE.
37.\"
38.\"	@(#)mount_procfs.8	8.3 (Berkeley) 6/1/94
39.\"
40.\"
41.Dd June 1, 1994
42.Dt MOUNT_PROCFS 8
43.Os
44.Sh NAME
45.Nm mount_procfs
46.Nd mount the process file system
47.Sh SYNOPSIS
48.Nm ""
49.Op Fl o Ar options
50.Pa /proc
51.Pa mount_point
52.Sh DESCRIPTION
53The
54.Nm
55command attaches an instance of the process
56namespace to the global filesystem namespace.
57The conventional mount point is
58.Pa /proc .
59This command is normally executed by
60.Xr mount 8
61at boot time.
62.Pp
63The options are as follows:
64.Bl -tag -width indent
65.It Fl o
66Options are specified with a
67.Fl o
68flag followed by a comma separated string of options.
69See the
70.Xr mount 8
71man page for possible generic options and their meanings. Currently, one
72procfs-specific option is defined, the
73.Cm linux
74option. This option enables a few extra features that are compatible
75with the proc filesystem as implemented in Linux. This option can
76be used if you run Linux binaries that need Linux-specific features
77in the proc filesystem (see also
78.Xr compat_linux 8 ) .
79.El
80.Pp
81The root of the process filesystem
82contains an entry for each active process.
83These processes are visible as a directory whose
84name is the process' pid.
85In addition, the special entry
86.Pa curproc
87references the current process.
88.Pp
89Each directory contains several files.
90.Bl -tag -width status
91.It Pa cmdline
92This file is readonly and returns null-terminated strings
93corresponding to the process' command line arguments.  For
94a system or zombie process, this file contains only a string
95with the name of the process.
96.It Pa ctl
97a writeonly file which supports a variety
98of control operations.
99Control commands are written as strings to the
100.Pa ctl
101file.
102The control commands are:
103.Bl -tag -width detach -compact
104.It attach
105stops the target process and arranges for the sending
106process to become the debug control process.
107.It detach
108continue execution of the target process and
109remove it from control by the debug process.
110.It run
111continue running the target process until
112a signal is delivered, a breakpoint is hit, or the
113target process exits.
114.It step
115single step the target process, with no signal delivery.
116.It wait
117wait for the target process to stop.
118The target process must be stopped before
119any of the run, step, or signal commands are allowed.
120.El
121.Pp
122The string can also be the name of a signal, lower case
123and without the
124.Dv SIG
125prefix,
126in which case that signal is delivered to the process
127(see
128.Xr sigaction 2 ) .
129.It Pa file
130A reference to the vnode from which the process text was read.
131This can be used to gain access to the process' symbol table,
132or to start another copy of the process.
133.It Pa map
134A map of the process' virtual memory.
135.It Pa mem
136The complete virtual memory image of the process.
137Only those addresses which exist in the process can be accessed.
138Writes to this file modify the process.
139Writes to the text segment normally remain private to the process,
140since the text segment is mapped with MAP_PRIVATE; however, this is
141not guaranteed.
142.It Pa note
143Not implemented.
144.It Pa notepg
145Not implemented.
146.It Pa regs
147Allows read and write access to the process' register set.
148This file contains a binary data structure
149.Dv "struct regs"
150defined in
151.Pa \*[Lt]machine/reg.h\*[Gt] .
152.Pa regs
153can only be written when the process is stopped.
154.It Pa fpregs
155The floating point registers as defined by
156.Dv "struct fpregs"
157in
158.Pa \*[Lt]machine/reg.h\*[Gt] .
159.Pa fpregs
160is only implemented on machines which have distinct general
161purpose and floating point register sets.
162.It Pa status
163The process status.
164This file is readonly and returns a single line containing
165multiple space-separated fields as follows:
166.Pp
167.Bl -bullet -compact
168.It
169command name
170.It
171process id
172.It
173parent process id
174.It
175process group id
176.It
177session id
178.It
179.Ar major,minor
180of the controlling terminal, or
181.Dv -1,-1
182if there is no controlling terminal.
183.It
184a list of process flags:
185.Dv ctty
186if there is a controlling terminal,
187.Dv sldr
188if the process is a session leader,
189.Dv noflags
190if neither of the other two flags are set.
191.It
192the process start time in seconds and microseconds,
193comma separated.
194.It
195the user time in seconds and microseconds,
196comma separated.
197.It
198the system time in seconds and microseconds,
199comma separated.
200.It
201the wait channel message
202.It
203the process credentials consisting of
204the effective user id
205and the list of groups (whose first member
206is the effective group id)
207all comma separated.
208.El
209.El
210.Pp
211In a normal debugging environment,
212where the target is fork/exec'd by the debugger,
213the debugger should fork and the child should stop
214itself (with a self-inflicted
215.Dv SIGSTOP
216for example).
217The parent should issue a
218.Dv wait
219and then an
220.Dv attach
221command via the appropriate
222.Pa ctl
223file.
224The child process will receive a
225.Dv SIGTRAP
226immediately after the call to exec (see
227.Xr execve 2 ) .
228.Sh FILES
229.Bl -tag -width /proc/curproc -compact
230.It Pa /proc/#
231.It Pa /proc/#/cmdline
232.It Pa /proc/#/ctl
233.It Pa /proc/#/file
234.It Pa /proc/#/map
235.It Pa /proc/#/mem
236.It Pa /proc/#/note
237.It Pa /proc/#/notepg
238.It Pa /proc/#/regs
239.It Pa /proc/#/fpregs
240.It Pa /proc/#/status
241.It Pa /proc/curproc
242.El
243.Pp
244If the
245.Cm linux
246mount option is used, the following files are also available:
247.Pp
248.Bl -tag -width /proc/meminfo -compact
249.It Pa /proc/#/exe
250.It Pa /proc/cpuinfo
251.It Pa /proc/meminfo
252.El
253.Sh SEE ALSO
254.Xr mount 2 ,
255.Xr sigaction 2 ,
256.Xr unmount 2
257.Sh HISTORY
258The
259.Nm
260utility first appeared in
261.Bx 4.4 .
262.Sh BUGS
263This filesystem may not be NFS-exported
264since most of the functionality of
265.Dv procfs
266requires that state be maintained.
267