]>
git.saurik.com Git - apple/launchd.git/blob - liblaunch/launch.h
2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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
16 * limitations under the License.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
24 #include <mach/mach.h>
25 #include <sys/cdefs.h>
29 #pragma GCC visibility push(default)
34 #define __ld_normal __attribute__((__nothrow__))
35 #define __ld_setter __attribute__((__nothrow__, __nonnull__))
36 #define __ld_getter __attribute__((__nothrow__, __nonnull__, __pure__, __warn_unused_result__))
37 #define __ld_iterator(x, y) __attribute__((__nonnull__(x, y)))
38 #define __ld_allocator __attribute__((__nothrow__, __malloc__, __nonnull__, __warn_unused_result__))
43 #define __ld_iterator(x, y)
44 #define __ld_allocator
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"
52 #define LAUNCH_KEY_GETJOBS "GetJobs"
53 #define LAUNCH_KEY_CHECKIN "CheckIn"
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"
60 #define LAUNCH_JOBKEY_EXITTIMEOUT "ExitTimeOut"
61 #define LAUNCH_JOBKEY_INITGROUPS "InitGroups"
62 #define LAUNCH_JOBKEY_SOCKETS "Sockets"
63 #define LAUNCH_JOBKEY_MACHSERVICES "MachServices"
64 #define LAUNCH_JOBKEY_MACHSERVICELOOKUPPOLICIES "MachServiceLookupPolicies"
65 #define LAUNCH_JOBKEY_INETDCOMPATIBILITY "inetdCompatibility"
66 #define LAUNCH_JOBKEY_ENABLEGLOBBING "EnableGlobbing"
67 #define LAUNCH_JOBKEY_PROGRAMARGUMENTS "ProgramArguments"
68 #define LAUNCH_JOBKEY_PROGRAM "Program"
69 #define LAUNCH_JOBKEY_ONDEMAND "OnDemand"
70 #define LAUNCH_JOBKEY_KEEPALIVE "KeepAlive"
71 #define LAUNCH_JOBKEY_LIMITLOADTOHOSTS "LimitLoadToHosts"
72 #define LAUNCH_JOBKEY_LIMITLOADFROMHOSTS "LimitLoadFromHosts"
73 #define LAUNCH_JOBKEY_LIMITLOADTOSESSIONTYPE "LimitLoadToSessionType"
74 #define LAUNCH_JOBKEY_LIMITLOADTOHARDWARE "LimitLoadToHardware"
75 #define LAUNCH_JOBKEY_LIMITLOADFROMHARDWARE "LimitLoadFromHardware"
76 #define LAUNCH_JOBKEY_RUNATLOAD "RunAtLoad"
77 #define LAUNCH_JOBKEY_ROOTDIRECTORY "RootDirectory"
78 #define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory"
79 #define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables"
80 #define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables"
81 #define LAUNCH_JOBKEY_UMASK "Umask"
82 #define LAUNCH_JOBKEY_NICE "Nice"
83 #define LAUNCH_JOBKEY_HOPEFULLYEXITSFIRST "HopefullyExitsFirst"
84 #define LAUNCH_JOBKEY_HOPEFULLYEXITSLAST "HopefullyExitsLast"
85 #define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO"
86 #define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate"
87 #define LAUNCH_JOBKEY_STARTONMOUNT "StartOnMount"
88 #define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits"
89 #define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits"
90 #define LAUNCH_JOBKEY_STANDARDINPATH "StandardInPath"
91 #define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath"
92 #define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath"
93 #define LAUNCH_JOBKEY_DEBUG "Debug"
94 #define LAUNCH_JOBKEY_WAITFORDEBUGGER "WaitForDebugger"
95 #define LAUNCH_JOBKEY_QUEUEDIRECTORIES "QueueDirectories"
96 #define LAUNCH_JOBKEY_WATCHPATHS "WatchPaths"
97 #define LAUNCH_JOBKEY_STARTINTERVAL "StartInterval"
98 #define LAUNCH_JOBKEY_STARTCALENDARINTERVAL "StartCalendarInterval"
99 #define LAUNCH_JOBKEY_BONJOURFDS "BonjourFDs"
100 #define LAUNCH_JOBKEY_LASTEXITSTATUS "LastExitStatus"
101 #define LAUNCH_JOBKEY_PID "PID"
102 #define LAUNCH_JOBKEY_THROTTLEINTERVAL "ThrottleInterval"
103 #define LAUNCH_JOBKEY_LAUNCHONLYONCE "LaunchOnlyOnce"
104 #define LAUNCH_JOBKEY_ABANDONPROCESSGROUP "AbandonProcessGroup"
105 #define LAUNCH_JOBKEY_IGNOREPROCESSGROUPATSHUTDOWN "IgnoreProcessGroupAtShutdown"
106 #define LAUNCH_JOBKEY_POLICIES "Policies"
107 #define LAUNCH_JOBKEY_ENABLETRANSACTIONS "EnableTransactions"
109 #define LAUNCH_JOBPOLICY_DENYCREATINGOTHERJOBS "DenyCreatingOtherJobs"
111 #define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait"
113 #define LAUNCH_JOBKEY_MACH_RESETATCLOSE "ResetAtClose"
114 #define LAUNCH_JOBKEY_MACH_HIDEUNTILCHECKIN "HideUntilCheckIn"
115 #define LAUNCH_JOBKEY_MACH_DRAINMESSAGESONCRASH "DrainMessagesOnCrash"
116 #define LAUNCH_JOBKEY_MACH_PINGEVENTUPDATES "PingEventUpdates"
118 #define LAUNCH_JOBKEY_KEEPALIVE_SUCCESSFULEXIT "SuccessfulExit"
119 #define LAUNCH_JOBKEY_KEEPALIVE_NETWORKSTATE "NetworkState"
120 #define LAUNCH_JOBKEY_KEEPALIVE_PATHSTATE "PathState"
121 #define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBACTIVE "OtherJobActive"
122 #define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBENABLED "OtherJobEnabled"
123 #define LAUNCH_JOBKEY_KEEPALIVE_AFTERINITIALDEMAND "AfterInitialDemand"
124 #define LAUNCH_JOBKEY_KEEPALIVE_CRASHED "Crashed"
126 #define LAUNCH_JOBKEY_LAUNCHEVENTS "LaunchEvents"
128 #define LAUNCH_JOBKEY_CAL_MINUTE "Minute"
129 #define LAUNCH_JOBKEY_CAL_HOUR "Hour"
130 #define LAUNCH_JOBKEY_CAL_DAY "Day"
131 #define LAUNCH_JOBKEY_CAL_WEEKDAY "Weekday"
132 #define LAUNCH_JOBKEY_CAL_MONTH "Month"
134 #define LAUNCH_JOBKEY_RESOURCELIMIT_CORE "Core"
135 #define LAUNCH_JOBKEY_RESOURCELIMIT_CPU "CPU"
136 #define LAUNCH_JOBKEY_RESOURCELIMIT_DATA "Data"
137 #define LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE "FileSize"
138 #define LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK "MemoryLock"
139 #define LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE "NumberOfFiles"
140 #define LAUNCH_JOBKEY_RESOURCELIMIT_NPROC "NumberOfProcesses"
141 #define LAUNCH_JOBKEY_RESOURCELIMIT_RSS "ResidentSetSize"
142 #define LAUNCH_JOBKEY_RESOURCELIMIT_STACK "Stack"
144 #define LAUNCH_JOBKEY_DISABLED_MACHINETYPE "MachineType"
145 #define LAUNCH_JOBKEY_DISABLED_MODELNAME "ModelName"
147 #define LAUNCH_JOBSOCKETKEY_TYPE "SockType"
148 #define LAUNCH_JOBSOCKETKEY_PASSIVE "SockPassive"
149 #define LAUNCH_JOBSOCKETKEY_BONJOUR "Bonjour"
150 #define LAUNCH_JOBSOCKETKEY_SECUREWITHKEY "SecureSocketWithKey"
151 #define LAUNCH_JOBSOCKETKEY_PATHNAME "SockPathName"
152 #define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode"
153 #define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName"
154 #define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName"
155 #define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily"
156 #define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol"
157 #define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup"
159 /* These APIs are NOT suitable for general use. Their use should be constrained
160 * to checking into launchd to obtain socket file descriptors using the
161 * LAUNCH_CHECK_IN message type.
163 typedef struct _launch_data
*launch_data_t
;
166 LAUNCH_DATA_DICTIONARY
= 1,
175 LAUNCH_DATA_MACHPORT
,
176 } launch_data_type_t
;
180 launch_data_alloc(launch_data_type_t
);
184 launch_data_copy(launch_data_t
);
188 launch_data_get_type(const launch_data_t
);
192 launch_data_free(launch_data_t
);
196 launch_data_dict_insert(launch_data_t
, const launch_data_t
, const char *);
200 launch_data_dict_lookup(const launch_data_t
, const char *);
204 launch_data_dict_remove(launch_data_t
, const char *);
208 launch_data_dict_iterate(const launch_data_t
,
209 void (*)(const launch_data_t
, const char *, void *), void *);
213 launch_data_dict_get_count(const launch_data_t
);
217 launch_data_array_set_index(launch_data_t
, const launch_data_t
, size_t);
221 launch_data_array_get_index(const launch_data_t
, size_t);
225 launch_data_array_get_count(const launch_data_t
);
229 launch_data_new_fd(int);
233 launch_data_new_machport(mach_port_t
);
237 launch_data_new_integer(long long);
241 launch_data_new_bool(bool);
245 launch_data_new_real(double);
249 launch_data_new_string(const char *);
253 launch_data_new_opaque(const void *, size_t);
257 launch_data_set_fd(launch_data_t
, int);
261 launch_data_set_machport(launch_data_t
, mach_port_t
);
265 launch_data_set_integer(launch_data_t
, long long);
269 launch_data_set_bool(launch_data_t
, bool);
273 launch_data_set_real(launch_data_t
, double);
277 launch_data_set_string(launch_data_t
, const char *);
281 launch_data_set_opaque(launch_data_t
, const void *, size_t);
285 launch_data_get_fd(const launch_data_t
);
289 launch_data_get_machport(const launch_data_t
);
293 launch_data_get_integer(const launch_data_t
);
297 launch_data_get_bool(const launch_data_t
);
301 launch_data_get_real(const launch_data_t
);
305 launch_data_get_string(const launch_data_t
);
309 launch_data_get_opaque(const launch_data_t
);
313 launch_data_get_opaque_size(const launch_data_t
);
317 launch_data_get_errno(const launch_data_t
);
322 * Use this to get the FD if you're doing asynchronous I/O with select(),
323 * poll() or kevent().
331 * Use this API to check in. Nothing else.
335 launch_msg(const launch_data_t
);
339 #pragma GCC visibility pop
341 #endif /* __LAUNCH_H__ */