Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ atfork(3-thr) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fork(2)

atfork(3-thr)                                                 atfork(3-thr)

NAME
     atfork - arranges for fork cleanup handling

SYNOPSIS
     #include <pthread.h>

     void atfork(
          void *userstate,
          void (*prefork)(),
          void (*parentfork)(),
          void (*childfork)());

PARAMETERS
     userstate   Pointer to the user state that is passed to each routine.

     prefork     Routine to be called before performing the fork.

     parentfork  Routine to be called in the parent after the fork.

     childfork   Routine to be called in the child after the fork.

DESCRIPTION
     The atfork() routine allows you to register three routines to be exe-
     cuted at different times relative to a fork. The different times
     and/or places are as follows:

     -  Just prior to the fork in the parent process.

     -  Just after the fork in the parent process.

     -  Just after the fork in the created (child) process.

     Use these routines to clean up just prior to fork(2), to set up after
     fork(2), and to perform locking relative to fork(2). You are allowed
     to provide one parameter to be used in conjunction with all the rou-
     tines. This parameter must be userstate.

RETURN VALUES
     The atfork() routine does not return a value. Instead, an exception is
     raised if there is insufficient table space to record the handler
     addresses.

SEE ALSO
     fork(2).











Page 1                       Reliant UNIX 5.44                Printed 11/98

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