The /proc filesystem

Linux System Configuration and the proc filesystem

The /proc filesystem

The /proc is a virtual filesystem which is getting mounted everything when your system starts. It is used to store many system configuration parameters. It is a filesystem that resides in the kernels memory. Some of the areas in this filesystem cannot be written to by the root user including /proc/sys. Much information here is based on the proc man page. Fro more information refer to that page. Elements of the proc filesystem include:

* Numerical subdirectories getting created for every process. The following files or directories are contained in each processes directory:

  • 1. cmdline – The command line the process was invoked with
    2. cwd – A link to the current working directory of the process
    3. environ – The process environment
    4. exe – A pointer appearing as a symbolic link to the binary that was executed.
    5. fd – A subdirectory with one entry per file that the process has open. 0-std input, 1-std output, 2-std err.
    6. maps – Contains the currently mapped memory regions and their access permissions. The format is:
address perms offset dev inode filename
08048000-0805d000 r-xp 00000000 08:08 81491 /sbin/init
0805d000-0805e000 rwxp 00015000 08:08 81491 /sbin/init
0805e000-081ab000 rwxp 0805e000 00:00 0 [heap]
b7e1d000-b7e1e000 rwxp b7e1d000 00:00 0
b7e1e000-b7f59000 r-xp 00000000 08:08 538659 /lib/tls/i686/cmov/libc-2.5.so
b7f59000-b7f5a000 r-xp 0013b000 08:08 538659 /lib/tls/i686/cmov/libc-2.5.so
b7f5a000-b7f5c000 rwxp 0013c000 08:08 538659 /lib/tls/i686/cmov/libc-2.5.so
b7f5c000-b7f5f000 rwxp b7f5c000 00:00 0
b7f72000-b7f74000 rwxp b7f72000 00:00 0
b7f74000-b7f8d000 r-xp 00000000 08:08 504949 /lib/ld-2.5.so
b7f8d000-b7f8f000 rwxp 00019000 08:08 504949 /lib/ld-2.5.so
bfdc0000-bfdd6000 rw-p bfdc0000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]

Permission s=private, s=shared
7. mem – The memory of the process that accesses the /dev/mem device
8. root – Points to the root filesystem
9. stat – Status information about the process used by the ps(1) command. Fields are:
1. pid – Process id
2. comm – The executable filename
3. state – R (running), S(sleeping interruptable), D(sleeping), Z(zombie), or T(stopped on a signal).
4. ppid – Parent process ID
5. pgrp – Process group ID
6. session – The process session ID.
7. tty – The tty the process is using
8. tpgid – The process group ID of the owning process of the tty the current process is connected to.
9. flags – Process flags, currently with bugs
10. minflt – Minor faults the process has made
11. cminflt – Minor faults the process and its children have made.
12. majflt
13. cmajflt
14. utime – The number of jiffies (processor time) that this process has been scheduled in user mode
15. stime – in kernel mode
16. cutime – This process and its children in user mode
17. cstime – in kernel mode
18. counter – The maximum time of this processes next time slice.
19. priority – The priority of the nice(1) (process priority) value plus fifteen.
20. timeout – The time in jiffies of the process’s next timeout.
21. itrealvalue – The time in jiffies before the next SIGALRM is sent to the process because of an internal timer.
22. starttime – Time the process started after system boot
23. vsize – Virtual memory size
24. rlim – Current limit in bytes of the rss of the process.
25. startcode – The address above which program text can run.
26. endcode – The address below which program text can run.
27. startstack – The address of the start of the stack
28. kstkesp – The current value of esp for the process as found in the kernel stack page.
29. kstkeip – The current 32 bit instruction pointer, EIP.
30. signal – The bitmap of pending signals
31. blocked – The bitmap of blocked signals
32. sigignore – The bitmap of ignored signals
33. sigcatch – The bitmap of catched signals
34. wchan – The channel in which the process is waiting. The “ps -l” command gives somewhat of a list.

