Re: StartupItems
Re: StartupItems
- Subject: Re: StartupItems
- From: Dave Zarzycki <email@hidden>
- Date: Fri, 2 Jun 2006 13:32:52 -0700
On Jun 2, 2006, at 12:14 PM, Andrew Gallatin wrote:
Let's take my software as a concrete example.
I maintain my company's HPC drivers and software on MacOSX. We have a
start/stop script which we plug into the rc.d/init.d/blah startup
scripts on the other *nixes we support, and which is warped into a
startup item on MacOSX. This script basically does 2 things
1) Loads the driver for the cluster interconnect
I thought IOKit's matching system does this automatically for you?
Does it not?
2) Starts a fabric mapper which runs over the interconnect.
My requirements are simple. I want to be called last, after
networking and disks and all that stuff is available.
What if they're not available at boot? What if they come online later?
I want the hostname to be more-or-less stable...
That's out of Apple's control. You'll have to talk to your sysadmin
if you want that.
How does this fit into the launchd model?
Depends on how robust you want to make the daemon.
The easiest, but least robust thing to do is to use IOKitWaitQuiet()
at the beginning of your main(). If your driver isn't loaded after
that call returns, then take the lazy way out and call abort(). After
that point, you'll need to use one of the SystemConfiguration
framework APIs to do the moral equivalent of IOKitWaitQuiet() except
for networking. I'm not an expert at that framework, otherwise I'd
mention what API you need to use. After that, you're good to go just
like you used to.
If you wish to make your daemon robust, you'll register for callbacks
for when your hardware shows up and probably more importantly, to
monitor for network configuration changes and adjust the fabric as
required.
Cheers,
davez
_______________________________________________
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