]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man5/proc.5
proc.5: tfix
[thirdparty/man-pages.git] / man5 / proc.5
CommitLineData
fea681da 1.\" Copyright (C) 1994, 1995 by Daniel Quinlan (quinlan@yggdrasil.com)
f352b560 2.\" and Copyright (C) 2002-2008,2017 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
3.\" with networking additions from Alan Cox (A.Cox@swansea.ac.uk)
4.\" and scsi additions from Michael Neuffer (neuffer@mail.uni-mainz.de)
5.\" and sysctl additions from Andries Brouwer (aeb@cwi.nl)
6.\" and System V IPC (as well as various other) additions from
c11b1abf 7.\" Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 8.\"
1dd72f9c 9.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
fea681da
MK
10.\" This is free documentation; you can redistribute it and/or
11.\" modify it under the terms of the GNU General Public License as
12.\" published by the Free Software Foundation; either version 2 of
13.\" the License, or (at your option) any later version.
14.\"
15.\" The GNU General Public License's references to "object code"
16.\" and "executables" are to be interpreted as the output of any
17.\" document formatting or typesetting system, including
18.\" intermediate and printed output.
19.\"
20.\" This manual is distributed in the hope that it will be useful,
21.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
22.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23.\" GNU General Public License for more details.
24.\"
25.\" You should have received a copy of the GNU General Public
c715f741
MK
26.\" License along with this manual; if not, see
27.\" <http://www.gnu.org/licenses/>.
6a8d8745 28.\" %%%LICENSE_END
fea681da
MK
29.\"
30.\" Modified 1995-05-17 by faith@cs.unc.edu
31.\" Minor changes by aeb and Marty Leisner (leisner@sdsp.mc.xerox.com).
32.\" Modified 1996-04-13, 1996-07-22 by aeb@cwi.nl
33.\" Modified 2001-12-16 by rwhron@earthlink.net
34.\" Modified 2002-07-13 by jbelton@shaw.ca
35.\" Modified 2002-07-22, 2003-05-27, 2004-04-06, 2004-05-25
c11b1abf 36.\" by Michael Kerrisk <mtk.manpages@gmail.com>
5d6d14a0
MK
37.\" 2004-11-17, mtk -- updated notes on /proc/loadavg
38.\" 2004-12-01, mtk, rtsig-max and rtsig-nr went away in 2.6.8
568105c6
MK
39.\" 2004-12-14, mtk, updated 'statm', and fixed error in order of list
40.\" 2005-05-12, mtk, updated 'stat'
6d64ca9c 41.\" 2005-07-13, mtk, added /proc/sys/fs/mqueue/*
363f747c
MK
42.\" 2005-09-16, mtk, Added /proc/sys/fs/suid_dumpable
43.\" 2005-09-19, mtk, added /proc/zoneinfo
b4e9ee8f 44.\" 2005-03-01, mtk, moved /proc/sys/fs/mqueue/* material to mq_overview.7.
69119dc7
MK
45.\" 2008-06-05, mtk, Added /proc/[pid]/oom_score, /proc/[pid]/oom_adj,
46.\" /proc/[pid]/limits, /proc/[pid]/mountinfo, /proc/[pid]/mountstats,
47.\" and /proc/[pid]/fdinfo/*.
48.\" 2008-06-19, mtk, Documented /proc/[pid]/status.
cc2d5c36 49.\" 2008-07-15, mtk, added /proc/config.gz
363f747c 50.\"
43d42cc0 51.\" FIXME cross check against Documentation/filesystems/proc.txt
c13182ef 52.\" to see what information could be imported from that file
c533af9d 53.\" into this file.
fea681da 54.\"
4b8c67d9 55.TH PROC 5 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da 56.SH NAME
9ee4a2b6 57proc \- process information pseudo-filesystem
fea681da
MK
58.SH DESCRIPTION
59The
31fa1fd2 60.B proc
ac8727b6 61filesystem is a pseudo-filesystem which provides an interface to
c13182ef
MK
62kernel data structures.
63It is commonly mounted at
fea681da 64.IR /proc .
b574c52d
MK
65Typically, it is mounted automatically by the system,
66but it can also be mounted manually using a command such as:
67.PP
68.in +4n
69.EX
70mount \-t proc proc /proc
71.EE
72.in
73.PP
7e174651 74Most of the files in the
31fa1fd2 75.B proc
7e174651 76filesystem are read-only,
64165e01 77but some files are writable, allowing kernel variables to be changed.
7e174651 78.\"
fee59977
MK
79.SS Mount options
80The
31fa1fd2 81.B proc
fee59977
MK
82filesystem supports the following mount options:
83.TP
84.BR hidepid "=\fIn\fP (since Linux 3.3)"
85.\" commit 0499680a42141d86417a8fbaa8c8db806bea1201
86This option controls who can access the information in
87.IR /proc/[pid]
88directories.
89The argument,
90.IR n ,
91is one of the following values:
92.RS
93.TP 4
940
95Everybody may access all
96.IR /proc/[pid]
97directories.
98This is the traditional behavior,
99and the default if this mount option is not specified.
100.TP
1011
102Users may not access files and subdirectories inside any
103.IR /proc/[pid]
104directories but their own (the
105.IR /proc/[pid]
106directories themselves remain visible).
107Sensitive files such as
97949440 108.IR /proc/[pid]/cmdline
fee59977 109and
97949440 110.IR /proc/[pid]/status
fee59977
MK
111are now protected against other users.
112This makes it impossible to learn whether any user is running a
113specific program
114(so long as the program doesn't otherwise reveal itself by its behavior).
115.\" As an additional bonus, since
97949440 116.\" .IR /proc/[pid]/cmdline
fee59977
MK
117.\" is unaccessible for other users,
118.\" poorly written programs passing sensitive information via
119.\" program arguments are now protected against local eavesdroppers.
120.TP
1212
122As for mode 1, but in addition the
123.IR /proc/[pid]
124directories belonging to other users become invisible.
125This means that
126.IR /proc/[pid]
127entries can no longer be used to discover the PIDs on the system.
128This doesn't hide the fact that a process with a specific PID value exists
9bc87ed0 129(it can be learned by other means, for example, by "kill \-0 $PID"),
fee59977
MK
130but it hides a process's UID and GID,
131which could otherwise be learned by employing
132.BR stat (2)
133on a
134.IR /proc/[pid]
135directory.
136This greatly complicates an attacker's task of gathering
137information about running processes (e.g., discovering whether
138some daemon is running with elevated privileges,
139whether another user is running some sensitive program,
140whether other users are running any program at all, and so on).
141.RE
142.TP
143.BR gid "=\fIgid\fP (since Linux 3.3)"
144.\" commit 0499680a42141d86417a8fbaa8c8db806bea1201
145Specifies the ID of a group whose members are authorized to
146learn process information otherwise prohibited by
147.BR hidepid
95b1c1d1 148(i.e., users in this group behave as though
fee59977
MK
149.I /proc
150was mounted with
95b1c1d1 151.IR hidepid=0 ).
fee59977
MK
152This group should be used instead of approaches such as putting
153nonroot users into the
154.BR sudoers (5)
155file.
3c7cfa32
MK
156.\"
157.SS Overview
158Underneath
159.IR /proc ,
160there are the following general groups of files and subdirectories:
161.TP
162.IR /proc/[pid] " subdirectories"
163Each one of these subdirectories contains files and subdirectories
164exposing information about the process with the corresponding process ID.
165.IP
166Underneath each of the
167.I /proc/[pid]
168directories, a
7fe3b32b 169.I task
3c7cfa32 170subdirectory contains subdirectories of the form
7fe3b32b 171.IR task/[tid] ,
3c7cfa32
MK
172which contain corresponding information about each of the threads
173in the process, where
174.I tid
175is the kernel thread ID of the thread.
01df7b70
MK
176.IP
177The
178.I /proc/[pid]
179subdirectories are visible when iterating through
180.I /proc
181with
182.BR getdents (2)
183(and thus are visible when one uses
184.BR ls (1)
185to view the contents of
186.IR /proc ).
187.TP
188.IR /proc/[tid] " subdirectories"
189Each one of these subdirectories contains files and subdirectories
190exposing information about the thread with the corresponding thread ID.
37cd58d2
MK
191The contents of these directories are the same as the corresponding
192.IR /proc/[pid]/task/[tid]
193directories.
01df7b70
MK
194.IP
195The
196.I /proc/[tid]
197subdirectories are
198.I not
199visible when iterating through
200.I /proc
201with
202.BR getdents (2)
203(and thus are
204.I not
205visible when one uses
206.BR ls (1)
3c7cfa32
MK
207to view the contents of
208.IR /proc ).
209.TP
210.I /proc/self
211When a process accesses this magic symbolic link,
212it resolves to the process's own
213.I /proc/[pid]
214directory.
215.TP
216.I /proc/thread-self
217When a thread accesses this magic symbolic link,
218it resolves to the process's own
7fe3b32b 219.I /proc/self/task/[tid]
3c7cfa32
MK
220directory.
221.TP
222.I /proc/[a-z]*
223Various other files and subdirectories under
224.I /proc
225expose system-wide information.
226.PP
227All of the above are described in more detail below.
228.\"
fee59977 229.SS Files and directories
01df7b70 230The following list provides details of many of the files and directories under the
743638fd
MK
231.I /proc
232hierarchy.
fea681da 233.TP
69119dc7 234.I /proc/[pid]
fea681da
MK
235There is a numerical subdirectory for each running process; the
236subdirectory is named by the process ID.
1e6a8e2f
MK
237Each
238.I /proc/[pid]
e96ad1fd
MK
239subdirectory contains the pseudo-files and directories described below.
240.IP
241The files inside each
242.I /proc/[pid]
243directory are normally owned by the effective user and
3bdb8ec5
MK
244effective group ID of the process.
245However, as a security measure, the ownership is made
246.IR root:root
247if the process's "dumpable" attribute is set to a value other than 1.
fb49322d 248.IP
ae636827
MK
249Before Linux 4.11,
250.\" commit 68eb94f16227336a5773b83ecfa8290f1d6b78ce
251.IR root:root
252meant the "global" root user ID and group ID
253(i.e., UID 0 and GID 0 in the initial user namespace).
254Since Linux 4.11,
255if the process is in a noninitial user namespace that has a
256valid mapping for user (group) ID 0 inside the namespace, then
257the user (group) ownership of the files under
258.I /proc/[pid]
259is instead made the same as the root user (group) ID of the namespace.
260This means that inside a container,
261things work as expected for the container "root" user.
262.IP
fb49322d 263The process's "dumpable" attribute may change for the following reasons:
3bdb8ec5
MK
264.RS
265.IP * 3
266The attribute was explicitly set via the
267.BR prctl (2)
268.B PR_SET_DUMPABLE
269operation.
270.IP *
271The attribute was reset to the value in the file
272.IR /proc/sys/fs/suid_dumpable
273(described below), for the reasons described in
274.BR prctl (2).
275.RE
276.IP
277Resetting the "dumpable" attribute to 1 reverts the ownership of the
278.IR /proc/[pid]/*
eada5570 279files to the process's effective UID and GID.
b7a42567
MK
280.TP
281.I /proc/[pid]/attr
282.\" https://lwn.net/Articles/28222/
283.\" From: Stephen Smalley <sds@epoch.ncsc.mil>
284.\" To: LKML and others
285.\" Subject: [RFC][PATCH] Process Attribute API for Security Modules
286.\" Date: 08 Apr 2003 16:17:52 -0400
287.\"
b3fb99e8
MK
288.\" http://www.nsa.gov/research/_files/selinux/papers/module/x362.shtml
289.\"
b7a42567
MK
290The files in this directory provide an API for security modules.
291The contents of this directory are files that can be read and written
292in order to set security-related attributes.
293This directory was added to support SELinux,
294but the intention was that the API be general enough to support
295other security modules.
296For the purpose of explanation,
297examples of how SELinux uses these files are provided below.
2dad4c59 298.IP
b7a42567
MK
299This directory is present only if the kernel was configured with
300.BR CONFIG_SECURITY .
301.TP
302.IR /proc/[pid]/attr/current " (since Linux 2.6.0)"
303The contents of this file represent the current
304security attributes of the process.
2dad4c59 305.IP
fd44bdc7
TY
306In SELinux, this file is used to get the security context of a process.
307Prior to Linux 2.6.11, this file could not be used to set the security
308context (a write was always denied), since SELinux limited process security
309transitions to
b7a42567
MK
310.BR execve (2)
311(see the description of
312.IR /proc/[pid]/attr/exec ,
313below).
fd44bdc7
TY
314Since Linux 2.6.11, SELinux lifted this restriction and began supporting
315"set" operations via writes to this node if authorized by policy,
316although use of this operation is only suitable for applications that are
317trusted to maintain any desired separation between the old and new security
b6620a25
MK
318contexts.
319Prior to Linux 2.6.28, SELinux did not allow threads within a
fd44bdc7
TY
320multi-threaded process to set their security context via this node
321as it would yield an inconsistency among the security contexts of the
b6620a25
MK
322threads sharing the same memory space.
323Since Linux 2.6.28, SELinux lifted
fd44bdc7 324this restriction and began supporting "set" operations for threads within
b6620a25 325a multithreaded process if the new security context is bounded by the old
fd44bdc7
TY
326security context, where the bounded relation is defined in policy and
327guarantees that the new security context has a subset of the permissions
328of the old security context.
b7a42567
MK
329Other security modules may choose to support "set" operations via
330writes to this node.
331.TP
332.IR /proc/[pid]/attr/exec " (since Linux 2.6.0)"
333This file represents the attributes to assign to the
334process upon a subsequent
335.BR execve (2).
2dad4c59 336.IP
b7a42567
MK
337In SELinux,
338this is needed to support role/domain transitions, and
339.BR execve (2)
340is the preferred point to make such transitions because it offers better
341control over the initialization of the process in the new security label
342and the inheritance of state.
343In SELinux, this attribute is reset on
344.BR execve (2)
345so that the new program reverts to the default behavior for any
346.BR execve (2)
347calls that it may make.
348In SELinux, a process can set
349only its own
350.I /proc/[pid]/attr/exec
351attribute.
352.TP
353.IR /proc/[pid]/attr/fscreate " (since Linux 2.6.0)"
354This file represents the attributes to assign to files
355created by subsequent calls to
356.BR open (2),
357.BR mkdir (2),
358.BR symlink (2),
359and
360.BR mknod (2)
2dad4c59 361.IP
b7a42567
MK
362SELinux employs this file to support creation of a file
363(using the aforementioned system calls)
364in a secure state,
365so that there is no risk of inappropriate access being obtained
366between the time of creation and the time that attributes are set.
367In SELinux, this attribute is reset on
368.BR execve (2),
369so that the new program reverts to the default behavior for
370any file creation calls it may make, but the attribute will persist
371across multiple file creation calls within a program unless it is
372explicitly reset.
373In SELinux, a process can set only its own
374.IR /proc/[pid]/attr/fscreate
375attribute.
376.TP
666db07e
MK
377.IR /proc/[pid]/attr/keycreate " (since Linux 2.6.18)"
378.\" commit 4eb582cf1fbd7b9e5f466e3718a59c957e75254e
666db07e
MK
379If a process writes a security context into this file,
380all subsequently created keys
381.RB ( add_key (2))
382will be labeled with this context.
383For further information, see the kernel source file
6b3ead8f
ES
384.I Documentation/security/keys/core.rst
385(or file
386.\" commit b68101a1e8f0263dbc7b8375d2a7c57c6216fb76
387.I Documentation/security/keys.txt
388on Linux between 3.0 and 4.13, or
389.\" commit d410fa4ef99112386de5f218dd7df7b4fca910b4
390.I Documentation/keys.txt
391before Linux 3.0).
2702dc21 392.TP
93401860
MK
393.IR /proc/[pid]/attr/prev " (since Linux 2.6.0)"
394This file contains the security context of the process before the last
395.BR execve (2);
396that is, the previous value of
397.IR /proc/[pid]/attr/current .
398.TP
2702dc21
MK
399.IR /proc/[pid]/attr/socketcreate " (since Linux 2.6.18)"
400.\" commit 42c3e03ef6b298813557cdb997bd6db619cd65a2
401If a process writes a security context into this file,
402all subsequently created sockets will be labeled with this context.
39b35179
MK
403.TP
404.IR /proc/[pid]/autogroup " (since Linux 2.6.38)"
405.\" commit 5091faa449ee0b7d73bc296a93bca9540fc51d0a
406See
407.BR sched (7).
fea681da 408.TP
69119dc7 409.IR /proc/[pid]/auxv " (since 2.6.0-test7)"
857f1942 410This contains the contents of the ELF interpreter information passed
c13182ef 411to the process at exec time.
857f1942 412The format is one \fIunsigned long\fP ID
c13182ef 413plus one \fIunsigned long\fP value for each entry.
857f1942 414The last entry contains two zeros.
4c69c692
MK
415See also
416.BR getauxval (3).
2dad4c59 417.IP
82664739
MK
418Permission to access this file is governed by a ptrace access mode
419.B PTRACE_MODE_READ_FSCREDS
420check; see
421.BR ptrace (2).
b5d204d0 422.TP
8d708d6b 423.IR /proc/[pid]/cgroup " (since Linux 2.6.24)"
5c2181ad
MK
424See
425.BR cgroups (7).
76e0451c
MK
426.TP
427.IR /proc/[pid]/clear_refs " (since Linux 2.6.22)"
428.\" commit b813e931b4c8235bb42e301096ea97dbdee3e8fe (2.6.22)
429.\" commit 398499d5f3613c47f2143b8c54a04efb5d7a6da9 (2.6.32)
430.\" commit 040fa02077de01c7e08fa75be6125e4ca5636011 (3.11)
b4e9ee8f 431.\"
b4e9ee8f 432.\" "Clears page referenced bits shown in smaps output"
76e0451c 433.\" write-only, writable only by the owner of the process
2dad4c59 434.IP
76e0451c 435This is a write-only file, writable only by owner of the process.
2dad4c59 436.IP
76e0451c
MK
437The following values may be written to the file:
438.RS
439.TP
4401 (since Linux 2.6.22)
441.\" Internally: CLEAR_REFS_ALL
442Reset the PG_Referenced and ACCESSED/YOUNG
443bits for all the pages associated with the process.
444(Before kernel 2.6.32, writing any nonzero value to this file
445had this effect.)
446.TP
4472 (since Linux 2.6.32)
448.\" Internally: CLEAR_REFS_ANON
449Reset the PG_Referenced and ACCESSED/YOUNG
450bits for all anonymous pages associated with the process.
451.TP
4523 (since Linux 2.6.32)
453.\" Internally: CLEAR_REFS_MAPPED
454Reset the PG_Referenced and ACCESSED/YOUNG
455bits for all file-mapped pages associated with the process.
456.RE
457.IP
458Clearing the PG_Referenced and ACCESSED/YOUNG bits provides a method
459to measure approximately how much memory a process is using.
322d49fb 460One first inspects the values in the "Referenced" fields
76e0451c
MK
461for the VMAs shown in
462.IR /proc/[pid]/smaps
463to get an idea of the memory footprint of the
464process.
465One then clears the PG_Referenced and ACCESSED/YOUNG bits
466and, after some measured time interval,
322d49fb 467once again inspects the values in the "Referenced" fields
76e0451c
MK
468to get an idea of the change in memory footprint of the
469process during the measured interval.
470If one is interested only in inspecting the selected mapping types,
471then the value 2 or 3 can be used instead of 1.
2dad4c59 472.IP
dfdf642e 473Further values can be written to affect different properties:
76e0451c
MK
474.RS
475.TP
4764 (since Linux 3.11)
477Clear the soft-dirty bit for all the pages associated with the process.
478.\" Internally: CLEAR_REFS_SOFT_DIRTY
479This is used (in conjunction with
480.IR /proc/[pid]/pagemap )
481by the check-point restore system to discover which pages of a process
482have been dirtied since the file
483.IR /proc/[pid]/clear_refs
484was written to.
dfdf642e
NK
485.TP
4865 (since Linux 4.0)
487.\" Internally: CLEAR_REFS_MM_HIWATER_RSS
0989246e
MK
488Reset the peak resident set size ("high water mark") to the process's
489current resident set size value.
76e0451c
MK
490.RE
491.IP
492Writing any value to
493.IR /proc/[pid]/clear_refs
494other than those listed above has no effect.
2dad4c59 495.IP
76e0451c
MK
496The
497.IR /proc/[pid]/clear_refs
498file is present only if the
499.B CONFIG_PROC_PAGE_MONITOR
500kernel configuration option is enabled.
857f1942 501.TP
69119dc7 502.I /proc/[pid]/cmdline
6975c16e 503This read-only file holds the complete command line for the process,
b447cd58
MK
504unless the process is a zombie.
505.\" In 2.3.26, this also used to be true if the process was swapped out.
506In the latter case, there is nothing in this file:
75b94dc3 507that is, a read on this file will return 0 characters.
b447cd58 508The command-line arguments appear in this file as a set of
6596d270
MK
509strings separated by null bytes (\(aq\\0\(aq),
510with a further null byte after the last string.
32d7ef00
MK
511.TP
512.IR /proc/[pid]/comm " (since Linux 2.6.33)"
513.\" commit 4614a696bd1c3a9af3a08f0e5874830a85b889d4
514This file exposes the process's
515.I comm
516value\(emthat is, the command name associated with the process.
517Different threads in the same process may have different
518.I comm
519values, accessible via
520.IR /proc/[pid]/task/[tid]/comm .
521A thread may modify its
522.I comm
523value, or that of any of other thread in the same thread group (see
524the discussion of
525.B CLONE_THREAD
526in
527.BR clone (2)),
528by writing to the file
529.IR /proc/self/task/[tid]/comm .
530Strings longer than
531.B TASK_COMM_LEN
532(16) characters are silently truncated.
2dad4c59 533.IP
ef4f4031 534This file provides a superset of the
32d7ef00
MK
535.BR prctl (2)
536.B PR_SET_NAME
537and
538.B PR_GET_NAME
539operations, and is employed by
540.BR pthread_setname_np (3)
541when used to rename threads other than the caller.
fea681da 542.TP
7e07d950 543.IR /proc/[pid]/coredump_filter " (since Linux 2.6.23)"
b4e9ee8f
MK
544See
545.BR core (5).
5c411b17 546.TP
7e07d950
MK
547.IR /proc/[pid]/cpuset " (since Linux 2.6.12)"
548.\" and/proc/[pid]/task/[tid]/cpuset
5c411b17
MK
549See
550.BR cpuset (7).
b4e9ee8f 551.TP
69119dc7 552.I /proc/[pid]/cwd
c13182ef 553This is a symbolic link to the current working directory of the process.
59a40ed7
MK
554To find out the current working directory of process 20,
555for instance, you can do this:
2dad4c59 556.IP
59a40ed7 557.in +4n
37d5e699 558.EX
b43a3b30 559.RB "$" " cd /proc/20/cwd; /bin/pwd"
37d5e699 560.EE
59a40ed7 561.in
2dad4c59 562.IP
c13182ef
MK
563Note that the
564.I pwd
e7b489f0 565command is often a shell built-in, and might
c13182ef 566not work properly.
743638fd
MK
567In
568.BR bash (1),
569you may use
570.IR "pwd\ \-P" .
2dad4c59 571.IP
afcaf646 572.\" The following was still true as at kernel 2.6.13
c13182ef
MK
573In a multithreaded process, the contents of this symbolic link
574are not available if the main thread has already terminated
afcaf646 575(typically by calling
59a40ed7 576.BR pthread_exit (3)).
2dad4c59 577.IP
b902fe18
MK
578Permission to dereference or read
579.RB ( readlink (2))
580this symbolic link is governed by a ptrace access mode
581.B PTRACE_MODE_READ_FSCREDS
582check; see
583.BR ptrace (2).
fea681da 584.TP
69119dc7 585.I /proc/[pid]/environ
09651080
MK
586This file contains the initial environment that was set
587when the currently executing program was started via
588.BR execve (2).
f81fb444 589The entries are separated by null bytes (\(aq\\0\(aq),
b4e9ee8f 590and there may be a null byte at the end.
fea681da 591Thus, to print out the environment of process 1, you would do:
37d5e699 592.IP
a08ea57c 593.in +4n
37d5e699 594.EX
d1081b23 595.RB "$" " cat /proc/1/environ | tr \(aq\e000\(aq \(aq\en\(aq"
37d5e699 596.EE
a08ea57c 597.in
2dad4c59 598.IP
09651080
MK
599If, after an
600.BR execve (2),
601the process modifies its environment
c187d2a1 602(e.g., by calling functions such as
387e2438
MF
603.BR putenv (3)
604or modifying the
605.BR environ (7)
606variable directly),
09651080
MK
607this file will
608.I not
609reflect those changes.
2dad4c59 610.IP
c187d2a1 611Furthermore, a process may change the memory location that this file refers via
387e2438 612.BR prctl (2)
c187d2a1 613operations such as
387e2438 614.BR PR_SET_MM_ENV_START .
2dad4c59 615.IP
82664739
MK
616Permission to access this file is governed by a ptrace access mode
617.B PTRACE_MODE_READ_FSCREDS
618check; see
619.BR ptrace (2).
fea681da 620.TP
69119dc7 621.I /proc/[pid]/exe
fea681da 622Under Linux 2.2 and later, this file is a symbolic link
2d7195b8 623containing the actual pathname of the executed command.
c13182ef
MK
624This symbolic link can be dereferenced normally; attempting to open
625it will open the executable.
626You can even type
69119dc7 627.I /proc/[pid]/exe
06dd061c 628to run another copy of the same executable that is being run by
69119dc7 629process [pid].
7e3c767a
GJ
630If the pathname has been unlinked, the symbolic link will contain the
631string \(aq(deleted)\(aq appended to the original pathname.
afcaf646 632.\" The following was still true as at kernel 2.6.13
c13182ef
MK
633In a multithreaded process, the contents of this symbolic link
634are not available if the main thread has already terminated
afcaf646
MK
635(typically by calling
636.BR pthread_exit (3)).
2dad4c59 637.IP
b902fe18
MK
638Permission to dereference or read
639.RB ( readlink (2))
640this symbolic link is governed by a ptrace access mode
641.B PTRACE_MODE_READ_FSCREDS
642check; see
643.BR ptrace (2).
2dad4c59 644.IP
eb9a0b2f 645Under Linux 2.0 and earlier,
69119dc7 646.I /proc/[pid]/exe
c13182ef
MK
647is a pointer to the binary which was executed,
648and appears as a symbolic link.
649A
fea681da
MK
650.BR readlink (2)
651call on this file under Linux 2.0 returns a string in the format:
2dad4c59 652.IP
59a40ed7 653 [device]:inode
2dad4c59 654.IP
fea681da
MK
655For example, [0301]:1502 would be inode 1502 on device major 03 (IDE,
656MFM, etc. drives) minor 01 (first partition on the first drive).
2dad4c59 657.IP
fea681da 658.BR find (1)
59a40ed7
MK
659with the
660.I \-inum
661option can be used to locate the file.
fea681da 662.TP
d4529654 663.I /proc/[pid]/fd/
fea681da
MK
664This is a subdirectory containing one entry for each file which the
665process has open, named by its file descriptor, and which is a
c13182ef 666symbolic link to the actual file.
f78ed33a 667Thus, 0 is standard input, 1 standard output, 2 standard error, and so on.
2dad4c59 668.IP
f75715e0
MK
669For file descriptors for pipes and sockets,
670the entries will be symbolic links whose content is the
671file type with the inode.
d4529654
MF
672A
673.BR readlink (2)
674call on this file returns a string in the format:
2dad4c59 675.IP
d4529654 676 type:[inode]
2dad4c59 677.IP
f75715e0
MK
678For example,
679.I socket:[2248868]
680will be a socket and its inode is 2248868.
681For sockets, that inode can be used to find more information
682in one of the files under
d4529654 683.IR /proc/net/ .
2dad4c59 684.IP
2b7a2ac5
MK
685For file descriptors that have no corresponding inode
686(e.g., file descriptors produced by
89e284a2 687.BR bpf (2),
2b7a2ac5
MK
688.BR epoll_create (2),
689.BR eventfd (2),
690.BR inotify_init (2),
89e284a2 691.BR perf_event_open (2),
2b7a2ac5 692.BR signalfd (2),
89e284a2 693.BR timerfd_create (2),
2b7a2ac5 694and
e8675558 695.BR userfaultfd (2)),
2b7a2ac5 696the entry will be a symbolic link with contents of the form
2dad4c59 697.IP
2b7a2ac5 698 anon_inode:<file-type>
2dad4c59 699.IP
e2a5929d 700In many cases (but not all), the
2b7a2ac5
MK
701.I file-type
702is surrounded by square brackets.
2dad4c59 703.IP
2b7a2ac5
MK
704For example, an epoll file descriptor will have a symbolic link
705whose content is the string
706.IR "anon_inode:[eventpoll]" .
2dad4c59 707.IP
d4529654 708.\"The following was still true as at kernel 2.6.13
afcaf646 709In a multithreaded process, the contents of this directory
c13182ef 710are not available if the main thread has already terminated
afcaf646
MK
711(typically by calling
712.BR pthread_exit (3)).
2dad4c59 713.IP
20c1a631
MK
714Programs that take a filename as a command-line argument,
715but don't take input from standard input if no argument is supplied,
716and programs that write to a file named as a command-line argument,
717but don't send their output to standard output
59a40ed7 718if no argument is supplied, can nevertheless be made to use
20c1a631
MK
719standard input or standard output by using
720.IR /proc/[pid]/fd
721files as command-line arguments.
59a40ed7
MK
722For example, assuming that
723.I \-i
724is the flag designating an input file and
725.I \-o
726is the flag designating an output file:
37d5e699 727.IP
a08ea57c 728.in +4n
37d5e699 729.EX
b43a3b30 730.RB "$" " foobar \-i /proc/self/fd/0 \-o /proc/self/fd/1 ..."
37d5e699 731.EE
a08ea57c 732.in
2dad4c59 733.IP
fea681da
MK
734and you have a working filter.
735.\" The following is not true in my tests (MTK):
736.\" Note that this will not work for
737.\" programs that seek on their files, as the files in the fd directory
738.\" are not seekable.
2dad4c59 739.IP
59a40ed7
MK
740.I /proc/self/fd/N
741is approximately the same as
742.I /dev/fd/N
008f1ecc 743in some UNIX and UNIX-like systems.
c13182ef 744Most Linux MAKEDEV scripts symbolically link
59a40ed7
MK
745.I /dev/fd
746to
747.IR /proc/self/fd ,
748in fact.
2dad4c59 749.IP
59a40ed7
MK
750Most systems provide symbolic links
751.IR /dev/stdin ,
752.IR /dev/stdout ,
753and
754.IR /dev/stderr ,
755which respectively link to the files
756.IR 0 ,
757.IR 1 ,
758and
759.IR 2
760in
761.IR /proc/self/fd .
762Thus the example command above could be written as:
d6bd89f3 763.IP
59a40ed7 764.in +4n
37d5e699 765.EX
b43a3b30 766.RB "$" " foobar \-i /dev/stdin \-o /dev/stdout ..."
37d5e699 767.EE
59a40ed7 768.in
138a191e
MK
769.IP
770Permission to dereference or read
771.RB ( readlink (2))
772the symbolic links in this directory is governed by a ptrace access mode
773.B PTRACE_MODE_READ_FSCREDS
774check; see
775.BR ptrace (2).
81c8aeb6
LW
776.IP
777Note that for file descriptors referring to inodes (pipes and sockets, see above),
778those inodes still have permission bits and ownership information
779distinct from those of the
780.I /proc/[pid]/fd
781entry,
782and that the owner may differ from the user and group IDs of the process.
783An unprivileged process may lack permissions to open them, as in this example:
784.IP
785.in +4n
786.EX
787.RB "$" " echo test | sudo -u nobody cat"
788test
789.RB "$" " echo test | sudo -u nobody cat /proc/self/fd/0"
790cat: /proc/self/fd/0: Permission denied
791.EE
792.in
793.IP
794File descriptor 0 refers to the pipe created by the shell
795and owned by that shell's user, which is not
796.IR nobody ,
797so
798.B cat
799does not have permission to create a new file descriptor to read from that inode,
800even though it can still read from its existing file descriptor 0.
69ab425e 801.TP
7e07d950 802.IR /proc/[pid]/fdinfo/ " (since Linux 2.6.22)"
69ab425e
MK
803This is a subdirectory containing one entry for each file which the
804process has open, named by its file descriptor.
0275956d 805The files in this directory are readable only by the owner of the process.
69ab425e 806The contents of each file can be read to obtain information
0275956d
MK
807about the corresponding file descriptor.
808The content depends on the type of file referred to by the
d9cb0d7d 809corresponding file descriptor.
2dad4c59 810.IP
0275956d 811For regular files and directories, we see something like:
37d5e699 812.IP
69ab425e 813.in +4n
37d5e699 814.EX
69ab425e
MK
815.RB "$" " cat /proc/12015/fdinfo/4"
816pos: 1000
817flags: 01002002
0275956d 818mnt_id: 21
37d5e699 819.EE
69ab425e 820.in
2dad4c59 821.IP
9599cbb3
MK
822The fields are as follows:
823.RS
824.TP
69ab425e 825.I pos
9599cbb3
MK
826This is a decimal number showing the file offset.
827.TP
69ab425e 828.I flags
9599cbb3 829This is an octal number that displays the
69ab425e
MK
830file access mode and file status flags (see
831.BR open (2)).
d7e537ce
MK
832If the close-on-exec file descriptor flag is set, then
833.I flags
834will also include the value
835.BR O_CLOEXEC .
2dad4c59 836.IP
d7e537ce
MK
837Before Linux 3.1,
838.\" commit 1117f72ea0217ba0cc19f05adbbd8b9a397f5ab7
839this field incorrectly displayed the setting of
840.B O_CLOEXEC
841at the time the file was opened,
842rather than the current setting of the close-on-exec flag.
9599cbb3
MK
843.TP
844.I
0275956d 845.I mnt_id
9599cbb3 846This field, present since Linux 3.15,
0275956d
MK
847.\" commit 49d063cb353265c3af701bab215ac438ca7df36d
848is the ID of the mount point containing this file.
849See the description of
850.IR /proc/[pid]/mountinfo .
9599cbb3
MK
851.RE
852.IP
6e7622ee
MK
853For eventfd file descriptors (see
854.BR eventfd (2)),
b6a7fd50
MK
855we see (since Linux 3.8)
856.\" commit cbac5542d48127b546a23d816380a7926eee1c25
857the following fields:
2dad4c59 858.IP
6e7622ee 859.in +4n
37d5e699 860.EX
6e7622ee
MK
861pos: 0
862flags: 02
863mnt_id: 10
864eventfd-count: 40
37d5e699 865.EE
6e7622ee 866.in
2dad4c59 867.IP
6e7622ee
MK
868.I eventfd-count
869is the current value of the eventfd counter, in hexadecimal.
2dad4c59 870.IP
58d375dd
MK
871For epoll file descriptors (see
872.BR epoll (7)),
b6a7fd50
MK
873we see (since Linux 3.8)
874.\" commit 138d22b58696c506799f8de759804083ff9effae
875the following fields:
2dad4c59 876.IP
58d375dd 877.in +4n
37d5e699 878.EX
58d375dd
MK
879pos: 0
880flags: 02
881mnt_id: 10
882tfd: 9 events: 19 data: 74253d2500000009
883tfd: 7 events: 19 data: 74253d2500000007
37d5e699 884.EE
58d375dd 885.in
2dad4c59 886.IP
58d375dd
MK
887Each of the lines beginning
888.I tfd
889describes one of the file descriptors being monitored via
890the epoll file descriptor (see
891.BR epoll_ctl (2)
892for some details).
893The
894.IR tfd
895field is the number of the file descriptor.
896The
897.I events
898field is a hexadecimal mask of the events being monitored for this file
899descriptor.
900The
901.I data
902field is the data value associated with this file descriptor.
2dad4c59 903.IP
f8a14cac
MK
904For signalfd file descriptors (see
905.BR signalfd (2)),
b6a7fd50
MK
906we see (since Linux 3.8)
907.\" commit 138d22b58696c506799f8de759804083ff9effae
908the following fields:
2dad4c59 909.IP
f8a14cac 910.in +4n
37d5e699 911.EX
f8a14cac
MK
912pos: 0
913flags: 02
914mnt_id: 10
915sigmask: 0000000000000006
37d5e699 916.EE
f8a14cac 917.in
2dad4c59 918.IP
f8a14cac
MK
919.I sigmask
920is the hexadecimal mask of signals that are accepted via this
921signalfd file descriptor.
922(In this example, bits 2 and 3 are set, corresponding to the signals
923.B SIGINT
924and
925.BR SIGQUIT ;
926see
927.BR signal (7).)
2dad4c59 928.IP
4e77145c
MK
929For inotify file descriptors (see
930.BR inotify (7)),
931we see (since Linux 3.8)
932the following fields:
2dad4c59 933.IP
4e77145c 934.in +4n
37d5e699 935.EX
4e77145c
MK
936pos: 0
937flags: 00
938mnt_id: 11
939inotify wd:2 ino:7ef82a sdev:800001 mask:800afff ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:2af87e00220ffd73
940inotify wd:1 ino:192627 sdev:800001 mask:800afff ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:27261900802dfd73
37d5e699 941.EE
4e77145c 942.in
2dad4c59 943.IP
4e77145c
MK
944Each of the lines beginning with "inotify" displays information about
945one file or directory that is being monitored.
946The fields in this line are as follows:
947.RS
948.TP
949.I wd
950A watch descriptor number (in decimal).
951.TP
952.I ino
953The inode number of the target file (in hexadecimal).
954.TP
955.I sdev
956The ID of the device where the target file resides (in hexadecimal).
957.TP
958.I mask
959The mask of events being monitored for the target file (in hexadecimal).
960.RE
961.IP
962If the kernel was built with exportfs support, the path to the target
963file is exposed as a file handle, via three hexadecimal fields:
964.IR fhandle-bytes ,
965.IR fhandle-type ,
966and
967.IR f_handle .
2dad4c59 968.IP
e2444bcb
MK
969For fanotify file descriptors (see
970.BR fanotify (7)),
971we see (since Linux 3.8)
972the following fields:
2dad4c59 973.IP
e2444bcb 974.in +4n
37d5e699 975.EX
e2444bcb
MK
976pos: 0
977flags: 02
978mnt_id: 11
979fanotify flags:0 event-flags:88002
980fanotify ino:19264f sdev:800001 mflags:0 mask:1 ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:4f261900a82dfd73
37d5e699 981.EE
e2444bcb 982.in
2dad4c59 983.IP
e2444bcb
MK
984The fourth line displays information defined when the fanotify group
985was created via
986.BR fanotify_init (2):
987.RS
988.TP
989.I flags
990The
991.I flags
992argument given to
993.BR fanotify_init (2)
994(expressed in hexadecimal).
995.TP
996.I event-flags
997The
998.I event_f_flags
999argument given to
1000.BR fanotify_init (2)
1001(expressed in hexadecimal).
1002.RE
1003.IP
1004Each additional line shown in the file contains information
1005about one of the marks in the fanotify group.
1006Most of these fields are as for inotify, except:
1007.RS
1008.TP
1009.I mflags
1010The flags associated with the mark
1011(expressed in hexadecimal).
1012.TP
1013.I mask
1014The events mask for this mark
1015(expressed in hexadecimal).
1016.TP
1017.I ignored_mask
1018The mask of events that are ignored for this mark
1019(expressed in hexadecimal).
1020.RE
1021.IP
1022For details on these fields, see
1023.BR fanotify_mark (2).
340a16a6
LW
1024.IP
1025For timerfd file descriptors (see
1026.BR timerfd (2)),
1027we see (since Linux 3.17)
cd595f62 1028.\" commit af9c4957cf212ad9cf0bee34c95cb11de5426e85
340a16a6
LW
1029the following fields:
1030.IP
1031.in +4n
1032.EX
1033pos: 0
1034flags: 02004002
1035mnt_id: 13
1036clockid: 0
1037ticks: 0
1038settime flags: 03
1039it_value: (7695568592, 640020877)
1040it_interval: (0, 0)
1041.EE
1042.in
1cdbc3a6
MK
1043.RS
1044.TP
340a16a6 1045.I clockid
1cdbc3a6 1046This is the numeric value of the clock ID
734ec506
MK
1047(corresponding to one of the
1048.B CLOCK_*
1049constants defined via
a6425049 1050.IR <time.h> )
cb5a67a4 1051that is used to mark the progress of the timer (in this example, 0 is
340a16a6 1052.BR CLOCK_REALTIME ).
1cdbc3a6 1053.TP
340a16a6 1054.I ticks
1cdbc3a6
MK
1055This is the number of timer expirations that have occurred,
1056(i.e., the value that
340a16a6 1057.BR read (2)
1cdbc3a6
MK
1058on it would return).
1059.TP
340a16a6 1060.I settime flags
1cdbc3a6 1061This field lists the flags with which the timerfd was last armed (see
340a16a6
LW
1062.BR timerfd_settime (2)),
1063in octal
1064(in this example, both
1065.B TFD_TIMER_ABSTIME
1066and
1067.B TFD_TIMER_CANCEL_ON_SET
1068are set).
1cdbc3a6 1069.TP
340a16a6 1070.I it_value
1cdbc3a6
MK
1071This field contains the amount of time until the timer will next expire,
1072expressed in seconds and nanoseconds.
734ec506
MK
1073This is always expressed as a relative value,
1074regardless of whether the timer was created using the
1075.B TFD_TIMER_ABSTIME
1076flag.
1cdbc3a6 1077.TP
340a16a6 1078.I it_interval
1cdbc3a6
MK
1079This field contains the interval of the timer,
1080in seconds and nanoseconds.
1081(The
1082.I it_value
1083and
1084.I it_interval
1085fields contain the values that
340a16a6 1086.BR timerfd_gettime (2)
1cdbc3a6
MK
1087on this file descriptor would return.)
1088.RE
0ca2fc4d 1089.TP
93401860
MK
1090.IR /proc/[pid]/gid_map " (since Linux 3.5)"
1091See
1092.BR user_namespaces (7).
1093.TP
0ca2fc4d 1094.IR /proc/[pid]/io " (since kernel 2.6.20)"
68f11066
MK
1095.\" commit 7c3ab7381e79dfc7db14a67c6f4f3285664e1ec2
1096This file contains I/O statistics for the process, for example:
37d5e699 1097.IP
0ca2fc4d 1098.in +4n
37d5e699 1099.EX
0ca2fc4d
PS
1100.RB "#" " cat /proc/3828/io"
1101rchar: 323934931
1102wchar: 323929600
1103syscr: 632687
1104syscw: 632675
1105read_bytes: 0
1106write_bytes: 323932160
1107cancelled_write_bytes: 0
37d5e699 1108.EE
0ca2fc4d 1109.in
2dad4c59 1110.IP
0ca2fc4d
PS
1111The fields are as follows:
1112.RS
68f11066
MK
1113.TP
1114.IR rchar ": characters read"
0ca2fc4d
PS
1115The number of bytes which this task has caused to be read from storage.
1116This is simply the sum of bytes which this process passed to
1117.BR read (2)
68f11066 1118and similar system calls.
11256884 1119It includes things such as terminal I/O and
68f11066
MK
1120is unaffected by whether or not actual
1121physical disk I/O was required (the read might have been satisfied from
0ca2fc4d 1122pagecache).
68f11066
MK
1123.TP
1124.IR wchar ": characters written"
0ca2fc4d
PS
1125The number of bytes which this task has caused, or shall cause to be written
1126to disk.
1127Similar caveats apply here as with
1128.IR rchar .
68f11066
MK
1129.TP
1130.IR syscr ": read syscalls"
1131Attempt to count the number of read I/O operations\(emthat is,
1132system calls such as
0ca2fc4d
PS
1133.BR read (2)
1134and
1135.BR pread (2).
68f11066
MK
1136.TP
1137.IR syscw ": write syscalls"
1138Attempt to count the number of write I/O operations\(emthat is,
1139system calls such as
0ca2fc4d
PS
1140.BR write (2)
1141and
1142.BR pwrite (2).
68f11066
MK
1143.TP
1144.IR read_bytes ": bytes read"
0ca2fc4d
PS
1145Attempt to count the number of bytes which this process really did cause to
1146be fetched from the storage layer.
1147This is accurate for block-backed filesystems.
68f11066
MK
1148.TP
1149.IR write_bytes ": bytes written"
0ca2fc4d
PS
1150Attempt to count the number of bytes which this process caused to be sent to
1151the storage layer.
68f11066 1152.TP
0ca2fc4d 1153.IR cancelled_write_bytes :
0ca2fc4d
PS
1154The big inaccuracy here is truncate.
1155If a process writes 1MB to a file and then deletes the file,
1156it will in fact perform no writeout.
1157But it will have been accounted as having caused 1MB of write.
68f11066 1158In other words: this field represents the number of bytes which this process
0ca2fc4d 1159caused to not happen, by truncating pagecache.
68f11066 1160A task can cause "negative" I/O too.
0ca2fc4d 1161If this task truncates some dirty pagecache,
68f11066
MK
1162some I/O which another task has been accounted for
1163(in its
1164.IR write_bytes )
1165will not be happening.
1166.RE
0ca2fc4d
PS
1167.IP
1168.IR Note :
68f11066 1169In the current implementation, things are a bit racy on 32-bit systems:
0ca2fc4d
PS
1170if process A reads process B's
1171.I /proc/[pid]/io
68f11066 1172while process B is updating one of these 64-bit counters,
0ca2fc4d 1173process A could see an intermediate result.
2dad4c59 1174.IP
d8e2972a
MK
1175Permission to access this file is governed by a ptrace access mode
1176.B PTRACE_MODE_READ_FSCREDS
1177check; see
1178.BR ptrace (2).
f6e17121 1179.TP
7e07d950 1180.IR /proc/[pid]/limits " (since Linux 2.6.24)"
69ab425e
MK
1181This file displays the soft limit, hard limit, and units of measurement
1182for each of the process's resource limits (see
1183.BR getrlimit (2)).
1184Up to and including Linux 2.6.35,
1185this file is protected to allow reading only by the real UID of the process.
1186Since Linux 2.6.36,
1187.\" commit 3036e7b490bf7878c6dae952eec5fb87b1106589
1188this file is readable by all users on the system.
df2a8576
MK
1189.\" FIXME Describe /proc/[pid]/loginuid
1190.\" Added in 2.6.11; updating requires CAP_AUDIT_CONTROL
1191.\" CONFIG_AUDITSYSCALL
b4f89985
PE
1192.TP
1193.IR /proc/[pid]/map_files/ " (since kernel 3.3)
18cdd0ac
MK
1194.\" commit 640708a2cff7f81e246243b0073c66e6ece7e53e
1195This subdirectory contains entries corresponding to memory-mapped
b4f89985
PE
1196files (see
1197.BR mmap (2)).
18cdd0ac
MK
1198Entries are named by memory region start and end
1199address pair (expressed as hexadecimal numbers),
1200and are symbolic links to the mapped files themselves.
1201Here is an example, with the output wrapped and reformatted to fit on an 80-column display:
37d5e699 1202.IP
b4f89985 1203.in +4n
37d5e699 1204.EX
f2aa4dcc 1205.RB "#" " ls -l /proc/self/map_files/"
18cdd0ac 1206lr\-\-\-\-\-\-\-\-. 1 root root 64 Apr 16 21:31
9bc87ed0 1207 3252e00000\-3252e20000 \-> /usr/lib64/ld\-2.15.so
b4f89985 1208\&...
37d5e699 1209.EE
b4f89985 1210.in
2dad4c59 1211.IP
b4f89985 1212Although these entries are present for memory regions that were
d6a56978 1213mapped with the
b4f89985 1214.BR MAP_FILE
18cdd0ac 1215flag, the way anonymous shared memory (regions created with the
b4f89985
PE
1216.B MAP_ANON | MAP_SHARED
1217flags)
1218is implemented in Linux
18cdd0ac
MK
1219means that such regions also appear on this directory.
1220Here is an example where the target file is the deleted
1221.I /dev/zero
1222one:
37d5e699 1223.IP
b4f89985 1224.in +4n
37d5e699 1225.EX
18cdd0ac
MK
1226lrw\-\-\-\-\-\-\-. 1 root root 64 Apr 16 21:33
1227 7fc075d2f000\-7fc075e6f000 \-> /dev/zero (deleted)
37d5e699 1228.EE
b4f89985 1229.in
2dad4c59 1230.IP
b4f89985
PE
1231This directory appears only if the
1232.B CONFIG_CHECKPOINT_RESTORE
1233kernel configuration option is enabled.
f2aa4dcc
MK
1234Privilege
1235.RB ( CAP_SYS_ADMIN )
1236.\" FIXME
1237.\" This may change. See the mail thread
43d42cc0 1238.\" "[RFC][PATCH v2] procfs: Always expose /proc/<pid>/map_files/ and make it readable"
f2aa4dcc
MK
1239.\" from Jan 2015
1240is required to view the contents of this directory.
fea681da 1241.TP
69119dc7 1242.I /proc/[pid]/maps
fea681da
MK
1243A file containing the currently mapped memory regions and their access
1244permissions.
bbf9f397
MK
1245See
1246.BR mmap (2)
1247for some further information about memory mappings.
2dad4c59 1248.IP
aee2f0bf
MK
1249Permission to access this file is governed by a ptrace access mode
1250.B PTRACE_MODE_READ_FSCREDS
1251check; see
1252.BR ptrace (2).
2dad4c59 1253.IP
dd0c3b96 1254The format of the file is:
c1a022dc
MK
1255.IP
1256.in 4n
1257.EX
21781757 1258.I "address perms offset dev inode pathname"
9bc87ed0
MK
125900400000\-00452000 r-xp 00000000 08:02 173521 /usr/bin/dbus-daemon
126000651000\-00652000 r--p 00051000 08:02 173521 /usr/bin/dbus-daemon
126100652000\-00655000 rw-p 00052000 08:02 173521 /usr/bin/dbus-daemon
126200e03000\-00e24000 rw-p 00000000 00:00 0 [heap]
126300e24000\-011f7000 rw-p 00000000 00:00 0 [heap]
182090db 1264\&...
9bc87ed0
MK
126535b1800000\-35b1820000 r-xp 00000000 08:02 135522 /usr/lib64/ld\-2.15.so
126635b1a1f000\-35b1a20000 r--p 0001f000 08:02 135522 /usr/lib64/ld\-2.15.so
126735b1a20000\-35b1a21000 rw-p 00020000 08:02 135522 /usr/lib64/ld\-2.15.so
126835b1a21000\-35b1a22000 rw-p 00000000 00:00 0
126935b1c00000\-35b1dac000 r-xp 00000000 08:02 135870 /usr/lib64/libc\-2.15.so
127035b1dac000\-35b1fac000 ---p 001ac000 08:02 135870 /usr/lib64/libc\-2.15.so
127135b1fac000\-35b1fb0000 r--p 001ac000 08:02 135870 /usr/lib64/libc\-2.15.so
127235b1fb0000\-35b1fb2000 rw-p 001b0000 08:02 135870 /usr/lib64/libc\-2.15.so
182090db 1273\&...
9bc87ed0 1274f2c6ff8c000\-7f2c7078c000 rw-p 00000000 00:00 0 [stack:986]
182090db 1275\&...
9bc87ed0
MK
12767fffb2c0d000\-7fffb2c2e000 rw-p 00000000 00:00 0 [stack]
12777fffb2d48000\-7fffb2d49000 r-xp 00000000 00:00 0 [vdso]
c1a022dc 1278.EE
21781757 1279.in
c1a022dc 1280.IP
7d2e6d74 1281The
3eb8c588
MK
1282.I address
1283field is the address space in the process that the mapping occupies.
1284The
1285.I perms
1286field is a set of permissions:
2dad4c59 1287.IP
37d5e699
MK
1288.in +4
1289.EX
fea681da
MK
1290r = read
1291w = write
1292x = execute
1293s = shared
1294p = private (copy on write)
37d5e699 1295.EE
fea681da 1296.in
2dad4c59 1297.IP
3eb8c588
MK
1298The
1299.I offset
b844cf04 1300field is the offset into the file/whatever;
3eb8c588
MK
1301.I dev
1302is the device
dd0c3b96 1303(major:minor);
3eb8c588
MK
1304.I inode
1305is the inode on that device.
59a40ed7 13060 indicates that no inode is associated with the memory region,
16e64bae 1307as would be the case with BSS (uninitialized data).
2dad4c59 1308.IP
3eb8c588
MK
1309The
1310.I pathname
1311field will usually be the file that is backing the mapping.
491ea6f1 1312For ELF files,
3eb8c588
MK
1313you can easily coordinate with the
1314.I offset
1315field by looking at the
491ea6f1
MK
1316Offset field in the ELF program headers
1317.RI ( "readelf\ \-l" ).
2dad4c59 1318.IP
491ea6f1 1319There are additional helpful pseudo-paths:
61b0b1f4
MK
1320.RS 12
1321.TP
1322.IR [stack]
16e64bae 1323The initial process's (also known as the main thread's) stack.
61b0b1f4 1324.TP
3eb8c588 1325.IR [stack:<tid>] " (since Linux 3.4)"
a60894c5 1326.\" commit b76437579d1344b612cf1851ae610c636cec7db0
61b0b1f4 1327A thread's stack (where the
3eb8c588 1328.IR <tid>
61b0b1f4 1329is a thread ID).
491ea6f1 1330It corresponds to the
3eb8c588 1331.IR /proc/[pid]/task/[tid]/
37d32c38 1332path.
61b0b1f4 1333.TP
7d2e6d74 1334.IR [vdso]
61b0b1f4 1335The virtual dynamically linked shared object.
c56a0185
MK
1336See
1337.BR vdso (7).
61b0b1f4 1338.TP
7d2e6d74 1339.IR [heap]
61b0b1f4
MK
1340The process's heap.
1341.in
61b0b1f4
MK
1342.RE
1343.IP
3eb8c588
MK
1344If the
1345.I pathname
1346field is blank,
40382e5e
MK
1347this is an anonymous mapping as obtained via
1348.BR mmap (2).
61b0b1f4
MK
1349There is no easy way to coordinate this back to a process's source,
1350short of running it through
491ea6f1
MK
1351.BR gdb (1),
1352.BR strace (1),
1353or similar.
2dad4c59 1354.IP
b6547479
EK
1355.I pathname
1356is shown unescaped except for newline characters, which are replaced
d512e7b4
MK
1357with an octal escape sequence.
1358As a result, it is not possible to determine whether the original
1359pathname contained a newline character or the literal
b6547479
EK
1360.I \\\012
1361character sequence.
1362.IP
1363If the mapping is file-backed and the file has been deleted, the string
d512e7b4
MK
1364" (deleted)" is appended to the pathname.
1365Note that this is ambiguous too.
b6547479 1366.IP
eb9a0b2f 1367Under Linux 2.0, there is no field giving pathname.
fea681da 1368.TP
69119dc7 1369.I /proc/[pid]/mem
fea681da
MK
1370This file can be used to access the pages of a process's memory through
1371.BR open (2),
1372.BR read (2),
1373and
ccb2bb0d 1374.BR lseek (2).
2dad4c59 1375.IP
aee2f0bf
MK
1376Permission to access this file is governed by a ptrace access mode
1377.B PTRACE_MODE_ATTACH_FSCREDS
1378check; see
1379.BR ptrace (2).
b4e9ee8f 1380.TP
69119dc7 1381.IR /proc/[pid]/mountinfo " (since Linux 2.6.26)"
b4e9ee8f 1382.\" This info adapted from Documentation/filesystems/proc.txt
fb4bdaa1 1383.\" commit 2d4d4864ac08caff5c204a752bd004eed4f08760
ef5b47f6
MK
1384This file contains information about mount points
1385in the process's mount namespace (see
1386.BR mount_namespaces (7)).
fb4bdaa1
MK
1387It supplies various information
1388(e.g., propagation state, root of mount for bind mounts,
1389identifier for each mount and its parent) that is missing from the (older)
1390.IR /proc/[pid]/mounts
1391file, and fixes various other problems with that file
1392(e.g., nonextensibility,
1393failure to distinguish per-mount versus per-superblock options).
2dad4c59 1394.IP
fb4bdaa1 1395The file contains lines of the form:
c1a022dc
MK
1396.IP
1397.in 0n
1398.EX
0f619d1f 139936 35 98:0 /mnt1 /mnt2 rw,noatime master:1 \- ext3 /dev/root rw,errors=continue
b4e9ee8f 1400(1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11)
c1a022dc
MK
1401.in
1402.EE
b4e9ee8f
MK
1403.IP
1404The numbers in parentheses are labels for the descriptions below:
3bc960c2 1405.RS 7
b4e9ee8f
MK
1406.TP 5
1407(1)
0f619d1f 1408mount ID: a unique ID for the mount (may be reused after
b4e9ee8f
MK
1409.BR umount (2)).
1410.TP
1411(2)
29270550
MK
1412parent ID: the ID of the parent mount
1413(or of self for the root of this mount namespace's mount tree).
1414.IP
8c420ed8
MK
1415If a new mount is stacked on top of a previous existing mount
1416(so that it hides the existing mount) at pathname P,
1417then the parent of the new mount is the previous mount at that location.
1418Thus, when looking at all the mounts stacked at a particular location,
1419the top-most mount is the one that is not the parent
1420of any other mount at the same location.
1421(Note, however, that this top-most mount will be accessible only if
1422the longest path subprefix of P that is a mount point
1423is not itself hidden by a stacked mount.)
1424.IP
29270550
MK
1425If the parent mount point lies outside the process's root directory (see
1426.BR chroot (2)),
1427the ID shown here won't have a corresponding record in
35cf1b93 1428.I mountinfo
29270550
MK
1429whose mount ID (field 1) matches this parent mount ID
1430(because mount points that lie outside the process's root directory
1431are not shown in
1432.IR mountinfo ).
1433As a special case of this point,
1434the process's root mount point may have a parent mount
1435(for the initramfs filesystem) that lies
1436.\" Miklos Szeredi, Nov 2017: The hidden one is the initramfs, I believe
1437.\" mtk: In the initial mount namespace, this hidden ID has the value 0
1438outside the process's root directory,
1439and an entry for that mount point will not appear in
1440.IR mountinfo .
b4e9ee8f
MK
1441.TP
1442(3)
0f619d1f 1443major:minor: the value of
b4e9ee8f 1444.I st_dev
0f619d1f 1445for files on this filesystem (see
b4e9ee8f
MK
1446.BR stat (2)).
1447.TP
1448(4)
0f619d1f 1449root: the pathname of the directory in the filesystem
8d857fcb 1450which forms the root of this mount.
b4e9ee8f
MK
1451.TP
1452(5)
ebdc66e2 1453mount point: the pathname of the mount point relative
0f619d1f 1454to the process's root directory.
b4e9ee8f
MK
1455.TP
1456(6)
1457mount options: per-mount options.
1458.TP
1459(7)
0f619d1f 1460optional fields: zero or more fields of the form "tag[:value]"; see below.
b4e9ee8f
MK
1461.TP
1462(8)
0f619d1f 1463separator: the end of the optional fields is marked by a single hyphen.
b4e9ee8f
MK
1464.TP
1465(9)
0f619d1f 1466filesystem type: the filesystem type in the form "type[.subtype]".
b4e9ee8f
MK
1467.TP
1468(10)
9ee4a2b6 1469mount source: filesystem-specific information or "none".
b4e9ee8f
MK
1470.TP
1471(11)
68d86eac 1472super options: per-superblock options.
b4e9ee8f
MK
1473.RE
1474.IP
966b5839
MK
1475Currently, the possible optional fields are
1476.IR shared ,
1477.IR master ,
1478.IR propagate_from ,
1479and
1480.IR unbindable .
1481See
1482.BR mount_namespaces (7)
1483for a description of these fields.
0f619d1f
MK
1484Parsers should ignore all unrecognized optional fields.
1485.IP
b4e9ee8f
MK
1486For more information on mount propagation see:
1487.I Documentation/filesystems/sharedsubtree.txt
66a9882e 1488in the Linux kernel source tree.
b4e9ee8f 1489.TP
cea61382 1490.IR /proc/[pid]/mounts " (since Linux 2.4.19)"
226cb3a8 1491This file lists all the filesystems currently mounted in the
ef5b47f6
MK
1492process's mount namespace (see
1493.BR mount_namespaces (7)).
cea61382
MK
1494The format of this file is documented in
1495.BR fstab (5).
2dad4c59 1496.IP
cea61382
MK
1497Since kernel version 2.6.15, this file is pollable:
1498after opening the file for reading, a change in this file
9ee4a2b6 1499(i.e., a filesystem mount or unmount) causes
cea61382 1500.BR select (2)
226cb3a8 1501to mark the file descriptor as having an exceptional condition, and
cea61382
MK
1502.BR poll (2)
1503and
1504.BR epoll_wait (2)
226cb3a8
MK
1505mark the file as having a priority event
1506.RB ( POLLPRI ).
1507(Before Linux 2.6.30,
1508a change in this file was indicated by the file descriptor
1509being marked as readable for
1510.BR select (2),
1511and being marked as having an error condition for
1512.BR poll (2)
1513and
1514.BR epoll_wait (2).)
cea61382 1515.TP
69119dc7 1516.IR /proc/[pid]/mountstats " (since Linux 2.6.17)"
783a6233 1517This file exports information (statistics, configuration information)
ef5b47f6
MK
1518about the mount points in the process's mount namespace (see
1519.BR mount_namespaces (7)).
b4e9ee8f 1520Lines in this file have the form:
37d5e699
MK
1521.IP
1522.in +4n
1523.EX
b4e9ee8f
MK
1524device /dev/sda7 mounted on /home with fstype ext3 [statistics]
1525( 1 ) ( 2 ) (3 ) (4)
37d5e699
MK
1526.EE
1527.in
b4e9ee8f
MK
1528.IP
1529The fields in each line are:
3bc960c2 1530.RS 7
b4e9ee8f
MK
1531.TP 5
1532(1)
1533The name of the mounted device
1534(or "nodevice" if there is no corresponding device).
1535.TP
1536(2)
9ee4a2b6 1537The mount point within the filesystem tree.
b4e9ee8f
MK
1538.TP
1539(3)
9ee4a2b6 1540The filesystem type.
b4e9ee8f
MK
1541.TP
1542(4)
1543Optional statistics and configuration information.
9ee4a2b6 1544Currently (as at Linux 2.6.26), only NFS filesystems export
b4e9ee8f
MK
1545information via this field.
1546.RE
1547.IP
90878f7c 1548This file is readable only by the owner of the process.
b4e9ee8f 1549.TP
2d3fb75b 1550.IR /proc/[pid]/net " (since Linux 2.6.25)"
9fb88bc8
MK
1551See the description of
1552.IR /proc/net .
1553.TP
b4a185e5 1554.IR /proc/[pid]/ns/ " (since Linux 3.0)"
2c4201f0 1555.\" See commit 6b4e306aa3dc94a0545eb9279475b1ab6209a31f
b4a185e5
EB
1556This is a subdirectory containing one entry for each namespace that
1557supports being manipulated by
80e63655 1558.BR setns (2).
cf8bfe6d
MK
1559For more information, see
1560.BR namespaces (7).
b4a185e5 1561.TP
69119dc7 1562.IR /proc/[pid]/numa_maps " (since Linux 2.6.14)"
610f75cc
MK
1563See
1564.BR numa (7).
7388733a 1565.TP
69119dc7 1566.IR /proc/[pid]/oom_adj " (since Linux 2.6.11)"
b4e9ee8f 1567This file can be used to adjust the score used to select which process
0425de01 1568should be killed in an out-of-memory (OOM) situation.
b4e9ee8f
MK
1569The kernel uses this value for a bit-shift operation of the process's
1570.IR oom_score
1571value:
5b8dbfd4
MK
1572valid values are in the range \-16 to +15,
1573plus the special value \-17,
b4e9ee8f
MK
1574which disables OOM-killing altogether for this process.
1575A positive score increases the likelihood of this
1576process being killed by the OOM-killer;
1577a negative score decreases the likelihood.
de8e9cc1 1578.IP
b4e9ee8f
MK
1579The default value for this file is 0;
1580a new process inherits its parent's
1581.I oom_adj
1582setting.
1583A process must be privileged
1584.RB ( CAP_SYS_RESOURCE )
1585to update this file.
f2c8b197
MK
1586.IP
1587Since Linux 2.6.36, use of this file is deprecated in favor of
1588.IR /proc/[pid]/oom_score_adj .
b4e9ee8f 1589.TP
69119dc7 1590.IR /proc/[pid]/oom_score " (since Linux 2.6.11)"
5753354a
MF
1591.\" See mm/oom_kill.c::badness() in pre 2.6.36 sources
1592.\" See mm/oom_kill.c::oom_badness() after 2.6.36
1593.\" commit a63d83f427fbce97a6cea0db2e64b0eb8435cd10
b4e9ee8f
MK
1594This file displays the current score that the kernel gives to
1595this process for the purpose of selecting a process
1596for the OOM-killer.
1597A higher score means that the process is more likely to be
1598selected by the OOM-killer.
1599The basis for this score is the amount of memory used by the process,
1600with increases (+) or decreases (\-) for factors including:
5753354a
MF
1601.\" See mm/oom_kill.c::badness() in pre 2.6.36 sources
1602.\" See mm/oom_kill.c::oom_badness() after 2.6.36
1603.\" commit a63d83f427fbce97a6cea0db2e64b0eb8435cd10
1604.RS
1605.IP * 2
9b0e3937 1606whether the process is privileged (\-).
5753354a
MF
1607.\" More precisely, if it has CAP_SYS_ADMIN or (pre 2.6.36) CAP_SYS_RESOURCE
1608.RE
1609.IP
1610Before kernel 2.6.36 the following factors were also used in the calculation of oom_score:
b4e9ee8f
MK
1611.RS
1612.IP * 2
1613whether the process creates a lot of children using
1614.BR fork (2)
1615(+);
1616.IP *
1617whether the process has been running a long time,
1618or has used a lot of CPU time (\-);
1619.IP *
5753354a 1620whether the process has a low nice value (i.e., > 0) (+); and
b4e9ee8f
MK
1621.IP *
1622whether the process is making direct hardware access (\-).
1623.\" More precisely, if it has CAP_SYS_RAWIO
1624.RE
1625.IP
1626The
1627.I oom_score
f2c8b197
MK
1628also reflects the adjustment specified by the
1629.I oom_score_adj
1630or
b4e9ee8f
MK
1631.I oom_adj
1632setting for the process.
f2c8b197
MK
1633.TP
1634.IR /proc/[pid]/oom_score_adj " (since Linux 2.6.36)"
1635.\" Text taken from 3.7 Documentation/filesystems/proc.txt
1636This file can be used to adjust the badness heuristic used to select which
1637process gets killed in out-of-memory conditions.
2dad4c59 1638.IP
f2c8b197
MK
1639The badness heuristic assigns a value to each candidate task ranging from 0
1640(never kill) to 1000 (always kill) to determine which process is targeted.
1641The units are roughly a proportion along that range of
1642allowed memory the process may allocate from,
1643based on an estimation of its current memory and swap use.
1644For example, if a task is using all allowed memory,
1645its badness score will be 1000.
1646If it is using half of its allowed memory, its score will be 500.
2dad4c59 1647.IP
f2c8b197
MK
1648There is an additional factor included in the badness score: root
1649processes are given 3% extra memory over other tasks.
2dad4c59 1650.IP
f2c8b197 1651The amount of "allowed" memory depends on the context
0633f951 1652in which the OOM-killer was called.
f2c8b197
MK
1653If it is due to the memory assigned to the allocating task's cpuset
1654being exhausted,
1655the allowed memory represents the set of mems assigned to that
1656cpuset (see
1657.BR cpuset (7)).
1658If it is due to a mempolicy's node(s) being exhausted,
1659the allowed memory represents the set of mempolicy nodes.
1660If it is due to a memory limit (or swap limit) being reached,
1661the allowed memory is that configured limit.
1662Finally, if it is due to the entire system being out of memory, the
1663allowed memory represents all allocatable resources.
2dad4c59 1664.IP
f2c8b197 1665The value of
0633f951 1666.I oom_score_adj
f2c8b197
MK
1667is added to the badness score before it
1668is used to determine which task to kill.
1669Acceptable values range from \-1000
1670(OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX).
0633f951 1671This allows user space to control the preference for OOM-killing,
f2c8b197 1672ranging from always preferring a certain
f082ada4 1673task or completely disabling it from OOM killing.
f2c8b197 1674The lowest possible value, \-1000, is
0633f951 1675equivalent to disabling OOM-killing entirely for that task,
f2c8b197 1676since it will always report a badness score of 0.
2dad4c59 1677.IP
f2c8b197
MK
1678Consequently, it is very simple for user space to define
1679the amount of memory to consider for each task.
48ac01a7 1680Setting an
f2c8b197
MK
1681.I oom_score_adj
1682value of +500, for example,
1683is roughly equivalent to allowing the remainder of tasks sharing the
1684same system, cpuset, mempolicy, or memory controller resources
1685to use at least 50% more memory.
1686A value of \-500, on the other hand, would be roughly
1687equivalent to discounting 50% of the task's
1688allowed memory from being considered as scoring against the task.
2dad4c59 1689.IP
0633f951 1690For backward compatibility with previous kernels,
f2c8b197
MK
1691.I /proc/[pid]/oom_adj
1692can still be used to tune the badness score.
1693Its value is
9f1b9726 1694scaled linearly with
f2c8b197 1695.IR oom_score_adj .
2dad4c59 1696.IP
f2c8b197
MK
1697Writing to
1698.IR /proc/[pid]/oom_score_adj
1699or
1700.IR /proc/[pid]/oom_adj
1701will change the other with its scaled value.
6f752251
MK
1702.IP
1703The
1704.BR choom (1)
1705program provides a command-line interface for adjusting the
1706.I oom_score_adj
1707value of a running process or a newly executed command.
b0aa1e51
MK
1708.TP
1709.IR /proc/[pid]/pagemap " (since Linux 2.6.25)"
1710This file shows the mapping of each of the process's virtual pages
1711into physical page frames or swap area.
1712It contains one 64-bit value for each virtual page,
1713with the bits set as follows:
1714.RS 12
1715.TP
171663
1717If set, the page is present in RAM.
1718.TP
171962
1720If set, the page is in swap space
1721.TP
172261 (since Linux 3.5)
1723The page is a file-mapped page or a shared anonymous page.
1724.TP
2e84528d 172560\(en57 (since Linux 3.11)
b0aa1e51
MK
1726Zero
1727.\" Not quite true; see commit 541c237c0923f567c9c4cabb8a81635baadc713f
1728.TP
2e84528d 172956 (since Linux 4.2)
abfbcb56
MK
1730.\" commit 77bb499bb60f4b79cca7d139c8041662860fcf87
1731.\" commit 83b4b0bb635eee2b8e075062e4e008d1bc110ed7
2e84528d
OE
1732The page is exclusively mapped.
1733.TP
b5301584 173455 (since Linux 3.11)
b0aa1e51
MK
1735PTE is soft-dirty
1736(see the kernel source file
f9326a24 1737.IR Documentation/admin-guide/mm/soft-dirty.rst ).
b0aa1e51 1738.TP
9bc87ed0 173954\(en0
b0aa1e51
MK
1740If the page is present in RAM (bit 63), then these bits
1741provide the page frame number, which can be used to index
1742.IR /proc/kpageflags
1743and
1744.IR /proc/kpagecount .
1745If the page is present in swap (bit 62),
9bc87ed0 1746then bits 4\(en0 give the swap type, and bits 54\(en5 encode the swap offset.
b0aa1e51
MK
1747.RE
1748.IP
9bc87ed0 1749Before Linux 3.11, bits 60\(en55 were
b0aa1e51
MK
1750used to encode the base-2 log of the page size.
1751.IP
1752To employ
1753.IR /proc/[pid]/pagemap
1754efficiently, use
1755.IR /proc/[pid]/maps
1756to determine which areas of memory are actually mapped and seek
1757to skip over unmapped regions.
1758.IP
1759The
1760.IR /proc/[pid]/pagemap
1761file is present only if the
1762.B CONFIG_PROC_PAGE_MONITOR
1763kernel configuration option is enabled.
2dad4c59 1764.IP
aee2f0bf
MK
1765Permission to access this file is governed by a ptrace access mode
1766.B PTRACE_MODE_READ_FSCREDS
1767check; see
1768.BR ptrace (2).
7c2905d1
MK
1769.TP
1770.IR /proc/[pid]/personality " (since Linux 2.6.28)"
1771.\" commit 478307230810d7e2a753ed220db9066dfdf88718
1772This read-only file exposes the process's execution domain, as set by
1773.BR personality (2).
1774The value is displayed in hexadecimal notation.
2dad4c59 1775.IP
4834ae91
MK
1776Permission to access this file is governed by a ptrace access mode
1777.B PTRACE_MODE_ATTACH_FSCREDS
1778check; see
1779.BR ptrace (2).
fea681da 1780.TP
69119dc7 1781.I /proc/[pid]/root
008f1ecc 1782UNIX and Linux support the idea of a per-process root of the
9ee4a2b6 1783filesystem, set by the
fea681da 1784.BR chroot (2)
c13182ef
MK
1785system call.
1786This file is a symbolic link that points to the process's
14d70713
MK
1787root directory, and behaves in the same way as
1788.IR exe ,
1789and
1790.IR fd/* .
2dad4c59 1791.IP
948f0ff4 1792Note however that this file is not merely a symbolic link.
2b312241
MF
1793It provides the same view of the filesystem (including namespaces and the
1794set of per-process mounts) as the process itself.
a77efd58
MK
1795An example illustrates this point.
1796In one terminal, we start a shell in new user and mount namespaces,
1797and in that shell we create some new mount points:
2dad4c59 1798.IP
a77efd58 1799.in +4n
37d5e699 1800.EX
a77efd58
MK
1801$ \fBPS1='sh1# ' unshare \-Urnm\fP
1802sh1# \fBmount \-t tmpfs tmpfs /etc\fP # Mount empty tmpfs at /etc
1803sh1# \fBmount \-\-bind /usr /dev\fP # Mount /usr at /dev
89f92905 1804sh1# \fBecho $$\fP
a77efd58 180527123
37d5e699 1806.EE
a77efd58 1807.in
2dad4c59 1808.IP
a77efd58
MK
1809In a second terminal window, in the initial mount namespace,
1810we look at the contents of the corresponding mounts in
1811the initial and new namespaces:
2dad4c59 1812.IP
a77efd58 1813.in +4n
37d5e699 1814.EX
89f92905 1815$ \fBPS1='sh2# ' sudo sh\fP
a77efd58
MK
1816sh2# \fBls /etc | wc \-l\fP # In initial NS
1817309
1818sh2# \fBls /proc/27123/root/etc | wc \-l\fP # /etc in other NS
18190 # The empty tmpfs dir
1820sh2# \fBls /dev | wc \-l\fP # In initial NS
1821205
1822sh2# \fBls /proc/27123/root/dev | wc \-l\fP # /dev in other NS
182311 # Actually bind
1824 # mounted to /usr
1825sh2# \fBls /usr | wc \-l\fP # /usr in initial NS
182611
37d5e699 1827.EE
a77efd58 1828.in
2dad4c59 1829.IP
afcaf646 1830.\" The following was still true as at kernel 2.6.13
3ed7270e
MK
1831In a multithreaded process, the contents of the
1832.I /proc/[pid]/root
1833symbolic link are not available if the main thread has already terminated
afcaf646
MK
1834(typically by calling
1835.BR pthread_exit (3)).
2dad4c59 1836.IP
b902fe18
MK
1837Permission to dereference or read
1838.RB ( readlink (2))
1839this symbolic link is governed by a ptrace access mode
1840.B PTRACE_MODE_READ_FSCREDS
1841check; see
1842.BR ptrace (2).
f34f0182 1843.\" FIXME Describe /proc/[pid]/projid_map
43d42cc0
MK
1844.\" Added in 3.7
1845.\" commit f76d207a66c3a53defea67e7d36c3eb1b7d6d61d
15869389
MK
1846.TP
1847.IR /proc/[pid]/seccomp " (Linux 2.6.12 to 2.6.22)"
1848This file can be used to read and change the process's
1849secure computing (seccomp) mode setting.
1850It contains the value 0 if the process is not in seccomp mode,
1851and 1 if the process is in strict seccomp mode (see
1852.BR seccomp (2)).
1853Writing 1 to this file places the process irreversibly in strict seccomp mode.
1854(Further attempts to write to the file fail with the
1855.B EPERM
1856error.)
2dad4c59 1857.IP
15869389
MK
1858In Linux 2.6.23,
1859this file went away, to be replaced by the
1860.BR prctl (2)
1861.BR PR_GET_SECCOMP
1862and
1863.BR PR_SET_SECCOMP
1864operations (and later by
1865.BR seccomp (2)
1866and the
1867.I Seccomp
1868field in
1869.IR /proc/[pid]/status ).
69119dc7 1870.\" FIXME Describe /proc/[pid]/sessionid
b3fb99e8 1871.\" commit 1e0bd7550ea9cf474b1ad4c6ff5729a507f75fdc
b4e9ee8f 1872.\" CONFIG_AUDITSYSCALL
43d42cc0 1873.\" Added in 2.6.25; read-only; only readable by real UID
bea08fec 1874.\"
69119dc7 1875.\" FIXME Describe /proc/[pid]/sched
b4e9ee8f
MK
1876.\" Added in 2.6.23
1877.\" CONFIG_SCHED_DEBUG, and additional fields if CONFIG_SCHEDSTATS
1878.\" Displays various scheduling parameters
1879.\" This file can be written, to reset stats
ef4f4031 1880.\" The set of fields exposed by this file have changed
b3fb99e8
MK
1881.\" significantly over time.
1882.\" commit 43ae34cb4cd650d1eb4460a8253a8e747ba052ac
1883.\"
69119dc7
MK
1884.\" FIXME Describe /proc/[pid]/schedstats and
1885.\" /proc/[pid]/task/[tid]/schedstats
b4e9ee8f
MK
1886.\" Added in 2.6.9
1887.\" CONFIG_SCHEDSTATS
fea681da 1888.TP
5c92b1b7 1889.IR /proc/[pid]/setgroups " (since Linux 3.19)"
ab28dba9
MK
1890See
1891.BR user_namespaces (7).
d520465b 1892.TP
69119dc7 1893.IR /proc/[pid]/smaps " (since Linux 2.6.14)"
b07b19c4 1894This file shows memory consumption for each of the process's mappings.
859503c3
MK
1895(The
1896.BR pmap (1)
1897command displays similar information,
1898in a form that may be easier for parsing.)
1f0add28 1899For each mapping there is a series of lines such as the following:
37d5e699 1900.IP
a08ea57c 1901.in +4n
37d5e699 1902.EX
9bc87ed0 190300400000\-0048a000 r\-xp 00000000 fd:03 960637 /bin/bash
95fe794d
PG
1904Size: 552 kB
1905Rss: 460 kB
1906Pss: 100 kB
1907Shared_Clean: 452 kB
1908Shared_Dirty: 0 kB
1909Private_Clean: 8 kB
1910Private_Dirty: 0 kB
1911Referenced: 460 kB
1912Anonymous: 0 kB
1913AnonHugePages: 0 kB
4ad958e1
MK
1914ShmemHugePages: 0 kB
1915ShmemPmdMapped: 0 kB
95fe794d
PG
1916Swap: 0 kB
1917KernelPageSize: 4 kB
1918MMUPageSize: 4 kB
6861f8f0
MK
1919KernelPageSize: 4 kB
1920MMUPageSize: 4 kB
95fe794d 1921Locked: 0 kB
2f057281 1922ProtectionKey: 0
eb848708 1923VmFlags: rd ex mr mw me dw
37d5e699 1924.EE
a08ea57c 1925.in
2d3fb75b 1926.IP
b07b19c4
MK
1927The first of these lines shows the same information as is displayed
1928for the mapping in
69119dc7 1929.IR /proc/[pid]/maps .
c3d59262 1930The following lines show the size of the mapping,
95fe794d 1931the amount of the mapping that is currently resident in RAM ("Rss"),
a5a3e91b 1932the process's proportional share of this mapping ("Pss"),
1f0add28 1933the number of clean and dirty shared pages in the mapping,
c7ce200d 1934and the number of clean and dirty private pages in the mapping.
95fe794d 1935"Referenced" indicates the amount of memory currently marked as
1f0add28
MK
1936referenced or accessed.
1937"Anonymous" shows the amount of memory
1938that does not belong to any file.
1939"Swap" shows how much
95fe794d 1940would-be-anonymous memory is also used, but out on swap.
2dad4c59 1941.IP
6861f8f0
MK
1942The "KernelPageSize" line (available since Linux 2.6.29)
1943is the page size used by the kernel to back the virtual memory area.
1f0add28
MK
1944This matches the size used by the MMU in the majority of cases.
1945However, one counter-example occurs on PPC64 kernels
6861f8f0 1946whereby a kernel using 64kB as a base page size may still use 4kB
1f0add28 1947pages for the MMU on older processors.
6861f8f0
MK
1948To distinguish the two attributes, the "MMUPageSize" line
1949(also available since Linux 2.6.29)
1950reports the page size used by the MMU.
2dad4c59 1951.IP
95fe794d
PG
1952The "Locked" indicates whether the mapping is locked in memory
1953or not.
2dad4c59 1954.IP
9b780b06
MK
1955The "ProtectionKey" line (available since Linux 4.9, on x86 only)
1956contains the memory protection key (see
1957.BR pkeys (7))
1958associated with the virtual memory area.
1959This entry is present only if the kernel was built with the
1960.B CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
1961configuration option.
2dad4c59 1962.IP
eb848708
MK
1963The "VmFlags" line (available since Linux 3.8)
1964represents the kernel flags associated with the virtual memory area,
1965encoded using the following two-letter codes:
2dad4c59 1966.IP
95fe794d 1967 rd - readable
1f0add28 1968 wr - writable
95fe794d
PG
1969 ex - executable
1970 sh - shared
1971 mr - may read
1972 mw - may write
1973 me - may execute
1974 ms - may share
723e333c 1975 gd - stack segment grows down
95fe794d
PG
1976 pf - pure PFN range
1977 dw - disabled write to the mapped file
1978 lo - pages are locked in memory
1979 io - memory mapped I/O area
1980 sr - sequential read advise provided
1981 rr - random read advise provided
1982 dc - do not copy area on fork
1983 de - do not expand area on remapping
1984 ac - area is accountable
1985 nr - swap space is not reserved for the area
1986 ht - area uses huge tlb pages
1987 nl - non-linear mapping
1988 ar - architecture specific flag
1989 dd - do not include area into core dump
1990 sd - soft-dirty flag
1991 mm - mixed map area
1992 hg - huge page advise flag
1993 nh - no-huge page advise flag
b5408a0f 1994 mg - mergeable advise flag
2dad4c59 1995.IP
be729d66
DH
1996"ProtectionKey" field contains the memory protection key (see
1997.BR pkeys (5))
1998associated with the virtual memory area.
f12f1b9b 1999Present only if the kernel was built with the
be729d66
DH
2000.B CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
2001configuration option. (since Linux 4.6)
2dad4c59 2002.IP
e618d945
MK
2003The
2004.IR /proc/[pid]/smaps
2005file is present only if the
2006.B CONFIG_PROC_PAGE_MONITOR
2007kernel configuration option is enabled.
b07b19c4 2008.TP
67aac6fb
MK
2009.IR /proc/[pid]/stack " (since Linux 2.6.29)"
2010.\" 2ec220e27f5040aec1e88901c1b6ea3d135787ad
2011This file provides a symbolic trace of the function calls in this
2012process's kernel stack.
2013This file is provided only if the kernel was built with the
2014.B CONFIG_STACKTRACE
2015configuration option.
2dad4c59 2016.IP
4834ae91
MK
2017Permission to access this file is governed by a ptrace access mode
2018.B PTRACE_MODE_ATTACH_FSCREDS
2019check; see
2020.BR ptrace (2).
67aac6fb 2021.TP
69119dc7 2022.I /proc/[pid]/stat
c13182ef
MK
2023Status information about the process.
2024This is used by
2025.BR ps (1).
082bf5b8
MK
2026It is defined in the kernel source file
2027.IR fs/proc/array.c "."
2dad4c59 2028.IP
fea681da
MK
2029The fields, in order, with their proper
2030.BR scanf (3)
b02b4b74
MK
2031format specifiers, are listed below.
2032Whether or not certain of these fields display valid information is governed by
2033a ptrace access mode
2034.BR PTRACE_MODE_READ_FSCREDS "\ |\ " PTRACE_MODE_NOAUDIT
2035check (refer to
2036.BR ptrace (2)).
2037If the check denies access, then the field value is displayed as 0.
2038The affected fields are indicated with the marking [PT].
2dad4c59 2039.IP
fea681da 2040.RS
62e4a418
MK
2041.TP 10
2042(1) \fIpid\fP \ %d
2043.br
2044The process ID.
fea681da 2045.TP
62e4a418
MK
2046(2) \fIcomm\fP \ %s
2047The filename of the executable, in parentheses.
c13182ef 2048This is visible whether or not the executable is swapped out.
fea681da 2049.TP
62e4a418 2050(3) \fIstate\fP \ %c
31293f37
MK
2051One of the following characters, indicating process state:
2052.RS
2053.IP R 3
2054Running
2055.IP S
2056Sleeping in an interruptible wait
2057.IP D
2058Waiting in uninterruptible
2059disk sleep
2060.IP Z
2061Zombie
2062.IP T
2063Stopped (on a signal) or (before Linux 2.6.33) trace stopped
2064.IP t
2065.\" commit 44d90df6b757c59651ddd55f1a84f28132b50d29
2066Tracing stop (Linux 2.6.33 onward)
2067.IP W
2068Paging (only before Linux 2.6.0)
2069.IP X
ef4f4031 2070Dead (from Linux 2.6.0 onward)
31293f37
MK
2071.IP x
2072.\" commit 44d90df6b757c59651ddd55f1a84f28132b50d29
2073Dead (Linux 2.6.33 to
2074.\" commit 74e37200de8e9c4e09b70c21c3f13c2071e77457
20753.13 only)
2076.IP K
2077.\" commit 44d90df6b757c59651ddd55f1a84f28132b50d29
2078Wakekill (Linux 2.6.33 to
2079.\" commit 74e37200de8e9c4e09b70c21c3f13c2071e77457
20803.13 only)
2081.IP W
2082.\" commit 44d90df6b757c59651ddd55f1a84f28132b50d29
2083Waking (Linux 2.6.33 to
2084.\" commit 74e37200de8e9c4e09b70c21c3f13c2071e77457
20853.13 only)
2086.IP P
2087.\" commit f2530dc71cf0822f90bb63ea4600caaef33a66bb
2088Parked (Linux 3.9 to
2089.\" commit 74e37200de8e9c4e09b70c21c3f13c2071e77457
20903.13 only)
2091.RE
fea681da 2092.TP
62e4a418 2093(4) \fIppid\fP \ %d
e0fdc57c 2094The PID of the parent of this process.
fea681da 2095.TP
62e4a418
MK
2096(5) \fIpgrp\fP \ %d
2097The process group ID of the process.
fea681da 2098.TP
62e4a418
MK
2099(6) \fIsession\fP \ %d
2100The session ID of the process.
fea681da 2101.TP
62e4a418
MK
2102(7) \fItty_nr\fP \ %d
2103The controlling terminal of the process.
59a40ed7
MK
2104(The minor device number is contained in the combination of bits
210531 to 20 and 7 to 0;
b97deb97 2106the major device number is in bits 15 to 8.)
fea681da 2107.TP
62e4a418 2108(8) \fItpgid\fP \ %d
fea681da 2109.\" This field and following, up to and including wchan added 0.99.1
62e4a418 2110The ID of the foreground process group of the controlling
59a40ed7 2111terminal of the process.
fea681da 2112.TP
62e4a418
MK
2113(9) \fIflags\fP \ %u
2114The kernel flags word of the process.
c13182ef 2115For bit meanings,
66a9882e 2116see the PF_* defines in the Linux kernel source file
00702acc 2117.IR include/linux/sched.h .
fea681da 2118Details depend on the kernel version.
2dad4c59 2119.IP
62e4a418 2120The format for this field was %lu before Linux 2.6.
fea681da 2121.TP
ee566744 2122(10) \fIminflt\fP \ %lu
62e4a418 2123The number of minor faults the process has made which have not
fea681da
MK
2124required loading a memory page from disk.
2125.TP
62e4a418
MK
2126(11) \fIcminflt\fP \ %lu
2127The number of minor faults that the process's
fea681da
MK
2128waited-for children have made.
2129.TP
62e4a418
MK
2130(12) \fImajflt\fP \ %lu
2131The number of major faults the process has made which have
fea681da
MK
2132required loading a memory page from disk.
2133.TP
62e4a418
MK
2134(13) \fIcmajflt\fP \ %lu
2135The number of major faults that the process's
fea681da
MK
2136waited-for children have made.
2137.TP
62e4a418
MK
2138(14) \fIutime\fP \ %lu
2139Amount of time that this process has been scheduled in user mode,
7a017e24 2140measured in clock ticks (divide by
67914165 2141.IR sysconf(_SC_CLK_TCK) ).
a1c9dc59
MK
2142This includes guest time, \fIguest_time\fP
2143(time spent running a virtual CPU, see below),
2144so that applications that are not aware of the guest time field
2145do not lose that time from their calculations.
fea681da 2146.TP
62e4a418
MK
2147(15) \fIstime\fP \ %lu
2148Amount of time that this process has been scheduled in kernel mode,
7a017e24 2149measured in clock ticks (divide by
67914165 2150.IR sysconf(_SC_CLK_TCK) ).
fea681da 2151.TP
62e4a418
MK
2152(16) \fIcutime\fP \ %ld
2153Amount of time that this process's
7a017e24
MK
2154waited-for children have been scheduled in user mode,
2155measured in clock ticks (divide by
67914165 2156.IR sysconf(_SC_CLK_TCK) ).
c13182ef 2157(See also
fea681da 2158.BR times (2).)
a1c9dc59
MK
2159This includes guest time, \fIcguest_time\fP
2160(time spent running a virtual CPU, see below).
fea681da 2161.TP
62e4a418
MK
2162(17) \fIcstime\fP \ %ld
2163Amount of time that this process's
7a017e24
MK
2164waited-for children have been scheduled in kernel mode,
2165measured in clock ticks (divide by
67914165 2166.IR sysconf(_SC_CLK_TCK) ).
fea681da 2167.TP
62e4a418
MK
2168(18) \fIpriority\fP \ %ld
2169(Explanation for Linux 2.6)
59a40ed7
MK
2170For processes running a real-time scheduling policy
2171.RI ( policy
2172below; see
2173.BR sched_setscheduler (2)),
2174this is the negated scheduling priority, minus one;
2175that is, a number in the range \-2 to \-100,
2176corresponding to real-time priorities 1 to 99.
2177For processes running under a non-real-time scheduling policy,
2178this is the raw nice value
2179.RB ( setpriority (2))
2180as represented in the kernel.
2181The kernel stores nice values as numbers
2182in the range 0 (high) to 39 (low),
2183corresponding to the user-visible nice range of \-20 to 19.
2dad4c59 2184.IP
59a40ed7
MK
2185Before Linux 2.6, this was a scaled value based on
2186the scheduler weighting given to this process.
2187.\" And back in kernel 1.2 days things were different again.
fea681da 2188.TP
62e4a418
MK
2189(19) \fInice\fP \ %ld
2190The nice value (see
59a40ed7
MK
2191.BR setpriority (2)),
2192a value in the range 19 (low priority) to \-20 (high priority).
2193.\" Back in kernel 1.2 days things were different.
fea681da
MK
2194.\" .TP
2195.\" \fIcounter\fP %ld
2196.\" The current maximum size in jiffies of the process's next timeslice,
2197.\" or what is currently left of its current timeslice, if it is the
2198.\" currently running process.
2199.\" .TP
2200.\" \fItimeout\fP %u
2201.\" The time in jiffies of the process's next timeout.
0e94f77b 2202.\" timeout was removed sometime around 2.1/2.2
aa610245 2203.TP
62e4a418
MK
2204(20) \fInum_threads\fP \ %ld
2205Number of threads in this process (since Linux 2.6).
bb83d1b9 2206Before kernel 2.6, this field was hard coded to 0 as a placeholder
0e94f77b 2207for an earlier removed field.
fea681da 2208.TP
62e4a418
MK
2209(21) \fIitrealvalue\fP \ %ld
2210The time in jiffies before the next
8bd58774
MK
2211.B SIGALRM
2212is sent to the process due to an interval timer.
0e94f77b
MK
2213Since kernel 2.6.17, this field is no longer maintained,
2214and is hard coded as 0.
fea681da 2215.TP
62e4a418
MK
2216(22) \fIstarttime\fP \ %llu
2217The time the process started after system boot.
055024ed
MK
2218In kernels before Linux 2.6, this value was expressed in jiffies.
2219Since Linux 2.6, the value is expressed in clock ticks (divide by
2220.IR sysconf(_SC_CLK_TCK) ).
2dad4c59 2221.IP
62e4a418 2222The format for this field was %lu before Linux 2.6.
fea681da 2223.TP
62e4a418
MK
2224(23) \fIvsize\fP \ %lu
2225Virtual memory size in bytes.
fea681da 2226.TP
62e4a418
MK
2227(24) \fIrss\fP \ %ld
2228Resident Set Size: number of pages the process has in real memory.
c13182ef 2229This is just the pages which
5fab2e7c 2230count toward text, data, or stack space.
c13182ef 2231This does not include pages
fea681da
MK
2232which have not been demand-loaded in, or which are swapped out.
2233.TP
62e4a418
MK
2234(25) \fIrsslim\fP \ %lu
2235Current soft limit in bytes on the rss of the process;
59a40ed7
MK
2236see the description of
2237.B RLIMIT_RSS
2238in
2b5407af 2239.BR getrlimit (2).
fea681da 2240.TP
b02b4b74 2241(26) \fIstartcode\fP \ %lu \ [PT]
62e4a418 2242The address above which program text can run.
fea681da 2243.TP
b02b4b74 2244(27) \fIendcode\fP \ %lu \ [PT]
62e4a418 2245The address below which program text can run.
fea681da 2246.TP
b02b4b74 2247(28) \fIstartstack\fP \ %lu \ [PT]
62e4a418 2248The address of the start (i.e., bottom) of the stack.
fea681da 2249.TP
b02b4b74 2250(29) \fIkstkesp\fP \ %lu \ [PT]
62e4a418 2251The current value of ESP (stack pointer), as found in the
fea681da
MK
2252kernel stack page for the process.
2253.TP
b02b4b74 2254(30) \fIkstkeip\fP \ %lu \ [PT]
62e4a418 2255The current EIP (instruction pointer).
fea681da 2256.TP
62e4a418
MK
2257(31) \fIsignal\fP \ %lu
2258The bitmap of pending signals, displayed as a decimal number.
59a40ed7 2259Obsolete, because it does not provide information on real-time signals; use
69119dc7 2260.I /proc/[pid]/status
59a40ed7 2261instead.
fea681da 2262.TP
62e4a418
MK
2263(32) \fIblocked\fP \ %lu
2264The bitmap of blocked signals, displayed as a decimal number.
59a40ed7 2265Obsolete, because it does not provide information on real-time signals; use
69119dc7 2266.I /proc/[pid]/status
59a40ed7 2267instead.
fea681da 2268.TP
62e4a418
MK
2269(33) \fIsigignore\fP \ %lu
2270The bitmap of ignored signals, displayed as a decimal number.
59a40ed7 2271Obsolete, because it does not provide information on real-time signals; use
69119dc7 2272.I /proc/[pid]/status
59a40ed7 2273instead.
fea681da 2274.TP
62e4a418
MK
2275(34) \fIsigcatch\fP \ %lu
2276The bitmap of caught signals, displayed as a decimal number.
59a40ed7 2277Obsolete, because it does not provide information on real-time signals; use
69119dc7 2278.I /proc/[pid]/status
59a40ed7 2279instead.
fea681da 2280.TP
b02b4b74 2281(35) \fIwchan\fP \ %lu \ [PT]
62e4a418 2282This is the "channel" in which the process is waiting.
2054f761
MK
2283It is the address of a location in the kernel where the process is sleeping.
2284The corresponding symbolic name can be found in
2285.IR /proc/[pid]/wchan .
fea681da 2286.TP
62e4a418 2287(36) \fInswap\fP \ %lu
0633f951 2288.\" nswap was added in 2.0
4d9b6984 2289Number of pages swapped (not maintained).
fea681da 2290.TP
62e4a418 2291(37) \fIcnswap\fP \ %lu
0633f951 2292.\" cnswap was added in 2.0
4d9b6984 2293Cumulative \fInswap\fP for child processes (not maintained).
fea681da 2294.TP
62e4a418
MK
2295(38) \fIexit_signal\fP \ %d \ (since Linux 2.1.22)
2296Signal to be sent to parent when we die.
fea681da 2297.TP
62e4a418
MK
2298(39) \fIprocessor\fP \ %d \ (since Linux 2.2.8)
2299CPU number last executed on.
568105c6 2300.TP
62e4a418
MK
2301(40) \fIrt_priority\fP \ %u \ (since Linux 2.5.19)
2302Real-time scheduling priority, a number in the range 1 to 99 for
59a40ed7
MK
2303processes scheduled under a real-time policy,
2304or 0, for non-real-time processes (see
568105c6
MK
2305.BR sched_setscheduler (2)).
2306.TP
62e4a418
MK
2307(41) \fIpolicy\fP \ %u \ (since Linux 2.5.19)
2308Scheduling policy (see
568105c6 2309.BR sched_setscheduler (2)).
cd60dedd 2310Decode using the SCHED_* constants in
59a40ed7 2311.IR linux/sched.h .
2dad4c59 2312.IP
62e4a418 2313The format for this field was %lu before Linux 2.6.22.
167450d6 2314.TP
62e4a418
MK
2315(42) \fIdelayacct_blkio_ticks\fP \ %llu \ (since Linux 2.6.18)
2316Aggregated block I/O delays, measured in clock ticks (centiseconds).
14c06953 2317.TP
62e4a418
MK
2318(43) \fIguest_time\fP \ %lu \ (since Linux 2.6.24)
2319Guest time of the process (time spent running a virtual CPU
7a017e24 2320for a guest operating system), measured in clock ticks (divide by
67914165 2321.IR sysconf(_SC_CLK_TCK) ).
14c06953 2322.TP
62e4a418
MK
2323(44) \fIcguest_time\fP \ %ld \ (since Linux 2.6.24)
2324Guest time of the process's children, measured in clock ticks (divide by
67914165 2325.IR sysconf(_SC_CLK_TCK) ).
fea681da 2326.TP
b02b4b74 2327(45) \fIstart_data\fP \ %lu \ (since Linux 3.3) \ [PT]
0be30a54 2328.\" commit b3f7f573a20081910e34e99cbc91831f4f02f1ff
62e4a418 2329Address above which program initialized and
426bc8d7 2330uninitialized (BSS) data are placed.
12449ae3 2331.TP
b02b4b74 2332(46) \fIend_data\fP \ %lu \ (since Linux 3.3) \ [PT]
0be30a54 2333.\" commit b3f7f573a20081910e34e99cbc91831f4f02f1ff
62e4a418 2334Address below which program initialized and
426bc8d7 2335uninitialized (BSS) data are placed.
12449ae3 2336.TP
b02b4b74 2337(47) \fIstart_brk\fP \ %lu \ (since Linux 3.3) \ [PT]
0be30a54 2338.\" commit b3f7f573a20081910e34e99cbc91831f4f02f1ff
62e4a418 2339Address above which program heap can be expanded with
426bc8d7 2340.BR brk (2).
12449ae3 2341.TP
b02b4b74 2342(48) \fIarg_start\fP \ %lu \ (since Linux 3.5) \ [PT]
0be30a54 2343.\" commit 5b172087f99189416d5f47fd7ab5e6fb762a9ba3
62e4a418 2344Address above which program command-line arguments
426bc8d7
MK
2345.RI ( argv )
2346are placed.
12449ae3 2347.TP
b02b4b74 2348(49) \fIarg_end\fP \ %lu \ (since Linux 3.5) \ [PT]
0be30a54 2349.\" commit 5b172087f99189416d5f47fd7ab5e6fb762a9ba3
62e4a418 2350Address below program command-line arguments
426bc8d7
MK
2351.RI ( argv )
2352are placed.
12449ae3 2353.TP
b02b4b74 2354(50) \fIenv_start\fP \ %lu \ (since Linux 3.5) \ [PT]
0be30a54 2355.\" commit 5b172087f99189416d5f47fd7ab5e6fb762a9ba3
62e4a418 2356Address above which program environment is placed.
12449ae3 2357.TP
b02b4b74 2358(51) \fIenv_end\fP \ %lu \ (since Linux 3.5) \ [PT]
0be30a54 2359.\" commit 5b172087f99189416d5f47fd7ab5e6fb762a9ba3
62e4a418 2360Address below which program environment is placed.
12449ae3 2361.TP
b02b4b74 2362(52) \fIexit_code\fP \ %d \ (since Linux 3.5) \ [PT]
0be30a54 2363.\" commit 5b172087f99189416d5f47fd7ab5e6fb762a9ba3
62e4a418 2364The thread's exit status in the form reported by
426bc8d7 2365.BR waitpid (2).
12449ae3 2366.RE
2367.TP
69119dc7 2368.I /proc/[pid]/statm
59a40ed7 2369Provides information about memory usage, measured in pages.
c13182ef 2370The columns are:
37d5e699 2371.IP
a08ea57c 2372.in +4n
37d5e699 2373.EX
cb42fb56 2374size (1) total program size
69119dc7 2375 (same as VmSize in \fI/proc/[pid]/status\fP)
cb42fb56 2376resident (2) resident set size
69119dc7 2377 (same as VmRSS in \fI/proc/[pid]/status\fP)
4e6fa352
MK
2378shared (3) number of resident shared pages (i.e., backed by a file)
2379 (same as RssFile+RssShmem in \fI/proc/[pid]/status\fP)
cb42fb56 2380text (4) text (code)
59a40ed7 2381.\" (not including libs; broken, includes data segment)
d133b9b3 2382lib (5) library (unused since Linux 2.6; always 0)
cb42fb56 2383data (6) data + stack
59a40ed7 2384.\" (including libs; broken, includes library text)
d133b9b3 2385dt (7) dirty pages (unused since Linux 2.6; always 0)
37d5e699 2386.EE
a08ea57c 2387.in
fea681da 2388.TP
69119dc7 2389.I /proc/[pid]/status
fea681da 2390Provides much of the information in
69119dc7 2391.I /proc/[pid]/stat
fea681da 2392and
69119dc7 2393.I /proc/[pid]/statm
fea681da 2394in a format that's easier for humans to parse.
16b5f7ba 2395Here's an example:
37d5e699 2396.IP
16b5f7ba 2397.in +4n
37d5e699 2398.EX
b43a3b30 2399.RB "$" " cat /proc/$$/status"
16b5f7ba 2400Name: bash
a79343e9 2401Umask: 0022
16b5f7ba 2402State: S (sleeping)
aac0b30f 2403Tgid: 17248
2d2dfb69 2404Ngid: 0
aac0b30f
MK
2405Pid: 17248
2406PPid: 17200
16b5f7ba
MK
2407TracerPid: 0
2408Uid: 1000 1000 1000 1000
2409Gid: 100 100 100 100
2410FDSize: 256
2411Groups: 16 33 100
aac0b30f
MK
2412NStgid: 17248
2413NSpid: 17248
2414NSpgid: 17248
2415NSsid: 17200
06b7cee0
MK
2416VmPeak: 131168 kB
2417VmSize: 131168 kB
2418VmLck: 0 kB
2419VmPin: 0 kB
2420VmHWM: 13484 kB
2421VmRSS: 13484 kB
e546617e
MK
2422RssAnon: 10264 kB
2423RssFile: 3220 kB
2424RssShmem: 0 kB
06b7cee0
MK
2425VmData: 10332 kB
2426VmStk: 136 kB
2427VmExe: 992 kB
2428VmLib: 2104 kB
2429VmPTE: 76 kB
2430VmPMD: 12 kB
2431VmSwap: 0 kB
4084d612 2432HugetlbPages: 0 kB # 4.4
4641c596 2433CoreDumping: 0 # 4.15
16b5f7ba
MK
2434Threads: 1
2435SigQ: 0/3067
2436SigPnd: 0000000000000000
2437ShdPnd: 0000000000000000
2438SigBlk: 0000000000010000
2439SigIgn: 0000000000384004
2440SigCgt: 000000004b813efb
2441CapInh: 0000000000000000
2442CapPrm: 0000000000000000
2443CapEff: 0000000000000000
2444CapBnd: ffffffffffffffff
6112ea97 2445CapAmb: 0000000000000000
6c0ed873 2446NoNewPrivs: 0
039b6546 2447Seccomp: 0
bf8fc275 2448Speculation_Store_Bypass: vulnerable
16b5f7ba
MK
2449Cpus_allowed: 00000001
2450Cpus_allowed_list: 0
2451Mems_allowed: 1
2452Mems_allowed_list: 0
2453voluntary_ctxt_switches: 150
2454nonvoluntary_ctxt_switches: 545
37d5e699 2455.EE
16b5f7ba
MK
2456.in
2457.IP
2458The fields are as follows:
2459.RS
2460.IP * 2
2461.IR Name :
2462Command run by this process.
2463.IP *
a79343e9 2464.IR Umask :
53473996
MK
2465Process umask, expressed in octal with a leading zero; see
2466.BR umask (2).
a79343e9
MK
2467(Since Linux 4.7.)
2468.IP *
16b5f7ba 2469.IR State :
4175f999
MK
2470Current state of the process.
2471One of
16b5f7ba
MK
2472"R (running)",
2473"S (sleeping)",
2474"D (disk sleep)",
2475"T (stopped)",
2476"T (tracing stop)",
2477"Z (zombie)",
2478or
2479"X (dead)".
2480.IP *
2481.IR Tgid :
2482Thread group ID (i.e., Process ID).
2483.IP *
2d2dfb69
MK
2484.IR Ngid :
2485NUMA group ID (0 if none; since Linux 3.13).
2486.IP *
16b5f7ba
MK
2487.IR Pid :
2488Thread ID (see
2489.BR gettid (2)).
2490.IP *
a1bc91d5
MK
2491.IR PPid :
2492PID of parent process.
2493.IP *
16b5f7ba
MK
2494.IR TracerPid :
2495PID of process tracing this process (0 if not being traced).
2496.IP *
2497.IR Uid ", " Gid :
9ee4a2b6 2498Real, effective, saved set, and filesystem UIDs (GIDs).
16b5f7ba
MK
2499.IP *
2500.IR FDSize :
2501Number of file descriptor slots currently allocated.
2502.IP *
2503.IR Groups :
2504Supplementary group list.
2505.IP *
b84a64f4 2506.IR NStgid :
aac0b30f
MK
2507Thread group ID (i.e., PID) in each of the PID namespaces of which
2508.I [pid]
2509is a member.
2510The leftmost entry shows the value with respect to the PID namespace
0aae4092
KF
2511of the process that mounted this procfs (or the root namespace
2512if mounted by the kernel),
aac0b30f
MK
2513followed by the value in successively nested inner namespaces.
2514.\" commit e4bc33245124db69b74a6d853ac76c2976f472d5
2515(Since Linux 4.1.)
2516.IP *
b84a64f4 2517.IR NSpid :
aac0b30f
MK
2518Thread ID in each of the PID namespaces of which
2519.I [pid]
2520is a member.
2521The fields are ordered as for
2522.IR NStgid .
2523(Since Linux 4.1.)
2524.IP *
ecc9535d 2525.IR NSpgid :
aac0b30f
MK
2526Process group ID in each of the PID namespaces of which
2527.I [pid]
2528is a member.
2529The fields are ordered as for
2530.IR NStgid .
2531(Since Linux 4.1.)
2532.IP *
ecc9535d 2533.IR NSsid :
aac0b30f
MK
2534descendant namespace session ID hierarchy
2535Session ID in each of the PID namespaces of which
2536.I [pid]
2537is a member.
2538The fields are ordered as for
2539.IR NStgid .
2540(Since Linux 4.1.)
2541.IP *
16b5f7ba
MK
2542.IR VmPeak :
2543Peak virtual memory size.
2544.IP *
2545.IR VmSize :
2546Virtual memory size.
2547.IP *
2548.IR VmLck :
fde39195 2549Locked memory size (see
f8bfb68e 2550.BR mlock (2)).
16b5f7ba 2551.IP *
15789039
TY
2552.IR VmPin :
2553Pinned memory size
2554.\" commit bc3e53f682d93df677dbd5006a404722b3adfe18
2555(since Linux 3.2).
2556These are pages that can't be moved because something needs to
2557directly access physical memory.
2558.IP *
16b5f7ba
MK
2559.IR VmHWM :
2560Peak resident set size ("high water mark").
2561.IP *
2562.IR VmRSS :
2563Resident set size.
e546617e
MK
2564Note that the value here is the sum of
2565.IR RssAnon ,
2566.IR RssFile ,
2567and
2568.IR RssShmem .
2569.IP *
2570.IR RssAnon :
2571Size of resident anonymous memory.
2572.\" commit bf9683d6990589390b5178dafe8fd06808869293
2573(since Linux 4.5).
2574.IP *
2575.IR RssFile :
2576Size of resident file mappings.
2577.\" commit bf9683d6990589390b5178dafe8fd06808869293
2578(since Linux 4.5).
2579.IP *
2580.IR RssShmem :
78230722 2581Size of resident shared memory (includes System V shared memory,
4e07c70f
MK
2582mappings from
2583.BR tmpfs (5),
2584and shared anonymous mappings).
e546617e
MK
2585.\" commit bf9683d6990589390b5178dafe8fd06808869293
2586(since Linux 4.5).
16b5f7ba
MK
2587.IP *
2588.IR VmData ", " VmStk ", " VmExe :
2589Size of data, stack, and text segments.
2590.IP *
2591.IR VmLib :
2592Shared library code size.
2593.IP *
2594.IR VmPTE :
2595Page table entries size (since Linux 2.6.10).
2596.IP *
e28af9cd
MK
2597.IR VmPMD :
2598.\" commit dc6c9a35b66b520cf67e05d8ca60ebecad3b0479
fcfac78d 2599Size of second-level page tables (added in Linux 4.0; removed in Linux 4.15).
e28af9cd 2600.IP *
ac4b0eb3 2601.IR VmSwap :
1ddc1665 2602.\" commit b084d4353ff99d824d3bc5a5c2c22c70b1fba722
fce21149
MK
2603Swapped-out virtual memory size by anonymous private pages;
2604shmem swap usage is not included (since Linux 2.6.34).
49f6dda7 2605.IP *
4084d612 2606.IR HugetlbPages :
422425ff 2607Size of hugetlb memory portions
4084d612
MK
2608.\" commit 5d317b2b6536592a9b51fe65faed43d65ca9158e
2609(since Linux 4.4).
2610.IP *
4641c596
MK
2611.IR CoreDumping :
2612Contains the value 1 if the process is currently dumping core,
2613and 0 if it is not
2614.\" commit c643401218be0f4ab3522e0c0a63016596d6e9ca
2615(since Linux 4.15).
2616This information can be used by a monitoring process to avoid killing
2617a process that is currently dumping core,
2618which could result in a corrupted core dump file.
2619.IP *
16b5f7ba
MK
2620.IR Threads :
2621Number of threads in process containing this thread.
2622.IP *
6ee625eb
MK
2623.IR SigQ :
2624This field contains two slash-separated numbers that relate to
2625queued signals for the real user ID of this process.
2626The first of these is the number of currently queued
2627signals for this real user ID, and the second is the
2628resource limit on the number of queued signals for this process
2629(see the description of
2630.BR RLIMIT_SIGPENDING
2631in
2632.BR getrlimit (2)).
2633.IP *
16b5f7ba
MK
2634.IR SigPnd ", " ShdPnd :
2635Number of signals pending for thread and for process as a whole (see
2636.BR pthreads (7)
2637and
2638.BR signal (7)).
2639.IP *
2640.IR SigBlk ", " SigIgn ", " SigCgt :
2641Masks indicating signals being blocked, ignored, and caught (see
2642.BR signal (7)).
2643.IP *
2644.IR CapInh ", " CapPrm ", " CapEff :
2645Masks of capabilities enabled in inheritable, permitted, and effective sets
2646(see
2647.BR capabilities (7)).
2648.IP *
2649.IR CapBnd :
2650Capability Bounding set
7e07d950 2651(since Linux 2.6.26, see
16b5f7ba
MK
2652.BR capabilities (7)).
2653.IP *
6112ea97
MK
2654.IR CapAmb :
2655Ambient capability set
2656(since Linux 4.3, see
2657.BR capabilities (7)).
2658.IP *
6c0ed873
MK
2659.IR NoNewPrivs :
2660.\" commit af884cd4a5ae62fcf5e321fecf0ec1014730353d
2661Value of the
2662.I no_new_privs
2663bit
2664(since Linux 4.10, see
2665.BR prctl (2)).
2666.IP *
039b6546
MK
2667.IR Seccomp :
2668.\" commit 2f4b3bf6b2318cfaa177ec5a802f4d8d6afbd816
2669Seccomp mode of the process
2670(since Linux 3.8, see
2671.BR seccomp (2)).
26720 means
2673.BR SECCOMP_MODE_DISABLED ;
26741 means
2675.BR SECCOMP_MODE_STRICT ;
26762 means
2677.BR SECCOMP_MODE_FILTER .
2678This field is provided only if the kernel was built with the
2679.BR CONFIG_SECCOMP
2680kernel configuration option enabled.
2681.IP *
bf8fc275
NF
2682.IR Speculation_Store_Bypass :
2683.\" commit fae1fa0fc6cca8beee3ab8ed71d54f9a78fa3f64
2684Speculation flaw mitigation state
2685(since Linux 4.17, see
2686.BR prctl (2)).
2687.IP *
16b5f7ba
MK
2688.IR Cpus_allowed :
2689Mask of CPUs on which this process may run
2690(since Linux 2.6.24, see
2691.BR cpuset (7)).
2692.IP *
2693.IR Cpus_allowed_list :
2694Same as previous, but in "list format"
2695(since Linux 2.6.26, see
2696.BR cpuset (7)).
2697.IP *
2698.IR Mems_allowed :
2699Mask of memory nodes allowed to this process
2700(since Linux 2.6.24, see
2701.BR cpuset (7)).
2702.IP *
2703.IR Mems_allowed_list :
2704Same as previous, but in "list format"
2705(since Linux 2.6.26, see
2706.BR cpuset (7)).
2707.IP *
7c82878a 2708.IR voluntary_ctxt_switches ", " nonvoluntary_ctxt_switches :
16b5f7ba
MK
2709Number of voluntary and involuntary context switches (since Linux 2.6.23).
2710.RE
afb7b014
MK
2711.TP
2712.IR /proc/[pid]/syscall " (since Linux 2.6.27)"
2713.\" commit ebcb67341fee34061430f3367f2e507e52ee051b
2714This file exposes the system call number and argument registers for the
2715system call currently being executed by the process,
2716followed by the values of the stack pointer and program counter registers.
2717The values of all six argument registers are exposed,
2718although most system calls use fewer registers.
2dad4c59 2719.IP
afb7b014 2720If the process is blocked, but not in a system call,
1fb61947 2721then the file displays \-1 in place of the system call number,
afb7b014 2722followed by just the values of the stack pointer and program counter.
64fcb6e1 2723If process is not blocked, then the file contains just the string "running".
2dad4c59 2724.IP
afb7b014
MK
2725This file is present only if the kernel was configured with
2726.BR CONFIG_HAVE_ARCH_TRACEHOOK .
2dad4c59 2727.IP
4834ae91
MK
2728Permission to access this file is governed by a ptrace access mode
2729.B PTRACE_MODE_ATTACH_FSCREDS
2730check; see
2731.BR ptrace (2).
fea681da 2732.TP
69119dc7 2733.IR /proc/[pid]/task " (since Linux 2.6.0-test6)"
afcaf646
MK
2734This is a directory that contains one subdirectory
2735for each thread in the process.
69119dc7
MK
2736The name of each subdirectory is the numerical thread ID
2737.RI ( [tid] )
2738of the thread (see
afcaf646
MK
2739.BR gettid (2)).
2740Within each of these subdirectories, there is a set of
2741files with the same names and contents as under the
69119dc7 2742.I /proc/[pid]
afcaf646
MK
2743directories.
2744For attributes that are shared by all threads, the contents for
2745each of the files under the
69119dc7 2746.I task/[tid]
afcaf646 2747subdirectories will be the same as in the corresponding
c13182ef 2748file in the parent
69119dc7 2749.I /proc/[pid]
afcaf646 2750directory
c13182ef 2751(e.g., in a multithreaded process, all of the
69119dc7 2752.I task/[tid]/cwd
c13182ef 2753files will have the same value as the
69119dc7 2754.I /proc/[pid]/cwd
c13182ef 2755file in the parent directory, since all of the threads in a process
afcaf646
MK
2756share a working directory).
2757For attributes that are distinct for each thread,
c13182ef 2758the corresponding files under
69119dc7 2759.I task/[tid]
afcaf646 2760may have different values (e.g., various fields in each of the
69119dc7 2761.I task/[tid]/status
4a40c703
JH
2762files may be different for each thread),
2763.\" in particular: "children" :/
2764or they might not exist in
2765.I /proc/[pid]
2766at all.
afcaf646
MK
2767.\" The following was still true as at kernel 2.6.13
2768In a multithreaded process, the contents of the
69119dc7 2769.I /proc/[pid]/task
c13182ef 2770directory are not available if the main thread has already terminated
afcaf646
MK
2771(typically by calling
2772.BR pthread_exit (3)).
2dad4c59 2773.IP
4a40c703
JH
2774.TP
2775.IR /proc/[pid]/task/[tid]/children " (since Linux 3.5)"
2776.\" commit 818411616baf46ceba0cff6f05af3a9b294734f7
2777A space-separated list of child tasks of this task.
2778Each child task is represented by its TID.
2dad4c59 2779.IP
4a40c703 2780.\" see comments in get_children_pid() in fs/proc/array.c
45dd5092
MK
2781This option is intended for use by the checkpoint-restore (CRIU) system,
2782and reliably provides a list of children only if all of the child processes
2783are stopped or frozen.
2784It does not work properly if children of the target task exit while
4a40c703 2785the file is being read!
45dd5092 2786Exiting children may cause non-exiting children to be omitted from the list.
4a40c703 2787This makes this interface even more unreliable than classic PID-based
45dd5092
MK
2788approaches if the inspected task and its children aren't frozen,
2789and most code should probably not use this interface.
2dad4c59 2790.IP
7ded2db4
MK
2791Until Linux 4.2, the presence of this file was governed by the
2792.B CONFIG_CHECKPOINT_RESTORE
2793kernel configuration option.
2794Since Linux 4.2,
2795.\" commit 2e13ba54a2682eea24918b87ad3edf70c2cf085b
ae34c521 2796it is governed by the
7ded2db4
MK
2797.B CONFIG_PROC_CHILDREN
2798option.
afcaf646 2799.TP
1509ca0e
MK
2800.IR /proc/[pid]/timers " (since Linux 3.10)"
2801.\" commit 5ed67f05f66c41e39880a6d61358438a25f9fee5
2802.\" commit 48f6a7a511ef8823fdff39afee0320092d43a8a0
2803A list of the POSIX timers for this process.
93691c1e 2804Each timer is listed with a line that starts with the string "ID:".
1509ca0e 2805For example:
2dad4c59 2806.IP
1509ca0e 2807.in +4n
37d5e699 2808.EX
1509ca0e
MK
2809ID: 1
2810signal: 60/00007fff86e452a8
2811notify: signal/pid.2634
2812ClockID: 0
2813ID: 0
2814signal: 60/00007fff86e452a8
2815notify: signal/pid.2634
2816ClockID: 1
37d5e699 2817.EE
1509ca0e 2818.in
2dad4c59 2819.IP
1509ca0e
MK
2820The lines shown for each timer have the following meanings:
2821.RS
2822.TP
2823.I ID
2824The ID for this timer.
2825This is not the same as the timer ID returned by
2826.BR timer_create (2);
2827rather, it is the same kernel-internal ID that is available via the
2828.I si_timerid
2829field of the
2830.IR siginfo_t
2831structure (see
2832.BR sigaction (2)).
2833.TP
2834.I signal
2835This is the signal number that this timer uses to deliver notifications
2836followed by a slash, and then the
7f1ea8fb 2837.I sigev_value
1509ca0e
MK
2838value supplied to the signal handler.
2839Valid only for timers that notify via a signal.
2840.TP
2841.I notify
2842The part before the slash specifies the mechanism
2843that this timer uses to deliver notifications,
2844and is one of "thread", "signal", or "none".
2845Immediately following the slash is either the string "tid" for timers
2846with
2847.B SIGEV_THREAD_ID
2848notification, or "pid" for timers that notify by other mechanisms.
dbe6f88b
MK
2849Following the "." is the PID of the process
2850(or the kernel thread ID of the thread) that will be delivered
1509ca0e
MK
2851a signal if the timer delivers notifications via a signal.
2852.TP
2853.I ClockID
2854This field identifies the clock that the timer uses for measuring time.
2855For most clocks, this is a number that matches one of the user-space
2856.BR CLOCK_*
9d54c087 2857constants exposed via
1509ca0e
MK
2858.IR <time.h> .
2859.B CLOCK_PROCESS_CPUTIME_ID
9bc87ed0 2860timers display with a value of \-6
1509ca0e
MK
2861in this field.
2862.B CLOCK_THREAD_CPUTIME_ID
9bc87ed0 2863timers display with a value of \-2
1509ca0e
MK
2864in this field.
2865.RE
5734da6d
MK
2866.IP
2867This file is available only when the kernel was configured with
2868.BR CONFIG_CHECKPOINT_RESTORE .
1509ca0e 2869.TP
11f60142
MK
2870.IR /proc/[pid]/timerslack_ns " (since Linux 4.6)"
2871.\" commit da8b44d5a9f8bf26da637b7336508ca534d6b319
2872.\" commit 5de23d435e88996b1efe0e2cebe242074ce67c9e
2873This file exposes the process's "current" timer slack value,
2874expressed in nanoseconds.
2875The file is writable,
2876allowing the process's timer slack value to be changed.
2877Writing 0 to this file resets the "current" timer slack to the
2878"default" timer slack value.
2879For further details, see the discussion of
2880.BR PR_SET_TIMERSLACK
2881in
2882.BR prctl (2).
2dad4c59 2883.IP
5daae264
MK
2884Initially,
2885permission to access this file was governed by a ptrace access mode
a62e0e01 2886.B PTRACE_MODE_ATTACH_FSCREDS
5daae264
MK
2887check (see
2888.BR ptrace (2)).
2889However, this was subsequently deemed too strict a requirement
2890(and had the side effect that requiring a process to have the
2891.B CAP_SYS_PTRACE
2892capability would also allow it to view and change any process's memory).
2893Therefore, since Linux 4.9,
2894.\" commit 7abbaf94049914f074306d960b0f968ffe52e59f
2895only the (weaker)
2896.B CAP_SYS_NICE
2897capability is required to access this file.
11f60142 2898.TP
b1aad373
MK
2899.IR /proc/[pid]/uid_map ", " /proc/[pid]/gid_map " (since Linux 3.5)"
2900See
2901.BR user_namespaces (7).
2902.TP
2903.IR /proc/[pid]/wchan " (since Linux 2.6.0)"
2904The symbolic name corresponding to the location
2905in the kernel where the process is sleeping.
2dad4c59 2906.IP
82664739
MK
2907Permission to access this file is governed by a ptrace access mode
2908.B PTRACE_MODE_READ_FSCREDS
2909check; see
2910.BR ptrace (2).
b1aad373 2911.TP
01df7b70
MK
2912.IR /proc/[tid]
2913There is a numerical subdirectory for each running thread
2914that is not a thread group leader
2915(i.e., a thread whose thread ID is not the same as its process ID);
2916the subdirectory is named by the thread ID.
2917Each one of these subdirectories contains files and subdirectories
2918exposing information about the thread with the thread ID
2919.IR tid .
2920The contents of these directories are the same as the corresponding
71190ded 2921.IR /proc/[pid]/task/[tid]
01df7b70
MK
2922directories.
2923.IP
2924The
2925.I /proc/[tid]
2926subdirectories are
2927.I not
2928visible when iterating through
2929.I /proc
2930with
2931.BR getdents (2)
2932(and thus are
2933.I not
2934visible when one uses
2935.BR ls (1)
2936to view the contents of
2937.IR /proc ).
37cd58d2
MK
2938However, the pathnames of these directories are visible to
2939(i.e., usable as arguments in)
2940system calls that operate on pathnames.
01df7b70 2941.TP
b1aad373
MK
2942.I /proc/apm
2943Advanced power management version and battery information when
2944.B CONFIG_APM
2945is defined at kernel compilation time.
2946.TP
2947.I /proc/buddyinfo
2948This file contains information which is used for diagnosing memory
2949fragmentation issues.
2950Each line starts with the identification of the node and the name
2951of the zone which together identify a memory region
2952This is then
2953followed by the count of available chunks of a certain order in
2954which these zones are split.
2955The size in bytes of a certain order is given by the formula:
2dad4c59 2956.IP
b1aad373 2957 (2^order)\ *\ PAGE_SIZE
2dad4c59 2958.IP
b1aad373
MK
2959The binary buddy allocator algorithm inside the kernel will split
2960one chunk into two chunks of a smaller order (thus with half the
2961size) or combine two contiguous chunks into one larger chunk of
2962a higher order (thus with double the size) to satisfy allocation
2963requests and to counter memory fragmentation.
2964The order matches the column number, when starting to count at zero.
2dad4c59 2965.IP
b5b0d21e 2966For example on an x86-64 system:
2dad4c59 2967.IP
b1aad373 2968.in -12n
37d5e699 2969.EX
b1aad373
MK
2970Node 0, zone DMA 1 1 1 0 2 1 1 0 1 1 3
2971Node 0, zone DMA32 65 47 4 81 52 28 13 10 5 1 404
2972Node 0, zone Normal 216 55 189 101 84 38 37 27 5 3 587
37d5e699 2973.EE
b1aad373 2974.in
2dad4c59 2975.IP
b1aad373
MK
2976In this example, there is one node containing three zones and there
2977are 11 different chunk sizes.
2978If the page size is 4 kilobytes, then the first zone called
2979.I DMA
2980(on x86 the first 16 megabyte of memory) has 1 chunk of 4 kilobytes
2981(order 0) available and has 3 chunks of 4 megabytes (order 10) available.
2dad4c59 2982.IP
b1aad373
MK
2983If the memory is heavily fragmented, the counters for higher
2984order chunks will be zero and allocation of large contiguous areas
2985will fail.
2dad4c59 2986.IP
b1aad373
MK
2987Further information about the zones can be found in
2988.IR /proc/zoneinfo .
2989.TP
2990.I /proc/bus
2991Contains subdirectories for installed busses.
2992.TP
2993.I /proc/bus/pccard
2994Subdirectory for PCMCIA devices when
2995.B CONFIG_PCMCIA
2996is set at kernel compilation time.
2997.TP
fea681da
MK
2998.I /proc/bus/pccard/drivers
2999.TP
3000.I /proc/bus/pci
c13182ef 3001Contains various bus subdirectories and pseudo-files containing
59a40ed7 3002information about PCI busses, installed devices, and device
c13182ef
MK
3003drivers.
3004Some of these files are not ASCII.
fea681da
MK
3005.TP
3006.I /proc/bus/pci/devices
59a40ed7 3007Information about PCI devices.
c13182ef 3008They may be accessed through
fea681da
MK
3009.BR lspci (8)
3010and
3011.BR setpci (8).
3012.TP
12b23dfe
MK
3013.IR /proc/cgroups " (since Linux 2.6.24)"
3014See
3015.BR cgroups (7).
3016.TP
fea681da 3017.I /proc/cmdline
c13182ef
MK
3018Arguments passed to the Linux kernel at boot time.
3019Often done via a boot manager such as
59a40ed7
MK
3020.BR lilo (8)
3021or
3022.BR grub (8).
f6e524c4
MK
3023.TP
3024.IR /proc/config.gz " (since Linux 2.6)"
3025This file exposes the configuration options that were used
c3d9780d 3026to build the currently running kernel,
f6e524c4
MK
3027in the same format as they would be shown in the
3028.I .config
3029file that resulted when configuring the kernel (using
3030.IR "make xconfig" ,
3031.IR "make config" ,
3032or similar).
3033The file contents are compressed; view or search them using
f78ed33a
MK
3034.BR zcat (1)
3035and
3036.BR zgrep (1).
f6e524c4 3037As long as no changes have been made to the following file,
250e01ec
MK
3038the contents of
3039.I /proc/config.gz
37d5e699
MK
3040are the same as those provided by:
3041.IP
f6e524c4 3042.in +4n
37d5e699 3043.EX
c3074d70 3044cat /lib/modules/$(uname \-r)/build/.config
37d5e699 3045.EE
f6e524c4 3046.in
250e01ec
MK
3047.IP
3048.I /proc/config.gz
90878f7c 3049is provided only if the kernel is configured with
250e01ec 3050.BR CONFIG_IKCONFIG_PROC .
fea681da 3051.TP
577c0e20
MK
3052.I /proc/crypto
3053A list of the ciphers provided by the kernel crypto API.
3054For details, see the kernel
3055.I "Linux Kernel Crypto API"
3056documentation available under the kernel source directory
e94de168
ES
3057.I Documentation/crypto/
3058.\" commit 3b72c814a8e8cd638e1ba0da4dfce501e9dff5af
3059(or
3060.I Documentation/DocBook
3061before 4.10;
3062the documentation can be built using a command such as
577c0e20 3063.IR "make htmldocs"
e94de168 3064in the root directory of the kernel source tree).
577c0e20 3065.TP
fea681da
MK
3066.I /proc/cpuinfo
3067This is a collection of CPU and system architecture dependent items,
3068for each supported architecture a different list.
3069Two common entries are \fIprocessor\fP which gives CPU number and
c13182ef
MK
3070\fIbogomips\fP; a system constant that is calculated
3071during kernel initialization.
3072SMP machines have information for
fea681da 3073each CPU.
a091f002
MK
3074The
3075.BR lscpu (1)
3076command gathers its information from this file.
fea681da
MK
3077.TP
3078.I /proc/devices
c13182ef
MK
3079Text listing of major numbers and device groups.
3080This can be used by MAKEDEV scripts for consistency with the kernel.
fea681da
MK
3081.TP
3082.IR /proc/diskstats " (since Linux 2.5.69)"
3083This file contains disk I/O statistics for each disk device.
66a9882e 3084See the Linux kernel source file
fea681da
MK
3085.I Documentation/iostats.txt
3086for further information.
3087.TP
3088.I /proc/dma
c13182ef 3089This is a list of the registered \fIISA\fP DMA (direct memory access)
fea681da
MK
3090channels in use.
3091.TP
3092.I /proc/driver
3093Empty subdirectory.
3094.TP
3095.I /proc/execdomains
3096List of the execution domains (ABI personalities).
3097.TP
3098.I /proc/fb
097585ed
MK
3099Frame buffer information when
3100.B CONFIG_FB
3101is defined during kernel compilation.
fea681da
MK
3102.TP
3103.I /proc/filesystems
9ee4a2b6
MK
3104A text listing of the filesystems which are supported by the kernel,
3105namely filesystems which were compiled into the kernel or whose kernel
6387216b
MK
3106modules are currently loaded.
3107(See also
fb477da2 3108.BR filesystems (5).)
9ee4a2b6 3109If a filesystem is marked with "nodev",
809d0164 3110this means that it does not require a block device to be mounted
9ee4a2b6 3111(e.g., virtual filesystem, network filesystem).
2dad4c59 3112.IP
809d0164
MK
3113Incidentally, this file may be used by
3114.BR mount (8)
9ee4a2b6
MK
3115when no filesystem is specified and it didn't manage to determine the
3116filesystem type.
3117Then filesystems contained in this file are tried
809d0164 3118(excepted those that are marked with "nodev").
fea681da
MK
3119.TP
3120.I /proc/fs
df352acc 3121.\" FIXME Much more needs to be said about /proc/fs
91085d85 3122.\"
df352acc
MK
3123Contains subdirectories that in turn contain files
3124with information about (certain) mounted filesystems.
fea681da
MK
3125.TP
3126.I /proc/ide
3127This directory
59a40ed7
MK
3128exists on systems with the IDE bus.
3129There are directories for each IDE channel and attached device.
c13182ef 3130Files include:
2dad4c59 3131.IP
a08ea57c 3132.in +4n
37d5e699 3133.EX
fea681da
MK
3134cache buffer size in KB
3135capacity number of sectors
3136driver driver version
3137geometry physical and logical geometry
9fdfa163 3138identify in hexadecimal
fea681da
MK
3139media media type
3140model manufacturer's model number
3141settings drive settings
9fdfa163
MK
3142smart_thresholds in hexadecimal
3143smart_values in hexadecimal
37d5e699 3144.EE
a08ea57c 3145.in
2dad4c59 3146.IP
c13182ef 3147The
fea681da
MK
3148.BR hdparm (8)
3149utility provides access to this information in a friendly format.
3150.TP
3151.I /proc/interrupts
23ec6ff0
MK
3152This is used to record the number of interrupts per CPU per IO device.
3153Since Linux 2.6.24,
9ea5bc66 3154for the i386 and x86-64 architectures, at least, this also includes
23ec6ff0
MK
3155interrupts internal to the system (that is, not associated with a device
3156as such), such as NMI (nonmaskable interrupt), LOC (local timer interrupt),
3157and for SMP systems, TLB (TLB flush interrupt), RES (rescheduling
3158interrupt), CAL (remote function call interrupt), and possibly others.
3159Very easy to read formatting, done in ASCII.
fea681da
MK
3160.TP
3161.I /proc/iomem
3162I/O memory map in Linux 2.4.
3163.TP
3164.I /proc/ioports
c13182ef 3165This is a list of currently registered Input-Output port regions that
fea681da
MK
3166are in use.
3167.TP
3168.IR /proc/kallsyms " (since Linux 2.5.71)"
3169This holds the kernel exported symbol definitions used by the
3170.BR modules (X)
3171tools to dynamically link and bind loadable modules.
3172In Linux 2.5.47 and earlier, a similar file with slightly different syntax
3173was named
3174.IR ksyms .
3175.TP
3176.I /proc/kcore
3177This file represents the physical memory of the system and is stored
c13182ef
MK
3178in the ELF core file format.
3179With this pseudo-file, and an unstripped
9a67332e
MK
3180kernel
3181.RI ( /usr/src/linux/vmlinux )
3182binary, GDB can be used to
fea681da 3183examine the current state of any kernel data structures.
2dad4c59 3184.IP
fea681da 3185The total length of the file is the size of physical memory (RAM) plus
ee8655b5 31864\ KiB.
fea681da 3187.TP
653836fb
MK
3188.IR /proc/keys " (since Linux 2.6.10)"
3189See
3190.BR keyrings (7).
3191.TP
3192.IR /proc/key-users " (since Linux 2.6.10)"
3193See
3194.BR keyrings (7).
3195.TP
fea681da
MK
3196.I /proc/kmsg
3197This file can be used instead of the
3198.BR syslog (2)
c13182ef
MK
3199system call to read kernel messages.
3200A process must have superuser
fea681da 3201privileges to read this file, and only one process should read this
c13182ef
MK
3202file.
3203This file should not be read if a syslog process is running
fea681da
MK
3204which uses the
3205.BR syslog (2)
3206system call facility to log kernel messages.
2dad4c59 3207.IP
fea681da 3208Information in this file is retrieved with the
c4517613 3209.BR dmesg (1)
fea681da
MK
3210program.
3211.TP
55d68a94 3212.IR /proc/kpagecgroup " (since Linux 4.3)"
0e462d71 3213.\" commit 80ae2fdceba8313b0433f899bdd9c6c463291a17
55d68a94
OE
3214This file contains a 64-bit inode number of
3215the memory cgroup each page is charged to,
3216indexed by page frame number (see the discussion of
3217.IR /proc/[pid]/pagemap ).
3218.IP
3219The
3220.IR /proc/kpagecgroup
3221file is present only if the
3222.B CONFIG_MEMCG
3223kernel configuration option is enabled.
3224.TP
ff56ac8b
MK
3225.IR /proc/kpagecount " (since Linux 2.6.25)"
3226This file contains a 64-bit count of the number of
3227times each physical page frame is mapped,
3228indexed by page frame number (see the discussion of
3229.IR /proc/[pid]/pagemap ).
3230.IP
3231The
3232.IR /proc/kpagecount
3233file is present only if the
3234.B CONFIG_PROC_PAGE_MONITOR
59d566a9
MK
3235kernel configuration option is enabled.
3236.TP
3237.IR /proc/kpageflags " (since Linux 2.6.25)"
ef4f4031 3238This file contains 64-bit masks corresponding to each physical page frame;
59d566a9
MK
3239it is indexed by page frame number (see the discussion of
3240.IR /proc/[pid]/pagemap ).
3241The bits are as follows:
2dad4c59 3242.IP
59d566a9
MK
3243 0 - KPF_LOCKED
3244 1 - KPF_ERROR
3245 2 - KPF_REFERENCED
3246 3 - KPF_UPTODATE
3247 4 - KPF_DIRTY
3248 5 - KPF_LRU
3249 6 - KPF_ACTIVE
3250 7 - KPF_SLAB
3251 8 - KPF_WRITEBACK
3252 9 - KPF_RECLAIM
3253 10 - KPF_BUDDY
3254 11 - KPF_MMAP (since Linux 2.6.31)
3255 12 - KPF_ANON (since Linux 2.6.31)
3256 13 - KPF_SWAPCACHE (since Linux 2.6.31)
3257 14 - KPF_SWAPBACKED (since Linux 2.6.31)
3258 15 - KPF_COMPOUND_HEAD (since Linux 2.6.31)
3259 16 - KPF_COMPOUND_TAIL (since Linux 2.6.31)
d0ffc687 3260 17 - KPF_HUGE (since Linux 2.6.31)
59d566a9
MK
3261 18 - KPF_UNEVICTABLE (since Linux 2.6.31)
3262 19 - KPF_HWPOISON (since Linux 2.6.31)
3263 20 - KPF_NOPAGE (since Linux 2.6.31)
3264 21 - KPF_KSM (since Linux 2.6.32)
3265 22 - KPF_THP (since Linux 3.4)
5487da4c
MK
3266 23 - KPF_BALLOON (since Linux 3.18)
3267.\" KPF_BALLOON: commit 09316c09dde33aae14f34489d9e3d243ec0d5938
f38dfdf1 3268 24 - KPF_ZERO_PAGE (since Linux 4.0)
c6f182bc 3269.\" KPF_ZERO_PAGE: commit 56873f43abdcd574b25105867a990f067747b2f4
f38dfdf1 3270 25 - KPF_IDLE (since Linux 4.3)
c6f182bc 3271.\" KPF_IDLE: commit f074a8f49eb87cde95ac9d040ad5e7ea4f029738
2dad4c59 3272.IP
59d566a9
MK
3273For further details on the meanings of these bits,
3274see the kernel source file
3275.IR Documentation/vm/pagemap.txt .
3276Before kernel 2.6.29,
3277.\" commit ad3bdefe877afb47480418fdb05ecd42842de65e
3278.\" commit e07a4b9217d1e97d2f3a62b6b070efdc61212110
3279.BR KPF_WRITEBACK ,
3280.BR KPF_RECLAIM ,
3281.BR KPF_BUDDY ,
3282and
3283.BR KPF_LOCKED
3284did not report correctly.
3285.IP
3286The
3287.IR /proc/kpageflags
3288file is present only if the
3289.B CONFIG_PROC_PAGE_MONITOR
ff56ac8b
MK
3290kernel configuration option is enabled.
3291.TP
93f18cbb 3292.IR /proc/ksyms " (Linux 1.1.23\(en2.5.47)"
fea681da
MK
3293See
3294.IR /proc/kallsyms .
3295.TP
3296.I /proc/loadavg
6b05dc38
MK
3297The first three fields in this file are load average figures
3298giving the number of jobs in the run queue (state R)
fea681da
MK
3299or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes.
3300They are the same as the load average numbers given by
3301.BR uptime (1)
3302and other programs.
6b05dc38 3303The fourth field consists of two numbers separated by a slash (/).
78fc91ec
EDB
3304The first of these is the number of currently runnable kernel
3305scheduling entities (processes, threads).
6b05dc38
MK
3306The value after the slash is the number of kernel scheduling entities
3307that currently exist on the system.
3308The fifth field is the PID of the process that was most
3309recently created on the system.
fea681da
MK
3310.TP
3311.I /proc/locks
3312This file shows current file locks
3313.RB ( flock "(2) and " fcntl (2))
3314and leases
3315.RB ( fcntl (2)).
f352b560
MK
3316.IP
3317An example of the content shown in this file is the following:
3318.IP
3319.in +4n
3320.EX
33211: POSIX ADVISORY READ 5433 08:01:7864448 128 128
33222: FLOCK ADVISORY WRITE 2001 08:01:7864554 0 EOF
33233: FLOCK ADVISORY WRITE 1568 00:2f:32388 0 EOF
33244: POSIX ADVISORY WRITE 699 00:16:28457 0 EOF
33255: POSIX ADVISORY WRITE 764 00:16:21448 0 0
33266: POSIX ADVISORY READ 3548 08:01:7867240 1 1
33277: POSIX ADVISORY READ 3548 08:01:7865567 1826 2335
33288: OFDLCK ADVISORY WRITE -1 08:01:8713209 128 191
3329.EE
3330.in
3331.IP
3332The fields shown in each line are as follows:
3333.RS
3334.IP (1) 4
3335The ordinal position of the lock in the list.
3336.IP (2)
3337The lock type.
3338Values that may appear here include:
3339.RS
3340.TP
3341.B FLOCK
3342This is a BSD file lock created using
3343.BR flock (2).
3344.TP
3345.B OFDLCK
3346This is an open file description (OFD) lock created using
3347.BR fcntl (2).
3348.TP
3349.B POSIX
3350This is a POSIX byte-range lock created using
3351.BR fcntl (2).
3352.RE
3353.IP (3)
3354Among the strings that can appear here are the following:
3355.RS
3356.TP
3357.B ADVISORY
3358This is an advisory lock.
3359.TP
3360.B MANDATORY
3361This is a mandatory lock.
3362.RE
3363.IP (4)
3364The type of lock.
3365Values that can appear here are:
3366.RS
3367.TP
3368.B READ
3369This is a POSIX or OFD read lock, or a BSD shared lock.
3370.TP
3371.B WRITE
3372This is a POSIX or OFD write lock, or a BSD exclusive lock.
3373.RE
3374.IP (5)
3375The PID of the process that owns the lock.
3376.IP
3377Because OFD locks are not owned by a single process
3378(since multiple processes may have file descriptors that
3379refer to the same open file description),
3380the value \-1 is displayed in this field for OFD locks.
3381(Before kernel 4.14,
52f842a5 3382.\" commit 9d5b86ac13c573795525ecac6ed2db39ab23e2a8
f352b560
MK
3383a bug meant that the PID of the process that
3384initially acquired the lock was displayed instead of the value \-1.)
3385.IP (6)
3386Three colon-separated subfields that identify the major and minor device
3387ID of the device containing the filesystem where the locked file resides,
3388followed by the inode number of the locked file.
3389.IP (7)
3390The byte offset of the first byte of the lock.
3391For BSD locks, this value is always 0.
3392.IP (8)
3393The byte offset of the last byte of the lock.
3394.B EOF
3395in this field means that the lock extends to the end of the file.
3396For BSD locks, the value shown is always
3397.IR EOF .
3398.RE
3399.IP
8fb9b45a
MK
3400Since Linux 4.9,
3401.\" commit d67fd44f697dff293d7cdc29af929241b669affe
3402the list of locks shown in
3403.I /proc/locks
3404is filtered to show just the locks for the processes in the PID
3405namespace (see
3406.BR pid_namespaces (7))
3407for which the
3408.I /proc
3409filesystem was mounted.
1dbe854b 3410(In the initial PID namespace,
8fb9b45a
MK
3411there is no filtering of the records shown in this file.)
3412.IP
9f1002a1
MK
3413The
3414.BR lslocks (8)
3415command provides a bit more information about each lock.
fea681da 3416.TP
89dd5f8a 3417.IR /proc/malloc " (only up to and including Linux 2.2)"
59a40ed7 3418.\" It looks like this only ever did something back in 1.0 days
90878f7c 3419This file is present only if
89dd5f8a 3420.B CONFIG_DEBUG_MALLOC
097585ed 3421was defined during compilation.
fea681da
MK
3422.TP
3423.I /proc/meminfo
77b802ec
MK
3424This file reports statistics about memory usage on the system.
3425It is used by
fea681da
MK
3426.BR free (1)
3427to report the amount of free and used memory (both physical and swap)
3428on the system as well as the shared memory and buffers used by the
3429kernel.
3ba3d5b1
MK
3430Each line of the file consists of a parameter name, followed by a colon,
3431the value of the parameter, and an option unit of measurement (e.g., "kB").
3432The list below describes the parameter names and
3433the format specifier required to read the field value.
3434Except as noted below,
3435all of the fields have been present since at least Linux 2.6.0.
86cf87d7 3436Some fields are displayed only if the kernel was configured
3ba3d5b1
MK
3437with various options; those dependencies are noted in the list.
3438.RS
3439.TP
3440.IR MemTotal " %lu"
449dd4e2 3441Total usable RAM (i.e., physical RAM minus a few reserved
99e91586 3442bits and the kernel binary code).
3ba3d5b1
MK
3443.TP
3444.IR MemFree " %lu"
7bccb7d4
DP
3445The sum of
3446.IR LowFree + HighFree .
3ba3d5b1 3447.TP
8b4b1f68
MK
3448.IR MemAvailable " %lu (since Linux 3.14)"
3449An estimate of how much memory is available for starting new
3450applications, without swapping.
3451.TP
3ba3d5b1 3452.IR Buffers " %lu"
99e91586 3453Relatively temporary storage for raw disk blocks that
3ba3d5b1
MK
3454shouldn't get tremendously large (20MB or so).
3455.TP
3456.IR Cached " %lu"
3457In-memory cache for files read from the disk (the page cache).
3458Doesn't include
3459.IR SwapCached .
3460.TP
3461.IR SwapCached " %lu"
3462Memory that once was swapped out, is swapped back in but
3463still also is in the swap file.
fa1d2749 3464(If memory pressure is high, these pages
3ba3d5b1 3465don't need to be swapped out again because they are already
99e91586 3466in the swap file.
3ba3d5b1
MK
3467This saves I/O.)
3468.TP
3469.IR Active " %lu"
3470Memory that has been used more recently and usually not
3471reclaimed unless absolutely necessary.
3472.TP
3473.IR Inactive " %lu"
3474Memory which has been less recently used.
3475It is more eligible to be reclaimed for other purposes.
3476.TP
3477.IR Active(anon) " %lu (since Linux 2.6.28)"
3478[To be documented.]
3479.TP
3480.IR Inactive(anon) " %lu (since Linux 2.6.28)"
3481[To be documented.]
3482.TP
3483.IR Active(file) " %lu (since Linux 2.6.28)"
3484[To be documented.]
3485.TP
3486.IR Inactive(file) " %lu (since Linux 2.6.28)"
3487[To be documented.]
3488.TP
3489.IR Unevictable " %lu (since Linux 2.6.28)"
3490(From Linux 2.6.28 to 2.6.30,
3491\fBCONFIG_UNEVICTABLE_LRU\fP was required.)
3492[To be documented.]
3493.TP
46fbfc07 3494.IR Mlocked " %lu (since Linux 2.6.28)"
3ba3d5b1
MK
3495(From Linux 2.6.28 to 2.6.30,
3496\fBCONFIG_UNEVICTABLE_LRU\fP was required.)
3497[To be documented.]
3498.TP
3499.IR HighTotal " %lu"
3500(Starting with Linux 2.6.19, \fBCONFIG_HIGHMEM\fP is required.)
3501Total amount of highmem.
99e91586 3502Highmem is all memory above ~860MB of physical memory.
3ba3d5b1
MK
3503Highmem areas are for use by user-space programs,
3504or for the page cache.
3505The kernel must use tricks to access
3506this memory, making it slower to access than lowmem.
3507.TP
3508.IR HighFree " %lu
3509(Starting with Linux 2.6.19, \fBCONFIG_HIGHMEM\fP is required.)
3510Amount of free highmem.
3511.TP
3512.IR LowTotal " %lu
3513(Starting with Linux 2.6.19, \fBCONFIG_HIGHMEM\fP is required.)
3514Total amount of lowmem.
3515Lowmem is memory which can be used for everything that
3516highmem can be used for, but it is also available for the
3517kernel's use for its own data structures.
3518Among many other things,
99e91586 3519it is where everything from
7bccb7d4
DP
3520.I Slab
3521is allocated.
3ba3d5b1
MK
3522Bad things happen when you're out of lowmem.
3523.TP
3524.IR LowFree " %lu
3525(Starting with Linux 2.6.19, \fBCONFIG_HIGHMEM\fP is required.)
3526Amount of free lowmem.
3527.TP
3528.IR MmapCopy " %lu (since Linux 2.6.29)"
99e91586
DP
3529.RB ( CONFIG_MMU
3530is required.)
3ba3d5b1
MK
3531[To be documented.]
3532.TP
3533.IR SwapTotal " %lu"
3534Total amount of swap space available.
3535.TP
3536.IR SwapFree " %lu"
c16d4f25 3537Amount of swap space that is currently unused.
3ba3d5b1
MK
3538.TP
3539.IR Dirty " %lu"
3540Memory which is waiting to get written back to the disk.
3541.TP
3542.IR Writeback " %lu"
3543Memory which is actively being written back to the disk.
3544.TP
3545.IR AnonPages " %lu (since Linux 2.6.18)"
3546Non-file backed pages mapped into user-space page tables.
3547.TP
3548.IR Mapped " %lu"
fda70f5b
MK
3549Files which have been mapped into memory (with
3550.BR mmap (2)),
3551such as libraries.
3ba3d5b1
MK
3552.TP
3553.IR Shmem " %lu (since Linux 2.6.32)"
eb775c04
MK
3554Amount of memory consumed in
3555.BR tmpfs (5)
3556filesystems.
3ba3d5b1 3557.TP
7375eaab
MK
3558.IR KReclaimable " %lu (since Linux 4.20)"
3559Kernel allocations that the kernel will attempt to reclaim
3560under memory pressure.
3561Includes
3562.I SReclaimable
3563(below), and other direct allocations with a shrinker.
3564.TP
3ba3d5b1
MK
3565.IR Slab " %lu"
3566In-kernel data structures cache.
5a5bde70
MK
3567(See
3568.BR slabinfo (5).)
3ba3d5b1
MK
3569.TP
3570.IR SReclaimable " %lu (since Linux 2.6.19)"
7bccb7d4
DP
3571Part of
3572.IR Slab ,
3573that might be reclaimed, such as caches.
3ba3d5b1
MK
3574.TP
3575.IR SUnreclaim " %lu (since Linux 2.6.19)"
7bccb7d4
DP
3576Part of
3577.IR Slab ,
3578that cannot be reclaimed on memory pressure.
3ba3d5b1
MK
3579.TP
3580.IR KernelStack " %lu (since Linux 2.6.32)"
3581Amount of memory allocated to kernel stacks.
3582.TP
3583.IR PageTables " %lu (since Linux 2.6.18)"
3584Amount of memory dedicated to the lowest level of page tables.
3585.TP
3586.IR Quicklists " %lu (since Linux 2.6.27)"
3587(\fBCONFIG_QUICKLIST\fP is required.)
3588[To be documented.]
3589.TP
3590.IR NFS_Unstable " %lu (since Linux 2.6.18)"
3591NFS pages sent to the server, but not yet committed to stable storage.
3592.TP
3593.IR Bounce " %lu (since Linux 2.6.18)"
3594Memory used for block device "bounce buffers".
3595.TP
3596.IR WritebackTmp " %lu (since Linux 2.6.26)"
3597Memory used by FUSE for temporary writeback buffers.
3598.TP
3599.IR CommitLimit " %lu (since Linux 2.6.10)"
cd7b6c40
MK
3600This is the total amount of memory currently available to
3601be allocated on the system, expressed in kilobytes.
90878f7c
MK
3602This limit is adhered to
3603only if strict overcommit accounting is enabled (mode 2 in
cd7b6c40
MK
3604.IR /proc/sys/vm/overcommit_memory ).
3605The limit is calculated according to the formula described under
3606.IR /proc/sys/vm/overcommit_memory .
3607For further details, see the kernel source file
3ba3d5b1
MK
3608.IR Documentation/vm/overcommit-accounting .
3609.TP
3610.IR Committed_AS " %lu"
3611The amount of memory presently allocated on the system.
3612The committed memory is a sum of all of the memory which
3613has been allocated by processes, even if it has not been
3614"used" by them as of yet.
3615A process which allocates 1GB of memory (using
3616.BR malloc (3)
33a0ccb2 3617or similar), but touches only 300MB of that memory will show up
90878f7c 3618as using only 300MB of memory even if it has the address space
3ba3d5b1 3619allocated for the entire 1GB.
2dad4c59 3620.IP
3ba3d5b1
MK
3621This 1GB is memory which has been "committed" to by the VM
3622and can be used at any time by the allocating application.
cd7b6c40 3623With strict overcommit enabled on the system (mode 2 in
d9e0f03d 3624.IR /proc/sys/vm/overcommit_memory ),
3ba3d5b1
MK
3625allocations which would exceed the
3626.I CommitLimit
cd7b6c40 3627will not be permitted.
3ba3d5b1
MK
3628This is useful if one needs to guarantee that processes will not
3629fail due to lack of memory once that memory has been successfully allocated.
3630.TP
3631.IR VmallocTotal " %lu"
3632Total size of vmalloc memory area.
3633.TP
3634.IR VmallocUsed " %lu"
3635Amount of vmalloc area which is used.
3636.TP
3637.IR VmallocChunk " %lu"
3638Largest contiguous block of vmalloc area which is free.
3639.TP
3640.IR HardwareCorrupted " %lu (since Linux 2.6.32)"
3641(\fBCONFIG_MEMORY_FAILURE\fP is required.)
3642[To be documented.]
3643.TP
f7bbc79d
MK
3644.IR LazyFree " %lu (since Linux 4.12)"
3645Shows the amount of memory marked by
3646.BR madvise (2)
3647.BR MADV_FREE .
3648.TP
3ba3d5b1
MK
3649.IR AnonHugePages " %lu (since Linux 2.6.38)"
3650(\fBCONFIG_TRANSPARENT_HUGEPAGE\fP is required.)
7fac88a9 3651Non-file backed huge pages mapped into user-space page tables.
3ba3d5b1 3652.TP
4ad958e1
MK
3653.IR ShmemHugePages " %lu (since Linux 4.8)"
3654(\fBCONFIG_TRANSPARENT_HUGEPAGE\fP is required.)
4e07c70f
MK
3655Memory used by shared memory (shmem) and
3656.BR tmpfs (5)
3657allocated with huge pages
4ad958e1
MK
3658.TP
3659.IR ShmemPmdMapped " %lu (since Linux 4.8)"
3660(\fBCONFIG_TRANSPARENT_HUGEPAGE\fP is required.)
956e74b4 3661Shared memory mapped into user space with huge pages.
4ad958e1 3662.TP
43179f55
MK
3663.IR CmaTotal " %lu (since Linux 3.1)"
3664Total CMA (Contiguous Memory Allocator) pages.
3665(\fBCONFIG_CMA\fP is required.)
3666.TP
3667.IR CmaFree " %lu (since Linux 3.1)"
3668Free CMA (Contiguous Memory Allocator) pages.
3669(\fBCONFIG_CMA\fP is required.)
3670.TP
3ba3d5b1
MK
3671.IR HugePages_Total " %lu"
3672(\fBCONFIG_HUGETLB_PAGE\fP is required.)
3673The size of the pool of huge pages.
3674.TP
3675.IR HugePages_Free " %lu"
3676(\fBCONFIG_HUGETLB_PAGE\fP is required.)
3677The number of huge pages in the pool that are not yet allocated.
3678.TP
3679.IR HugePages_Rsvd " %lu (since Linux 2.6.17)"
3680(\fBCONFIG_HUGETLB_PAGE\fP is required.)
3681This is the number of huge pages for
3682which a commitment to allocate from the pool has been made,
3683but no allocation has yet been made.
3684These reserved huge pages
3685guarantee that an application will be able to allocate a
3686huge page from the pool of huge pages at fault time.
3687.TP
aa8a6b4f 3688.IR HugePages_Surp " %lu (since Linux 2.6.24)"
3ba3d5b1
MK
3689(\fBCONFIG_HUGETLB_PAGE\fP is required.)
3690This is the number of huge pages in
3691the pool above the value in
3692.IR /proc/sys/vm/nr_hugepages .
3693The maximum number of surplus huge pages is controlled by
3694.IR /proc/sys/vm/nr_overcommit_hugepages .
3695.TP
3696.IR Hugepagesize " %lu"
3697(\fBCONFIG_HUGETLB_PAGE\fP is required.)
3698The size of huge pages.
d5268de1
MK
3699.TP
3700.IR DirectMap4k " %lu (since Linux 2.6.27)"
3701Number of bytes of RAM linearly mapped by kernel in 4kB pages.
3702(x86.)
3703.TP
3704.IR DirectMap4M " %lu (since Linux 2.6.27)"
3705Number of bytes of RAM linearly mapped by kernel in 4MB pages.
3706(x86 with
3707.BR CONFIG_X86_64
3708or
3709.BR CONFIG_X86_PAE
3710enabled.)
3711.TP
3712.IR DirectMap2M " %lu (since Linux 2.6.27)"
3713Number of bytes of RAM linearly mapped by kernel in 2MB pages.
3714(x86 with neither
3715.BR CONFIG_X86_64
3716nor
3717.BR CONFIG_X86_PAE
3718enabled.)
3719.TP
3720.IR DirectMap1G " %lu (since Linux 2.6.27)"
3721(x86 with
3722.BR CONFIG_X86_64
3723and
3724.B CONFIG_X86_DIRECT_GBPAGES
3725enabled.)
3ba3d5b1 3726.RE
fea681da 3727.TP
aa341984
MK
3728.I /proc/modules
3729A text list of the modules that have been loaded by the system.
3730See also
3731.BR lsmod (8).
3732.TP
fea681da 3733.I /proc/mounts
c1eea65a 3734Before kernel 2.4.19, this file was a list
9ee4a2b6 3735of all the filesystems currently mounted on the system.
ef5b47f6
MK
3736With the introduction of per-process mount namespaces in Linux 2.4.19 (see
3737.BR mount_namespaces (7)),
3738this file became a link to
c1eea65a 3739.IR /proc/self/mounts ,
732e54dd 3740which lists the mount points of the process's own mount namespace.
fea681da 3741The format of this file is documented in
31e9a9ec 3742.BR fstab (5).
fea681da 3743.TP
fea681da 3744.I /proc/mtrr
c13182ef 3745Memory Type Range Registers.
66a9882e 3746See the Linux kernel source file
a8999e1f
ES
3747.I Documentation/x86/mtrr.txt
3748.\" commit 7225e75144b9718cbbe1820d9c011c809d5773fd
3749(or
cfe70b66 3750.I Documentation/mtrr.txt
a8999e1f 3751before Linux 2.6.28)
fea681da
MK
3752for details.
3753.TP
3754.I /proc/net
ccb4bcdc
MK
3755This directory contains various files and subdirectories containing
3756information about the networking layer.
3757The files contain ASCII structures and are,
59a40ed7
MK
3758therefore, readable with
3759.BR cat (1).
c13182ef 3760However, the standard
fea681da
MK
3761.BR netstat (8)
3762suite provides much cleaner access to these files.
2dad4c59 3763.IP
9fb88bc8
MK
3764With the advent of network namespaces,
3765various information relating to the network stack is virtualized (see
3766.BR namespaces (7)).
3767Thus, since Linux 2.6.25,
3768.\" commit e9720acd728a46cb40daa52c99a979f7c4ff195c
3769.IR /proc/net
3770is a symbolic link to the directory
3771.IR /proc/self/net ,
3772which contains the same files and directories as listed below.
3773However, these files and directories now expose information
3774for the network namespace of which the process is a member.
fea681da
MK
3775.TP
3776.I /proc/net/arp
3777This holds an ASCII readable dump of the kernel ARP table used for
c13182ef 3778address resolutions.
01d0a447 3779It will show both dynamically learned and preprogrammed ARP entries.
c13182ef 3780The format is:
c1a022dc
MK
3781.IP
3782.in 7n
3783.EX
fea681da
MK
3784IP address HW type Flags HW address Mask Device
3785192.168.0.50 0x1 0x2 00:50:BF:25:68:F3 * eth0
3786192.168.0.250 0x1 0xc 00:00:00:00:00:00 * eth0
c1a022dc 3787.EE
fea681da 3788.in
c1a022dc 3789.IP
6c04f928 3790Here "IP address" is the IPv4 address of the machine and the "HW type"
c13182ef
MK
3791is the hardware type of the address from RFC\ 826.
3792The flags are the internal
9a67332e
MK
3793flags of the ARP structure (as defined in
3794.IR /usr/include/linux/if_arp.h )
3795and
6c04f928 3796the "HW address" is the data link layer mapping for that IP address if
fea681da
MK
3797it is known.
3798.TP
3799.I /proc/net/dev
c13182ef
MK
3800The dev pseudo-file contains network device status information.
3801This gives
3802the number of received and sent packets, the number of errors and
fea681da 3803collisions
c13182ef
MK
3804and other basic statistics.
3805These are used by the
fea681da 3806.BR ifconfig (8)
c13182ef
MK
3807program to report device status.
3808The format is:
c1a022dc 3809.IP
fea681da 3810.in 1n
c1a022dc 3811.EX
fea681da
MK
3812Inter-| Receive | Transmit
3813 face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
3814 lo: 2776770 11307 0 0 0 0 0 0 2776770 11307 0 0 0 0 0 0
3815 eth0: 1215645 2751 0 0 0 0 0 0 1782404 4324 0 0 0 427 0 0
3816 ppp0: 1622270 5552 1 0 0 0 0 0 354130 5669 0 0 0 0 0 0
3817 tap0: 7714 81 0 0 0 0 0 0 7714 81 0 0 0 0 0 0
c1a022dc 3818.EE
fea681da 3819.in
fea681da
MK
3820.\" .TP
3821.\" .I /proc/net/ipx
3822.\" No information.
3823.\" .TP
3824.\" .I /proc/net/ipx_route
3825.\" No information.
3826.TP
3827.I /proc/net/dev_mcast
3828Defined in
3829.IR /usr/src/linux/net/core/dev_mcast.c :
37d5e699
MK
3830.IP
3831.in +4
3832.EX
9fdfa163 3833indx interface_name dmi_u dmi_g dmi_address
fea681da
MK
38342 eth0 1 0 01005e000001
38353 eth1 1 0 01005e000001
38364 eth2 1 0 01005e000001
37d5e699 3837.EE
fea681da 3838.in
fea681da
MK
3839.TP
3840.I /proc/net/igmp
c13182ef
MK
3841Internet Group Management Protocol.
3842Defined in
fea681da
MK
3843.IR /usr/src/linux/net/core/igmp.c .
3844.TP
3845.I /proc/net/rarp
3846This file uses the same format as the
3847.I arp
3848file and contains the current reverse mapping database used to provide
3849.BR rarp (8)
c13182ef
MK
3850reverse address lookup services.
3851If RARP is not configured into the
fea681da
MK
3852kernel,
3853this file will not be present.
3854.TP
3855.I /proc/net/raw
c13182ef
MK
3856Holds a dump of the RAW socket table.
3857Much of the information is not of
fea681da 3858use
c13182ef 3859apart from debugging.
6c04f928 3860The "sl" value is the kernel hash slot for the
fea681da 3861socket,
6c04f928
MK
3862the "local_address" is the local address and protocol number pair.
3863\&"St" is
c13182ef
MK
3864the internal status of the socket.
3865The "tx_queue" and "rx_queue" are the
fea681da 3866outgoing and incoming data queue in terms of kernel memory usage.
94e9d9fe 3867The "tr", "tm\->when", and "rexmits" fields are not used by RAW.
fdc196f5
MK
3868The "uid"
3869field holds the effective UID of the creator of the socket.
fea681da
MK
3870.\" .TP
3871.\" .I /proc/net/route
3872.\" No information, but looks similar to
3873.\" .BR route (8).
3874.TP
3875.I /proc/net/snmp
c13182ef 3876This file holds the ASCII data needed for the IP, ICMP, TCP, and UDP
fea681da 3877management
763f0e47 3878information bases for an SNMP agent.
fea681da
MK
3879.TP
3880.I /proc/net/tcp
c13182ef
MK
3881Holds a dump of the TCP socket table.
3882Much of the information is not
3883of use apart from debugging.
3884The "sl" value is the kernel hash slot
6beb1671
MK
3885for the socket, the "local_address" is the local address and port number pair.
3886The "rem_address" is the remote address and port number pair
6c04f928
MK
3887(if connected).
3888\&"St" is the internal status of the socket.
3889The "tx_queue" and "rx_queue" are the
fea681da 3890outgoing and incoming data queue in terms of kernel memory usage.
94e9d9fe 3891The "tr", "tm\->when", and "rexmits" fields hold internal information of
f33774c4 3892the kernel socket state and are useful only for debugging.
fdc196f5
MK
3893The "uid"
3894field holds the effective UID of the creator of the socket.
fea681da
MK
3895.TP
3896.I /proc/net/udp
c13182ef
MK
3897Holds a dump of the UDP socket table.
3898Much of the information is not of
3899use apart from debugging.
3900The "sl" value is the kernel hash slot for the
6beb1671
MK
3901socket, the "local_address" is the local address and port number pair.
3902The "rem_address" is the remote address and port number pair
f2d607ee
MK
3903(if connected).
3904"St" is the internal status of the socket.
fea681da 3905The "tx_queue" and "rx_queue" are the outgoing and incoming data queue
c13182ef 3906in terms of kernel memory usage.
94e9d9fe 3907The "tr", "tm\->when", and "rexmits" fields
c13182ef 3908are not used by UDP.
fdc196f5
MK
3909The "uid"
3910field holds the effective UID of the creator of the socket.
fea681da 3911The format is:
c1a022dc 3912.IP
fea681da 3913.in 1n
c1a022dc 3914.EX
94e9d9fe 3915sl local_address rem_address st tx_queue rx_queue tr rexmits tm\->when uid
fea681da
MK
3916 1: 01642C89:0201 0C642C89:03FF 01 00000000:00000001 01:000071BA 00000000 0
3917 1: 00000000:0801 00000000:0000 0A 00000000:00000000 00:00000000 6F000100 0
3918 1: 00000000:0201 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0
c1a022dc 3919.EE
fea681da 3920.in
c1a022dc 3921.IP
fea681da
MK
3922.TP
3923.I /proc/net/unix
008f1ecc 3924Lists the UNIX domain sockets present within the system and their
c13182ef
MK
3925status.
3926The format is:
c1a022dc
MK
3927.IP
3928.in 1n
3929.EX
fea681da
MK
3930Num RefCount Protocol Flags Type St Path
3931 0: 00000002 00000000 00000000 0001 03
3932 1: 00000001 00000000 00010000 0001 01 /dev/printer
c1a022dc
MK
3933.EE
3934.in
3935.IP
756f55f6
MK
3936The fields are as follows:
3937.RS
3938.TP 10
3939.IR Num :
3940the kernel table slot number.
3941.TP
3942.IR RefCount :
3943the number of users of the socket.
3944.TP
3945.IR Protocol :
3946currently always 0.
3947.TP
3948.IR Flags :
3949the internal kernel flags holding the status of the socket.
3950.TP
3951.IR Type :
a405066e
MK
3952the socket type.
3953For
3954.BR SOCK_STREAM
3955sockets, this is 0001; for
3956.BR SOCK_DGRAM
3957sockets, it is 0002; and for
3958.BR SOCK_SEQPACKET
3959sockets, it is 0005.
756f55f6
MK
3960.TP
3961.IR St :
3962the internal state of the socket.
3963.TP
3964.IR Path :
590ba7e5 3965the bound pathname (if any) of the socket.
8f8a46fb
MK
3966Sockets in the abstract namespace are included in the list,
3967and are shown with a
3968.I Path
3969that commences with the character '@'.
756f55f6 3970.RE
fea681da 3971.TP
ed8de0e4 3972.I /proc/net/netfilter/nfnetlink_queue
6f858d5c 3973This file contains information about netfilter user-space queueing, if used.
f2d607ee
MK
3974Each line represents a queue.
3975Queues that have not been subscribed to
6f858d5c 3976by user space are not shown.
37d5e699
MK
3977.IP
3978.in +4n
3979.EX
ed8de0e4
FW
3980 1 4207 0 2 65535 0 0 0 1
3981 (1) (2) (3)(4) (5) (6) (7) (8)
37d5e699
MK
3982.EE
3983.in
ed8de0e4
FW
3984.IP
3985The fields in each line are:
3986.RS 7
3987.TP 5
3988(1)
f2d607ee
MK
3989The ID of the queue.
3990This matches what is specified in the
ed8de0e4
FW
3991.B \-\-queue\-num
3992or
3993.B \-\-queue\-balance
3994options to the
3995.BR iptables (8)
f2d607ee
MK
3996NFQUEUE target.
3997See
ed8de0e4
FW
3998.BR iptables-extensions (8)
3999for more information.
4000.TP
4001(2)
7672e08e 4002The netlink port ID subscribed to the queue.
ed8de0e4
FW
4003.TP
4004(3)
4005The number of packets currently queued and waiting to be processed by
4006the application.
4007.TP
4008(4)
f2d607ee
MK
4009The copy mode of the queue.
4010It is either 1 (metadata only) or 2
6f858d5c 4011(also copy payload data to user space).
ed8de0e4
FW
4012.TP
4013(5)
1dea597b 4014Copy range; that is, how many bytes of packet payload should be copied to
6f858d5c 4015user space at most.
ed8de0e4
FW
4016.TP
4017(6)
f2d607ee
MK
4018queue dropped.
4019Number of packets that had to be dropped by the kernel because
6f858d5c 4020too many packets are already waiting for user space to send back the mandatory
ed8de0e4
FW
4021accept/drop verdicts.
4022.TP
4023(7)
f2d607ee
MK
4024queue user dropped.
4025Number of packets that were dropped within the netlink
4026subsystem.
4027Such drops usually happen when the corresponding socket buffer is
6f858d5c 4028full; that is, user space is not able to read messages fast enough.
ed8de0e4
FW
4029.TP
4030(8)
f2d607ee
MK
4031sequence number.
4032Every queued packet is associated with a (32-bit)
ed8de0e4
FW
4033monotonically-increasing sequence number.
4034This shows the ID of the most recent packet queued.
4035.RE
4036.IP
f33774c4 4037The last number exists only for compatibility reasons and is always 1.
ed8de0e4 4038.TP
fea681da 4039.I /proc/partitions
f042d149
MK
4040Contains the major and minor numbers of each partition as well as the number
4041of 1024-byte blocks and the partition name.
fea681da
MK
4042.TP
4043.I /proc/pci
4044This is a listing of all PCI devices found during kernel initialization
4045and their configuration.
2dad4c59 4046.IP
59a40ed7
MK
4047This file has been deprecated in favor of a new
4048.I /proc
2990d781
MK
4049interface for PCI
4050.RI ( /proc/bus/pci ).
4051It became optional in Linux 2.2 (available with
4052.B CONFIG_PCI_OLD_PROC
4053set at kernel compilation).
24b74457 4054It became once more nonoptionally enabled in Linux 2.4.
2990d781
MK
4055Next, it was deprecated in Linux 2.6 (still available with
4056.B CONFIG_PCI_LEGACY_PROC
4057set), and finally removed altogether since Linux 2.6.17.
43d42cc0 4058.\" FIXME Document /proc/sched_debug (since Linux 2.6.23)
69119dc7 4059.\" See also /proc/[pid]/sched
caea7868
MK
4060.TP
4061.IR /proc/profile " (since Linux 2.4)"
4062This file is present only if the kernel was booted with the
4063.I profile=1
4064command-line option.
4065It exposes kernel profiling information in a binary format for use by
4066.BR readprofile (1).
4067Writing (e.g., an empty string) to this file resets the profiling counters;
4068on some architectures,
4069writing a binary integer "profiling multiplier" of size
4070.IR sizeof(int)
8a3ac89a 4071sets the profiling interrupt frequency.
fea681da
MK
4072.TP
4073.I /proc/scsi
59a40ed7
MK
4074A directory with the
4075.I scsi
4076mid-level pseudo-file and various SCSI low-level
2990d781
MK
4077driver directories,
4078which contain a file for each SCSI host in this system, all of
c13182ef
MK
4079which give the status of some part of the SCSI IO subsystem.
4080These files contain ASCII structures and are, therefore, readable with
2990d781 4081.BR cat (1).
2dad4c59 4082.IP
c13182ef 4083You can also write to some of the files to reconfigure the subsystem or
59a40ed7 4084switch certain features on or off.
fea681da
MK
4085.TP
4086.I /proc/scsi/scsi
c13182ef 4087This is a listing of all SCSI devices known to the kernel.
59a40ed7 4088The listing is similar to the one seen during bootup.
c13182ef 4089scsi currently supports only the \fIadd-single-device\fP command which
59a40ed7 4090allows root to add a hotplugged device to the list of known devices.
2dad4c59 4091.IP
59a40ed7 4092The command
37d5e699 4093.IP
59a40ed7 4094.in +4n
37d5e699 4095.EX
59a40ed7 4096echo \(aqscsi add-single-device 1 0 5 0\(aq > /proc/scsi/scsi
37d5e699 4097.EE
59a40ed7 4098.in
37d5e699 4099.IP
c13182ef
MK
4100will cause
4101host scsi1 to scan on SCSI channel 0 for a device on ID 5 LUN 0.
4102If there
fea681da
MK
4103is already a device known on this address or the address is invalid, an
4104error will be returned.
4105.TP
4106.I /proc/scsi/[drivername]
c13182ef
MK
4107\fI[drivername]\fP can currently be NCR53c7xx, aha152x, aha1542, aha1740,
4108aic7xxx, buslogic, eata_dma, eata_pio, fdomain, in2000, pas16, qlogic,
4109scsi_debug, seagate, t128, u15-24f, ultrastore, or wd7000.
4110These directories show up for all drivers that registered at least one
59a40ed7 4111SCSI HBA.
c13182ef 4112Every directory contains one file per registered host.
59a40ed7 4113Every host-file is named after the number the host was assigned during
c13182ef 4114initialization.
2dad4c59 4115.IP
c13182ef 4116Reading these files will usually show driver and host configuration,
f78ed33a 4117statistics, and so on.
2dad4c59 4118.IP
fea681da
MK
4119Writing to these files allows different things on different hosts.
4120For example, with the \fIlatency\fP and \fInolatency\fP commands,
4121root can switch on and off command latency measurement code in the
c13182ef
MK
4122eata_dma driver.
4123With the \fIlockup\fP and \fIunlock\fP commands,
4124root can control bus lockups simulated by the scsi_debug driver.
fea681da
MK
4125.TP
4126.I /proc/self
59a40ed7
MK
4127This directory refers to the process accessing the
4128.I /proc
9ee4a2b6 4129filesystem,
59a40ed7
MK
4130and is identical to the
4131.I /proc
4132directory named by the process ID of the same process.
fea681da
MK
4133.TP
4134.I /proc/slabinfo
c13182ef 4135Information about kernel caches.
c13182ef 4136See
fea681da
MK
4137.BR slabinfo (5)
4138for details.
4139.TP
4140.I /proc/stat
c13182ef
MK
4141kernel/system statistics.
4142Varies with architecture.
4143Common
fea681da
MK
4144entries include:
4145.RS
4146.TP
46f6dbe8
ES
4147.I cpu 10132153 290696 3084719 46828483 16683 0 25195 0 175628 0
4148.TQ
4149.I cpu0 1393280 32966 572056 13343292 6130 0 17875 0 23933 0
bfbfcd18 4150The amount of time, measured in units of
268f000b
MK
4151USER_HZ (1/100ths of a second on most architectures, use
4152.IR sysconf(_SC_CLK_TCK)
4153to obtain the right value),
b81087ab 4154.\" 1024 on Alpha and ia64
46f6dbe8
ES
4155that the system ("cpu" line) or the specific CPU ("cpu\fIN\fR" line)
4156spent in various states:
ae3b8047
MK
4157.RS
4158.TP
4159.I user
ea0841f6 4160(1) Time spent in user mode.
ae3b8047
MK
4161.TP
4162.I nice
0633f951 4163(2) Time spent in user mode with low priority (nice).
9f1b9726 4164.TP
ae3b8047 4165.I system
0633f951 4166(3) Time spent in system mode.
ae3b8047
MK
4167.TP
4168.I idle
ea0841f6 4169(4) Time spent in the idle task.
bea08fec 4170.\" FIXME . Actually, the following info about the /proc/stat 'cpu' field
e04a1f93
MK
4171.\" does not seem to be quite right (at least in 2.6.12 or 3.6):
4172.\" the idle time in /proc/uptime does not quite match this value
4173This value should be USER_HZ times the
4cb1deb7
MK
4174second entry in the
4175.I /proc/uptime
4176pseudo-file.
ae3b8047
MK
4177.TP
4178.IR iowait " (since Linux 2.5.41)"
ea0841f6 4179(5) Time waiting for I/O to complete.
e0a73a31
MK
4180This value is not reliable, for the following reasons:
4181.\" See kernel commit 9c240d757658a3ae9968dd309e674c61f07c7f48
4182.RS
4183.IP 1. 3
4184The CPU will not wait for I/O to complete;
4185iowait is the time that a task is waiting for I/O to complete.
4186When a CPU goes into idle state for outstanding task I/O,
4187another task will be scheduled on this CPU.
4188.IP 2.
4189On a multi-core CPU,
4190the task waiting for I/O to complete is not running on any CPU,
4191so the iowait of each CPU is difficult to calculate.
4192.IP 3.
4193The value in this field may
4194.I decrease
4195in certain conditions.
2d3fb75b 4196.RE
ae3b8047
MK
4197.TP
4198.IR irq " (since Linux 2.6.0-test4)"
ea0841f6 4199(6) Time servicing interrupts.
ae3b8047 4200.TP
0633f951 4201.IR softirq " (since Linux 2.6.0-test4)"
ea0841f6 4202(7) Time servicing softirqs.
ae3b8047
MK
4203.TP
4204.IR steal " (since Linux 2.6.11)"
ea0841f6 4205(8) Stolen time, which is the time spent in other operating systems when
9de1f6cc 4206running in a virtualized environment
ae3b8047
MK
4207.TP
4208.IR guest " (since Linux 2.6.24)"
0633f951 4209(9) Time spent running a virtual CPU for guest
afef1764 4210operating systems under the control of the Linux kernel.
14c06953 4211.\" See Changelog entry for 5e84cfde51cf303d368fcb48f22059f37b3872de
d4fd4120
MK
4212.TP
4213.IR guest_nice " (since Linux 2.6.33)"
4214.\" commit ce0e7b28fb75cb003cfc8d0238613aaf1c55e797
4215(10) Time spent running a niced guest (virtual CPU for guest
4216operating systems under the control of the Linux kernel).
ae3b8047 4217.RE
fea681da
MK
4218.TP
4219\fIpage 5741 1808\fP
4220The number of pages the system paged in and the number that were paged
4221out (from disk).
4222.TP
4223\fIswap 1 0\fP
4224The number of swap pages that have been brought in and out.
4225.TP
bea08fec 4226.\" FIXME . The following is not the full picture for the 'intr' of
777f5a9e 4227.\" /proc/stat on 2.6:
fea681da 4228\fIintr 1462898\fP
bfbfcd18
MK
4229This line shows counts of interrupts serviced since boot time,
4230for each of the possible system interrupts.
d63ff76e 4231The first column is the total of all interrupts serviced
d6a56978
MK
4232including unnumbered architecture specific interrupts;
4233each subsequent column is the total for that particular numbered interrupt.
d63ff76e 4234Unnumbered interrupts are not shown, only summed into the total.
fea681da
MK
4235.TP
4236\fIdisk_io: (2,0):(31,30,5764,1,2) (3,0):\fP...
636297e9 4237(major,disk_idx):(noinfo, read_io_ops, blks_read, write_io_ops, blks_written)
bfbfcd18
MK
4238.br
4239(Linux 2.4 only)
fea681da
MK
4240.TP
4241\fIctxt 115315\fP
4242The number of context switches that the system underwent.
4243.TP
4244\fIbtime 769041601\fP
f49c451a 4245boot time, in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
fea681da
MK
4246.TP
4247\fIprocesses 86031\fP
4248Number of forks since boot.
bfbfcd18
MK
4249.TP
4250\fIprocs_running 6\fP
4251Number of processes in runnable state.
5fab2e7c 4252(Linux 2.5.45 onward.)
bfbfcd18
MK
4253.TP
4254\fIprocs_blocked 2\fP
4255Number of processes blocked waiting for I/O to complete.
5fab2e7c 4256(Linux 2.5.45 onward.)
76f6f102
ES
4257.TP
4258.I softirq 229245889 94 60001584 13619 5175704 2471304 28 51212741 59130143 0 51240672
4259.\" commit d3d64df21d3d0de675a0d3ffa7c10514f3644b30
4260This line shows the number of softirq for all CPUs.
4261The first column is the total of all softirqs and
4262each subsequent column is the total for particular softirq.
d7f23d0b 4263(Linux 2.6.31 onward.)
fea681da
MK
4264.RE
4265.TP
4266.I /proc/swaps
c13182ef
MK
4267Swap areas in use.
4268See also
fea681da
MK
4269.BR swapon (8).
4270.TP
4271.I /proc/sys
4272This directory (present since 1.3.57) contains a number of files
4273and subdirectories corresponding to kernel variables.
4274These variables can be read and sometimes modified using
9ee4a2b6 4275the \fI/proc\fP filesystem, and the (deprecated)
fea681da 4276.BR sysctl (2)
c13182ef 4277system call.
2dad4c59 4278.IP
e8aa7100 4279String values may be terminated by either \(aq\\0\(aq or \(aq\\n\(aq.
2dad4c59 4280.IP
84ff8c1e
HS
4281Integer and long values may be written either in decimal or in
4282hexadecimal notation (e.g. 0x3FFF).
e8aa7100
MK
4283When writing multiple integer or long values, these may be separated
4284by any of the following whitespace characters:
4285\(aq\ \(aq, \(aq\\t\(aq, or \(aq\\n\(aq.
4286Using other separators leads to the error
84ff8c1e 4287.BR EINVAL .
fea681da 4288.TP
6ab7c0aa 4289.IR /proc/sys/abi " (since Linux 2.4.10)"
fea681da 4290This directory may contain files with application binary information.
6ab7c0aa 4291.\" On some systems, it is not present.
66a9882e 4292See the Linux kernel source file
6ab7c0aa
MK
4293.I Documentation/sysctl/abi.txt
4294for more information.
fea681da
MK
4295.TP
4296.I /proc/sys/debug
4297This directory may be empty.
4298.TP
4299.I /proc/sys/dev
e2badfdf 4300This directory contains device-specific information (e.g.,
9a67332e 4301.IR dev/cdrom/info ).
fea681da
MK
4302On
4303some systems, it may be empty.
4304.TP
4305.I /proc/sys/fs
49236d3c 4306This directory contains the files and subdirectories for kernel variables
9ee4a2b6 4307related to filesystems.
fea681da
MK
4308.TP
4309.I /proc/sys/fs/binfmt_misc
c13182ef 4310Documentation for files in this directory can be found
a2923df0
MK
4311in the Linux kernel source in the file
4312.IR Documentation/admin-guide/binfmt-misc.rst
4313(or in
4314.IR Documentation/binfmt_misc.txt
4315on older kernels).
fea681da 4316.TP
59a40ed7
MK
4317.IR /proc/sys/fs/dentry-state " (since Linux 2.2)"
4318This file contains information about the status of the
4319directory cache (dcache).
4320The file contains six numbers,
c13182ef 4321.IR nr_dentry ", " nr_unused ", " age_limit " (age in seconds), "
59a40ed7 4322.I want_pages
fea681da 4323(pages requested by system) and two dummy values.
59a40ed7
MK
4324.RS
4325.IP * 2
4326.I nr_dentry
4327is the number of allocated dentries (dcache entries).
4328This field is unused in Linux 2.2.
4329.IP *
4330.I nr_unused
4331is the number of unused dentries.
4332.IP *
4333.I age_limit
4334.\" looks like this is unused in kernels 2.2 to 2.6
4335is the age in seconds after which dcache entries
4336can be reclaimed when memory is short.
4337.IP *
4338.I want_pages
4339.\" looks like this is unused in kernels 2.2 to 2.6
c7094399 4340is nonzero when the kernel has called shrink_dcache_pages() and the
fea681da 4341dcache isn't pruned yet.
59a40ed7 4342.RE
fea681da
MK
4343.TP
4344.I /proc/sys/fs/dir-notify-enable
4345This file can be used to disable or enable the
4346.I dnotify
4347interface described in
4348.BR fcntl (2)
4349on a system-wide basis.
4350A value of 0 in this file disables the interface,
4351and a value of 1 enables it.
4352.TP
4353.I /proc/sys/fs/dquot-max
4354This file shows the maximum number of cached disk quota entries.
4355On some (2.4) systems, it is not present.
4356If the number of free cached disk quota entries is very low and
4357you have some awesome number of simultaneous system users,
4358you might want to raise the limit.
4359.TP
4360.I /proc/sys/fs/dquot-nr
4361This file shows the number of allocated disk quota
4362entries and the number of free disk quota entries.
4363.TP
24cb4a4b 4364.IR /proc/sys/fs/epoll " (since Linux 2.6.28)"
242b46af
MK
4365This directory contains the file
4366.IR max_user_watches ,
24cb4a4b
MK
4367which can be used to limit the amount of kernel memory consumed by the
4368.I epoll
4369interface.
4370For further details, see