Annotation of lucent/sys/man/3/proc, revision 1.1.1.1

1.1       root        1: .TH PROC 3 
                      2: .SH NAME
                      3: proc \- running processes
                      4: .SH SYNOPSIS
                      5: .nf
                      6: .B bind #p /proc
                      7: 
                      8: .BI /proc/ n /ctl
                      9: .BI /proc/ n /mem
                     10: .BI /proc/ n /note
                     11: .BI /proc/ n /noteid
                     12: .BI /proc/ n /notepg
                     13: .BI /proc/ n /proc
                     14: .BI /proc/ n /segment
                     15: .BI /proc/ n /status
                     16: .BI /proc/ n /text
                     17: .BI /proc/ n /wait
                     18: \&...
                     19: .fi
                     20: .SH DESCRIPTION
                     21: The
                     22: .I proc
                     23: device serves a two-level directory structure.
                     24: The first level contains numbered directories
                     25: corresponding to pids of live processes;
                     26: each such directory contains a set of files
                     27: representing the corresponding process.
                     28: .PP
                     29: The
                     30: .B mem
                     31: file contains the current memory image of the process.
                     32: A read or write at offset
                     33: .IR o ,
                     34: which must be a valid virtual address,
                     35: accesses bytes from address
                     36: .IR o
                     37: up to the end of the memory segment containing
                     38: .IR o .
                     39: Kernel virtual memory, including the kernel stack for the process and
                     40: saved user registers (whose addresses are machine-dependent),
                     41: can be accessed through
                     42: .BR mem .
                     43: Writes are permitted only while the process is in the
                     44: .B Stopped
                     45: state and only to user addresses or registers.
                     46: .PP
                     47: The read-only
                     48: .B proc
                     49: file contains the kernel per-process
                     50: structure.
                     51: Its main use is to recover the kernel stack and program counter
                     52: for kernel debugging.
                     53: .PP
                     54: The read-only
                     55: .B segment
                     56: file contains a textual display of the memory segments
                     57: attached to the process.  Each line has multiple fields:
                     58: the type of segment (\c
                     59: .BR Stack ,
                     60: .BR Text ,
                     61: .BR Data ,
                     62: .BR Bss ,
                     63: etc.); one-letter flags such as
                     64: .B R
                     65: for read-only, if any;
                     66: starting virtual address, in hexadecimal;
                     67: ending virtual address, and reference count.
                     68: .PP
                     69: The read-only
                     70: .B status
                     71: file contains a string with eight fields, each followed by a space.
                     72: The fields are: the process name and user name, each 27 characters left justified;
                     73: the process state, 11 characters left justified (see
                     74: .IR ps (1));
                     75: the six 11-character numbers also held in the process's
                     76: .B #c/cputime
                     77: file,
                     78: and the amount of memory used by the process, except its stack,
                     79: in units of 1024 bytes.
                     80: .PP
                     81: The
                     82: .B text
                     83: file is a pseudonym for the file
                     84: from which the process was executed;
                     85: its main use is to recover the symbol table of the process.
                     86: .PP
                     87: The
                     88: .B wait
                     89: file may be read to recover
                     90: .B Waitmsg
                     91: records from the exiting children of the process.
                     92: If the process has no extant children, living or exited,
                     93: a read of
                     94: .B wait
                     95: will block.
                     96: It is an error for a process to attempt to read its own
                     97: .B wait
                     98: file when it has no children.
                     99: When a process's
                    100: .B wait
                    101: file is being read,
                    102: the process will draw an error
                    103: if it attempts a
                    104: .B wait
                    105: system call; similarly, if a process is in a
                    106: .B wait
                    107: system call, its
                    108: .B wait
                    109: file cannot be read by any process.
                    110: .PP
                    111: Textual messages written to the
                    112: .B ctl
                    113: file control the execution of the process.
                    114: Some require that the process is in a particular state
                    115: and return an error if it is not.
                    116: .TP 10n
                    117: .B stop
                    118: Suspend execution of the process, putting it in the
                    119: .B Stopped
                    120: state.
                    121: .TP 10n
                    122: .B start
                    123: Resume execution of a
                    124: .B Stopped
                    125: process.
                    126: .TP 10n
                    127: .B waitstop
                    128: Do not affect the process directly but, like all other messages ending with
                    129: .BR stop ,
                    130: block the process writing the
                    131: .B ctl
                    132: file until the target process is in the
                    133: .B Stopped
                    134: state or exits.
                    135: Also like other
                    136: .B stop
                    137: control messages,
                    138: if the target process would receive a note while the message is pending,
                    139: it is instead stopped and the debugging process is resumed.
                    140: .TP 10n
                    141: .B startstop
                    142: Allow a
                    143: .B Stopped
                    144: process to resume, and then do a
                    145: .B waitstop
                    146: action.
                    147: .TP 10n
                    148: .B hang
                    149: Set a bit in the process so that,
                    150: when it completes an
                    151: .IR exec (2)
                    152: system call, it will enter the
                    153: .B Stopped
                    154: state before returning to user mode.
                    155: This bit is inherited across a
                    156: .IR fork (2).
                    157: .TP 10n
                    158: .B nohang
                    159: Clear the hang bit.
                    160: .TP 10n
                    161: .B kill
                    162: Kill the process the next time it crosses the user/kernel boundary.
                    163: .PP
                    164: Strings written to the
                    165: .B note
                    166: file will be posted as a note to the process
                    167: (see
                    168: .IR notify (2)).
                    169: The note should be less than
                    170: .L ERRLEN-1
                    171: characters long;
                    172: the last character is reserved for a terminating NUL character.
                    173: A read of at least
                    174: .L ERRLEN
                    175: characters will retrieve the oldest note posted to the
                    176: process and prevent its delivery to the process.
                    177: The
                    178: .B notepg
                    179: file is similar, but the note will be delivered to all the
                    180: processes in the target process's
                    181: .I note group
                    182: (see
                    183: .IR fork (2)).
                    184: However, if the process doing the write is in the group,
                    185: it will not receive the note.
                    186: The
                    187: .B notepg
                    188: file is write-only.
                    189: .PP
                    190: The textual
                    191: .B noteid
                    192: file may be read to recover an integer identifying the note group of the process
                    193: (see
                    194: .B RFNOTEG
                    195: in
                    196: .IR fork (2)).
                    197: The file may be written to cause the process to change to another note group,
                    198: provided the group exists and is owned by the same user.
                    199: .SH FILES
                    200: .nf
                    201: .B /sys/src/9/*/mem.h
                    202: .B /sys/src/9/*/dat.h
                    203: .fi
                    204: .SH SEE ALSO
                    205: .IR debugger (2),
                    206: .IR mach (2),
                    207: .IR cons (3)
                    208: .SH SOURCE
                    209: .B /sys/src/9/port/devproc.c

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.