]>
git.saurik.com Git - apple/launchd.git/blob - launchd/src/launch.h
2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
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"
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"
74 #define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait"
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"
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"
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"
97 #define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode"
98 #define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName"
99 #define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName"
100 #define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily"
101 #define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol"
102 #define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup"
104 typedef struct _launch_data
*launch_data_t
;
107 LAUNCH_DATA_DICTIONARY
= 1,
116 } launch_data_type_t
;
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
);
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
);
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
);
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);
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);
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
);
162 * Use this to get the FD if you're doing asynchronous I/O with select(),
163 * poll() or kevent().
165 int launch_get_fd(void);
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.
173 * If a message was to be sent, it returns NULL and errno on failure.
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.
178 launch_data_t
launch_msg(launch_data_t
);