* apm – A file containing the string “1.9 1.2 0×07 0×01 0xff 0×80 -1% -1 ?” on my system.
* bus – A directory
o pci – A directory
+ 00 – A directory containing filenames like 00.0, 07.0, 07.1, 07.2, 08.0, 09.0, and 0b.0. Each are 256 bytes long and appear to be in binary form.
+ devices – I think this file numerically identifies devices on the pci bus. My file contains:

Character devices:

1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
6 lp
7 vcs
10 misc
13 input
14 sound
21 sg
29 fb
99 ppdev
116 alsa
128 ptm
136 pts
180 usb
189 usb_device
216 rfcomm
226 drm
253 pcmcia
254 usb_endpoint

Block devices:
1 ramdisk
8 sd
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd

* cmdline – The command line at system startup. My file contains “auto BOOT_IMAGE=rhl ro root=302″.
* cpuinfo – CPU architecture information
* devices – Text listing of major numbers and device groups
* dma – A list of ISA direct memory access channels in use.
* fb – On my system, this file is empty
* filesystems – A text listing of the filesystems compiled into the kernel. The file on my system:

nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cpuset
nodev debugfs
nodev securityfs
nodev sockfs
nodev pipefs
nodev futexfs
nodev tmpfs
nodev inotifyfs
nodev eventpollfs
nodev devpts
cramfs
nodev ramfs
nodev mqueue
nodev usbfs
ext3
nodev fuse
fuseblk
nodev fusectl
vfat
ntfs
nodev binfmt_misc

* fs – A directory
o nfs – A directory
+ exports – A file containing information similar to that in the /etc/exports file. My listing:
# Version 1.0
# Path Client(Flags) # IPs
/tftpboot/lts/ltsroot linux1(ro,no_root_squash,async,wdelay) # 192.168.200.201
/tftpboot/lts/ltsroot linux3(ro,no_root_squash,async,wdelay) # 192.168.200.203
/tftpboot/lts/ltsroot linux2(ro,no_root_squash,async,wdelay) # 192.168.200.202

+ time-diff-margin – A file containing a numerical string value. On my system it is “10″.
* ide – A directory containing information on ide devices.
o drivers – A file describing the ide drivers on the system. My file:

ide-cdrom version 4.54
ide-disk version 1.08

o hda – Symbolic link to ide0/hda
o hdb – Symbolic link to ide0/hdb
o hdd – Symbolic link to ide1/hdd
o ide0 – A directory containing information on the device ide0.
+ channel – A file containing the channel number of the… device? My file contains the number 0.
+ config – A file. My file:

pci bus 00 device 39 vid 8086 did 7111 channel 0
86 80 11 71 05 00 80 02 01 80 01 01 00 40 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
77 e3 30 c0 9b 00 00 00 03 00 22 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 28 0f 00 00 00 00 00 00

+ hda – A directory containing the following files
# cache – The amount of cache capability in KB? On my system it is the number “256″
# capacity – The capacity of the device. On my system it is 12500460 on a 6GB hard drive.
# driver – the type of driver. On my system it is “ide-disk version 1.08″.
# geometry – The disk geometry of the device. On my system:

physical 13228/15/63
logical 778/255/63

# identify – On my system:

0c5a 33ac 0000 000f 0000 0000 003f 0000
0000 0000 3541 4330 3336 3350 2020 2020
2020 2020 2020 2020 0000 0200 0000 332e
3034 2020 2020 5354 3336 3432 3241 2020
2020 2020 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 8010
0000 2f00 0000 0200 0200 0007 33ac 000f
003f bdec 00be 0010 bdec 00be 0000 0007
0003 0078 0078 00f0 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
001e 0000 3069 4001 4000 3068 0001 4000
0407 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 85c4 00cb 85c4 00cb 2020 0002 0000
0001 0000 0001 0401 0001 0140 0201 0000
3c24 0001 4001 3cb4 0100 0100 0072 3001
0001 0128 0000 0000 1000 0105 00e9 0009
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

# media – On my system it is “disk”.
# model – The manufacturers model. On my system it is “ST36422A”.
# settings – On my system:

