]>
Commit | Line | Data |
---|---|---|
e91b9f68 A |
1 | /* |
2 | * Copyright (c) 2005 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 | #ifndef _LAUNCH_H_ | |
24 | #define _LAUNCH_H_ | |
25 | ||
26 | #include <stddef.h> | |
27 | #include <stdbool.h> | |
28 | ||
29 | ||
30 | #define LAUNCH_KEY_SUBMITJOB "SubmitJob" | |
31 | #define LAUNCH_KEY_REMOVEJOB "RemoveJob" | |
32 | #define LAUNCH_KEY_STARTJOB "StartJob" | |
33 | #define LAUNCH_KEY_STOPJOB "StopJob" | |
34 | #define LAUNCH_KEY_GETJOB "GetJob" | |
35 | #define LAUNCH_KEY_GETJOBWITHHANDLES "GetJobWithHandles" | |
36 | #define LAUNCH_KEY_GETJOBS "GetJobs" | |
37 | #define LAUNCH_KEY_CHECKIN "CheckIn" | |
38 | ||
39 | #define LAUNCH_JOBKEY_LABEL "Label" | |
40 | #define LAUNCH_JOBKEY_DISABLED "Disabled" | |
41 | #define LAUNCH_JOBKEY_USERNAME "UserName" | |
42 | #define LAUNCH_JOBKEY_GROUPNAME "GroupName" | |
43 | #define LAUNCH_JOBKEY_TIMEOUT "TimeOut" | |
44 | #define LAUNCH_JOBKEY_INITGROUPS "InitGroups" | |
45 | #define LAUNCH_JOBKEY_SOCKETS "Sockets" | |
46 | #define LAUNCH_JOBKEY_EVENTSOURCES "EventSources" | |
47 | #define LAUNCH_JOBKEY_INETDCOMPATIBILITY "inetdCompatibility" | |
48 | #define LAUNCH_JOBKEY_PROGRAMARGUMENTS "ProgramArguments" | |
49 | #define LAUNCH_JOBKEY_PROGRAM "Program" | |
50 | #define LAUNCH_JOBKEY_ONDEMAND "OnDemand" | |
51 | #define LAUNCH_JOBKEY_RUNATLOAD "RunAtLoad" | |
52 | #define LAUNCH_JOBKEY_ROOTDIRECTORY "RootDirectory" | |
53 | #define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory" | |
54 | #define LAUNCH_JOBKEY_SERVICEDESCRIPTION "ServiceDescription" | |
55 | #define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables" | |
56 | #define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables" | |
57 | #define LAUNCH_JOBKEY_PID "PID" | |
58 | #define LAUNCH_JOBKEY_UMASK "Umask" | |
59 | #define LAUNCH_JOBKEY_NICE "Nice" | |
60 | #define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO" | |
61 | #define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate" | |
62 | #define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits" | |
63 | #define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits" | |
64 | #define LAUNCH_JOBKEY_SERVICEIPC "ServiceIPC" | |
65 | #define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath" | |
66 | #define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath" | |
67 | #define LAUNCH_JOBKEY_DEBUG "Debug" | |
68 | #define LAUNCH_JOBKEY_QUEUEDIRECTORIES "QueueDirectories" | |
69 | #define LAUNCH_JOBKEY_WATCHPATHS "WatchPaths" | |
70 | #define LAUNCH_JOBKEY_STARTINTERVAL "StartInterval" | |
71 | #define LAUNCH_JOBKEY_STARTCALENDARINTERVAL "StartCalendarInterval" | |
72 | #define LAUNCH_JOBKEY_BONJOURFDS "BonjourFDs" | |
73 | ||
74 | #define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait" | |
75 | ||
76 | #define LAUNCH_JOBKEY_CAL_MINUTE "Minute" | |
77 | #define LAUNCH_JOBKEY_CAL_HOUR "Hour" | |
78 | #define LAUNCH_JOBKEY_CAL_DAY "Day" | |
79 | #define LAUNCH_JOBKEY_CAL_WEEKDAY "Weekday" | |
80 | #define LAUNCH_JOBKEY_CAL_MONTH "Month" | |
81 | ||
82 | #define LAUNCH_JOBKEY_RESOURCELIMIT_CORE "Core" | |
83 | #define LAUNCH_JOBKEY_RESOURCELIMIT_CPU "CPU" | |
84 | #define LAUNCH_JOBKEY_RESOURCELIMIT_DATA "Data" | |
85 | #define LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE "FileSize" | |
86 | #define LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK "MemoryLock" | |
87 | #define LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE "NumberOfFiles" | |
88 | #define LAUNCH_JOBKEY_RESOURCELIMIT_NPROC "NumberOfProcesses" | |
89 | #define LAUNCH_JOBKEY_RESOURCELIMIT_RSS "ResidentSetSize" | |
90 | #define LAUNCH_JOBKEY_RESOURCELIMIT_STACK "Stack" | |
91 | ||
92 | #define LAUNCH_JOBSOCKETKEY_TYPE "SockType" | |
93 | #define LAUNCH_JOBSOCKETKEY_PASSIVE "SockPassive" | |
94 | #define LAUNCH_JOBSOCKETKEY_BONJOUR "Bonjour" | |
95 | #define LAUNCH_JOBSOCKETKEY_SECUREWITHKEY "SecureSocketWithKey" | |
96 | #define LAUNCH_JOBSOCKETKEY_PATHNAME "SockPathName" | |
aa59983a | 97 | #define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode" |
e91b9f68 A |
98 | #define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName" |
99 | #define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName" | |
100 | #define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily" | |
101 | #define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol" | |
ab36757d | 102 | #define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup" |
e91b9f68 A |
103 | |
104 | typedef struct _launch_data *launch_data_t; | |
105 | ||
106 | typedef enum { | |
107 | LAUNCH_DATA_DICTIONARY = 1, | |
108 | LAUNCH_DATA_ARRAY, | |
109 | LAUNCH_DATA_FD, | |
110 | LAUNCH_DATA_INTEGER, | |
111 | LAUNCH_DATA_REAL, | |
112 | LAUNCH_DATA_BOOL, | |
113 | LAUNCH_DATA_STRING, | |
114 | LAUNCH_DATA_OPAQUE, | |
115 | LAUNCH_DATA_ERRNO, | |
116 | } launch_data_type_t; | |
117 | ||
118 | launch_data_t launch_data_alloc(launch_data_type_t); | |
119 | launch_data_t launch_data_copy(launch_data_t); | |
120 | launch_data_type_t launch_data_get_type(launch_data_t); | |
121 | void launch_data_free(launch_data_t); | |
122 | ||
123 | /* Generic Dictionaries */ | |
124 | /* the value should not be changed while iterating */ | |
125 | bool launch_data_dict_insert(launch_data_t, launch_data_t, const char *); | |
126 | launch_data_t launch_data_dict_lookup(launch_data_t, const char *); | |
127 | bool launch_data_dict_remove(launch_data_t, const char *); | |
128 | void launch_data_dict_iterate(launch_data_t, void (*)(launch_data_t, const char *, void *), void *); | |
129 | size_t launch_data_dict_get_count(launch_data_t); | |
130 | ||
131 | /* Generic Arrays */ | |
132 | bool launch_data_array_set_index(launch_data_t, launch_data_t, size_t); | |
133 | launch_data_t launch_data_array_get_index(launch_data_t, size_t); | |
134 | size_t launch_data_array_get_count(launch_data_t); | |
135 | ||
136 | launch_data_t launch_data_new_fd(int); | |
137 | launch_data_t launch_data_new_integer(long long); | |
138 | launch_data_t launch_data_new_bool(bool); | |
139 | launch_data_t launch_data_new_real(double); | |
140 | launch_data_t launch_data_new_string(const char *); | |
141 | launch_data_t launch_data_new_opaque(const void *, size_t); | |
142 | ||
143 | bool launch_data_set_fd(launch_data_t, int); | |
144 | bool launch_data_set_integer(launch_data_t, long long); | |
145 | bool launch_data_set_bool(launch_data_t, bool); | |
146 | bool launch_data_set_real(launch_data_t, double); | |
147 | bool launch_data_set_string(launch_data_t, const char *); | |
148 | bool launch_data_set_opaque(launch_data_t, const void *, size_t); | |
149 | ||
150 | int launch_data_get_fd(launch_data_t); | |
151 | long long launch_data_get_integer(launch_data_t); | |
152 | bool launch_data_get_bool(launch_data_t); | |
153 | double launch_data_get_real(launch_data_t); | |
154 | const char * launch_data_get_string(launch_data_t); | |
155 | void * launch_data_get_opaque(launch_data_t); | |
156 | size_t launch_data_get_opaque_size(launch_data_t); | |
157 | int launch_data_get_errno(launch_data_t); | |
158 | ||
159 | ||
160 | /* launch_get_fd() | |
161 | * | |
162 | * Use this to get the FD if you're doing asynchronous I/O with select(), | |
163 | * poll() or kevent(). | |
164 | */ | |
165 | int launch_get_fd(void); | |
166 | ||
167 | /* launch_msg() | |
168 | * | |
169 | * Use this API to send and receive messages. | |
170 | * Calling launch_msg() with no message to send is a valid way to get | |
171 | * asynchronously received messages. | |
172 | * | |
173 | * If a message was to be sent, it returns NULL and errno on failure. | |
174 | * | |
175 | * If no messages were to be sent, it returns NULL and errno is set to zero if | |
176 | * no more asynchronous messages are available. | |
177 | */ | |
178 | launch_data_t launch_msg(launch_data_t); | |
179 | ||
180 | #endif |