It is a launchd daemon, something like this, handler ignored since client apps can talk to it:
Code Block int main(int argc, const char *argv[]) |
{ |
syslog(logLevel, "😎 L%d: start XpcEndPoint", __LINE__); |
const char *name = "com.me.driver.myaudio.xpc.XpcEndpoint"; |
/*dispatch_queue_t queue = dispatch_queue_create("TestXPC", 0);*/ |
|
xpc_connection_t service = xpc_connection_create_mach_service(name, DISPATCH_TARGET_QUEUE_DEFAULT, XPC_CONNECTION_MACH_SERVICE_LISTENER); |
if (!service) |
{ |
syslog(logLevel, "😎 failed to create service"); |
return; |
} |
/*xpc_connection_activate(service); |
xpc_connection_set_context(service, this); |
auto pSrv = this;*/ |
xpc_connection_set_event_handler(service, ^(xpc_object_t connection) { |
xpc_connection_set_context((xpc_connection_t)connection, pSrv); |
XpcServer::new_connection_handler((xpc_connection_t)connection); |
}); |
xpc_connection_resume(service); |
|
dispatch_main(); |
|
xpc_release(service); |
|
} |
=====the launchdaemon plist =========
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...>
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.me.driver.myaudio.xpc.XpcEndpoint</string>
<key>MachServices</key>
<dict>
<key>com.me.driver.myaudio.xpc.XpcEndpoint</key>
<true/>
</dict>
<key>ProgramArguments</key>
<array>
<string>/Library/Audio/Plug-Ins/HAL/MyAudio.driver/Contents/XPCServices/XpcEndpoint.xpc/Contents/MacOS/XpcEndpoint</string>
</array>
<key>ProcessType</key>
<string>Adaptive</string>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
====Add in the log===== // The bold lines were restart
2021-03-21 18:43:43.277902-0600 0x75d Default 0x0 278 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 PrepareXPCServer ===>
2021-03-21 18:43:43.277997-0600 0x75d Default 0x0 278 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 L210: sending XPC message: <dictionary: 0x7feb1ee041f0> { count = 3, transaction: 0, voucher = 0x0, contents =
2021-03-21 18:44:53.343469-0600 0x1822 Default 0x0 607 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 L210: sending XPC message: <dictionary: 0x7fb308609080> { count = 3, transaction: 0, voucher = 0x0, contents =
2021-03-21 18:44:54.924630-0600 0x343 Default 0x0 80 0 XpcAgent: 😎 L14: start XpcEndPoint :2021-03-21 18:44:54.924649-0600 0x343 Default 0x0 80 0 XpcAgent: 😎 XpcServer constructor 0x7fef83f04080
2021-03-21 18:44:54.924664-0600 0x343 Default 0x0 80 0 XpcAgent: 😎 XpcServer::Run
2021-03-21 18:44:54.925038-0600 0x1840 Default 0x0 80 0 XpcAgent: 😎 L66: Client Msg: <dictionary: 0x7fef83f04c00> { count = 3, transaction: 1, voucher = 0x7fef83f04350, contents =
2021-03-21 18:44:54.925042-0600 0x1842 Default 0x0 80 0 XpcAgent: 😎 L66: Client Msg: <dictionary: 0x7fef83e04100> { count = 3, transaction: 1, voucher = 0x7fef83e04230, contents =
2021-03-21 18:44:54.925086-0600 0x1840 Default 0x0 80 0 XpcAgent: 😎 L119 dealWithRegistration: size of table = 1
2021-03-21 18:44:54.925108-0600 0x1840 Default 0x0 80 0 XpcAgent: 😎 L137 reply client: <dictionary: 0x7fef83e04a30> { count = 3, transaction: 1, voucher = 0x7fef83f04350, contents =
2021-03-21 18:44:54.925150-0600 0x1822 Default 0x0 607 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 L215: XPC replied: <dictionary: 0x7fb308609930> { count = 3, transaction: 0, voucher = 0x0, contents =
2021-03-21 18:44:54.925155-0600 0x1822 Default 0x0 607 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 Registrated XPC service successfully!
2021-03-21 18:44:54.967501-0600 0x1861 Default 0x0 609 0 XpcAgent: 😎 L14: start XpcEndPoint :2021-03-21 18:44:54.967511-0600 0x1861 Default 0x0 609 0 XpcAgent: 😎 XpcServer constructor 0x7fc56a5045a0
2021-03-21 18:44:54.967515-0600 0x1861 Default 0x0 609 0 XpcAgent: 😎 XpcServer::Run
2021-03-21 18:44:54.968272-0600 0x187a Default 0x0 609 0 XpcAgent: 😎 L66: Client Msg: <dictionary: 0x7fc56a704980> { count = 3, transaction: 1, voucher = 0x7fc56a704470, contents =
2021-03-21 18:44:54.968311-0600 0x187a Default 0x0 609 0 XpcAgent: 😎 L119 dealWithRegistration: size of table = 1
2021-03-21 18:44:54.968335-0600 0x187a Default 0x0 609 0 XpcAgent: 😎 L137 reply client: <dictionary: 0x7fc56b8043a0> { count = 3, transaction: 1, voucher = 0x7fc56a704470, contents =
2021-03-21 18:44:54.968908-0600 0x1855 Default 0x0 610 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 L215: XPC replied: <dictionary: 0x7fe3d6804670> { count = 3, transaction: 0, voucher = 0x0, contents =
2021-03-21 18:44:54.968913-0600 0x1855 Default 0x0 610 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 Registrated XPC service successfully!
2021-03-21 18:44:54.968931-0600 0x1855 Default 0x0 610 0 com.apple.audio.Core-Audio-Driver-Service: (MyAudio) 😎 Done with PrepareXPCServer, moved on!
2021-03-21 18:45:04.981495-0600 0x1dcd Default 0x0 680 0 XpcAgent: 😎 L14: start XpcEndPoint :2021-03-21 18:45:04.981511-0600 0x1dcd Default 0x0 680 0 XpcAgent: 😎 XpcServer constructor 0x7fb23f504380
2021-03-21 18:45:04.981516-0600 0x1dcd Default 0x0 680 0 XpcAgent: 😎 XpcServer::Run