xref: /titanic_41/usr/src/head/spawn.h (revision 4496171313bed39e96f21bc2f9faf2868e267ae3)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SPAWN_H
28 #define	_SPAWN_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/feature_tests.h>
33 #include <sys/types.h>
34 #include <signal.h>
35 #include <sched.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	POSIX_SPAWN_RESETIDS		0x01
42 #define	POSIX_SPAWN_SETPGROUP		0x02
43 #define	POSIX_SPAWN_SETSIGDEF		0x04
44 #define	POSIX_SPAWN_SETSIGMASK		0x08
45 #define	POSIX_SPAWN_SETSCHEDPARAM	0x10
46 #define	POSIX_SPAWN_SETSCHEDULER	0x20
47 
48 typedef struct {
49 	void *__spawn_attrp;	/* implementation-private */
50 } posix_spawnattr_t;
51 
52 typedef struct {
53 	void *__file_attrp;	/* implementation-private */
54 } posix_spawn_file_actions_t;
55 
56 #if defined(__STDC__)
57 
58 extern int posix_spawn(
59 	pid_t *_RESTRICT_KYWD pid,
60 	const char *_RESTRICT_KYWD path,
61 	const posix_spawn_file_actions_t *file_actions,
62 	const posix_spawnattr_t *_RESTRICT_KYWD attrp,
63 	char *const argv[_RESTRICT_KYWD],
64 	char *const envp[_RESTRICT_KYWD]);
65 
66 extern int posix_spawnp(
67 	pid_t *_RESTRICT_KYWD pid,
68 	const char *_RESTRICT_KYWD file,
69 	const posix_spawn_file_actions_t *file_actions,
70 	const posix_spawnattr_t *_RESTRICT_KYWD attrp,
71 	char *const argv[_RESTRICT_KYWD],
72 	char *const envp[_RESTRICT_KYWD]);
73 
74 extern int posix_spawn_file_actions_init(
75 	posix_spawn_file_actions_t *file_actions);
76 
77 extern int posix_spawn_file_actions_destroy(
78 	posix_spawn_file_actions_t *file_actions);
79 
80 extern int posix_spawn_file_actions_addopen(
81 	posix_spawn_file_actions_t *_RESTRICT_KYWD file_actions,
82 	int filedes,
83 	const char *_RESTRICT_KYWD path,
84 	int oflag,
85 	mode_t mode);
86 
87 extern int posix_spawn_file_actions_addclose(
88 	posix_spawn_file_actions_t *file_actions,
89 	int filedes);
90 
91 extern int posix_spawn_file_actions_adddup2(
92 	posix_spawn_file_actions_t *file_actions,
93 	int filedes,
94 	int newfiledes);
95 
96 extern int posix_spawnattr_init(
97 	posix_spawnattr_t *attr);
98 
99 extern int posix_spawnattr_destroy(
100 	posix_spawnattr_t *attr);
101 
102 extern int posix_spawnattr_setflags(
103 	posix_spawnattr_t *attr,
104 	short flags);
105 
106 extern int posix_spawnattr_getflags(
107 	const posix_spawnattr_t *_RESTRICT_KYWD attr,
108 	short *_RESTRICT_KYWD flags);
109 
110 extern int posix_spawnattr_setpgroup(
111 	posix_spawnattr_t *attr,
112 	pid_t pgroup);
113 
114 extern int posix_spawnattr_getpgroup(
115 	const posix_spawnattr_t *_RESTRICT_KYWD attr,
116 	pid_t *_RESTRICT_KYWD pgroup);
117 
118 extern int posix_spawnattr_setschedparam(
119 	posix_spawnattr_t *_RESTRICT_KYWD attr,
120 	const struct sched_param *_RESTRICT_KYWD schedparam);
121 
122 extern int posix_spawnattr_getschedparam(
123 	const posix_spawnattr_t *_RESTRICT_KYWD attr,
124 	struct sched_param *_RESTRICT_KYWD schedparam);
125 
126 extern int posix_spawnattr_setschedpolicy(
127 	posix_spawnattr_t *attr,
128 	int schedpolicy);
129 
130 extern int posix_spawnattr_getschedpolicy(
131 	const posix_spawnattr_t *_RESTRICT_KYWD attr,
132 	int *_RESTRICT_KYWD schedpolicy);
133 
134 extern int posix_spawnattr_setsigdefault(
135 	posix_spawnattr_t *_RESTRICT_KYWD attr,
136 	const sigset_t *_RESTRICT_KYWD sigdefault);
137 
138 extern int posix_spawnattr_getsigdefault(
139 	const posix_spawnattr_t *_RESTRICT_KYWD attr,
140 	sigset_t *_RESTRICT_KYWD sigdefault);
141 
142 extern int posix_spawnattr_setsigmask(
143 	posix_spawnattr_t *_RESTRICT_KYWD attr,
144 	const sigset_t *_RESTRICT_KYWD sigmask);
145 
146 extern int posix_spawnattr_getsigmask(
147 	const posix_spawnattr_t *_RESTRICT_KYWD attr,
148 	sigset_t *_RESTRICT_KYWD sigmask);
149 
150 #else	/* __STDC__ */
151 
152 extern int posix_spawn();
153 extern int posix_spawnp();
154 extern int posix_spawn_file_actions_init();
155 extern int posix_spawn_file_actions_destroy();
156 extern int posix_spawn_file_actions_addopen();
157 extern int posix_spawn_file_actions_addclose();
158 extern int posix_spawn_file_actions_adddup2();
159 extern int posix_spawnattr_init();
160 extern int posix_spawnattr_destroy();
161 extern int posix_spawnattr_setflags();
162 extern int posix_spawnattr_getflags();
163 extern int posix_spawnattr_setpgroup();
164 extern int posix_spawnattr_getpgroup();
165 extern int posix_spawnattr_setschedparam();
166 extern int posix_spawnattr_getschedparam();
167 extern int posix_spawnattr_setschedpolicy();
168 extern int posix_spawnattr_getschedpolicy();
169 extern int posix_spawnattr_setsigdefault();
170 extern int posix_spawnattr_getsigdefault();
171 extern int posix_spawnattr_setsigmask();
172 extern int posix_spawnattr_getsigmask();
173 
174 #endif	/* __STDC__ */
175 
176 #ifdef	__cplusplus
177 }
178 #endif
179 
180 #endif	/* _SPAWN_H */
181