name value min max mode
—- —– — — —-
bios_cyl 778 0 65535 rw
bios_head 255 0 255 rw
bios_sect 63 0 63 rw
breada_readahead 4 0 127 rw
bswap 0 0 1 r
file_readahead 124 0 2097151 rw
io_32bit 0 0 3 rw
keepsettings 0 0 1 rw
max_kb_per_request 64 1 127 rw
multcount 0 0 8 rw
nice1 1 0 1 rw
nowerr 0 0 1 rw
pio_mode write-only 0 255 w
slow 0 0 1 rw
unmaskirq 0 0 1 rw
using_dma 1 0 1 rw

# smart_thresholds – A table of numbers similar to the file identify.
# smart_values – A table of numbers as in smart_thresholds
+ hdb – A directory containing the same files as hda, above.
+ mate – A file containing the string “ide1″ on my system which I think is the companion disk device.
+ model – A file containing the string “pci” on my system.
o ide1 – A directory similar to the directory ide0, above with information on the device ide1.
* interrupts – The number of interrupts per IRQ.
* ioports – A list of currently registered input-output port regions that are in use.
* kcore – Represents the physical memory of the system stored in the core format.
* kmsg – This file can be used to log system messages.
* ksyms – Holds the kernel exported symbol definitions used by the modules(X) tools to dynamically link and bind loadable modules.
* loadavg – Load average numbers
* malloc – Present if CONFIGDEBUGMALLOC was defined during kernel compilation.
* locks – The file on my system:

1: POSIX ADVISORY WRITE 29396 08:08:509286 0 EOF
2: POSIX ADVISORY WRITE 6086 08:08:522914 0 EOF
3: POSIX ADVISORY WRITE 5508 08:08:602744 0 EOF
4: POSIX ADVISORY WRITE 5310 00:0f:17832 0 EOF
5: FLOCK ADVISORY WRITE 5194 00:0f:17594 0 EOF
6: POSIX ADVISORY WRITE 5181 00:0f:17583 0 EOF
7: POSIX ADVISORY WRITE 4880 08:08:130879 0 EOF
8: POSIX ADVISORY WRITE 4880 08:08:130878 0 EOF
9: POSIX ADVISORY WRITE 4880 08:08:130877 0 EOF
10: FLOCK ADVISORY WRITE 4780 00:0f:16731 0 EOF
11: FLOCK ADVISORY WRITE 4778 00:0f:16720 0 EOF

* mdstat – The file on my system:

Personalities :
read_ahead not set
md0 : inactive
md1 : inactive
md2 : inactive
md3 : inactive

* meminfo – Used by free(1) to report memory usage.
* misc – The file on my system:

135 rtc
134 apm
1 psaux

* modules – A list of kernel modules loaded by the system
* mounts – Shows mounted filesystems. Shows device, mount point, filesystem type, permissions, and two flags. The file on my system:

/dev/root / ext2 rw 0 0
/proc /proc proc rw 0 0
/dev/hdb1 /data vfat rw 0 0
/dev/hda1 /dos vfat rw 0 0
/dev/hda3 /slackw ext2 rw 0 0
none /dev/pts devpts rw 0 0
automount(pid640) /mnt autofs rw 0 0
ENG_SRV/MYUSER /eng_srv ncpfs rw 0 0

* mtrr – The file on my system:

reg00: base=0x000a0000 ( 0MB), size= 128kB: write-combining, count=1
reg01: base=0x000c0000 ( 0MB), size= 256kB: uncachable, count=1
reg03: base=0x000a8000 ( 0MB), size= 32kB: write-combining, count=1
reg07: base=0×00000000 ( 0MB), size= 64MB: write-back, count=1

* net – Various network pseudo files. The netstat(8) command suite provides cleaner access to these files. Files:
1. arp – The kernel address resolution protocol table.
2. dev – Network device status information
3. ipx
4. ipx_route
5. rarp – used to provide rarp(8) services.
6. raw – A dump of the RAW socket table
7. route – Looks like route(8).
8. snmp – Holds the ASCII databases used for the IP, ICMP, TCP, and UDP management information bases for an snmp agent.
9. tcp – A dump of the TCP socket table.
10. udp – A dump of the UDP socket table
11. unix – Lists UNIX domain sockets and their status.
* partitions – Lists the partitions and their device major and minor numbers. The file on my system:

