[launchd-dev] Understanding sockpathmode

Quinn "The Eskimo!" eskimo1 at apple.com
Tue Aug 30 03:09:50 PDT 2011


On 30 Aug 2011, at 10:44, Gian Luca Gaiba wrote:

> what actually means sockpathmode in property list?

It's used for UNIX domain (AF_UNIX) sockets.  It controls the access mode (permissions) of the socket, which in turn controls who is allowed to connect to it.  For example, the "com.apple.mDNSResponder" job has the following items in its launchd property list file:

    <key>SockPathName</key>
    <string>/var/run/mDNSResponder</string>
    <key>SockPathMode</key>
    <integer>438</integer>

This causes launchd to create a listening UNIX domain socket with the path "/var/run/mDNSResponder" and the permissions of 0666 (octal 0666 is equal to decimal 438).  You can see this socket in the file system:

$ ls -l /var/run/mDNSResponder
srw-rw-rw-  1 root  daemon  0 18 Aug 20:55 /var/run/mDNSResponder

Note that the permisions, rw-rw-rw-, is equal to 0666, meaning that the owner (root), anyone in the owning group (daemon), and indeed anyone on the system is allowed to connect to that socket.

Finally, be aware that this value is not relevant for TCP/IP sockets.

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