The kernel does not use normal blanks to separate elements but NUL bytes as used in C to indicate the end of a string

[email protected]> cat cmdline emacsfs.tex

The od tool can be used to convert the data to a readable format:

[email protected]> od -t a /proc/7748/cmdline

0000015

The above output makes it clear that the process was called by emacs fs.tex. The other files contain the following data:

□ environ indicates all environment variables set for the program; again, NUL characters are used as separators instead of blanks.

□ All memory mappings to libraries (and to the binary file itself) used by the process are listed in text form in maps. In the case of emacs, an excerpt from this file would look like this (I use a regular text format without NUL characters):

[email protected]> cat maps

00400000-005a4000 r-xp 00000000 08:05 283752 /usr/bin/emacs

007a3 000-00e8c000 rw-p 001a3000 08:05 283752 /usr/bin/emacs

00e8c000-018a1000 rw-p 00e8c000 00:00 0 [heap]

2af4b085d000-2af4b0879000 r-xp 00000000 08:05 1743619

/lib64/ld-2.6.1.so

4003a000-

-40086000

r-xp

00000000

03:

02

131108

/usr/lib/libcanna.so.1.2

40086000

-4008b000

rwxp

0004b000

03:

02

131108

/usr/lib/libcanna.so.1.2

4008b000

-40090000

rwxp

4008b000

00:

00

0

40090000

-400a0000

r-xp

00000000

03:

02

131102

/usr/lib/libRKC.so.1.2

400a0000-

-400a1000

rwxp

00010000

03:

02

131102

/usr/lib/libRKC.so.1.2

400a1000-

-400a3000

rwxp

400a1000

00:

00

0

400a3000-

-400e6000

r-xp

00000000

03:

02

133514

/usr/X11R6/lib/libXaw3d.so

400e6000

-400ec000

rwxp

00043000

03:

02

133514

/usr/X11R6/lib/libXaw3d.so

400ec000

-400fe000

rwxp

400ec000

00:

00

0

400fe000

-4014f000

r-xp

00000000

03:

02

13104

/usr/lib/libtiff.so.3.7.3

4014f000

-40151000

rwxp

00051000

03:

02

13104

/usr/lib/libtiff.so.3.7.3

40151000

-4018f000

r-xp

00000000

03:

02

13010

/usr/lib/libpng.so.3.1.2.8

4018f000

-40190000

rwxp

0003d000

03:

02

13010

/usr/lib/libpng.so.3.1.2.8

40190000

-401af000

r-xp

00000000

03:

02

9011

/usr/lib/libjpeg.so.62.0.0

401af000-

-401b0000

rwxp

0001e000

03:

02

9011

/usr/lib/libjpeg.so.62.0.0

401b0000

-401c2000

r-xp

00000000

03:

02

12590

/lib/libz.so.1.2.3

401c2000

-401c3000

rwxp

00011000

03:

02

12590

/lib/libz.so.1.2.3

2af4b7dc1000-2af4b7dc3 000 rw-p 00001000 08:05 490436 /usr/lib64/pango/1.6.0/modules/pango-basic-fc.so 2af4b7dc3000-2af4b7e07000 r--p 00000000 08:05 1222118 /usr/share/fonts/truetype/arial.ttf 2af4b7e4d000-2af4b7e53 000 r--p 00000000 08:05 211780 /usr/share/locale-bundle/en_GB/LC_MESSAGES/glib20.mo 2af4b7e53000-2af4b7e9c000 rw-p 2af4b7e07000 00:00 0 7ffffa218000-7ffffa24d000 rw-p 7ffffa218000 00:00 0 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0

□ status returns general information on process status in text form.

[email protected]> cat status

Name: emacs

State: S (sleeping)

SleepAVG: 98%

Tgid: 7748

Pid: 7748

PPid: 4891

TracerPid: 0

Uid: 1000 1000 1000 1000 Gid: 100 100 100 100 FDSize Groups VmPeak VmSize

VmLck VmHWM VmRSS VmData: VmStk VmExe VmLib VmPTE Threads: SigQ:

1000 100 100 100 256

16 33 100 140352 kB 139888 kB 0 kB 28144 kB 27860 kB 10772 kB 212 kB 1680 kB 13256 kB 284 kB 1

0/38912

SigPnd ShdPnd SigBlk SigIgn SigCgt CapInh CapPrm CapEff Cpus_allowed: Mems allowed:

0000000000000000 0000000000000000 0000000000000000 0000000000000000 00000001d1817efd 0000000000000000 0000000000000000 0000000000000000 00000000,00000000,00000000,0000000f 00000000,00000001

Information is provided not only on UID/GID and other process numbers but also on memory allocation, process capabilities, and the state of the individual signal masks (pending, blocked, etc.).

□ stat and statm contain — as a consecutive sequence of numbers — more status information on the process and its memory consumption.

The fd subdirectory contains files with numbers as names; these represent the individual file descriptors of the process. A symbolic link points to the position in the filesystem that is associated with the file descriptor, assuming it is a file in the proper sense. Other elements such as pipes that are also addressed via file descriptors are given a link target in the form pipe:[1434].

Similarly, symbolic links point to files and directories associated with the process:

□ cwd points to the current working directory of the process. If users have the appropriate rights, they can switch to this directory using cd cwd without needing to know which directory it is.

□ exe points to the binary file with the application code. In our example, it would point to

/usr/bin/emacs

□ root points to the root directory of the process. This need not necessarily be the global root directory (see the chroot mechanism discussed in Chapter 8).

Continue reading here: General System Information

Was this article helpful?

0 0