Annotation of researchv10dc/man/man4/proc.4, revision 1.1.1.1

1.1       root        1: .TH PROC 4
                      2: .CT 2 proc_man
                      3: .SH NAME
                      4: proc \- process file system
                      5: .SH SYNOPSIS
                      6: .B #include <sys/types.h>
                      7: .B #include <sys/proc.h>
                      8: .br
                      9: .B #include <sys/pioctl.h>
                     10: .SH DESCRIPTION
                     11: .I Proc
                     12: is a file system that contains memory images of each
                     13: running process in the system.
                     14: The name of each entry in the
                     15: .F /proc
                     16: directory is the process
                     17: id of the subject process, expressed in decimal with
                     18: optional leading zeros.
                     19: Each process file is owned by the userid of the subject process.
                     20: The file mode includes read and write permission for
                     21: the owner if that userid has read
                     22: access to the associated text file; all other permission bits
                     23: are zero.
                     24: The file size is
                     25: the sum of the sizes of virtual memory segments
                     26: in the subject process.
                     27: .PP
                     28: The subject process is unaffected, except that setuid bits
                     29: will be ignored if it does an
                     30: .IR exec (2).
                     31: (Setuid bits are also ignored if the
                     32: .IR exec "ing"
                     33: process has traced signals, or stops on
                     34: .IR exec ;
                     35: see the description of
                     36: .B PIOCSMASK
                     37: and
                     38: .B PIOCSEXEC
                     39: below.)
                     40: .PP
                     41: Data may be transferred
                     42: from or to any locations in the subject's address space through
                     43: .IR lseek (2),
                     44: .IR read (2),
                     45: and
                     46: .IR write .
                     47: The
                     48: .I text segment
                     49: begins at address 0; the
                     50: .I data segment
                     51: starts above the text.
                     52: The
                     53: .I user area
                     54: extends downward below address 0x80000000, and is
                     55: .B UPAGES*NBPG
                     56: bytes long (see the header files listed below);
                     57: the
                     58: .I stack segment
                     59: grows downward below the user area.
                     60: The text, data, and stack sizes
                     61: may be determined from the process's
                     62: .L proc
                     63: structure (see
                     64: .B PIOCGETPR
                     65: below).
                     66: It is an error to access addresses between data and stack.
                     67: No read or write may span a segment boundary;
                     68: in the user area only the locations of saved user registers
                     69: are writable.
                     70: .PP
                     71: .IR Ioctl (2)
                     72: calls control the subject process.
                     73: The third argument usually points to an integer.
                     74: The 
                     75: .I ioctl
                     76: codes are:
                     77: .TF PIOCSMASK
                     78: .TP
                     79: .B PIOCSTOP
                     80: Send signal
                     81: .B SIGSTOP
                     82: to the process, and wait for it to
                     83: enter the stopped state.
                     84: .TP
                     85: .B PIOCWSTOP
                     86: Wait for the process to stop.
                     87: .TP
                     88: .B PIOCRUN
                     89: Make the process runnable again after a stop.
                     90: .TP
                     91: .B PIOCSMASK
                     92: Define
                     93: a set of signals to be traced.
                     94: The process will stop when it receives any signal whose number,
                     95: as given in
                     96: .IR signal (2),
                     97: corresponds to a 1-bit in the given integer,
                     98: with the least significant bit counted as 1.
                     99: The traced state and mask bits are inherited by the child of a
                    100: .IR fork (2).
                    101: When the process file is closed, the mask becomes zero, but
                    102: the traced state persists.
                    103: .TP
                    104: .B PIOCSEXEC
                    105: Cause the process to stop after
                    106: .IR exec (2).
                    107: This condition is inherited across
                    108: .IR fork (2)
                    109: and persists when the process file is closed.
                    110: .TP
                    111: .B PIOCREXEC
                    112: Reverse the effect of
                    113: .BR PIOCSEXEC .
                    114: .TP
                    115: .B PIOCCSIG
                    116: Clear the subject's currently pending signal (if any).
                    117: .TP
                    118: .B PIOCKILL
                    119: Set the subject's currently pending signal to a given number.
                    120: .TP
                    121: .B PIOCOPENT
                    122: Return a read-only file descriptor
                    123: for the subject process's text file.
                    124: (Thus a debugger can find the
                    125: symbol table without knowing the name of the text file.)
                    126: .TP
                    127: .B PIOCNICE
                    128: Increment the
                    129: priority of the subject process by a given amount
                    130: as if by
                    131: .IR nice (2).
                    132: .TP
                    133: .B PIOCGETPR
                    134: Copy the subject's
                    135: .B proc
                    136: structure (see
                    137: .BR <sys/proc.h> )
                    138: from the kernel process table into an area pointed to
                    139: the third argument.
                    140: (This information, which resides in system space, is not accessible
                    141: via a normal read.)
                    142: .PD
                    143: .PP
                    144: Any system call is guaranteed to be atomic with respect to the 
                    145: subject process,
                    146: but nothing prevents more than one
                    147: process from opening and controlling the same subject.
                    148: .PP
                    149: The following header files are useful in analyzing
                    150: .I proc
                    151: files:
                    152: .PP
                    153: .TF <sys/param.h>
                    154: .TP
                    155: .B <signal.h>
                    156: list of signal numbers
                    157: .TP
                    158: .B <sys/param.h>
                    159: size parameters
                    160: .TP
                    161: .B <sys/types.h>
                    162: special system types
                    163: .TP
                    164: .B <sys/user.h>
                    165: user structure
                    166: .TP
                    167: .B <sys/proc.h>
                    168: proc structure
                    169: .TP
                    170: .B <sys/reg.h>
                    171: locations of saved user registers
                    172: .TP
                    173: .B <sys/pioctl.h>
                    174: ioctl codes for
                    175: .I proc
                    176: files
                    177: .PD
                    178: .SH FILES
                    179: .F /proc/*
                    180: .SH SEE ALSO
                    181: .IR adb (1),
                    182: .IR ps (1), 
                    183: .IR hang (1),
                    184: .IR fmount (2),
                    185: .IR signal (2),
                    186: .IR mount (8),
                    187: .IR pi (9.1)
                    188: .SH DIAGNOSTICS
                    189: These errors can occur in addition to the
                    190: errors normally associated with the file system; see
                    191: .IR intro (2):
                    192: .TF ENOENT
                    193: .TP
                    194: .B ENOENT
                    195: The subject process has exited.
                    196: .TP
                    197: .B EIO
                    198: The subject process has attempted I/O at an illegal address.
                    199: .TP
                    200: .B EBUSY
                    201: The subject is in the midst of changing virtual memory
                    202: attributes, or has pages locked for physical I/O.
                    203: .TP
                    204: .B ENOSPC
                    205: A write has been attempted on a shared text segment and there
                    206: is no room on the swap space to make a copy.
                    207: .TP
                    208: .B EPERM
                    209: A non-super-user has attempted to better
                    210: the subject's priority with
                    211: .BR PIOCNICE .
                    212: .SH BUGS
                    213: A process must be swapped in for reading and writing (but not
                    214: .IR ioctl );
                    215: this may cause
                    216: a noticeable delay.
                    217: .br
                    218: The spectrum of states which result in 
                    219: .B EBUSY
                    220: is too conservative.
                    221: .br
                    222: A process loaded from a text file with magic number 0407 does not have as
                    223: a read-only text segment; in this (presumably rare) case
                    224: .B PIOCOPENT
                    225: does not work, and the process is accessible even if the
                    226: text file is read-only.
                    227: .br
                    228: The interface involves too many VAX-specific magic numbers.

unix.superglobalmegacorp.com

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