Annotation of cci/usr/src/man/man2/fork.2, revision 1.1.1.1

1.1       root        1: .TH FORK 2 
                      2: .SH NAME
                      3: fork \- create a new process
                      4: .SH SYNOPSIS
                      5: .B int fork (\|)
                      6: .SH DESCRIPTION
                      7: .I Fork\^
                      8: causes creation of a new process.
                      9: The new process (child process) is an
                     10: exact copy of the calling process (parent process).
                     11: This means the child process inherits the following attributes from the parent
                     12: process:
                     13: .PP
                     14: .PD 0
                     15: .RS 0.5i
                     16: .PP
                     17: environment
                     18: .PP
                     19: close-on-exec flag (see
                     20: .IR exec (2))
                     21: .PP
                     22: signal handling settings (i.e.,
                     23: .SM
                     24: .BR SIG_DFL ", " SIG_ING ,
                     25: function address)
                     26: .PP
                     27: set-user-\s-1ID\s+1 mode bit
                     28: .PP
                     29: set-group-\s-1ID\s+1 mode bit
                     30: .PP
                     31: profiling on/off status
                     32: .PP
                     33: nice value (see 
                     34: .IR nice (2))
                     35: .PP
                     36: all attached shared memory segments (see
                     37: .IR shmop (2))
                     38: .PP
                     39: process group
                     40: .SM ID
                     41: .PP
                     42: tty group
                     43: .SM ID
                     44: (see 
                     45: .IR exit (2)
                     46: and
                     47: .IR signal (2))
                     48: .PP
                     49: trace flag (see
                     50: .IR ptrace "(2) request 0)"
                     51: .PP
                     52: time left until an alarm clock signal (see 
                     53: .IR alarm (2))
                     54: .PP
                     55: current working directory
                     56: .PP
                     57: root directory
                     58: .PP
                     59: file mode creation mask (see
                     60: .IR umask (2))
                     61: .PP
                     62: file size limit (see 
                     63: .IR ulimit (2))
                     64: .RE
                     65: .PD
                     66: .PP
                     67: The child process differs from the parent process in the following ways:
                     68: .IP
                     69: The child process has a unique process
                     70: .SM ID\*S.
                     71: .IP
                     72: The child process has a different parent process
                     73: .SM ID
                     74: (i.e., the
                     75: process
                     76: .SM ID
                     77: of the parent process).
                     78: .IP
                     79: The child process has its own copy of the parent's file descriptors.
                     80: Each of the child's file descriptors shares a common file pointer with the
                     81: corresponding file descriptor of the parent.
                     82: .IP
                     83: All semadj values are cleared (see
                     84: .IR semop (2)).
                     85: .IP
                     86: Process locks, text locks and data locks are not inherited by the child (see
                     87: .IR plock (2)).
                     88: .IP
                     89: The child process's
                     90: .IR utime , " stime" , " cutime" ,
                     91: and
                     92: .I cstime\^
                     93: are set to 0.
                     94: The time left until an alarm clock signal is reset to 0.
                     95: .PP
                     96: .I Fork\^
                     97: will fail and no child process will be created if one or more of the
                     98: following are true:
                     99: .sp
                    100: .TP 15
                    101: \s-1\%[EAGAIN]\s+1
                    102: The system-imposed limit on the total number of processes under execution
                    103: would be exceeded.
                    104: .TP
                    105: \s-1\%[EAGAIN]\s+1
                    106: The system-imposed limit on the total number of processes under execution
                    107: by a single user would be exceeded.
                    108: .SH RETURN VALUE
                    109: Upon successful completion,
                    110: .I fork\^
                    111: returns a value of 0 to the child process and returns the process
                    112: .SM ID
                    113: of the
                    114: child process to the parent process.
                    115: Otherwise, a value of \-1 is
                    116: returned to the parent process, no child process is created, and
                    117: .I errno\^
                    118: is set to indicate the error.
                    119: .SH NOTES
                    120: This manual page replaces the 4.2BSD manual page.
                    121: .SH "SEE ALSO"
                    122: exec(2), nice(2), plock(2), ptrace(2), semop(2), shmop(2), signal(2), times(2), ulimit(2), umask(2), wait(2).
                    123: .\"    @(#)fork.2      6.2 of 9/6/83

unix.superglobalmegacorp.com

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