[launchd-dev] Setting up an AF_UNIX based launchd server

Quinn "The Eskimo!" eskimo1 at apple.com
Mon Jul 25 02:51:51 PDT 2011


On 24 Jul 2011, at 23:15, mailist at ericgorr.net wrote:

> One question is how should /var/tmp/net.ericgorr.testserver/Socket be created?

This is your fundamental problem.  The launchd infrastructure will take care of creating the UNIX domain socket for you, but it won't create intermediate directories.  So the socket has to live within a directory that already exists.  The standard path is for your service would be "/var/run/net.ericgorr.testserver.socket" ("/var/run" not "/var/tmp", and ".socket" not "/socket").

> Another question is, after I can launch the server, the server will need to check in with launchd and I need to know what index should be passed to launch_data_array_get_index...? And, where is this documented?

In the TCP/IP case, the array can contain multiple elements (typically one for IPv4 and one for IPv6) and you are expected to work with all elements.

In the UNIX domain sockets case, the array will contain just one element.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware




More information about the launchd-dev mailing list