Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

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)

sched_setscheduler(2)

dg_csfctl(2)

dg_cpu_set_affinity(3T)

appropriate_privilege(5)

cap_defaults(5)



fork(2)                           SDK R4.11                          fork(2)


NAME
       fork - create a new process

SYNOPSIS
       #include <sys/types.h>
       pid_t   fork ()

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
              Scheduling policy and parameters [see sched_setscheduler(2)]
              Nice value [see nice(2)]
              Scheduling class and local execution depth [see dg_csfctl(2)]
              All attached shared memory segments [see shmat(2)]
              Process group ID
              Current working directory
              Root directory
              File mode creation mask [see umask(2)]
              Resources utilization limits [see ulimit(2), setrlimit(2)]
              Controlling terminal device
              Close on exec flag
              Attached shared descriptor array
              Affinity attributes [see dg_cpu_set_set_affinity(3T)]
              (On a system with DG/UX information security) Authentication ID
              Authentication information
              Per-process audit mask
              (On a system with DG/UX information security)
              Process clearance label
              Multilevel directory mode

       Any semaphores that are open in the parent process at the time of a
       fork call are opened in the child process as if by appropriate calls
       to sem_init(2).

       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
              per-process 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.

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

       ·      Per-process timers created by the parent are not inherited.

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

       ·      All semaphore adjustment values are cleared [see semop(2)].

       ·      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(2) and memcntl(2)].

       ·      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(2)].

       ·      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(2) and dg_xtrace(2)].

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
       appropriate privilege.  For systems supporting the DG/UX Capability
       Option, appropriate privilege is defined as having one or more
       specific capabilities enabled in the effective capability set of the
       user.  See cap_defaults(5) for the default capabilities for this
       command.

       On systems without the DG/UX Capability Option, appropriate privilege
       means that your process has an effective UID of root.  See the
       appropriate_privilege(5) man page for more information.

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.

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

       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), sched_setscheduler(2), dg_csfctl(2),
       dg_cpu_set_affinity(3T), appropriate_privilege(5).
       cap_defaults(5).


Licensed material--property of copyright holder(s)

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