]>
Commit | Line | Data |
---|---|---|
224c7076 A |
1 | /* |
2 | * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | ||
25 | #ifndef _SPAWN_H_ | |
26 | #define _SPAWN_H_ | |
27 | ||
28 | /* | |
29 | * [SPN] Support for _POSIX_SPAWN | |
30 | */ | |
31 | ||
32 | #include <sys/cdefs.h> | |
33 | #include <_types.h> | |
34 | #include <sys/spawn.h> /* shared types */ | |
35 | ||
36 | /* | |
37 | * [SPN] Inclusion of the <spawn.h> header may make visible symbols defined | |
38 | * in the <sched.h>, <signal.h>, and <sys/types.h> headers. | |
39 | */ | |
40 | #ifndef _PID_T | |
41 | typedef __darwin_pid_t pid_t; | |
42 | #define _PID_T | |
43 | #endif | |
44 | ||
45 | #ifndef _SIGSET_T | |
46 | #define _SIGSET_T | |
47 | typedef __darwin_sigset_t sigset_t; | |
48 | #endif | |
49 | ||
50 | #ifndef _MODE_T | |
51 | typedef __darwin_mode_t mode_t; | |
52 | #define _MODE_T | |
53 | #endif | |
54 | ||
55 | /* | |
56 | * Opaque types for use with posix_spawn() family functions. Internals are | |
57 | * not defined, and should not be accessed directly. Types are defined as | |
58 | * mandated by POSIX. | |
59 | */ | |
60 | typedef void *posix_spawnattr_t; | |
61 | typedef void *posix_spawn_file_actions_t; | |
62 | ||
63 | __BEGIN_DECLS | |
64 | /* | |
65 | * gcc under c99 mode won't compile "[ __restrict]" by itself. As a workaround, | |
66 | * a dummy argument name is added. | |
67 | */ | |
68 | int posix_spawn(pid_t * __restrict, const char * __restrict, | |
69 | const posix_spawn_file_actions_t *, | |
70 | const posix_spawnattr_t * __restrict, | |
71 | char *const __argv[ __restrict], | |
72 | char *const __envp[ __restrict]); | |
73 | int posix_spawnp(pid_t * __restrict, const char * __restrict, | |
74 | const posix_spawn_file_actions_t *, | |
75 | const posix_spawnattr_t * __restrict, | |
76 | char *const __argv[ __restrict], | |
77 | char *const __envp[ __restrict]); | |
78 | int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int); | |
79 | int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, | |
80 | int); | |
81 | int posix_spawn_file_actions_addopen( | |
82 | posix_spawn_file_actions_t * __restrict, int, | |
83 | const char * __restrict, int, mode_t); | |
84 | int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *); | |
85 | int posix_spawn_file_actions_init(posix_spawn_file_actions_t *); | |
86 | int posix_spawnattr_destroy(posix_spawnattr_t *); | |
87 | int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict, | |
88 | sigset_t * __restrict); | |
89 | int posix_spawnattr_getflags(const posix_spawnattr_t * __restrict, | |
90 | short * __restrict); | |
91 | int posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict, | |
92 | pid_t * __restrict); | |
93 | int posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict, | |
94 | sigset_t * __restrict); | |
95 | int posix_spawnattr_init(posix_spawnattr_t *); | |
96 | int posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict, | |
97 | const sigset_t * __restrict); | |
98 | int posix_spawnattr_setflags(posix_spawnattr_t *, short); | |
99 | int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t); | |
100 | int posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict, | |
101 | const sigset_t * __restrict); | |
102 | ||
103 | #if 0 /* _POSIX_PRIORITY_SCHEDULING [PS] : not supported */ | |
104 | int posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict, | |
105 | const struct sched_param * __restrict); | |
106 | int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int); | |
107 | int posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict, | |
108 | struct sched_param * __restrict); | |
109 | int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict, | |
110 | int * __restrict); | |
111 | #endif /* 0 */ | |
112 | ||
113 | __END_DECLS | |
114 | ||
115 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) | |
116 | /* | |
117 | * Darwin-specific extensions below | |
118 | */ | |
119 | #include <mach/exception_types.h> | |
120 | #include <mach/machine.h> | |
121 | #include <mach/port.h> | |
122 | ||
123 | #ifndef _SIZE_T | |
124 | typedef __darwin_size_t size_t; | |
125 | #define _SIZE_T | |
126 | #endif | |
127 | ||
128 | __BEGIN_DECLS | |
129 | ||
130 | int posix_spawnattr_getbinpref_np(const posix_spawnattr_t * __restrict, | |
131 | size_t, cpu_type_t *__restrict, size_t *__restrict); | |
132 | int posix_spawnattr_setbinpref_np(posix_spawnattr_t * __restrict, | |
133 | size_t, cpu_type_t *__restrict, size_t *__restrict); | |
134 | int posix_spawnattr_setspecialport_np(posix_spawnattr_t *__restrict, | |
135 | mach_port_t, int); | |
136 | int posix_spawnattr_setexceptionports_np(posix_spawnattr_t *__restrict, | |
137 | exception_mask_t, mach_port_t, | |
138 | exception_behavior_t, thread_state_flavor_t); | |
139 | ||
140 | __END_DECLS | |
141 | ||
142 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ | |
143 | #endif /* _SPAWN_H_ */ |