Skip to content

Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.

C

Launch angels: the jobs of System/Library/LaunchAngels, on demand

vcvkk3d97ffd5b073
diff --git a/userland/jobinfo.py b/userland/jobinfo.py
index 22ed491..e46a068 100755
--- a/userland/jobinfo.py
+++ b/userland/jobinfo.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
"""Show stock iOS launchd jobs: jobinfo.py [-s SERVICE | LABEL...]
-With -s, find the jobs that provide a Mach service whose name contains SERVICE."""
+With -s, find the jobs that provide a Mach service whose name contains SERVICE.
+The jobs are those of System/Library/LaunchDaemons and LaunchAngels."""
import glob, json, os, plistlib, sys
ROOTFS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ios165/rootfs')
-D = ROOTFS + '/System/Library/LaunchDaemons'
+DIRS = [ROOTFS + '/System/Library/LaunchDaemons', ROOTFS + '/System/Library/LaunchAngels']
def show(path):
d = plistlib.load(open(path, 'rb'))
prog = d.get('Program') or (d.get('ProgramArguments') or ['?'])[0]
@@ -15,10 +16,10 @@ def show(path):
print(' ', json.dumps(keys, default=str)[:300])
print(' services:', ' '.join(sorted(d.get('MachServices', {})))[:400])
if sys.argv[1:2] == ['-s']:
- for path in sorted(glob.glob(D + '/*.plist')):
+ for path in sorted(path for d in DIRS for path in glob.glob(d + '/*.plist')):
d = plistlib.load(open(path, 'rb'))
if any(sys.argv[2] in name for name in d.get('MachServices', {})):
show(path)
else:
for label in sys.argv[1:]:
- show(f'{D}/{label}.plist')
+ show(next((f'{d}/{label}.plist' for d in DIRS if os.path.isfile(f'{d}/{label}.plist')), f'{DIRS[0]}/{label}.plist'))
diff --git a/userland/mkjobs.py b/userland/mkjobs.py
index ae4648e..c95b524 100755
--- a/userland/mkjobs.py
+++ b/userland/mkjobs.py
@@ -12,7 +12,10 @@ costs time and pushes everybody else out of the log that comes back from the pho
The program itself must be in the system image; a warning is printed if it was not extracted.
With --rest, the other jobs of iOS follow (their standard error on the console as well, their os_log
-only when named in OSLOG), but strictly on demand: whatever starts them by
+only when named in OSLOG), and with them the "launch angels" (System/Library/LaunchAngels: the
+applications without an icon that draw parts of the system's own interface in a process of their
+own -- the wallpaper, the keyboard, the now playing controls -- and are reached through a Mach
+service like a daemon), but strictly on demand: whatever starts them by
itself (RunAtLoad, KeepAlive) is taken out, so that launchd runs one only when a program asks
for one of its Mach services. That is how an application finds the daemons it needs without
all 490 of them being started at boot. Left out: jobs without Mach services (nothing could
@@ -40,6 +43,7 @@ if rest:
src_root, dest, labels = args[0], args[1], args[2:]
oslog = os.environ.get('OSLOG', '').split()
src = f'{src_root}/System/Library/LaunchDaemons'
+angels = f'{src_root}/System/Library/LaunchAngels'
os.makedirs(dest, exist_ok=True)
for label in labels:
with open(f'{src}/{label}.plist', 'rb') as f:
@@ -55,11 +59,14 @@ for label in labels:
if rest:
count = 0
- for name in sorted(os.listdir(src)):
+ rest_jobs = [(src, name) for name in sorted(os.listdir(src))]
+ if os.path.isdir(angels):
+ rest_jobs += [(angels, name) for name in sorted(os.listdir(angels))]
+ for directory, name in rest_jobs:
label = name[:-len('.plist')]
if not name.endswith('.plist') or label in labels or any(word in label for word in DENY):
continue
- with open(f'{src}/{name}', 'rb') as f:
+ with open(f'{directory}/{name}', 'rb') as f:
job = plistlib.load(f)
program = job.get('Program') or (job.get('ProgramArguments') or [''])[0]
if not job.get('MachServices') or not os.path.isfile(f'{src_root}{program}'):