xref: /illumos-gate/usr/src/uts/common/sys/fork.h (revision 6a3e8e8695d5c7d1d18c6800d676990d7f61a2a4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_FORK_H
28 #define	_SYS_FORK_H
29 
30 #include <sys/types.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
37 
38 #if !defined(_KERNEL)
39 
40 extern pid_t forkx(int);
41 extern pid_t forkallx(int);
42 extern pid_t vforkx(int) __RETURNS_TWICE;
43 
44 #pragma unknown_control_flow(vforkx)
45 
46 #endif	/* !defined(_KERNEL) */
47 
48 /*
49  * The argument to any of the forkx() functions is a set of flags
50  * formed by or-ing together zero or more of the following flags.
51  * fork()/forkall()/vfork() are equivalent to the corresponding
52  * forkx()/forkallx()/vforkx() functions with a zero argument.
53  */
54 
55 /*
56  * Do not post a SIGCHLD signal to the parent when the child terminates,
57  * regardless of the disposition of the SIGCHLD signal in the parent.
58  * SIGCHLD signals are still possible for job control stop and continue
59  * actions (CLD_STOPPED, CLD_CONTINUED) if the parent has requested them.
60  */
61 #define	FORK_NOSIGCHLD	0x0001
62 
63 /*
64  * Do not allow wait-for-multiple-pids by the parent, as in waitid(P_ALL)
65  * or waitid(P_PGID), to reap the child and do not allow the child to
66  * be reaped automatically due the disposition of the SIGCHLD signal
67  * being set to be ignored.  Only a specific wait for the child, as
68  * in waitid(P_PID, pid), is allowed and it is required, else when
69  * the child exits it will remain a zombie until the parent exits.
70  */
71 #define	FORK_WAITPID	0x0002
72 
73 #endif	/* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _SYS_FORK_H */
80