Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fork(2) — posix — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

alarm(2)

exec(2)

fcntl(2)

kill(2)

nice(2)

plock(2)

ptrace(2)

semop(2)

shmop(2)

signal(2)

sigaction(2)

times(2)

ulimit(2)

umask(2)

wait(2)



FORK(2-POSIX)       RISC/os Reference Manual        FORK(2-POSIX)



NAME
     fork - create a new process

SYNOPSIS
     pidt fork ()

DESCRIPTION
     fork causes creation of a new process.  The new process
     (child process) is an exact copy of the calling process
     (parent process).  This means the child process inherits the
     following attributes from the parent process:

          environment
          close-on-exec flag [see exec(2)]
          signal handling settings (i.e., SIGDFL, SIGIGN, func-
          tion address)
          set-user-ID mode bit
          set-group-ID mode bit
          profiling on/off status [see profil(2)]
          nice value [see nice(2)]
          all attached shared memory segments [see shmop(2)]
          process group ID
          tty group ID [see exit(2)]
          current working directory
          root directory
          file mode creation mask [see umask(2)]
          file size limit [see ulimit(2)]
          controlling terminal

     The child process differs from the parent process in the
     following ways:

          The child process has a unique process ID.

          The child process has a different parent process ID
          (i.e., the process ID of the parent process).

          The child process has its own copy of the parent's file
          descriptors.  Each of the child's file descriptors
          refers to the same open file description as the
          corresponding file descriptor of the parent.

          The child process has its own copy of the parent's open
          directory streams.  Each open directory stream in the
          child process shares directory stream positioning with
          the corresponding directory steam in the parent.

          All semadj values are cleared [see semop(2)].

          Process locks, text locks and data locks are not inher-
          ited by the child [see plock(2)].




                         Printed 1/15/91                   Page 1





FORK(2-POSIX)       RISC/os Reference Manual        FORK(2-POSIX)



          The child process' values of tms_utime, tms_stime,
          tms_cutime, and tms_cstime are set to 0.  The time left
          until an alarm clock signal is reset to 0.

          File locks previously set by the parent are not inher-
          ited by the child (see fcntl(2)).

          Pending alarms are cleared for the child process (see
          alarm(2)).

          The set of pending signals for the child process is set
          to the empty set.

ERRORS
     fork will fail and no child process will be created if one
     or more of the following are true:


     [EAGAIN]                 The system-imposed limit on the
                              total number of processes under
                              execution would be exceeded.

     [EAGAIN]                 The system-imposed limit on the
                              total number of processes under
                              execution by a single user would be
                              exceeded.

     [EAGAIN]                 Total amount of system memory
                              available to create the child pro-
                              cess is temporarily insufficient.

SEE ALSO
     alarm(2), exec(2), fcntl(2), kill(2), nice(2), plock(2),
     ptrace(2), semop(2), shmop(2), signal(2), sigaction(2),
     times(2), ulimit(2), umask(2), wait(2).

DIAGNOSTICS
     Upon successful completion, fork returns a value of 0 to the
     child process and returns the process ID of the child pro-
     cess to the parent process.  Otherwise, a value of -1 is
     returned to the parent process, no child process is created,
     and errno is set to indicate the error.













 Page 2                  Printed 1/15/91



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026