xref: /freebsd/share/man/man4/procfs.4 (revision a0ca4af9455b844c5e094fc1b09b1390ffa979fc)
1.\" Written by Garrett Wollman
2.\" This file is in the public domain.
3.\"
4.Dd April 10, 2023
5.Dt PROCFS 4
6.Os
7.Sh NAME
8.Nm procfs
9.Nd process file system
10.Sh SYNOPSIS
11.Bd -literal
12proc		/proc	procfs	rw 0 0
13.Ed
14.Sh DESCRIPTION
15.Bf -symbolic
16This functionality is deprecated.
17Users are advised to use
18.Xr libprocstat 3
19and
20.Xr kvm 3
21instead.
22.Ef
23.Pp
24The process file system, or
25.Nm ,
26implements a view of the system process table inside the file system.
27It is normally mounted on
28.Pa /proc .
29.Pp
30The
31.Nm
32provides a two-level view of process space, unlike the previous
33.Fx 1.1
34.Nm
35implementation.
36At the highest level, processes themselves are named, according to
37their process ids in decimal, with no leading zeros.
38There is also a
39special node called
40.Pa curproc
41which always refers to the process making the lookup request.
42.Pp
43Each node is a directory which contains the following entries:
44.Bl -tag -width status
45.It Pa dbregs
46The debug registers as defined by
47.Dv "struct dbregs"
48in
49.In machine/reg.h .
50.Pa dbregs
51is currently only implemented on the i386 architecture.
52.It Pa etype
53The type of the executable referenced by the
54.Pa file
55entry.
56.It Pa file
57A symbolic link to the file from which the process text was read.
58This can be used to gain access to the process' symbol table,
59or to start another copy of the process.
60If the file cannot be found, the link target is
61.Ql unknown .
62.It Pa fpregs
63The floating point registers as defined by
64.Dv "struct fpregs"
65in
66.In machine/reg.h .
67.Pa fpregs
68is only implemented on machines which have distinct general
69purpose and floating point register sets.
70.It Pa map
71A collection of lines describing the memory regions of the process,
72where each line contains the following fields:
73.Bl -tag -compact -width private-resident
74.It start-address
75The starting address for the region (inclusive).
76.It end-address
77The ending address for the region (exclusive).
78.It resident
79The number of resident pages.
80.It private-resident
81The number of resident pages that were private to the process.
82.It obj
83The virtual address of the
84.Vt struct vm_object
85kernel data structure describing the memory region.
86.It access
87A three character string comprising the characters
88.Sq r ,
89.Sq w
90and
91.Sq x ,
92denoting read, write, and execute permissions respectively.
93The lack of a permission is represented by
94.Sq - .
95.It ref_count
96The number of references to the region.
97.It shadow_count
98The number of VM objects that this region is a shadow for.
99.It flags
100The flags for the object, see the flags named
101.Sy OBJ_*
102in
103.In vm/vm_object.h .
104.It copy-on-write
105Whether the region is copy-on-write.
106One of:
107.Bl -tag -compact -width NCOW
108.It COW
109A copy-on-write region.
110.It NCOW
111A non-copy-on-write region.
112.El
113.It needs-copy
114Whether the region needs a copy.
115One of:
116.Bl -tag -compact -width NNC
117.It NC
118The region needs a copy.
119.It NNC
120The region does not need a copy.
121.El
122.It type
123The type of the region.
124One of:
125.Bl -tag -compact -width unknown
126.It dead
127A region associated with a dead VM object.
128.It device
129A region backed by device memory.
130.It none
131A region not backed by anything.
132.It phys
133A region backed by physical memory.
134.It swap
135A region backed by swap.
136.It unknown
137A region of unknown type.
138.It vnode
139A region backed by a file.
140.El
141.It fullpath
142The path to the file backing the memory region, or
143.Sq -
144if there is no such file.
145.It cred
146One of:
147.Bl -tag -compact -width NCH
148.It CH
149The region is being charged to the user specified in the
150.Sq charged-uid
151field.
152.It NCH
153The region is not being charged to any user.
154.El
155.It charged-uid
156The UID of the user being charged, or -1 if no user is being charged.
157.El
158.It Pa mem
159The complete virtual memory image of the process.
160Only those address which exist in the process can be accessed.
161Reads and writes to this file modify the process.
162Writes to the text segment remain private to the process.
163.It Pa note
164Used for sending signals to the process.
165Not implemented.
166.It Pa notepg
167Used for sending signal to the process group.
168Not implemented.
169.It Pa osrel
170Allows read and write of the kernel osrel value assigned to the process.
171It affects the compatibility shims that are turned on and off
172depending on the value.
173Initial process value is read from the ABI note tag in the executed ELF image,
174and is zero if the tag not supported by binary format or was not found.
175.It Pa regs
176Allows read and write access to the process' register set.
177This file contains a binary data structure
178.Dv "struct regs"
179defined in
180.In machine/reg.h .
181.Pa regs
182can only be written when the process is stopped.
183.It Pa rlimit
184This is a read-only file containing the process current and maximum
185limits.
186Each line is of the format
187.Ar rlimit current max ,
188with -1
189indicating infinity.
190.It Pa status
191The process status.
192This file is read-only and returns a single line containing
193multiple space-separated fields as follows:
194.Pp
195.Bl -bullet -compact
196.It
197command name
198.It
199process id
200.It
201parent process id
202.It
203process group id
204.It
205session id
206.It
207device name
208of the controlling terminal, or
209a minus sign
210.Pq Dq -
211if there is no controlling terminal.
212.It
213a list of process flags:
214.Dv ctty
215if there is a controlling terminal,
216.Dv sldr
217if the process is a session leader,
218.Dv noflags
219if neither of the other two flags are set.
220.It
221the process start time in seconds and microseconds,
222comma separated.
223.It
224the user time in seconds and microseconds,
225comma separated.
226.It
227the system time in seconds and microseconds,
228comma separated.
229.It
230the wait channel message
231.It
232the process credentials consisting of
233the effective user id
234and the list of groups (whose first member
235is the effective group id)
236all comma separated.
237.It
238the hostname of the jail in which the process runs, or
239.Ql -
240to indicate that the process is not running within a jail.
241.El
242.El
243.Pp
244Each node is owned by the process's user, and belongs to that user's
245primary group.
246.Sh FILES
247.Bl -tag -width /proc/curproc/XXXXXXX -compact
248.It Pa /proc
249normal mount point for the
250.Nm .
251.It Pa /proc/pid
252directory containing process information for process
253.Pa pid .
254.It Pa /proc/curproc
255directory containing process information for the current process
256.It Pa /proc/self
257directory containing process information for the current process
258.It Pa /proc/curproc/cmdline
259the process executable name
260.It Pa /proc/curproc/etype
261executable type
262.It Pa /proc/curproc/exe
263executable image
264.It Pa /proc/curproc/file
265executable image
266.It Pa /proc/curproc/fpregs
267the process floating point register set
268.It Pa /proc/curproc/map
269virtual memory map of the process
270.It Pa /proc/curproc/mem
271the complete virtual address space of the process
272.It Pa /proc/curproc/note
273used for signaling the process
274.It Pa /proc/curproc/notepg
275used for signaling the process group
276.It Pa /proc/curproc/osrel
277the process osrel value
278.It Pa /proc/curproc/regs
279the process register set
280.It Pa /proc/curproc/rlimit
281the process current and maximum rlimit
282.It Pa /proc/curproc/status
283the process' current status
284.El
285.Sh EXAMPLES
286To mount a
287.Nm
288file system on
289.Pa /proc :
290.Pp
291.Dl "mount -t procfs proc /proc"
292.Sh SEE ALSO
293.Xr procstat 1 ,
294.Xr mount 2 ,
295.Xr sigaction 2 ,
296.Xr unmount 2 ,
297.Xr kvm 3 ,
298.Xr libprocstat 3 ,
299.Xr pseudofs 9
300.Sh AUTHORS
301.An -nosplit
302This manual page written by
303.An Garrett Wollman ,
304based on the description
305provided by
306.An Jan-Simon Pendry ,
307and revamped later by
308.An Mike Pritchard .
309