Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fork(2) — DG/UX 4.30

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dg_xtrace(2)

exec(2)

memcntl(2)

nice(2)

plock(2)

ptrace(2)

semop(2)

shmat(2)

signal(2)

sigset(2)

times(2)

ulimit(2)

umask(2)

vfork(2)

wait(2)



     fork(2)                    DG/UX 4.30                     fork(2)



     NAME
          fork - create a new process

     SYNOPSIS
          int     fork    ()

     PARAMETERS
          None.

     DESCRIPTION
          Fork creates a new process with its own address space that
          is initialized to the contents of the calling process's
          address space at the time the "fork" call is made.  The new
          process is entered into the process tree as a child of the
          calling process.

          The following attributes in the new process are set to the
          values the parent process had at the time of the fork call:

                  Environment
                  Signal handling settings
                          (i.e., SIG_DFL, SIG_IGN, function address)
                  Real- and effective-user-id
                  Real- and effective-group-id
                  Tty group id
                  Group list
                  Profiling on/off status
                  Nice value (see nice)
                  All attached shared memory segments (see shmat)
                  Process group ID
                  Current working directory
                  Root directory
                  File mode creation mask (see umask)
                  Resources utilization limits (see ulimit, setrlimit)
                  Controlling terminal device
                  Close on exec flag

          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
               (the process ID of its parent).

          ⊕    The child process has its own copy of each of the
               parent's object descriptors, with the close-on-exec
               flag in each set to the value from the corresponding
               object descriptor in the parent.  Each of the child's
               object descriptors shares a common object pointer with
               the corresponding object descriptor of the parent.




     Licensed material--property of copyright holder(s)         Page 1





     fork(2)                    DG/UX 4.30                     fork(2)



          ⊕    File locks set by the parent are not inherited by the
               child.

          ⊕    The set of signals pending for the child process is
               cleared.

          ⊕    All semaphore adjustment values are cleared (see
               semop).

          ⊕    Process locks, text locks, data locks, and locks on any
               other regions of the parent process's address space are
               not inherited by the child (see plock and memcntl).

          ⊕    The child process's current resources consumed and
               cumulative resources consumed by its children are set
               to zero.  This includes the child's utime, stime,
               cutime, and cstime.  (see setrlimit)

          ⊕    The value of ITIMER_REAL (used by alarm and setitimer)
               is set to 0 so that SIGALRMs are disabled.
               ITIMER_VIRTUAL and ITIMER_PROF (used by setitimer) are
               also set to 0 (ie. all pending alarms are cleared in
               the child).

          ⊕    Unless specifically set, the child process does not
               inherit tracing (see ptrace and dg_xtrace).

     ACCESS CONTROL
          If the new process would cause the system-imposed limit on
          the total number of processes in the system to be reached,
          an error is returned and the new process is not created,
          unless the calling process has an effective-user-id of 0.
          In other words, only the superuser is allowed to create a
          process that causes the limit to be reached.

     RETURN VALUE
          Upon successful completion, fork returns a value of 0 to the
          child process and returns the process ID of the child
          process 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.

     EXCEPTIONS
          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.



     Licensed material--property of copyright holder(s)         Page 2





     fork(2)                    DG/UX 4.30                     fork(2)



          ENOMEM    The process requires more memory than the system
                    is able to supply.

     SEE ALSO
          dg_xtrace(2), exec(2), memcntl(2), nice(2), plock(2),
          ptrace(2), semop(2), shmat(2), signal(2), sigset(2),
          times(2), ulimit(2), umask(2), vfork(2), wait(2).
















































     Licensed material--property of copyright holder(s)         Page 3



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