Re: Launchd daemon
Re: Launchd daemon
- Subject: Re: Launchd daemon
- From: Steve Sisak <email@hidden>
- Date: Sun, 17 Mar 2013 18:25:03 -0400
Hi Erwin,
At 10:53 PM +0100 3/17/13, Erwin Namal wrote:
The daemon will just maintain a database shared by all users of the
computer, as well as hold some configuration options tied to
external hardware and dialog with kexts. When no user is logged in,
the daemon will be able to answer the kexts questions about the
hardware's configuration. When one or many users are logged in, the
daemon will allow them to access the database in a thread-secure way
as well as modify the hardware config.
Based on this, your deamon is just vending a service and probably
doesn't need to be running all the time, although launchd will give
your clients the illusion that it.
I'm not sure if you can access a daemon from a kext -- you may have
to vend that from a kext (or the IORegistry) and re-vend that from
your daemon of have your daemon connect to your own lext that handles
the kernel side.
What you want to read is:
man launchd.plist
What you're going to to do is write a .plist file that declares what
ports (IP or Mach) that your daemon listens on plus a bunch of other
configuration stuff.
based on the contents of you .plist, launchd will register those
ports on your behalf.
The first time that someone tries to connect to that port, launchd
will block the client and launch you (on demand) as part of your
startup, you check in with launchd, it hands you the file
descriptor(s) for the already open port(s), you respond to the
request, and you're on your way.
So, when my daemon is launched, I expose my control sockets and
exit? launchd will keep my daemon resident?
The other way around -- you declare your sockets in your .plist, and
launchd launches you when needed.
I've glossed over a lot for simplicity (for instance Mack and IP
ports aren't the only means of access), but hopefully this will give
you a staring point.
Best,
-Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden