xref: /netbsd-src/sbin/mount_procfs/mount_procfs.8 (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1.\"	$NetBSD: mount_procfs.8,v 1.38 2020/01/08 12:04:57 ad 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 January 8, 2020
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 cwd
94A symbolic link that points to the current working directory of the
95process.
96If the target process's current working directory is not available or
97is not at or below the current process's root directory, this link
98will point to
99.Dq / .
100.It Pa fd/#
101File descriptors which can be accessed through the file system.
102See
103.Xr fd 4
104for more information.
105.It Pa file
106A reference to the vnode from which the process text was read.
107This can be used to gain access to the process' symbol table,
108or to start another copy of the process.
109.It Pa map
110A map of the process' virtual memory.
111.It Pa maps
112A map of the process' virtual memory in a form like the
113proc filesystem as implemented in Linux.
114.It Pa mem
115The complete virtual memory image of the process.
116Only those addresses which exist in the process can be accessed.
117Writes to this file modify the process.
118Writes to the text segment normally remain private to the process,
119since the text segment is mapped with MAP_PRIVATE; however, this is
120not guaranteed.
121.It Pa note
122Not implemented.
123.It Pa notepg
124Not implemented.
125.It Pa regs
126Allows read and write access to the process' register set.
127This file contains a binary data structure
128.Dv "struct regs"
129defined in
130.Pa <machine/reg.h> .
131.Pa regs
132can only be written when the process is stopped.
133.It Pa fpregs
134The floating point registers as defined by
135.Dv "struct fpregs"
136in
137.Pa <machine/reg.h> .
138.Pa fpregs
139is only implemented on machines which have distinct general
140purpose and floating point register sets.
141.It Pa root
142A symbolic link that points to the root directory of the process.
143If the target process's root directory is not available or is not at
144or below the current process's root directory, this link will point to
145.Dq / .
146.It Pa status
147The process status.
148This file is readonly and returns a single line containing
149multiple space-separated fields as follows:
150.Pp
151.Bl -bullet -compact
152.It
153command name
154.It
155process id
156.It
157parent process id
158.It
159process group id
160.It
161session id
162.It
163.Ar major,minor
164of the controlling terminal, or
165.Dv -1,-1
166if there is no controlling terminal.
167.It
168a list of process flags:
169.Dv ctty
170if there is a controlling terminal,
171.Dv sldr
172if the process is a session leader,
173.Dv noflags
174if neither of the other two flags are set.
175.It
176the process start time in seconds and microseconds,
177comma separated.
178.It
179the user time in seconds and microseconds,
180comma separated.
181.It
182the system time in seconds and microseconds,
183comma separated.
184.It
185the wait channel message
186.It
187the process credentials consisting of
188the effective user id
189and the list of groups (whose first member
190is the effective group id)
191all comma separated.
192.El
193.El
194.Sh FILES
195.Bl -tag -width /proc/curproc -compact
196.It Pa /proc/#
197.It Pa /proc/#/cmdline
198.It Pa /proc/#/cwd
199.It Pa /proc/#/exe
200.It Pa /proc/#/file
201.It Pa /proc/#/fpregs
202.It Pa /proc/#/map
203.It Pa /proc/#/maps
204.It Pa /proc/#/mem
205.It Pa /proc/#/note
206.It Pa /proc/#/notepg
207.It Pa /proc/#/regs
208.It Pa /proc/#/root
209.It Pa /proc/#/status
210.It Pa /proc/curproc
211.It Pa /proc/self
212.El
213.Pp
214If the
215.Cm linux
216mount option is used, the following files are also available:
217.Pp
218.Bl -tag -width /proc/meminfo -compact
219.It Pa /proc/#/stat
220.It Pa /proc/cpuinfo
221.It Pa /proc/devices
222.It Pa /proc/meminfo
223.It Pa /proc/mounts
224.It Pa /proc/uptime
225.El
226.Sh SEE ALSO
227.Xr mount 2 ,
228.Xr sigaction 2 ,
229.Xr unmount 2
230.Sh HISTORY
231The
232.Nm
233utility first appeared in
234.Bx 4.4 .
235.Sh BUGS
236This filesystem may not be NFS-exported
237since most of the functionality of
238.Dv procfs
239requires that state be maintained.
240