major minor #blocks name

3 0 6250230 hda
3 1 208813 hda1
3 2 3068415 hda2
3 3 2843505 hda3
3 4 128520 hda4
3 64 6250230 hdb
3 65 6249253 hdb1
22 64 1073741823 hdd

* pci – A listing of all PCI devices that the system is aware of.
* rtc – A file containing clock information. The file on my system:

rtc_time : 20:15:03
rtc_date : 2000-05-07
rtc_epoch : 1900
alarm : 16:29:44
DST_enable : no
BCD : yes
24hr : yes
square_wave : no
alarm_IRQ : no
update_IRQ : no
periodic_IRQ : no
periodic_freq : 1024
batt_status : okay

* scsi – A directory with scsi files and driver directories.
1. scsi – A list of all scsi devices known to the kernel
2. drivername – Various scsi driver brand names
* self – Refers to the /proc filesystem.
* slabinfo – The file on my system

slabinfo – version: 1.0
kmem_cache 29 42
pio_request 0 0
tcp_tw_bucket 0 42
tcp_bind_bucket 41 127
tcp_open_request 0 0
skbuff_head_cache 64 147
sock 150 242
dquot 0 0
filp 1505 1512
signal_queue 0 0
buffer_head 566 1428
mm_struct 65 93
vm_area_struct 2527 3528
dentry_cache 4704 4743
files_cache 72 99
uid_cache 4 127
size-131072 0 0
size-65536 0 0
size-32768 0 0
size-16384 16 16
size-8192 0 1
size-4096 3 8
size-2048 151 176
size-1024 20 32
size-512 37 72
size-256 33 70
size-128 546 700
size-64 192 210
size-32 1080 1197
slab_cache 78 126

* stat – kernel statistics subdirectory
1. cpu – Jiffies spent in user mode, user mode with low priority, system mode, and idle.
2. disk – Four disk entries not yet implemented
3. page – The number of pages the system paged in and out.
4. swap – Swap pages that have been brought in and out.
5. intr – The number of interrupts received form the system boot
6. ctxt – The number of context switches that the system underwent.
7. btime – Boot time in seconds since Jan 1, 1970.
* swaps – A file defining swap partitions. The file on my system:

Filename Type Size Used Priority
/dev/hda4 partition 128516 7600 -1

* sys – Directory corresponding to kernel variables
o debug
o dev
o fs
o kernel
+ domainname
+ file-max
+ file-nr
+ hostname
+ inode-max
+ inode-nr
+ osrelease
+ ostype
+ panic
+ real-root-dev
+ securelevel
+ version
o net
o proc
o sunrpc
o vm
* tty
o driver – A directory
+ serial – A file
o drivers – A file listing device drivers. The file on my system:

pty_slave /dev/pts 136 0-255 pty:slave
pty_master /dev/ptm 128 0-255 pty:master
pty_slave /dev/ttyp 3 0-255 pty:slave
pty_master /dev/pty 2 0-255 pty:master
serial /dev/cua 5 64-95 serial:callout
serial /dev/ttyS 4 64-95 serial
/dev/tty0 /dev/tty0 4 0 system:vtmaster
/dev/ptmx /dev/ptmx 5 2 system
/dev/console /dev/console 5 1 system:console
/dev/tty /dev/tty 5 0 system:/dev/tty
unknown /dev/tty 4 1-63 console

o ldisc – A directory containing no files on my system.
o ldiscs – The file on my system:

n_tty 0

* uptime
* version

The sysctl tool

This tool is worth mentioning in this section since it is used to manipulate kernel parameters. If you type “sysctl -a |more” you will see a long list of kernel parameters. You can use this sysctl program to modify these parameters. However, I have been unable to add new parameters.

Leave a Reply

Your email address will not be published. Required fields are marked *