]>
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_PRIV_H_ | |
21 | #define _LAUNCH_PRIV_H_ | |
22 | ||
5b0a4722 A |
23 | #include <mach/mach.h> |
24 | #include <sys/types.h> | |
ed34e3c3 | 25 | #include <launch.h> |
5b0a4722 | 26 | #include <unistd.h> |
ddbbfbc1 A |
27 | #include <paths.h> |
28 | #include <uuid/uuid.h> | |
5b0a4722 A |
29 | |
30 | #pragma GCC visibility push(default) | |
ed34e3c3 A |
31 | |
32 | __BEGIN_DECLS | |
33 | ||
ddbbfbc1 A |
34 | #define LAUNCH_KEY_SETUSERENVIRONMENT "SetUserEnvironment" |
35 | #define LAUNCH_KEY_UNSETUSERENVIRONMENT "UnsetUserEnvironment" | |
36 | #define LAUNCH_KEY_SHUTDOWN "Shutdown" | |
37 | #define LAUNCH_KEY_SINGLEUSER "SingleUser" | |
38 | #define LAUNCH_KEY_GETRESOURCELIMITS "GetResourceLimits" | |
39 | #define LAUNCH_KEY_SETRESOURCELIMITS "SetResourceLimits" | |
40 | #define LAUNCH_KEY_GETRUSAGESELF "GetResourceUsageSelf" | |
41 | #define LAUNCH_KEY_GETRUSAGECHILDREN "GetResourceUsageChildren" | |
42 | #define LAUNCH_KEY_SETPRIORITYLIST "SetPriorityList" | |
43 | ||
44 | #define LAUNCHD_SOCKET_ENV "LAUNCHD_SOCKET" | |
45 | #define LAUNCHD_SOCK_PREFIX _PATH_VARTMP "launchd" | |
46 | #define LAUNCHD_TRUSTED_FD_ENV "__LAUNCHD_FD" | |
47 | #define LAUNCHD_ASYNC_MSG_KEY "_AsyncMessage" | |
48 | #define LAUNCH_KEY_BATCHCONTROL "BatchControl" | |
49 | #define LAUNCH_KEY_BATCHQUERY "BatchQuery" | |
50 | #define LAUNCHD_DO_APPLE_INTERNAL_LOGGING "__DoAppleInternalLogging__" | |
51 | ||
ddbbfbc1 A |
52 | #define LAUNCH_JOBKEY_TRANSACTIONCOUNT "TransactionCount" |
53 | #define LAUNCH_JOBKEY_QUARANTINEDATA "QuarantineData" | |
54 | #define LAUNCH_JOBKEY_SANDBOXPROFILE "SandboxProfile" | |
55 | #define LAUNCH_JOBKEY_SANDBOXFLAGS "SandboxFlags" | |
56 | #define LAUNCH_JOBKEY_SANDBOX_NAMED "Named" | |
587e987e | 57 | #define LAUNCH_JOBKEY_JETSAMPROPERTIES "JetsamProperties" |
ddbbfbc1 | 58 | #define LAUNCH_JOBKEY_JETSAMPRIORITY "JetsamPriority" |
587e987e | 59 | #define LAUNCH_JOBKEY_JETSAMMEMORYLIMIT "JetsamMemoryLimit" |
ddbbfbc1 | 60 | #define LAUNCH_JOBKEY_SECURITYSESSIONUUID "SecuritySessionUUID" |
dcace88f A |
61 | #define LAUNCH_JOBKEY_DISABLEASLR "DisableASLR" |
62 | #define LAUNCH_JOBKEY_XPCDOMAIN "XPCDomain" | |
63 | #define LAUNCH_JOBKEY_POSIXSPAWNTYPE "POSIXSpawnType" | |
ddbbfbc1 | 64 | |
587e987e A |
65 | #define LAUNCH_KEY_JETSAMLABEL "JetsamLabel" |
66 | #define LAUNCH_KEY_JETSAMFRONTMOST "JetsamFrontmost" | |
67 | #define LAUNCH_KEY_JETSAMPRIORITY LAUNCH_JOBKEY_JETSAMPRIORITY | |
68 | #define LAUNCH_KEY_JETSAMMEMORYLIMIT LAUNCH_JOBKEY_JETSAMMEMORYLIMIT | |
69 | ||
dcace88f A |
70 | #define LAUNCH_KEY_POSIXSPAWNTYPE_TALAPP "TALApp" |
71 | #define LAUNCH_KEY_POSIXSPAWNTYPE_WIDGET "Widget" | |
72 | #define LAUNCH_KEY_POSIXSPAWNTYPE_IOSAPP "iOSApp" | |
73 | ||
ddbbfbc1 A |
74 | #define LAUNCH_JOBKEY_EMBEDDEDPRIVILEGEDISPENSATION "EmbeddedPrivilegeDispensation" |
75 | #define LAUNCH_JOBKEY_EMBEDDEDMAINTHREADPRIORITY "EmbeddedMainThreadPriority" | |
76 | ||
77 | #define LAUNCH_JOBKEY_ENTERKERNELDEBUGGERBEFOREKILL "EnterKernelDebuggerBeforeKill" | |
78 | #define LAUNCH_JOBKEY_PERJOBMACHSERVICES "PerJobMachServices" | |
79 | #define LAUNCH_JOBKEY_SERVICEIPC "ServiceIPC" | |
80 | #define LAUNCH_JOBKEY_BINARYORDERPREFERENCE "BinaryOrderPreference" | |
81 | #define LAUNCH_JOBKEY_MACHEXCEPTIONHANDLER "MachExceptionHandler" | |
dcace88f A |
82 | #define LAUNCH_JOBKEY_MULTIPLEINSTANCES "MultipleInstances" |
83 | #define LAUNCH_JOBKEY_EVENTMONITOR "EventMonitor" | |
84 | #define LAUNCH_JOBKEY_SHUTDOWNMONITOR "ShutdownMonitor" | |
85 | #define LAUNCH_JOBKEY_BEGINTRANSACTIONATSHUTDOWN "BeginTransactionAtShutdown" | |
ddbbfbc1 A |
86 | |
87 | #define LAUNCH_JOBKEY_MACH_KUNCSERVER "kUNCServer" | |
88 | #define LAUNCH_JOBKEY_MACH_EXCEPTIONSERVER "ExceptionServer" | |
89 | #define LAUNCH_JOBKEY_MACH_TASKSPECIALPORT "TaskSpecialPort" | |
90 | #define LAUNCH_JOBKEY_MACH_HOSTSPECIALPORT "HostSpecialPort" | |
5b0a4722 | 91 | #define LAUNCH_JOBKEY_MACH_ENTERKERNELDEBUGGERONCLOSE "EnterKernelDebuggerOnClose" |
e91b9f68 | 92 | |
dcace88f | 93 | #define LAUNCH_ENV_INSTANCEID "LaunchInstanceID" |
e91b9f68 | 94 | |
ed34e3c3 A |
95 | /* For LoginWindow. |
96 | * | |
97 | * After this call, the task's bootstrap port is set to the per session launchd. | |
98 | * | |
5b0a4722 | 99 | * This returns 1 on success (it used to return otherwise), and -1 on failure. |
ed34e3c3 | 100 | */ |
ddbbfbc1 A |
101 | #define LOAD_ONLY_SAFEMODE_LAUNCHAGENTS 1 << 0 |
102 | #define LAUNCH_GLOBAL_ON_DEMAND 1 << 1 | |
5b0a4722 A |
103 | pid_t create_and_switch_to_per_session_launchd(const char * /* loginname */, int flags, ...); |
104 | ||
105 | /* Also for LoginWindow. | |
106 | * | |
107 | * This is will load jobs at the LoginWindow prompt. | |
108 | */ | |
109 | void load_launchd_jobs_at_loginwindow_prompt(int flags, ...); | |
110 | ||
ed34e3c3 A |
111 | /* For CoreProcesses |
112 | */ | |
113 | ||
dcace88f A |
114 | #define SPAWN_VIA_LAUNCHD_STOPPED 0x0001 |
115 | #define SPAWN_VIA_LAUNCHD_TALAPP 0x0002 | |
116 | #define SPAWN_VIA_LAUNCHD_WIDGET 0x0004 | |
117 | #define SPAWN_VIA_LAUNCHD_DISABLE_ASLR 0x0008 | |
ed34e3c3 A |
118 | |
119 | struct spawn_via_launchd_attr { | |
120 | uint64_t spawn_flags; | |
121 | const char * spawn_path; | |
122 | const char * spawn_chdir; | |
123 | const char *const * spawn_env; | |
124 | const mode_t * spawn_umask; | |
125 | mach_port_t * spawn_observer_port; | |
5b0a4722 A |
126 | const cpu_type_t * spawn_binpref; |
127 | size_t spawn_binpref_cnt; | |
f36da725 | 128 | void * spawn_quarantine; |
5b0a4722 A |
129 | const char * spawn_seatbelt_profile; |
130 | const uint64_t * spawn_seatbelt_flags; | |
ed34e3c3 A |
131 | }; |
132 | ||
dcace88f | 133 | #define spawn_via_launchd(a, b, c) _spawn_via_launchd(a, b, c, 3) |
ed34e3c3 A |
134 | pid_t _spawn_via_launchd( |
135 | const char *label, | |
136 | const char *const *argv, | |
137 | const struct spawn_via_launchd_attr *spawn_attrs, | |
138 | int struct_version); | |
139 | ||
dcace88f A |
140 | int launch_wait(mach_port_t port); |
141 | ||
ed34e3c3 A |
142 | kern_return_t mpm_wait(mach_port_t ajob, int *wstatus); |
143 | ||
144 | kern_return_t mpm_uncork_fork(mach_port_t ajob); | |
145 | ||
ed34e3c3 A |
146 | __END_DECLS |
147 | ||
5b0a4722 A |
148 | #pragma GCC visibility pop |
149 | ||
150 | ||
e91b9f68 | 151 | #endif |