My application is split into two parts. The main application and a helper tool. The helper tool performs a task with elevated permissions.
The launchd plist looks like this: (Only important settings included.)
<key>UserName</key>
<string>root</string>
<key>ProgramArguments</key>
<array>
<string>/Library/PrivilegedHelperTools/helperTool</string>
</array>
<key>Sockets</key>
<dict>
<key>IPC</key>
<dict>
<key>SockPathName</key>
<string>/tmp/TheSocket</string>
</dict>
</dict>
Is there a way to launch a new helper instance for every connection to the socket?
Or alternatively, is there a existing template for handling multiple requests? (I'm doing this myself at the moment, which is quite a lot of ugly code.)