The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/procfs/

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

Name Size Last modified (GMT) Description
Back Parent directory 2019-04-23 12:45:19
File README 4397 bytes 2019-04-23 12:45:19
C file procfs.c 6038 bytes 2019-04-23 12:45:19
C file procfs.h 2617 bytes 2019-04-23 12:45:19
C file procfs_ctl.c 9233 bytes 2019-04-23 12:45:19
C file procfs_dbregs.c 4128 bytes 2019-04-23 12:45:19
C file procfs_fpregs.c 3845 bytes 2019-04-23 12:45:19
C file procfs_ioctl.c 5356 bytes 2019-04-23 12:45:19
C file procfs_map.c 6020 bytes 2019-04-23 12:45:19
C file procfs_mem.c 2536 bytes 2019-04-23 12:45:19
C file procfs_note.c 2147 bytes 2019-04-23 12:45:19
C file procfs_regs.c 3803 bytes 2019-04-23 12:45:19
C file procfs_rlimit.c 3345 bytes 2019-04-23 12:45:19
C file procfs_status.c 6133 bytes 2019-04-23 12:45:19
C file procfs_type.c 2235 bytes 2019-04-23 12:45:19

    1 saute procfs lyonnais
    2 
    3 procfs supports two levels of directory.  the filesystem root
    4 directory contains a representation of the system process table.
    5 this consists of an entry for each active and zombie process, and
    6 an additional entry "curproc" which always represents the process
    7 making the lookup request.
    8 
    9 each of the sub-directories contains several files.  these files
   10 are used to control and interrogate processes.  the files implemented
   11 are:
   12 
   13         file    - xxx.  the exec'ed file.
   14 
   15         status  - r/o.  returns process status.
   16 
   17         ctl     - w/o.  sends a control message to the process.
   18                         for example:
   19                                 echo hup > /proc/curproc/note
   20                         will send a SIGHUP to the shell.
   21                         whereas
   22                                 echo attach > /proc/1293/ctl
   23                         would set up process 1293 for debugging.
   24                         see below for more details.
   25 
   26         mem     - r/w.  virtual memory image of the process.
   27                         parts of the address space are readable
   28                         only if they exist in the target process.
   29                         a more reasonable alternative might be
   30                         to return zero pages instead of an error.
   31                         comments?
   32 
   33         note    - w/o.  writing a string here sends the
   34                         equivalent note to the process.
   35                         [ not implemented. ]
   36 
   37         notepg  - w/o.  the same as note, but sends to all
   38                         members of the process group.
   39                         [ not implemented. ]
   40 
   41         regs    - r/w.  process register set.  this can be read
   42                         or written any time even if the process
   43                         is not stopped.  since the bsd kernel
   44                         is single-processor, this implementation
   45                         will get the "right" register values.
   46                         a multi-proc kernel would need to do some
   47                         synchronisation.
   48 
   49 this then looks like:
   50 
   51 % ls -li /proc
   52 total 0
   53    9 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 0
   54   17 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 1
   55   89 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 10
   56   25 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 2
   57 2065 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 257
   58 2481 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 309
   59  265 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 32
   60 3129 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 390
   61 3209 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 400
   62 3217 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 401
   63 3273 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 408
   64  393 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 48
   65  409 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 50
   66  465 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 57
   67  481 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 59
   68  537 dr-xr-xr-x  2 root  kmem   0 Sep 21 15:06 66
   69  545 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 67
   70  657 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 81
   71  665 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 82
   72  673 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 83
   73  681 dr-xr-xr-x  2 root  wheel  0 Sep 21 15:06 84
   74 3273 dr-xr-xr-x  2 jsp   staff  0 Sep 21 15:06 curproc
   75 % ls -li /proc/curproc
   76 total 408
   77 3341 --w-------  1 jsp  staff       0 Sep 21 15:06 ctl
   78 1554 -r-xr-xr-x  1 bin  bin     90112 Mar 29 04:52 file
   79 3339 -rw-------  1 jsp  staff  118784 Sep 21 15:06 mem
   80 3343 --w-------  1 jsp  staff       0 Sep 21 15:06 note
   81 3344 --w-------  1 jsp  staff       0 Sep 21 15:06 notepg
   82 3340 -rw-------  1 jsp  staff       0 Sep 21 15:06 regs
   83 3342 -r--r--r--  1 jsp  staff       0 Sep 21 15:06 status
   84 % df /proc/curproc /proc/curproc/file
   85 Filesystem  512-blocks    Used   Avail Capacity  Mounted on
   86 proc                 2       2       0   100%    /proc
   87 /dev/wd0a        16186   13548    1018    93%    /
   88 % cat /proc/curproc/status
   89 cat 446 439 400 81 12,0 ctty 748620684 270000 0 0 0 20000 nochan 11 20 20 20 0 21 117
   90 
   91 
   92 
   93 the basic sequence of commands written to "ctl" would be
   94 
   95         attach          - this stops the target process and
   96                           arranges for the sending process
   97                           to become the debug control process
   98         wait            - wait for the target process to come to
   99                           a steady state ready for debugging.
  100         step            - single step, with no signal delivery.
  101         run             - continue running, with no signal delivery,
  102                           until next trap or breakpoint.
  103         <signame>       - deliver signal <signame> and continue running.
  104         detach          - continue execution of the target process
  105                           and remove it from control by the debug process
  106 
  107 in a normal debugging environment, where the target is fork/exec'd by
  108 the debugger, the debugger should fork and the child should stop itself
  109 (with a self-inflicted SIGSTOP).  the parent should do a "wait" then an
  110 "attach".  as before, the child will hit a breakpoint on the first
  111 instruction in any newly exec'd image.
  112 
  113 $FreeBSD: releng/6.4/sys/fs/procfs/README 50477 1999-08-28 01:08:13Z peter $

[ source navigation ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.