xref: /illumos-gate/usr/src/uts/common/sys/fork.h (revision 6a3e8e86)
1657b1f3dSraf /*
2657b1f3dSraf  * CDDL HEADER START
3657b1f3dSraf  *
4657b1f3dSraf  * The contents of this file are subject to the terms of the
5657b1f3dSraf  * Common Development and Distribution License (the "License").
6657b1f3dSraf  * You may not use this file except in compliance with the License.
7657b1f3dSraf  *
8657b1f3dSraf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9657b1f3dSraf  * or http://www.opensolaris.org/os/licensing.
10657b1f3dSraf  * See the License for the specific language governing permissions
11657b1f3dSraf  * and limitations under the License.
12657b1f3dSraf  *
13657b1f3dSraf  * When distributing Covered Code, include this CDDL HEADER in each
14657b1f3dSraf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15657b1f3dSraf  * If applicable, add the following below this CDDL HEADER, with the
16657b1f3dSraf  * fields enclosed by brackets "[]" replaced with your own identifying
17657b1f3dSraf  * information: Portions Copyright [yyyy] [name of copyright owner]
18657b1f3dSraf  *
19657b1f3dSraf  * CDDL HEADER END
20657b1f3dSraf  */
21657b1f3dSraf 
22657b1f3dSraf /*
23943bc4a4SRoger A. Faulkner  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24657b1f3dSraf  * Use is subject to license terms.
25657b1f3dSraf  */
26657b1f3dSraf 
27657b1f3dSraf #ifndef _SYS_FORK_H
28657b1f3dSraf #define	_SYS_FORK_H
29657b1f3dSraf 
30657b1f3dSraf #include <sys/types.h>
31657b1f3dSraf 
32657b1f3dSraf #ifdef	__cplusplus
33657b1f3dSraf extern "C" {
34657b1f3dSraf #endif
35657b1f3dSraf 
36657b1f3dSraf #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
37657b1f3dSraf 
38657b1f3dSraf #if !defined(_KERNEL)
39657b1f3dSraf 
40657b1f3dSraf extern pid_t forkx(int);
41657b1f3dSraf extern pid_t forkallx(int);
42*6a3e8e86SRichard Lowe extern pid_t vforkx(int) __RETURNS_TWICE;
43657b1f3dSraf 
44657b1f3dSraf #pragma unknown_control_flow(vforkx)
45657b1f3dSraf 
46657b1f3dSraf #endif	/* !defined(_KERNEL) */
47657b1f3dSraf 
48657b1f3dSraf /*
49657b1f3dSraf  * The argument to any of the forkx() functions is a set of flags
50657b1f3dSraf  * formed by or-ing together zero or more of the following flags.
51657b1f3dSraf  * fork()/forkall()/vfork() are equivalent to the corresponding
52657b1f3dSraf  * forkx()/forkallx()/vforkx() functions with a zero argument.
53657b1f3dSraf  */
54657b1f3dSraf 
55657b1f3dSraf /*
56657b1f3dSraf  * Do not post a SIGCHLD signal to the parent when the child terminates,
57657b1f3dSraf  * regardless of the disposition of the SIGCHLD signal in the parent.
58657b1f3dSraf  * SIGCHLD signals are still possible for job control stop and continue
59657b1f3dSraf  * actions (CLD_STOPPED, CLD_CONTINUED) if the parent has requested them.
60657b1f3dSraf  */
61657b1f3dSraf #define	FORK_NOSIGCHLD	0x0001
62657b1f3dSraf 
63657b1f3dSraf /*
64657b1f3dSraf  * Do not allow wait-for-multiple-pids by the parent, as in waitid(P_ALL)
65657b1f3dSraf  * or waitid(P_PGID), to reap the child and do not allow the child to
66657b1f3dSraf  * be reaped automatically due the disposition of the SIGCHLD signal
67657b1f3dSraf  * being set to be ignored.  Only a specific wait for the child, as
68657b1f3dSraf  * in waitid(P_PID, pid), is allowed and it is required, else when
69657b1f3dSraf  * the child exits it will remain a zombie until the parent exits.
70657b1f3dSraf  */
71657b1f3dSraf #define	FORK_WAITPID	0x0002
72657b1f3dSraf 
73657b1f3dSraf #endif	/* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
74657b1f3dSraf 
75657b1f3dSraf #ifdef	__cplusplus
76657b1f3dSraf }
77657b1f3dSraf #endif
78657b1f3dSraf 
79657b1f3dSraf #endif	/* _SYS_FORK_H */
80