My project includes an Endpoint Security Client and a daemon that communicates with the ES client using NSXPCConnection. The daemon is launched by launchd thank to a plist file in /Library/LaunchDaemons.
As both processes are started by launchd I was wondering if there was a predetermined order in which they are started. For the moment based on the PID, the daemon seems to be starting before the EndpointSecurity client.
Is this startup order documented somewhere?
Thanks
Yes, I was seeing the same thing, launchd agent failing to connect at startup, until I did the early boot. Then I saw PIDs that didn't make sense, but looking at timestamps of messages I added, I saw that the system extension loaded and ran before the launchd process.
This was the comment I got back from Apple when I asked back in April:
PIDs are assigned at fork time, not exec time. When the ES kext knows there are early boot clients, it holds up the kernel thread performing the execve. So all binaries that would get exec'd (e.g. via Loginwindow, launchd loads, etc.), will all get a new pid - they just won't have code execute if they're non-platform binaries until the ES client connects and makes its first set of subscriptions (and, if they subscribed to AUTH EXEC, the client has the opportunity to DENY the exec from continuing). None of this has anything to do with lower numbered PIDs.