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