xref: /dragonfly/share/man/man5/procfs.5 (revision f2c43266)
1.\" $FreeBSD: src/share/man/man5/procfs.5,v 1.14.2.5 2001/08/17 13:08:47 ru Exp $
2.\" Written by Garrett Wollman
3.\" This file is in the public domain.
4.\"
5.Dd August 10, 1994
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 ,
21and is required for the complete operation of programs such as
22.Xr ps 1
23and
24.Xr w 1 .
25.Pp
26The
27.Nm
28provides a two-level view of process space, unlike the previous
29.Fx 1.1
30.Nm
31implementation.
32At the highest level, processes themselves are named, according to
33their process ids in decimal, with no leading zeros.  There is also a
34special node called
35.Pa curproc
36which always refers to the process making the lookup request.
37.Pp
38Each node is a directory which contains the following entries:
39.Pp
40Each directory contains several files:
41.Bl -tag -width status
42.It Pa ctl
43a write-only file which supports a variety
44of control operations.
45Control commands are written as strings to the
46.Pa ctl
47file.
48The control commands are:
49.Bl -tag -width detach -compact
50.It attach
51stops the target process and arranges for the sending
52process to become the debug control process.
53.It detach
54continue execution of the target process and
55remove it from control by the debug process (which
56need not be the sending process).
57.It run
58continue running the target process until
59a signal is delivered, a breakpoint is hit, or the
60target process exits.
61.It step
62single step the target process, with no signal delivery.
63.It wait
64wait for the target process to come to a steady
65state ready for debugging.
66The target process must be in this state before
67any of the other commands are allowed.
68.El
69.Pp
70The string can also be the name of a signal, lower case
71and without the
72.Dv SIG
73prefix,
74in which case that signal is delivered to the process
75(see
76.Xr sigaction 2 ) .
77.It Pa dbregs
78The debug registers as defined by
79.Dv "struct dbregs"
80in
81.In machine/reg.h .
82.It Pa etype
83The type of the executable referenced by the
84.Pa file
85entry.
86.It Pa file
87A reference to the vnode from which the process text was read.
88This can be used to gain access to the process' symbol table,
89or to start another copy of the process.
90.It Pa fpregs
91The floating point registers as defined by
92.Dv "struct fpregs"
93in
94.In machine/reg.h .
95.Pa fpregs
96is only implemented on machines which have distinct general
97purpose and floating point register sets.
98.It Pa map
99A map of the process' virtual memory.
100.It Pa mem
101The complete virtual memory image of the process.
102Only those address which exist in the process can be accessed.
103Reads and writes to this file modify the process.
104Writes to the text segment remain private to the process.
105.It Pa note
106Used for sending signals to the process.  Not implemented.
107.It Pa notepg
108Used for sending signal to the process group.  Not implemented.
109.It Pa regs
110Allows read and write access to the process' register set.
111This file contains a binary data structure
112.Dv "struct regs"
113defined in
114.In machine/reg.h .
115.Pa regs
116can only be written when the process is stopped.
117.It Pa rlimit
118This is a read-only file containing the process current and maximum
119limits.
120Each line is of the format
121.Ar rlimit current max ,
122with -1
123indicating infinity.
124.It Pa status
125The process status.
126This file is read-only and returns a single line containing
127multiple space-separated fields as follows:
128.Pp
129.Bl -bullet -compact
130.It
131command name
132.It
133process id
134.It
135parent process id
136.It
137process group id
138.It
139session id
140.It
141.Ar major , Ns Ar minor
142of the controlling terminal, or
143.Dv -1,-1
144if there is no controlling terminal.
145.It
146a list of process flags:
147.Dv ctty
148if there is a controlling terminal,
149.Dv sldr
150if the process is a session leader,
151.Dv noflags
152if neither of the other two flags are set.
153.It
154the process start time in seconds and microseconds,
155comma separated.
156.It
157the user time in seconds and microseconds,
158comma separated.
159.It
160the system time in seconds and microseconds,
161comma separated.
162.It
163the wait channel message
164.It
165the process credentials consisting of
166the effective user id
167and the list of groups (whose first member
168is the effective group id)
169all comma separated.
170.El
171.El
172.Pp
173In a normal debugging environment,
174where the target is fork/exec'd by the debugger,
175the debugger should fork and the child should stop
176itself (with a self-inflicted
177.Dv SIGSTOP
178for example).
179The parent should issue a
180.Dv wait
181and then an
182.Dv attach
183command via the appropriate
184.Pa ctl
185file.
186The child process will receive a
187.Dv SIGTRAP
188immediately after the call to exec (see
189.Xr execve 2 ) .
190.Pp
191Each node is owned by the process's user, and belongs to that user's
192primary group, except for the
193.Pa mem
194node, which belongs to the
195.Li kmem
196group.
197.Sh FILES
198.Bl -tag -width /proc/curproc/XXXXXXX -compact
199.It Pa /proc
200normal mount point for the
201.Nm .
202.It Pa /proc/pid
203directory containing process information for process
204.Pa pid .
205.It Pa /proc/curproc
206directory containing process information for the current process
207.It Pa /proc/curproc/cmdline
208the process executable name
209.It Pa /proc/curproc/ctl
210used to send control messages to the process
211.It Pa /proc/curproc/etype
212executable type
213.It Pa /proc/curproc/file
214executable image
215.It Pa /proc/curproc/fpregs
216the process floating point register set
217.It Pa /proc/curproc/map
218virtual memory map of the process
219.It Pa /proc/curproc/mem
220the complete virtual address space of the process
221.It Pa /proc/curproc/note
222used for signaling the process
223.It Pa /proc/curproc/notepg
224used for signaling the process group
225.It Pa /proc/curproc/regs
226the process register set
227.It Pa /proc/curproc/rlimit
228the process current and maximum rlimit
229.It Pa /proc/curproc/status
230the process' current status
231.El
232.Sh SEE ALSO
233.Xr mount 2 ,
234.Xr sigaction 2 ,
235.Xr unmount 2 ,
236.Xr mount_procfs 8
237.Sh AUTHORS
238.An -nosplit
239This manual page written by
240.An Garrett Wollman ,
241based on the description
242provided by
243.An Jan-Simon Pendry ,
244and revamped later by
245.An Mike Pritchard .
246