[ source navigation ] [ identifier search ] [ freetext search ] [ file search ]

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

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD70  -  FREEBSD6  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

Name Size Last modified (GMT) Description
Back Parent directory 2008-11-17 04:49:15
File README 4393 bytes 1999-08-28 00:46:53
C file procfs.c 6016 bytes 2008-11-12 22:17:56
C file procfs.h 2613 bytes 2005-01-23 18:51:50
C file procfs_ctl.c 9079 bytes 2008-03-16 13:24:23
C file procfs_dbregs.c 4110 bytes 2008-03-16 13:24:23
C file procfs_fpregs.c 3841 bytes 2007-04-23 13:59:46
C file procfs_ioctl.c 5810 bytes 2007-06-12 16:10:31
C file procfs_map.c 6052 bytes 2008-11-12 22:17:56
C file procfs_mem.c 2532 bytes 2005-01-23 18:51:50
C file procfs_note.c 2142 bytes 2004-04-08 01:01:25
C file procfs_regs.c 3799 bytes 2007-04-23 13:59:46
C file procfs_rlimit.c 3341 bytes 2005-01-23 18:51:50
C file procfs_status.c 6068 bytes 2008-03-16 13:24:23
C file procfs_type.c 2231 bytes 2005-01-23 18:51:50

  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: src/sys/fs/procfs/README,v 1.4 1999/08/28 00:46:53 peter Exp $

[ source navigation ] [ identifier search ] [ freetext search ] [ file search ]


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