⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proc.txt

📁 linux 内核源代码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
------------------------------------------------------------------------------                       T H E  /proc   F I L E S Y S T E M------------------------------------------------------------------------------/proc/sys         Terrehon Bowden <terrehon@pacbell.net>        October 7 1999                  Bodo Bauer <bb@ricochet.net>2.4.x update	  Jorge Nerin <comandante@zaralinux.com>      November 14 2000------------------------------------------------------------------------------Version 1.3                                              Kernel version 2.2.12					      Kernel version 2.4.0-test11-pre4------------------------------------------------------------------------------Table of Contents-----------------  0     Preface  0.1	Introduction/Credits  0.2	Legal Stuff  1	Collecting System Information  1.1	Process-Specific Subdirectories  1.2	Kernel data  1.3	IDE devices in /proc/ide  1.4	Networking info in /proc/net  1.5	SCSI info  1.6	Parallel port info in /proc/parport  1.7	TTY info in /proc/tty  1.8	Miscellaneous kernel statistics in /proc/stat  2	Modifying System Parameters  2.1	/proc/sys/fs - File system data  2.2	/proc/sys/fs/binfmt_misc - Miscellaneous binary formats  2.3	/proc/sys/kernel - general kernel parameters  2.4	/proc/sys/vm - The virtual memory subsystem  2.5	/proc/sys/dev - Device specific parameters  2.6	/proc/sys/sunrpc - Remote procedure calls  2.7	/proc/sys/net - Networking stuff  2.8	/proc/sys/net/ipv4 - IPV4 settings  2.9	Appletalk  2.10	IPX  2.11	/proc/sys/fs/mqueue - POSIX message queues filesystem  2.12	/proc/<pid>/oom_adj - Adjust the oom-killer score  2.13	/proc/<pid>/oom_score - Display current oom-killer score  2.14	/proc/<pid>/io - Display the IO accounting fields  2.15	/proc/<pid>/coredump_filter - Core dump filtering settings------------------------------------------------------------------------------Preface------------------------------------------------------------------------------0.1 Introduction/Credits------------------------This documentation is  part of a soon (or  so we hope) to be  released book onthe SuSE  Linux distribution. As  there is  no complete documentation  for the/proc file system and we've used  many freely available sources to write thesechapters, it  seems only fair  to give the work  back to the  Linux community.This work is  based on the 2.2.*  kernel version and the  upcoming 2.4.*. I'mafraid it's still far from complete, but we  hope it will be useful. As far aswe know, it is the first 'all-in-one' document about the /proc file system. Itis focused  on the Intel  x86 hardware,  so if you  are looking for  PPC, ARM,SPARC, AXP, etc., features, you probably  won't find what you are looking for.It also only covers IPv4 networking, not IPv6 nor other protocols - sorry. Butadditions and patches  are welcome and will  be added to this  document if youmail them to Bodo.We'd like  to  thank Alan Cox, Rik van Riel, and Alexey Kuznetsov and a lot ofother people for help compiling this documentation. We'd also like to extend aspecial thank  you to Andi Kleen for documentation, which we relied on heavilyto create  this  document,  as well as the additional information he provided.Thanks to  everybody  else  who contributed source or docs to the Linux kerneland helped create a great piece of software... :)If you  have  any comments, corrections or additions, please don't hesitate tocontact Bodo  Bauer  at  bb@ricochet.net.  We'll  be happy to add them to thisdocument.The   latest   version    of   this   document   is    available   online   athttp://skaro.nightcrawler.com/~bb/Docs/Proc as HTML version.If  the above  direction does  not works  for you,  ypu could  try the  kernelmailing  list  at  linux-kernel@vger.kernel.org  and/or try  to  reach  me  atcomandante@zaralinux.com.0.2 Legal Stuff---------------We don't  guarantee  the  correctness  of this document, and if you come to uscomplaining about  how  you  screwed  up  your  system  because  of  incorrectdocumentation, we won't feel responsible...------------------------------------------------------------------------------CHAPTER 1: COLLECTING SYSTEM INFORMATION------------------------------------------------------------------------------------------------------------------------------------------------------------In This Chapter------------------------------------------------------------------------------* Investigating  the  properties  of  the  pseudo  file  system  /proc and its  ability to provide information on the running Linux system* Examining /proc's structure* Uncovering  various  information  about the kernel and the processes running  on the system------------------------------------------------------------------------------The proc  file  system acts as an interface to internal data structures in thekernel. It  can  be  used to obtain information about the system and to changecertain kernel parameters at runtime (sysctl).First, we'll  take  a  look  at the read-only parts of /proc. In Chapter 2, weshow you how you can use /proc/sys to change settings.1.1 Process-Specific Subdirectories-----------------------------------The directory  /proc  contains  (among other things) one subdirectory for eachprocess running on the system, which is named after the process ID (PID).The link  self  points  to  the  process reading the file system. Each processsubdirectory has the entries listed in Table 1-1.Table 1-1: Process specific entries in /proc .............................................................................. File		Content clear_refs	Clears page referenced bits shown in smaps output cmdline	Command line arguments cpu		Current and last cpu in which it was executed	(2.4)(smp) cwd		Link to the current working directory environ	Values of environment variables exe		Link to the executable of this process fd		Directory, which contains all file descriptors maps		Memory maps to executables and library files	(2.4) mem		Memory held by this process root		Link to the root directory of this process stat		Process status statm		Process memory status information status		Process status in human readable form wchan		If CONFIG_KALLSYMS is set, a pre-decoded wchan smaps		Extension based on maps, the rss size for each mapped file..............................................................................For example, to get the status information of a process, all you have to do isread the file /proc/PID/status:  >cat /proc/self/status   Name:   cat   State:  R (running)   Pid:    5452   PPid:   743   TracerPid:      0						(2.4)  Uid:    501     501     501     501   Gid:    100     100     100     100   Groups: 100 14 16   VmSize:     1112 kB   VmLck:         0 kB   VmRSS:       348 kB   VmData:       24 kB   VmStk:        12 kB   VmExe:         8 kB   VmLib:      1044 kB   SigPnd: 0000000000000000   SigBlk: 0000000000000000   SigIgn: 0000000000000000   SigCgt: 0000000000000000   CapInh: 00000000fffffeff   CapPrm: 0000000000000000   CapEff: 0000000000000000 This shows you nearly the same information you would get if you viewed it withthe ps  command.  In  fact,  ps  uses  the  proc  file  system  to  obtain itsinformation. The  statm  file  contains  more  detailed  information about theprocess memory usage. Its seven fields are explained in Table 1-2.  The statfile contains details information about the process itself.  Its fields areexplained in Table 1-3.Table 1-2: Contents of the statm files (as of 2.6.8-rc3).............................................................................. Field    Content size     total program size (pages)		(same as VmSize in status) resident size of memory portions (pages)	(same as VmRSS in status) shared   number of pages that are shared	(i.e. backed by a file) trs      number of pages that are 'code'	(not including libs; broken,							includes data segment) lrs      number of pages of library		(always 0 on 2.6) drs      number of pages of data/stack		(including libs; broken,							includes library text) dt       number of dirty pages			(always 0 on 2.6)..............................................................................Table 1-3: Contents of the stat files (as of 2.6.22-rc3).............................................................................. Field          Content  pid           process id  tcomm         filename of the executable  state         state (R is running, S is sleeping, D is sleeping in an                uninterruptible wait, Z is zombie, T is traced or stopped)  ppid          process id of the parent process  pgrp          pgrp of the process  sid           session id  tty_nr        tty the process uses  tty_pgrp      pgrp of the tty  flags         task flags  min_flt       number of minor faults  cmin_flt      number of minor faults with child's  maj_flt       number of major faults  cmaj_flt      number of major faults with child's  utime         user mode jiffies  stime         kernel mode jiffies  cutime        user mode jiffies with child's  cstime        kernel mode jiffies with child's  priority      priority level  nice          nice level  num_threads   number of threads  start_time    time the process started after system boot  vsize         virtual memory size  rss           resident set memory size  rsslim        current limit in bytes on the rss  start_code    address above which program text can run  end_code      address below which program text can run  start_stack   address of the start of the stack  esp           current value of ESP  eip           current value of EIP  pending       bitmap of pending signals (obsolete)  blocked       bitmap of blocked signals (obsolete)  sigign        bitmap of ignored signals (obsolete)  sigcatch      bitmap of catched signals (obsolete)  wchan         address where process went to sleep  0             (place holder)  0             (place holder)  exit_signal   signal to send to parent thread on exit  task_cpu      which CPU the task is scheduled on  rt_priority   realtime priority  policy        scheduling policy (man sched_setscheduler)  blkio_ticks   time spent waiting for block IO..............................................................................1.2 Kernel data---------------Similar to  the  process entries, the kernel data files give information aboutthe running kernel. The files used to obtain this information are contained in/proc and  are  listed  in Table 1-4. Not all of these will be present in yoursystem. It  depends  on the kernel configuration and the loaded modules, whichfiles are there, and which are missing.Table 1-4: Kernel info in /proc.............................................................................. File        Content                                            apm         Advanced power management info                     buddyinfo   Kernel memory allocator information (see text)	(2.5) bus         Directory containing bus specific information      cmdline     Kernel command line                                cpuinfo     Info about the CPU                                 devices     Available devices (block and character)            dma         Used DMS channels                                  filesystems Supported filesystems                              driver	     Various drivers grouped here, currently rtc (2.4) execdomains Execdomains, related to security			(2.4) fb	     Frame Buffer devices				(2.4) fs	     File system parameters, currently nfs/exports	(2.4) ide         Directory containing info about the IDE subsystem  interrupts  Interrupt usage                                    iomem	     Memory map						(2.4) ioports     I/O port usage                                     irq	     Masks for irq to cpu affinity			(2.4)(smp?) isapnp	     ISA PnP (Plug&Play) Info				(2.4) kcore       Kernel core image (can be ELF or A.OUT(deprecated in 2.4))    kmsg        Kernel messages                                    ksyms       Kernel symbol table                                loadavg     Load average of last 1, 5 & 15 minutes                 locks       Kernel locks                                       meminfo     Memory info                                        misc        Miscellaneous                                      modules     List of loaded modules                             mounts      Mounted filesystems                                net         Networking info (see text)                         partitions  Table of partitions known to the system            pci	     Deprecated info of PCI bus (new way -> /proc/bus/pci/,             decoupled by lspci					(2.4) rtc         Real time clock                                    scsi        SCSI info (see text)                               slabinfo    Slab pool info                                     stat        Overall statistics                                 swaps       Swap space utilization                             sys         See chapter 2                                      sysvipc     Info of SysVIPC Resources (msg, sem, shm)		(2.4) tty	     Info of tty drivers uptime      System uptime                                      version     Kernel version                                     video	     bttv info of video resources			(2.4)..............................................................................You can,  for  example,  check  which interrupts are currently in use and whatthey are used for by looking in the file /proc/interrupts:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -