Manual Page Result
0
Command: proc | Section: 4 | Source: UNIX v10 | File: proc.4
PROC(4) Kernel Interfaces Manual PROC(4)
NAME
proc - process file system
SYNOPSIS
#include <sys/types.h> #include <sys/proc.h>
#include <sys/pioctl.h>
DESCRIPTION
Proc is a file system that contains memory images of each running
process in the system. The name of each entry in the directory is the
process id of the subject process, expressed in decimal with optional
leading zeros. Each process file is owned by the userid of the subject
process. The file mode includes read and write permission for the
owner if that userid has read access to the associated text file; all
other permission bits are zero. The file size is the sum of the sizes
of virtual memory segments in the subject process.
The subject process is unaffected, except that setuid bits will be ig-
nored if it does an exec(2). (Setuid bits are also ignored if the ex-
ecing process has traced signals, or stops on exec; see the description
of PIOCSMASK and PIOCSEXEC below.)
Data may be transferred from or to any locations in the subject's ad-
dress space through lseek(2), read(2), and write. The text segment be-
gins at address 0; the data segment starts above the text. The user
area extends downward below address 0x80000000, and is UPAGES*NBPG
bytes long (see the header files listed below); the stack segment grows
downward below the user area. The text, data, and stack sizes may be
determined from the process's structure (see PIOCGETPR below). It is
an error to access addresses between data and stack. No read or write
may span a segment boundary; in the user area only the locations of
saved user registers are writable.
Ioctl(2) calls control the subject process. The third argument usually
points to an integer. The ioctl codes are:
PIOCSTOP
Send signal SIGSTOP to the process, and wait for it to enter the
stopped state.
PIOCWSTOP
Wait for the process to stop.
PIOCRUN
Make the process runnable again after a stop.
PIOCSMASK
Define a set of signals to be traced. The process will stop
when it receives any signal whose number, as given in signal(2),
corresponds to a 1-bit in the given integer, with the least sig-
nificant bit counted as 1. The traced state and mask bits are
inherited by the child of a fork(2). When the process file is
closed, the mask becomes zero, but the traced state persists.
PIOCSEXEC
Cause the process to stop after exec(2). This condition is in-
herited across fork(2) and persists when the process file is
closed.
PIOCREXEC
Reverse the effect of PIOCSEXEC.
PIOCCSIG
Clear the subject's currently pending signal (if any).
PIOCKILL
Set the subject's currently pending signal to a given number.
PIOCOPENT
Return a read-only file descriptor for the subject process's
text file. (Thus a debugger can find the symbol table without
knowing the name of the text file.)
PIOCNICE
Increment the priority of the subject process by a given amount
as if by nice(2).
PIOCGETPR
Copy the subject's proc structure (see <sys/proc.h>) from the
kernel process table into an area pointed to the third argument.
(This information, which resides in system space, is not acces-
sible via a normal read.)
Any system call is guaranteed to be atomic with respect to the subject
process, but nothing prevents more than one process from opening and
controlling the same subject.
The following header files are useful in analyzing proc files:
<signal.h>
list of signal numbers
<sys/param.h>
size parameters
<sys/types.h>
special system types
<sys/user.h>
user structure
<sys/proc.h>
proc structure
<sys/reg.h>
locations of saved user registers
<sys/pioctl.h>
ioctl codes for proc files
FILES
SEE ALSO
adb(1), ps(1), hang(1), fmount(2), signal(2), mount(8), pi(9.1)
DIAGNOSTICS
These errors can occur in addition to the errors normally associated
with the file system; see intro(2):
ENOENT The subject process has exited.
EIO The subject process has attempted I/O at an illegal address.
EBUSY The subject is in the midst of changing virtual memory attrib-
utes, or has pages locked for physical I/O.
ENOSPC A write has been attempted on a shared text segment and there is
no room on the swap space to make a copy.
EPERM A non-super-user has attempted to better the subject's priority
with PIOCNICE.
BUGS
A process must be swapped in for reading and writing (but not ioctl);
this may cause a noticeable delay.
The spectrum of states which result in EBUSY is too conservative.
A process loaded from a text file with magic number 0407 does not have
as a read-only text segment; in this (presumably rare) case PIOCOPENT
does not work, and the process is accessible even if the text file is
read-only.
The interface involves too many VAX-specific magic numbers.
PROC(4)