]>
git.saurik.com Git - apple/launchd.git/blob - liblaunch/launch_priv.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@
21 #ifndef __LAUNCH_PRIVATE_H__
22 #define __LAUNCH_PRIVATE_H__
24 #include <mach/mach.h>
25 #include <sys/types.h>
29 #include <uuid/uuid.h>
31 #pragma GCC visibility push(default)
35 #define LAUNCH_EXITSTATUS_FAIRPLAY_FAIL (INT64_MAX)
37 #define LAUNCH_KEY_SETUSERENVIRONMENT "SetUserEnvironment"
38 #define LAUNCH_KEY_UNSETUSERENVIRONMENT "UnsetUserEnvironment"
39 #define LAUNCH_KEY_SHUTDOWN "Shutdown"
40 #define LAUNCH_KEY_SINGLEUSER "SingleUser"
41 #define LAUNCH_KEY_GETRESOURCELIMITS "GetResourceLimits"
42 #define LAUNCH_KEY_SETRESOURCELIMITS "SetResourceLimits"
43 #define LAUNCH_KEY_GETRUSAGESELF "GetResourceUsageSelf"
44 #define LAUNCH_KEY_GETRUSAGECHILDREN "GetResourceUsageChildren"
46 #define LAUNCHD_SOCKET_ENV "LAUNCHD_SOCKET"
47 #define LAUNCHD_SOCK_PREFIX _PATH_VARTMP "launchd"
48 #define LAUNCHD_TRUSTED_FD_ENV "__LAUNCHD_FD"
49 #define LAUNCHD_ASYNC_MSG_KEY "_AsyncMessage"
50 #define LAUNCH_KEY_BATCHCONTROL "BatchControl"
51 #define LAUNCH_KEY_BATCHQUERY "BatchQuery"
53 #define LAUNCH_JOBKEY_TRANSACTIONCOUNT "TransactionCount"
54 #define LAUNCH_JOBKEY_QUARANTINEDATA "QuarantineData"
55 #define LAUNCH_JOBKEY_SANDBOXPROFILE "SandboxProfile"
56 #define LAUNCH_JOBKEY_SANDBOXFLAGS "SandboxFlags"
57 #define LAUNCH_JOBKEY_SANDBOX_NAMED "Named"
58 #define LAUNCH_JOBKEY_SANDBOXCONTAINER "SandboxContainer"
59 #define LAUNCH_JOBKEY_JETSAMPROPERTIES "JetsamProperties"
60 #define LAUNCH_JOBKEY_JETSAMPRIORITY "JetsamPriority"
61 #define LAUNCH_JOBKEY_JETSAMMEMORYLIMIT "JetsamMemoryLimit"
62 #define LAUNCH_JOBKEY_JETSAMMEMORYLIMITBACKGROUND "JetsamMemoryLimitBackground"
63 #define LAUNCH_JOBKEY_SECURITYSESSIONUUID "SecuritySessionUUID"
64 #define LAUNCH_JOBKEY_DISABLEASLR "DisableASLR"
65 #define LAUNCH_JOBKEY_XPCDOMAIN "XPCDomain"
66 #define LAUNCH_JOBKEY_POSIXSPAWNTYPE "POSIXSpawnType"
68 #define LAUNCH_KEY_JETSAMLABEL "JetsamLabel"
69 #define LAUNCH_KEY_JETSAMFRONTMOST "JetsamFrontmost"
70 #define LAUNCH_KEY_JETSAMACTIVE "JetsamActive"
71 #define LAUNCH_KEY_JETSAMPRIORITY LAUNCH_JOBKEY_JETSAMPRIORITY
72 #define LAUNCH_KEY_JETSAMMEMORYLIMIT LAUNCH_JOBKEY_JETSAMMEMORYLIMIT
74 #define LAUNCH_KEY_POSIXSPAWNTYPE_APP LAUNCH_KEY_PROCESSTYPE_APP
75 #define LAUNCH_KEY_POSIXSPAWNTYPE_SYSTEMAPP "SystemApp"
76 #define LAUNCH_KEY_POSIXSPAWNTYPE_STANDARD LAUNCH_KEY_PROCESSTYPE_STANDARD
77 #define LAUNCH_KEY_POSIXSPAWNTYPE_BACKGROUND LAUNCH_KEY_PROCESSTYPE_BACKGROUND
78 #define LAUNCH_KEY_POSIXSPAWNTYPE_INTERACTIVE LAUNCH_KEY_PROCESSTYPE_INTERACTIVE
79 #define LAUNCH_KEY_POSIXSPAWNTYPE_ADAPTIVE LAUNCH_KEY_PROCESSTYPE_ADAPTIVE
80 #define LAUNCH_KEY_POSIXSPAWNTYPE_TALAPP "TALApp"
82 #define LAUNCH_JOBKEY_EMBEDDEDPRIVILEGEDISPENSATION "EmbeddedPrivilegeDispensation"
83 #define LAUNCH_JOBKEY_EMBEDDEDHOMESCREEN "EmbeddedHomeScreen"
84 #define LAUNCH_JOBKEY_EMBEDDEDMAINTHREADPRIORITY "EmbeddedMainThreadPriority"
86 #define LAUNCH_JOBKEY_ENTERKERNELDEBUGGERBEFOREKILL "EnterKernelDebuggerBeforeKill"
87 #define LAUNCH_JOBKEY_PERJOBMACHSERVICES "PerJobMachServices"
88 #define LAUNCH_JOBKEY_SERVICEIPC "ServiceIPC"
89 #define LAUNCH_JOBKEY_BINARYORDERPREFERENCE "BinaryOrderPreference"
90 #define LAUNCH_JOBKEY_MACHEXCEPTIONHANDLER "MachExceptionHandler"
91 #define LAUNCH_JOBKEY_MULTIPLEINSTANCES "MultipleInstances"
92 #define LAUNCH_JOBKEY_EVENTMONITOR "EventMonitor"
93 #define LAUNCH_JOBKEY_SHUTDOWNMONITOR "ShutdownMonitor"
94 #define LAUNCH_JOBKEY_BEGINTRANSACTIONATSHUTDOWN "BeginTransactionAtShutdown"
95 #define LAUNCH_JOBKEY_XPCDOMAINBOOTSTRAPPER "XPCDomainBootstrapper"
96 #define LAUNCH_JOBKEY_ASID "AuditSessionID"
97 #define LAUNCH_JOBKEY_JOINGUISESSION "JoinGUISession"
99 #define LAUNCH_JOBKEY_MACH_KUNCSERVER "kUNCServer"
100 #define LAUNCH_JOBKEY_MACH_EXCEPTIONSERVER "ExceptionServer"
101 #define LAUNCH_JOBKEY_MACH_TASKSPECIALPORT "TaskSpecialPort"
102 #define LAUNCH_JOBKEY_MACH_HOSTSPECIALPORT "HostSpecialPort"
103 #define LAUNCH_JOBKEY_MACH_ENTERKERNELDEBUGGERONCLOSE "EnterKernelDebuggerOnClose"
104 #define LAUNCH_JOBKEY_LOWPRIORITYBACKGROUNDIO "LowPriorityBackgroundIO"
105 #define LAUNCH_JOBKEY_LEGACYTIMERS "LegacyTimers"
107 #define LAUNCH_ENV_INSTANCEID "LaunchInstanceID"
109 #define JETSAM_PROPERTY_PRIORITY "Priority"
110 #define JETSAM_PROPERTY_MEMORYLIMIT "MemoryLimitMB"
114 * After this call, the task's bootstrap port is set to the per session launchd.
116 * This returns 1 on success (it used to return otherwise), and -1 on failure.
118 #define LOAD_ONLY_SAFEMODE_LAUNCHAGENTS (1 << 0)
119 #define LAUNCH_GLOBAL_ON_DEMAND (1 << 1)
121 create_and_switch_to_per_session_launchd(const char *, int flags
, ...);
123 /* Also for LoginWindow.
125 * This is will load jobs at the LoginWindow prompt.
128 load_launchd_jobs_at_loginwindow_prompt(int flags
, ...);
130 /* For CoreProcesses */
131 #define SPAWN_VIA_LAUNCHD_STOPPED 0x0001
132 #define SPAWN_VIA_LAUNCHD_TALAPP 0x0002
133 #define SPAWN_VIA_LAUNCHD_WIDGET 0x0004
134 #define SPAWN_VIA_LAUNCHD_DISABLE_ASLR 0x0008
136 struct spawn_via_launchd_attr
{
137 uint64_t spawn_flags
;
138 const char *spawn_path
;
139 const char *spawn_chdir
;
140 const char * const * spawn_env
;
141 const mode_t
*spawn_umask
;
142 mach_port_t
*spawn_observer_port
;
143 const cpu_type_t
*spawn_binpref
;
144 size_t spawn_binpref_cnt
;
145 void * spawn_quarantine
;
146 const char *spawn_seatbelt_profile
;
147 const uint64_t *spawn_seatbelt_flags
;
150 #define spawn_via_launchd(a, b, c) _spawn_via_launchd(a, b, c, 3)
152 _spawn_via_launchd(const char *label
, const char * const *argv
,
153 const struct spawn_via_launchd_attr
*spawn_attrs
, int struct_version
);
156 launch_wait(mach_port_t port
);
158 /* The mpm_*() APIs no longer do anything. */
160 mpm_wait(mach_port_t ajob
, int *wstatus
);
163 mpm_uncork_fork(mach_port_t ajob
);
166 launch_socket_service_check_in(void);
170 #pragma GCC visibility pop
173 #endif /* __LAUNCH_PRIVATE_H__ */