xref: /illumos-gate/usr/src/uts/common/sys/fork.h (revision a38ddfee9c8c6b6c5a2947ff52fd2338362a4444)
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 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
39 
40 #if !defined(_KERNEL)
41 
42 extern pid_t forkx(int);
43 extern pid_t forkallx(int);
44 extern pid_t vforkx(int);
45 
46 #if defined(__sparc)
47 #pragma unknown_control_flow(vforkx)
48 #endif
49 
50 #endif	/* !defined(_KERNEL) */
51 
52 /*
53  * The argument to any of the forkx() functions is a set of flags
54  * formed by or-ing together zero or more of the following flags.
55  * fork()/forkall()/vfork() are equivalent to the corresponding
56  * forkx()/forkallx()/vforkx() functions with a zero argument.
57  */
58 
59 /*
60  * Do not post a SIGCHLD signal to the parent when the child terminates,
61  * regardless of the disposition of the SIGCHLD signal in the parent.
62  * SIGCHLD signals are still possible for job control stop and continue
63  * actions (CLD_STOPPED, CLD_CONTINUED) if the parent has requested them.
64  */
65 #define	FORK_NOSIGCHLD	0x0001
66 
67 /*
68  * Do not allow wait-for-multiple-pids by the parent, as in waitid(P_ALL)
69  * or waitid(P_PGID), to reap the child and do not allow the child to
70  * be reaped automatically due the disposition of the SIGCHLD signal
71  * being set to be ignored.  Only a specific wait for the child, as
72  * in waitid(P_PID, pid), is allowed and it is required, else when
73  * the child exits it will remain a zombie until the parent exits.
74  */
75 #define	FORK_WAITPID	0x0002
76 
77 #endif	/* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
78 
79 #ifdef	__cplusplus
80 }
81 #endif
82 
83 #endif	/* _SYS_FORK_H */
84