for instance, you can do this:
.IP
.in +4n
-.nf
+.EX
.RB "$" " cd /proc/20/cwd; /bin/pwd"
-.fi
+.EE
.in
.IP
Note that the
The entries are separated by null bytes (\(aq\\0\(aq),
and there may be a null byte at the end.
Thus, to print out the environment of process 1, you would do:
+.IP
.in +4n
-.nf
-
+.EX
.RB "$" " strings /proc/1/environ"
-.fi
+.EE
.in
.IP
If, after an
is the flag designating an input file and
.I \-o
is the flag designating an output file:
+.IP
.in +4n
-.nf
-
+.EX
.RB "$" " foobar \-i /proc/self/fd/0 \-o /proc/self/fd/1 ..."
-.fi
+.EE
.in
.IP
and you have a working filter.
in
.IR /proc/self/fd .
Thus the example command above could be written as:
+.PP
.in +4n
-.nf
-
+.EX
.RB "$" " foobar \-i /dev/stdin \-o /dev/stdout ..."
-.fi
+.EE
.in
.IP
Permission to dereference or read
corresponding file descriptor.
.IP
For regular files and directories, we see something like:
+.IP
.in +4n
-.nf
-
+.EX
.RB "$" " cat /proc/12015/fdinfo/4"
pos: 1000
flags: 01002002
mnt_id: 21
-.fi
+.EE
.in
.IP
The fields are as follows:
the following fields:
.IP
.in +4n
-.nf
+.EX
pos: 0
flags: 02
mnt_id: 10
eventfd-count: 40
-.fi
+.EE
.in
.IP
.I eventfd-count
the following fields:
.IP
.in +4n
-.nf
+.EX
pos: 0
flags: 02
mnt_id: 10
tfd: 9 events: 19 data: 74253d2500000009
tfd: 7 events: 19 data: 74253d2500000007
-.fi
+.EE
.in
.IP
Each of the lines beginning
the following fields:
.IP
.in +4n
-.nf
+.EX
pos: 0
flags: 02
mnt_id: 10
sigmask: 0000000000000006
-.fi
+.EE
.in
.IP
.I sigmask
the following fields:
.IP
.in +4n
-.nf
+.EX
pos: 0
flags: 00
mnt_id: 11
inotify wd:2 ino:7ef82a sdev:800001 mask:800afff ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:2af87e00220ffd73
inotify wd:1 ino:192627 sdev:800001 mask:800afff ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:27261900802dfd73
-.fi
+.EE
.in
.IP
Each of the lines beginning with "inotify" displays information about
the following fields:
.IP
.in +4n
-.nf
+.EX
pos: 0
flags: 02
mnt_id: 11
fanotify flags:0 event-flags:88002
fanotify ino:19264f sdev:800001 mflags:0 mask:1 ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:4f261900a82dfd73
-.fi
+.EE
.in
.IP
The fourth line displays information defined when the fanotify group
.IR /proc/[pid]/io " (since kernel 2.6.20)"
.\" commit 7c3ab7381e79dfc7db14a67c6f4f3285664e1ec2
This file contains I/O statistics for the process, for example:
+.IP
.in +4n
-.nf
-
+.EX
.RB "#" " cat /proc/3828/io"
rchar: 323934931
wchar: 323929600
read_bytes: 0
write_bytes: 323932160
cancelled_write_bytes: 0
-.fi
+.EE
.in
.IP
The fields are as follows:
address pair (expressed as hexadecimal numbers),
and are symbolic links to the mapped files themselves.
Here is an example, with the output wrapped and reformatted to fit on an 80-column display:
+.IP
.in +4n
-.nf
-
+.EX
.RB "#" " ls -l /proc/self/map_files/"
lr\-\-\-\-\-\-\-\-. 1 root root 64 Apr 16 21:31
3252e00000\-3252e20000 \-> /usr/lib64/ld-2.15.so
\&...
-.fi
+.EE
.in
.IP
Although these entries are present for memory regions that were
Here is an example where the target file is the deleted
.I /dev/zero
one:
+.IP
.in +4n
-.nf
-
+.EX
lrw\-\-\-\-\-\-\-. 1 root root 64 Apr 16 21:33
7fc075d2f000\-7fc075e6f000 \-> /dev/zero (deleted)
-.fi
+.EE
.in
.IP
This directory appears only if the
.I perms
field is a set of permissions:
.IP
-.nf
-.in +5
+.in +4
+.EX
r = read
w = write
x = execute
s = shared
p = private (copy on write)
-.fi
+.EE
.in
.IP
The
about the mount points in the process's mount namespace (see
.BR mount_namespaces (7)).
Lines in this file have the form:
-.nf
-
+.IP
+.in +4n
+.EX
device /dev/sda7 mounted on /home with fstype ext3 [statistics]
( 1 ) ( 2 ) (3 ) (4)
-.fi
+.EE
+.in
.IP
The fields in each line are:
.RS 7
In one terminal, we start a shell in new user and mount namespaces,
and in that shell we create some new mount points:
.IP
-.nf
.in +4n
+.EX
$ \fBPS1='sh1# ' unshare \-Urnm\fP
sh1# \fBmount \-t tmpfs tmpfs /etc\fP # Mount empty tmpfs at /etc
sh1# \fBmount \-\-bind /usr /dev\fP # Mount /usr at /dev
sh1# \fBecho $$\fP
27123
+.EE
.in
-.fi
.IP
In a second terminal window, in the initial mount namespace,
we look at the contents of the corresponding mounts in
the initial and new namespaces:
.IP
-.nf
.in +4n
+.EX
$ \fBPS1='sh2# ' sudo sh\fP
sh2# \fBls /etc | wc \-l\fP # In initial NS
309
# mounted to /usr
sh2# \fBls /usr | wc \-l\fP # /usr in initial NS
11
+.EE
.in
-.fi
.IP
.\" The following was still true as at kernel 2.6.13
In a multithreaded process, the contents of the
command displays similar information,
in a form that may be easier for parsing.)
For each mapping there is a series of lines such as the following:
+.IP
.in +4n
-.nf
-
+.EX
00400000-0048a000 r-xp 00000000 fd:03 960637 /bin/bash
Size: 552 kB
Rss: 460 kB
Locked: 0 kB
ProtectionKey: 0
VmFlags: rd ex mr mw me dw
-
-.fi
+.EE
.in
+.PP
The first of these lines shows the same information as is displayed
for the mapping in
.IR /proc/[pid]/maps .
.I /proc/[pid]/statm
Provides information about memory usage, measured in pages.
The columns are:
+.IP
.in +4n
-.nf
-
+.EX
size (1) total program size
(same as VmSize in \fI/proc/[pid]/status\fP)
resident (2) resident set size
data (6) data + stack
.\" (including libs; broken, includes library text)
dt (7) dirty pages (unused since Linux 2.6; always 0)
-.fi
+.EE
.in
.TP
.I /proc/[pid]/status
.I /proc/[pid]/statm
in a format that's easier for humans to parse.
Here's an example:
+.IP
.in +4n
-.nf
-
+.EX
.RB "$" " cat /proc/$$/status"
Name: bash
Umask: 0022
Mems_allowed_list: 0
voluntary_ctxt_switches: 150
nonvoluntary_ctxt_switches: 545
-.fi
+.EE
.in
.IP
The fields are as follows:
For example:
.IP
.in +4n
-.nf
+.EX
ID: 1
signal: 60/00007fff86e452a8
notify: signal/pid.2634
signal: 60/00007fff86e452a8
notify: signal/pid.2634
ClockID: 1
-.fi
+.EE
.in
.IP
The lines shown for each timer have the following meanings:
For example on a x86_64 system:
.IP
.in -12n
-.nf
+.EX
Node 0, zone DMA 1 1 1 0 2 1 1 0 1 1 3
Node 0, zone DMA32 65 47 4 81 52 28 13 10 5 1 404
Node 0, zone Normal 216 55 189 101 84 38 37 27 5 3 587
-.fi
+.EE
.in
.IP
In this example, there is one node containing three zones and there
As long as no changes have been made to the following file,
the contents of
.I /proc/config.gz
-are the same as those provided by :
+are the same as those provided by:
+.IP
.in +4n
-.nf
-
+.EX
cat /lib/modules/$(uname \-r)/build/.config
-.fi
+.EE
.in
.IP
.I /proc/config.gz
Files include:
.IP
.in +4n
-.nf
+.EX
cache buffer size in KB
capacity number of sectors
driver driver version
settings drive settings
smart_thresholds in hexadecimal
smart_values in hexadecimal
-.fi
+.EE
.in
.IP
The
.I /proc/net/dev_mcast
Defined in
.IR /usr/src/linux/net/core/dev_mcast.c :
-.nf
-.in +5
+.IP
+.in +4
+.EX
indx interface_name dmi_u dmi_g dmi_address
2 eth0 1 0 01005e000001
3 eth1 1 0 01005e000001
4 eth2 1 0 01005e000001
+.EE
.in
-.fi
.TP
.I /proc/net/igmp
Internet Group Management Protocol.
Each line represents a queue.
Queues that have not been subscribed to
by user space are not shown.
-.nf
-
+.IP
+.in +4n
+.EX
1 4207 0 2 65535 0 0 0 1
(1) (2) (3)(4) (5) (6) (7) (8)
-.fi
+.EE
+.in
.IP
The fields in each line are:
.RS 7
allows root to add a hotplugged device to the list of known devices.
.IP
The command
+.IP
.in +4n
-.nf
-
+.EX
echo \(aqscsi add-single-device 1 0 5 0\(aq > /proc/scsi/scsi
-
-.fi
+.EE
.in
+.IP
will cause
host scsi1 to scan on SCSI channel 0 for a device on ID 5 LUN 0.
If there
that is:
.IP
.in +4n
-.nf
+.EX
.RB "#" " echo \(aqdarkstar\(aq > /proc/sys/kernel/hostname"
.RB "#" " echo \(aqmydomain\(aq > /proc/sys/kernel/domainname"
-.fi
+.EE
.in
.IP
has the same effect as
.IP
.in +4n
-.nf
+.EX
.RB "#" " hostname \(aqdarkstar\(aq"
.RB "#" " domainname \(aqmydomain\(aq"
-.fi
+.EE
.in
.IP
Note, however, that the classic darkstar.frop.org has the