1 .\" Copyright (c) 2004 Apple Computer, Inc.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" Portions of this text are reprinted and reproduced in electronic form
25 .\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
26 .\" Portable Operating System Interface (POSIX), The Open Group Base
27 .\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
28 .\" Electrical and Electronics Engineers, Inc and The Open Group. In the
29 .\" event of any discrepancy between this version and the original IEEE and
30 .\" The Open Group Standard, the original IEEE and The Open Group Standard is
31 .\" the referee document. The original Standard can be obtained online at
32 .\" http://www.opengroup.org/unix/online.html.
41 .Nd register handlers to be called before and after
47 .Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]"
48 .Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]"
49 .Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]"
54 function declares fork handlers to be called before and after
56 in the context of the thread that called
59 The handlers registered with
61 are called at the moments in time described below:
62 .Bl -tag -width ".Fa prepare"
66 processing commences in the parent process.
69 handler is registered they will be called in the opposite order
74 completes in the parent process.
77 handler is registered they will be called in the same order
82 processing completes in the child process.
85 handler is registered they will be called in the same order
89 If no handling is desired at one or more of these three points,
90 a null pointer may be passed as the corresponding fork handler.
93 only async-signal-safe functions are allowed on the child side of
101 function will return zero.
102 Otherwise an error number will be returned to indicate the error.
106 function will fail if:
109 The system lacked the necessary resources to add another handler to the list.