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
|
Name | Size | Last modified (GMT) | Description | |
Parent directory | 2023-01-29 20:54:29 | |||
README | 4330 bytes | 2023-01-29 20:54:29 | ||
procfs.h | 6663 bytes | 2023-01-29 20:54:29 | ||
procfs_ctl.c | 8299 bytes | 2023-01-29 20:54:29 | ||
procfs_fpregs.c | 2959 bytes | 2023-01-29 20:54:29 | ||
procfs_map.c | 5383 bytes | 2023-01-29 20:54:29 | ||
procfs_mem.c | 8537 bytes | 2023-01-29 20:54:29 | ||
procfs_note.c | 2482 bytes | 2023-01-29 20:54:29 | ||
procfs_regs.c | 2947 bytes | 2023-01-29 20:54:29 | ||
procfs_status.c | 6663 bytes | 2023-01-29 20:54:29 | ||
procfs_subr.c | 9525 bytes | 2023-01-29 20:54:29 | ||
procfs_type.c | 2809 bytes | 2023-01-29 20:54:29 | ||
procfs_vfsops.c | 5870 bytes | 2023-01-29 20:54:29 | ||
procfs_vnops.c | 24861 bytes | 2023-01-29 20:54:29 |
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$
[ 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.