]>
Commit | Line | Data |
---|---|---|
e91b9f68 A |
1 | /* |
2 | * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. | |
3 | * | |
ed34e3c3 | 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ |
e91b9f68 | 5 | * |
ed34e3c3 A |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | * you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at | |
e91b9f68 | 9 | * |
ed34e3c3 A |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
e91b9f68 A |
16 | * limitations under the License. |
17 | * | |
ed34e3c3 | 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ |
e91b9f68 A |
19 | */ |
20 | #ifndef _LAUNCH_H_ | |
21 | #define _LAUNCH_H_ | |
22 | ||
ed34e3c3 A |
23 | #include <mach/mach.h> |
24 | #include <sys/cdefs.h> | |
e91b9f68 A |
25 | #include <stddef.h> |
26 | #include <stdbool.h> | |
27 | ||
5b0a4722 A |
28 | #pragma GCC visibility push(default) |
29 | ||
ed34e3c3 A |
30 | __BEGIN_DECLS |
31 | ||
32 | #ifdef __GNUC__ | |
33 | #define __ld_normal __attribute__((__nothrow__)) | |
34 | #define __ld_setter __attribute__((__nothrow__, __nonnull__)) | |
35 | #define __ld_getter __attribute__((__nothrow__, __nonnull__, __pure__, __warn_unused_result__)) | |
36 | #define __ld_iterator(x, y) __attribute__((__nonnull__(x, y))) | |
37 | #define __ld_allocator __attribute__((__nothrow__, __malloc__, __nonnull__, __warn_unused_result__)) | |
38 | #else | |
39 | #define __ld_normal | |
40 | #define __ld_setter | |
41 | #define __ld_getter | |
42 | #define __ld_iterator(x, y) | |
43 | #define __ld_allocator | |
44 | #endif | |
45 | ||
e91b9f68 A |
46 | |
47 | #define LAUNCH_KEY_SUBMITJOB "SubmitJob" | |
48 | #define LAUNCH_KEY_REMOVEJOB "RemoveJob" | |
49 | #define LAUNCH_KEY_STARTJOB "StartJob" | |
50 | #define LAUNCH_KEY_STOPJOB "StopJob" | |
51 | #define LAUNCH_KEY_GETJOB "GetJob" | |
e91b9f68 A |
52 | #define LAUNCH_KEY_GETJOBS "GetJobs" |
53 | #define LAUNCH_KEY_CHECKIN "CheckIn" | |
54 | ||
55 | #define LAUNCH_JOBKEY_LABEL "Label" | |
56 | #define LAUNCH_JOBKEY_DISABLED "Disabled" | |
57 | #define LAUNCH_JOBKEY_USERNAME "UserName" | |
58 | #define LAUNCH_JOBKEY_GROUPNAME "GroupName" | |
59 | #define LAUNCH_JOBKEY_TIMEOUT "TimeOut" | |
5b0a4722 | 60 | #define LAUNCH_JOBKEY_EXITTIMEOUT "ExitTimeOut" |
e91b9f68 A |
61 | #define LAUNCH_JOBKEY_INITGROUPS "InitGroups" |
62 | #define LAUNCH_JOBKEY_SOCKETS "Sockets" | |
ed34e3c3 | 63 | #define LAUNCH_JOBKEY_MACHSERVICES "MachServices" |
5b0a4722 | 64 | #define LAUNCH_JOBKEY_MACHSERVICELOOKUPPOLICIES "MachServiceLookupPolicies" |
e91b9f68 | 65 | #define LAUNCH_JOBKEY_INETDCOMPATIBILITY "inetdCompatibility" |
ed34e3c3 | 66 | #define LAUNCH_JOBKEY_ENABLEGLOBBING "EnableGlobbing" |
e91b9f68 A |
67 | #define LAUNCH_JOBKEY_PROGRAMARGUMENTS "ProgramArguments" |
68 | #define LAUNCH_JOBKEY_PROGRAM "Program" | |
69 | #define LAUNCH_JOBKEY_ONDEMAND "OnDemand" | |
ed34e3c3 A |
70 | #define LAUNCH_JOBKEY_KEEPALIVE "KeepAlive" |
71 | #define LAUNCH_JOBKEY_LIMITLOADTOHOSTS "LimitLoadToHosts" | |
72 | #define LAUNCH_JOBKEY_LIMITLOADFROMHOSTS "LimitLoadFromHosts" | |
73 | #define LAUNCH_JOBKEY_LIMITLOADTOSESSIONTYPE "LimitLoadToSessionType" | |
e91b9f68 A |
74 | #define LAUNCH_JOBKEY_RUNATLOAD "RunAtLoad" |
75 | #define LAUNCH_JOBKEY_ROOTDIRECTORY "RootDirectory" | |
76 | #define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory" | |
e91b9f68 A |
77 | #define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables" |
78 | #define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables" | |
e91b9f68 A |
79 | #define LAUNCH_JOBKEY_UMASK "Umask" |
80 | #define LAUNCH_JOBKEY_NICE "Nice" | |
5b0a4722 A |
81 | #define LAUNCH_JOBKEY_HOPEFULLYEXITSFIRST "HopefullyExitsFirst" |
82 | #define LAUNCH_JOBKEY_HOPEFULLYEXITSLAST "HopefullyExitsLast" | |
e91b9f68 A |
83 | #define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO" |
84 | #define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate" | |
5b0a4722 | 85 | #define LAUNCH_JOBKEY_STARTONMOUNT "StartOnMount" |
e91b9f68 A |
86 | #define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits" |
87 | #define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits" | |
e91b9f68 A |
88 | #define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath" |
89 | #define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath" | |
90 | #define LAUNCH_JOBKEY_DEBUG "Debug" | |
ed34e3c3 | 91 | #define LAUNCH_JOBKEY_WAITFORDEBUGGER "WaitForDebugger" |
e91b9f68 A |
92 | #define LAUNCH_JOBKEY_QUEUEDIRECTORIES "QueueDirectories" |
93 | #define LAUNCH_JOBKEY_WATCHPATHS "WatchPaths" | |
94 | #define LAUNCH_JOBKEY_STARTINTERVAL "StartInterval" | |
95 | #define LAUNCH_JOBKEY_STARTCALENDARINTERVAL "StartCalendarInterval" | |
96 | #define LAUNCH_JOBKEY_BONJOURFDS "BonjourFDs" | |
ed34e3c3 A |
97 | #define LAUNCH_JOBKEY_LASTEXITSTATUS "LastExitStatus" |
98 | #define LAUNCH_JOBKEY_PID "PID" | |
5b0a4722 A |
99 | #define LAUNCH_JOBKEY_THROTTLEINTERVAL "ThrottleInterval" |
100 | #define LAUNCH_JOBKEY_LAUNCHONLYONCE "LaunchOnlyOnce" | |
101 | #define LAUNCH_JOBKEY_ABANDONPROCESSGROUP "AbandonProcessGroup" | |
e91b9f68 A |
102 | |
103 | #define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait" | |
104 | ||
ed34e3c3 A |
105 | #define LAUNCH_JOBKEY_MACH_RESETATCLOSE "ResetAtClose" |
106 | #define LAUNCH_JOBKEY_MACH_HIDEUNTILCHECKIN "HideUntilCheckIn" | |
107 | ||
108 | #define LAUNCH_JOBKEY_KEEPALIVE_SUCCESSFULEXIT "SuccessfulExit" | |
109 | #define LAUNCH_JOBKEY_KEEPALIVE_NETWORKSTATE "NetworkState" | |
110 | #define LAUNCH_JOBKEY_KEEPALIVE_PATHSTATE "PathState" | |
5b0a4722 A |
111 | #define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBACTIVE "OtherJobActive" |
112 | #define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBENABLED "OtherJobEnabled" | |
ed34e3c3 | 113 | |
e91b9f68 A |
114 | #define LAUNCH_JOBKEY_CAL_MINUTE "Minute" |
115 | #define LAUNCH_JOBKEY_CAL_HOUR "Hour" | |
116 | #define LAUNCH_JOBKEY_CAL_DAY "Day" | |
117 | #define LAUNCH_JOBKEY_CAL_WEEKDAY "Weekday" | |
118 | #define LAUNCH_JOBKEY_CAL_MONTH "Month" | |
119 | ||
120 | #define LAUNCH_JOBKEY_RESOURCELIMIT_CORE "Core" | |
121 | #define LAUNCH_JOBKEY_RESOURCELIMIT_CPU "CPU" | |
122 | #define LAUNCH_JOBKEY_RESOURCELIMIT_DATA "Data" | |
123 | #define LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE "FileSize" | |
124 | #define LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK "MemoryLock" | |
125 | #define LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE "NumberOfFiles" | |
126 | #define LAUNCH_JOBKEY_RESOURCELIMIT_NPROC "NumberOfProcesses" | |
127 | #define LAUNCH_JOBKEY_RESOURCELIMIT_RSS "ResidentSetSize" | |
128 | #define LAUNCH_JOBKEY_RESOURCELIMIT_STACK "Stack" | |
129 | ||
5b0a4722 A |
130 | #define LAUNCH_JOBKEY_DISABLED_MACHINETYPE "MachineType" |
131 | #define LAUNCH_JOBKEY_DISABLED_MODELNAME "ModelName" | |
132 | ||
e91b9f68 A |
133 | #define LAUNCH_JOBSOCKETKEY_TYPE "SockType" |
134 | #define LAUNCH_JOBSOCKETKEY_PASSIVE "SockPassive" | |
135 | #define LAUNCH_JOBSOCKETKEY_BONJOUR "Bonjour" | |
136 | #define LAUNCH_JOBSOCKETKEY_SECUREWITHKEY "SecureSocketWithKey" | |
137 | #define LAUNCH_JOBSOCKETKEY_PATHNAME "SockPathName" | |
aa59983a | 138 | #define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode" |
e91b9f68 A |
139 | #define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName" |
140 | #define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName" | |
141 | #define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily" | |
142 | #define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol" | |
ab36757d | 143 | #define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup" |
e91b9f68 A |
144 | |
145 | typedef struct _launch_data *launch_data_t; | |
146 | ||
147 | typedef enum { | |
148 | LAUNCH_DATA_DICTIONARY = 1, | |
149 | LAUNCH_DATA_ARRAY, | |
150 | LAUNCH_DATA_FD, | |
151 | LAUNCH_DATA_INTEGER, | |
152 | LAUNCH_DATA_REAL, | |
153 | LAUNCH_DATA_BOOL, | |
154 | LAUNCH_DATA_STRING, | |
155 | LAUNCH_DATA_OPAQUE, | |
156 | LAUNCH_DATA_ERRNO, | |
ed34e3c3 | 157 | LAUNCH_DATA_MACHPORT, |
e91b9f68 A |
158 | } launch_data_type_t; |
159 | ||
ed34e3c3 A |
160 | launch_data_t launch_data_alloc(launch_data_type_t) __ld_allocator; |
161 | launch_data_t launch_data_copy(launch_data_t) __ld_allocator; | |
162 | launch_data_type_t launch_data_get_type(const launch_data_t) __ld_getter; | |
163 | void launch_data_free(launch_data_t) __ld_setter; | |
e91b9f68 A |
164 | |
165 | /* Generic Dictionaries */ | |
166 | /* the value should not be changed while iterating */ | |
ed34e3c3 A |
167 | bool launch_data_dict_insert(launch_data_t, const launch_data_t, const char *) __ld_setter; |
168 | launch_data_t launch_data_dict_lookup(const launch_data_t, const char *) __ld_getter; | |
169 | bool launch_data_dict_remove(launch_data_t, const char *) __ld_setter; | |
170 | void launch_data_dict_iterate(const launch_data_t, void (*)(const launch_data_t, const char *, void *), void *) __ld_iterator(1, 2); | |
171 | size_t launch_data_dict_get_count(const launch_data_t) __ld_getter; | |
e91b9f68 A |
172 | |
173 | /* Generic Arrays */ | |
ed34e3c3 A |
174 | bool launch_data_array_set_index(launch_data_t, const launch_data_t, size_t) __ld_setter; |
175 | launch_data_t launch_data_array_get_index(const launch_data_t, size_t) __ld_getter; | |
176 | size_t launch_data_array_get_count(const launch_data_t) __ld_getter; | |
177 | ||
178 | launch_data_t launch_data_new_fd(int) __ld_allocator; | |
179 | launch_data_t launch_data_new_machport(mach_port_t) __ld_allocator; | |
180 | launch_data_t launch_data_new_integer(long long) __ld_allocator; | |
181 | launch_data_t launch_data_new_bool(bool) __ld_allocator; | |
182 | launch_data_t launch_data_new_real(double) __ld_allocator; | |
183 | launch_data_t launch_data_new_string(const char *) __ld_allocator; | |
184 | launch_data_t launch_data_new_opaque(const void *, size_t) __ld_allocator; | |
185 | ||
186 | bool launch_data_set_fd(launch_data_t, int) __ld_setter; | |
187 | bool launch_data_set_machport(launch_data_t, mach_port_t) __ld_setter; | |
188 | bool launch_data_set_integer(launch_data_t, long long) __ld_setter; | |
189 | bool launch_data_set_bool(launch_data_t, bool) __ld_setter; | |
190 | bool launch_data_set_real(launch_data_t, double) __ld_setter; | |
191 | bool launch_data_set_string(launch_data_t, const char *) __ld_setter; | |
192 | bool launch_data_set_opaque(launch_data_t, const void *, size_t) __ld_setter; | |
193 | ||
194 | int launch_data_get_fd(const launch_data_t) __ld_getter; | |
195 | mach_port_t launch_data_get_machport(const launch_data_t) __ld_getter; | |
196 | long long launch_data_get_integer(const launch_data_t) __ld_getter; | |
197 | bool launch_data_get_bool(const launch_data_t) __ld_getter; | |
198 | double launch_data_get_real(const launch_data_t) __ld_getter; | |
199 | const char * launch_data_get_string(const launch_data_t) __ld_getter; | |
200 | void * launch_data_get_opaque(const launch_data_t) __ld_getter; | |
201 | size_t launch_data_get_opaque_size(const launch_data_t) __ld_getter; | |
202 | int launch_data_get_errno(const launch_data_t) __ld_getter; | |
e91b9f68 A |
203 | |
204 | ||
205 | /* launch_get_fd() | |
206 | * | |
207 | * Use this to get the FD if you're doing asynchronous I/O with select(), | |
208 | * poll() or kevent(). | |
209 | */ | |
ed34e3c3 | 210 | int launch_get_fd(void) __ld_normal; |
e91b9f68 A |
211 | |
212 | /* launch_msg() | |
213 | * | |
214 | * Use this API to send and receive messages. | |
215 | * Calling launch_msg() with no message to send is a valid way to get | |
216 | * asynchronously received messages. | |
217 | * | |
218 | * If a message was to be sent, it returns NULL and errno on failure. | |
219 | * | |
220 | * If no messages were to be sent, it returns NULL and errno is set to zero if | |
221 | * no more asynchronous messages are available. | |
222 | */ | |
ed34e3c3 A |
223 | launch_data_t launch_msg(const launch_data_t) __ld_normal; |
224 | ||
225 | __END_DECLS | |
e91b9f68 | 226 | |
5b0a4722 A |
227 | #pragma GCC visibility pop |
228 | ||
e91b9f68 | 229 | #endif |