Launchd and domain sockets, accept() problem (was Re: launchd APIs)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com I've got a domain socket that the daemon listens on for IPC. This works fine if the daemon initializes the socket itself. in the plist file for that socket I've got: <key>SockFamily</key> <string>Unix</string> <key>SockPassive</key> <true/> <key>SockPathMode</key> <integer>49663</integer> -- this corresponds to 140777 octal... <key>SockPathName</key> <string>/var/tmp/com.deterministicnetworks.daemon/Socket</string> Kevin Brock apple@kevin.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Apr 21, 2006, at 1:24 PM, Dave Zarzycki wrote: Sorry, no documentation has been written as of yet. That's all my fault. Do you have any questions you'd like answered? Internally it takes a socket FD and uses it as an argument to CFSocketCreateWithNative with an accept callback. Using launchd, it doesn't work. Clients appear to connect to the socket, but the accept callback is never called. There *is* a socket in the dictionary. Here's the code the daemon calls to get the socket. I've cut out all of the error handling code. There *aren't* any errors, so it's not really relevant. This is pretty much straight from sampled, except that since I have exactly one socket I don't need a loop: sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS); listening_fd_array = launch_data_dict_lookup(sockets_dict, "DaemonDomainSocket"); if (0 < launch_data_array_get_count(listening_fd_array)) { launch_data_t this_listening_fd = launch_data_array_get_index (listening_fd_array, i); listener_fd = launch_data_get_fd(this_listening_fd); } Then listening_fd is used as the socket passed to CFSocketCreateWithNative. I've checked that the socket is being created, in the right location with the right permissions. Is launchd handling the accepts? If so, how do I find out when something has been accepted? If not, do you have any idea what's going on with launchd here? This email sent to site_archiver@lists.apple.com
participants (1)
-
Kevin Brock