/proc 文件系统中的文件及内容介绍

好资料,有时间翻译。

Linux System Configuration and the proc filesystem

The /proc filesystem

/proc文件系统是被用来存储许多系统配置参数。它是一个基于内核内存的虚拟文件系统。在该文件系统中有些文件是不能被root用户进行写的包括/proc/sys。下面的一些信息是来自于man页。/proc文件系统包括以下元素:

The /proc filesystem is used to store many system configuration parameters. It is a virtual 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:

  • 在/proc下,每个进程都存在一个以pid为名称的目录。下面是每个进程目录中包含的

1. cmdline - 该进程被调用时使用的命令行

2. cwd - 一个指向进程当前工作路径的链接

3.environ - 进程的环境

4.exe - 一个指向被运行的二进制文件的链接

5.fd - 一个目录,包含进程打开的标准输入,标准输出,标准错误

6.maps - 包含当前映射内存区域和他们的访问权限 格式如下:

address                    perms offset    dev   idnode  filename
08048000-0804e000 r-xp 00000400 0302 192233 /sbin/init
0804e000-0804f000 rw-p 00005000 0302 192233 /sbin/init

Permission s=private, s=shared
  • Numerical subdirectories exist 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   idnode  filename
      08048000-0804e000 r-xp 00000400 0302 192233 /sbin/init
      0804e000-0804f000 rw-p 00005000 0302 192233 /sbin/init

      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 0x07 0x01 0xff 0x80 -1% -1 ?" on my system.
  • bus - A directory
    • 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:
        0000	80867100	0	00000000	00000000	00000000	00000000	00000000	00000000	00000000
        0038 80867110 0 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        0039 80867111 0 00000000 00000000 00000000 00000000 0000f001 00000000 00000000
        003a 80867112 b 00000000 00000000 00000000 00000000 00006401 00000000 00000000
        003b 80867113 0 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        0040 10b79055 a 00006801 e4000000 00000000 00000000 00000000 00000000 00000000
        0058 10b79055 b 00006c01 e4001000 00000000 00000000 00000000 00000000 00000000
        0048 53338a01 9 e0000000 00000000 00000000 00000000 00000000 00000000 00000000
  • 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:
    	ext2
    nodev proc
    iso9660
    nodev autofs
    nodev devpts
    vfat
    nodev ncpfs
  • fs - A directory
    • 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.
    • drivers - A file describing the ide drivers on the system. My file:
      ide-cdrom version 4.54
      ide-disk version 1.08
    • hda - Symbolic link to ide0/hda
    • hdb - Symbolic link to ide0/hdb
    • hdd - Symbolic link to ide1/hdd
    • 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.
    • 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 853 03:02:260062 0 2147483647 c228ba40 00000000 c228b5c0 00000000 00000000
    2: POSIX ADVISORY WRITE 766 03:02:324064 0 0 c228b5c0 c228ba40 c228b560 00000000 00000000
    3: POSIX ADVISORY WRITE 755 03:02:323503 0 0 c228b560 c228b5c0 c3ef6de0 00000000 00000000
    4: POSIX ADVISORY WRITE 735 03:02:260034 0 2147483647 c3ef6de0 c228b560 c3ef6ba0 00000000 c3103f44
    4: -> POSIX ADVISORY WRITE 734 03:02:260034 0 2147483647 c3103f44 00000000 00000000 00000000 c2837f44
    4: -> POSIX ADVISORY WRITE 733 03:02:260034 0 2147483647 c2837f44 00000000 00000000 00000000 c2345f44
    4: -> POSIX ADVISORY WRITE 737 03:02:260034 0 2147483647 c2345f44 00000000 00000000 00000000 c233bf44
    4: -> POSIX ADVISORY WRITE 738 03:02:260034 0 2147483647 c233bf44 00000000 00000000 00000000 c2331f44
    4: -> POSIX ADVISORY WRITE 739 03:02:260034 0 2147483647 c2331f44 00000000 00000000 00000000 c2325f44
    4: -> POSIX ADVISORY WRITE 740 03:02:260034 0 2147483647 c2325f44 00000000 00000000 00000000 c2305f44
    4: -> POSIX ADVISORY WRITE 743 03:02:260034 0 2147483647 c2305f44 00000000 00000000 00000000 c230ff44
    4: -> POSIX ADVISORY WRITE 742 03:02:260034 0 2147483647 c230ff44 00000000 00000000 00000000 c231bf44
    4: -> POSIX ADVISORY WRITE 741 03:02:260034 0 2147483647 c231bf44 00000000 00000000 00000000 c3ef6de0
    5: FLOCK ADVISORY WRITE 0 03:02:51547 0 2147483647 c3ef6ba0 c3ef6de0 c3ef6a80 00000000 00000000
    6: FLOCK ADVISORY WRITE 0 03:02:259912 0 2147483647 c3ef6a80 c3ef6ba0 c3ef6a20 00000000 00000000
    7: POSIX ADVISORY WRITE 459 03:02:259911 0 2147483647 c3ef6a20 c3ef6a80 00000000 00000000 00000000
  • 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=0x00000000 ( 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
    • debug
    • dev
    • fs
    • kernel
      • domainname
      • file-max
      • file-nr
      • hostname
      • inode-max
      • inode-nr
      • osrelease
      • ostype
      • panic
      • real-root-dev
      • securelevel
      • version
    • net
    • proc
    • sunrpc
    • vm
  • tty
    • driver - A directory
      • serial - A file
    • 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
    • ldisc - A directory containing no files on my system.
    • 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. 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值