The socket is still present in /tmp/ but it belongs to user B and is no more usable but user A.
What I would like is the ability for launchd to (re)configure the Unix domain socket each time a user authenticates to the console, either the first time or using the fast user switching method.
- I use a UNIX domain socket so that only local processes can talk to the socket and use my agent. I don't want to open my agent to other computer on the network.
- I use launchd to start my agent on request only. That is a very nice feature. I can't detect the user switching since my agent code is, most of the time, not running.
- I can't use a different socket name per user since the client of my agent does not know who is currently logged. My client application is talking to the socket configured for whoever is logged at that time.
My /Library/LaunchAgents/com.foobar.plist file contains:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.foobar</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/lib/foobar_exe</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockPathName</key>
<string>/tmp/foobar.socket</string>
</dict>
</dict>
<key>ProcessType</key>
<string>Interactive</string>
</dict>
</plist>
Does launchd provides a solution to my problem?
Should I open a bug at Apple to ask for this new feature in launchd?
Thanks
[1]
https://lists.macosforge.org/pipermail/launchd-dev/2008-May/000298.html