[launchd-dev] Daemon & Network Availability?

Karl Moskowski kolpanic at voodooergonomics.com
Mon Nov 10 09:46:36 PST 2008


On 10-Nov-08, at 12:09 PM, Ned Hogan wrote:

> Hi Karl,
>
> I have a similar implementation, I think this is what you want, as  
> one who has been socket programming on Unix for 25 years I need to  
> get my head around not doing my own fd plumbing, rather trusting  
> launchd to do it for me. It also means you need to spend some time  
> re-factoring your code.
>
> inetdCompatibility <dictionary>
>     The presence of this key specifies that the daemon expects to be  
> run as if
>     it were launched from inetd.
>
>           Wait <boolean>
>           This flag corresponds to the "wait" or "nowait" option of  
> inetd. If
>           true, then the listening socket is passed via the standard
>           in/out/error file descriptors. If false, then accept(2) is  
> called on
>           behalf of the job, and the result is passed via the standard
>           in/out/error descriptors.


Thanks for the info, Ned. Would I need this if my daemon doesn't  
provide any networks services? (The daemon really just a client for a  
network service - I made it a daemon because it has to run without a  
user logged into Mac OS X.) What type of refactoring do you think  
would be required?

BTW, I added the usual launchd checkin code to main(), and set  
ServiceIPC to true in the plist, to see if that helped out. It didn't  
- the launchd checkin fails with errno 13 (EACCES). I'd expect that to  
happen if, e.g., I ran it manually from Terminal, not if launchd  
started it.

----
Karl Moskowski <kolpanic at voodooergonomics.com>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2441 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20081110/49e8ceac/attachment.bin>


More information about the launchd-dev mailing list