PROC(4) PROC(4) Name proc - Processor boxes. Synopsis /b/proc /b/proc/me /b/proc/*/name /b/proc/*/args /b/proc/*/stat /b/proc/*/regs /b/proc/*/usr /b/proc/*/prog /b/proc/*/events /b/proc/*/del /b/proc/*/legacy /b/proc/*/vm /b/proc/*/ns /b/proc/*/ioN Description The /b/proc box supplies processing services for the system. Each process has a box under /b/proc on a Plan B machine. Boxes under /b/proc have names that determine the process name. To avoid name collissions, the shell creates boxes named /b/proc/program.N where N is a random number. The special name /b/proc/me maps to the box for the process that evaluates the namebeware of this when using the shell. To access the shell's own box from the command line use the shell variable $me. New processes can be created by using make(2) and existing ones can be killed by using delete(2). Each process box has inner boxes representing process resources. Although kernel processes have their boxes listed in /b/proc, they don't have all the inner boxes that are customary for user processes. name is the box containing the name of the process box. This is useful to obtain the real box name for so that a process could obtain a name that is portable to others. args is the box containing the arguments of the process; i.e. its command-line. stat contains a string with the process status. Newly created processes are said to be born, while ready/running processes are said to be alive. Other states are dead, for faulting processes, paused, for stopped processes, and debugged, for traced PROC(4) PROC(4) processes. regs contains the set of register values for the process. The format is a set two-digit string (hexa) with the size of the machine word followed by a two-digit string (hexa) with the number of registers and by either 8 or 16 digit strings (hexa) with the regis- ter values. usr contains a string with the name of the user respon- sible for the process. The name is the same used under /b/usr for the same human. Besides the ones listed above, user processes also have these inner boxes: prog is used to contain the program executed by the pro- cess. A newly created process starts in born state and does not run until a binary box is either linked or copied to its prog box. Only programs within the same node can be linked. events is used to post events related to the process as well as to control event handling. A process can write to its own event box the strings die to die after any event post, catch to cause event posts to raise an error instead, and ignore to cause event posts to be ignored. Events are posted by copying a string representing the event to the event box. Any process can post events provided it has permission to copy them and the system itself may post events. Special system events starting with die: can not be catched or ignored, and cause inmediate process death. To arrange for a timeout event to be sent in the future (after n milliseconds), a process can copy a tmout n event to its event box. A periodic timer can be set in the same way by posting a tick n event. del is a box that contains names for boxes that the sys- tem should delete(2) if the process dies. When a box is created with the Pdeldie permission bit set, the system writes its name to the del box of the pro- cess. The user can copy more names into it (one at a time). legacy is the process legacy. A process is expected to write an error string (null is no error) to its legacy box. By default, legacy is the same of /b/sys/null and the process legacy is ignored. While the process is born, legacy can be linked to a more appropriate place. vm is the outter box for the process virtual memory boxes. Virtual memory boxes are described in vm(4). A copy(2) from another vm box can be used to clone an address space. A link(2) from another vm box can be used to share the address space. Only address space boxes within the same node can be linked. Both operations are allowed only while the process is PROC(4) PROC(4) born. ns contains a textual representation of the process name space. Each import is described on a separate line. The box exists not just for informative pur- poses, a copy(2) from another ns box can be used to clone a name space; A link(2) from another ns box can be used to share the name space. Only name space boxes within the same node can be linked. Both oper- ations are allowed only while the process is born. ioN boxes (where N is conventionally a number) represent the set of stardard I/O boxes used by the process. Number 0 is used for input, number 1 for output, and number 2 for errors. These boxes are linked to appropriate places according to the usr(4). Announces /b/proc as /proc. Source /src/b/port/procbox.c and /src/b/*/proc.c. See also spawn(3). Bugs Inne box regs is not implemented. It is not expected to be implemented before starting the native port of the system. Some special events are expected to appear after adding debugging facilities to Plan B. If a box is noted to be removed when the process dies, and an error forbids the removal during process deletetion, the box may survive the process. The conventions for I/O boxes are undergoing severe changes.