xref: /freebsd/share/man/man5/procfs.5 (revision 42249ef2)
1.\" $FreeBSD$
2.\" Written by Garrett Wollman
3.\" This file is in the public domain.
4.\"
5.Dd March 4, 2017
6.Dt PROCFS 5
7.Os
8.Sh NAME
9.Nm procfs
10.Nd process file system
11.Sh SYNOPSIS
12.Bd -literal
13proc		/proc	procfs	rw 0 0
14.Ed
15.Sh DESCRIPTION
16The process file system, or
17.Nm ,
18implements a view of the system process table inside the file system.
19It is normally mounted on
20.Pa /proc .
21.Pp
22The
23.Nm
24provides a two-level view of process space, unlike the previous
25.Fx 1.1
26.Nm
27implementation.
28At the highest level, processes themselves are named, according to
29their process ids in decimal, with no leading zeros.
30There is also a
31special node called
32.Pa curproc
33which always refers to the process making the lookup request.
34.Pp
35Each node is a directory which contains the following entries:
36.Bl -tag -width status
37.It Pa dbregs
38The debug registers as defined by
39.Dv "struct dbregs"
40in
41.In machine/reg.h .
42.Pa dbregs
43is currently only implemented on the i386 architecture.
44.It Pa etype
45The type of the executable referenced by the
46.Pa file
47entry.
48.It Pa file
49A symbolic link to the file from which the process text was read.
50This can be used to gain access to the process' symbol table,
51or to start another copy of the process.
52If the file cannot be found, the link target is
53.Ql unknown .
54.It Pa fpregs
55The floating point registers as defined by
56.Dv "struct fpregs"
57in
58.In machine/reg.h .
59.Pa fpregs
60is only implemented on machines which have distinct general
61purpose and floating point register sets.
62.It Pa map
63A map of the process' virtual memory.
64.It Pa mem
65The complete virtual memory image of the process.
66Only those address which exist in the process can be accessed.
67Reads and writes to this file modify the process.
68Writes to the text segment remain private to the process.
69.It Pa note
70Used for sending signals to the process.
71Not implemented.
72.It Pa notepg
73Used for sending signal to the process group.
74Not implemented.
75.It Pa osrel
76Allows read and write of the kernel osrel value assigned to the process.
77It affects the compatibility shims that are turned on and off
78depending on the value.
79Initial process value is read from the ABI note tag in the executed ELF image,
80and is zero if the tag not supported by binary format or was not found.
81.It Pa regs
82Allows read and write access to the process' register set.
83This file contains a binary data structure
84.Dv "struct regs"
85defined in
86.In machine/reg.h .
87.Pa regs
88can only be written when the process is stopped.
89.It Pa rlimit
90This is a read-only file containing the process current and maximum
91limits.
92Each line is of the format
93.Ar rlimit current max ,
94with -1
95indicating infinity.
96.It Pa status
97The process status.
98This file is read-only and returns a single line containing
99multiple space-separated fields as follows:
100.Pp
101.Bl -bullet -compact
102.It
103command name
104.It
105process id
106.It
107parent process id
108.It
109process group id
110.It
111session id
112.It
113device name
114of the controlling terminal, or
115a minus sign
116.Pq Dq -
117if there is no controlling terminal.
118.It
119a list of process flags:
120.Dv ctty
121if there is a controlling terminal,
122.Dv sldr
123if the process is a session leader,
124.Dv noflags
125if neither of the other two flags are set.
126.It
127the process start time in seconds and microseconds,
128comma separated.
129.It
130the user time in seconds and microseconds,
131comma separated.
132.It
133the system time in seconds and microseconds,
134comma separated.
135.It
136the wait channel message
137.It
138the process credentials consisting of
139the effective user id
140and the list of groups (whose first member
141is the effective group id)
142all comma separated.
143.It
144the hostname of the jail in which the process runs, or
145.Ql -
146to indicate that the process is not running within a jail.
147.El
148.El
149.Pp
150Each node is owned by the process's user, and belongs to that user's
151primary group.
152.Sh FILES
153.Bl -tag -width /proc/curproc/XXXXXXX -compact
154.It Pa /proc
155normal mount point for the
156.Nm .
157.It Pa /proc/pid
158directory containing process information for process
159.Pa pid .
160.It Pa /proc/curproc
161directory containing process information for the current process
162.It Pa /proc/curproc/cmdline
163the process executable name
164.It Pa /proc/curproc/etype
165executable type
166.It Pa /proc/curproc/file
167executable image
168.It Pa /proc/curproc/fpregs
169the process floating point register set
170.It Pa /proc/curproc/map
171virtual memory map of the process
172.It Pa /proc/curproc/mem
173the complete virtual address space of the process
174.It Pa /proc/curproc/note
175used for signaling the process
176.It Pa /proc/curproc/notepg
177used for signaling the process group
178.It Pa /proc/curproc/osrel
179the process osrel value
180.It Pa /proc/curproc/regs
181the process register set
182.It Pa /proc/curproc/rlimit
183the process current and maximum rlimit
184.It Pa /proc/curproc/status
185the process' current status
186.El
187.Sh EXAMPLES
188To mount a
189.Nm
190file system on
191.Pa /proc :
192.Pp
193.Dl "mount -t procfs proc /proc"
194.Sh SEE ALSO
195.Xr procstat 1 ,
196.Xr mount 2 ,
197.Xr sigaction 2 ,
198.Xr unmount 2 ,
199.Xr pseudofs 9
200.Sh AUTHORS
201.An -nosplit
202This manual page written by
203.An Garrett Wollman ,
204based on the description
205provided by
206.An Jan-Simon Pendry ,
207and revamped later by
208.An Mike Pritchard .
209