Fwd: StartupItems
Fwd: StartupItems
- Subject: Fwd: StartupItems
- From: Michael Smith <email@hidden>
- Date: Sat, 3 Jun 2006 18:49:53 -0700
On Jun 3, 2006, at 12:03 PM, email@hidden (Peter Seebach) wrote:
In message <email@hidden>,
"Jordan K. Hubbard
" writes:
Maybe this whole conversation would be easier if you (and some of the
others in this conversation) could more precisely describe just what
it is you want launchd to do, rather than making this an ongoing
retro argument where we stick on our grey beards and debate the
usefulness of StartupItems, /etc/rc.d, SYSV runlevels and so on.
Okay.
What I want launchd to do is "handle the dependencies needed to
determine
when a daemon can be safely launched".
In the common case, it already does; I just don't think you
understand how.
Part of that comes from looking at it the wrong way. It's not a
question of "when it can be safely launched", but "when it is needed".
It's safe to "launch" something almost anytime; the question is one
of ensuring that dependencies are satisfied when they are required.
The act of "launching" a daemon requires little more than the
executable and a few shared libraries.
I understand that, in the abstract,
it might be neat if every program everywhere graciously handled all
sorts
of service availability. However, that involves a huge amount of
duplication
of effort, and leaves me with dozens of developers whose code could
potentially screw things up in some way.
... and here you make it really clear that you don't get it at all.
Let's say that you're launching something that requires a service on
port 1234.
In the launchd world, you connect to port 1234. That's your service
availability check - either you get a connection refusal in which
case your depended service is not installed and you can abort right
now with an error, or you will block until the service is brought up
by launchd, which will have noticed you looking for it.
There is no code for you to add. In fact, you can #ifdef out the
block of code that looks for the PID file the depended service would
otherwise have written, because you don't need it and until you start
the service it ain't going to be there anyway.
So, it'd be REALLY NICE if launchd provided at least a few basic
hooks so
that the easy cases would Just Work.
It already does. Note that your system boots just fine.
What I want, here, is to NOT have a situation where every separate
daemon
has to actually contain the Mac-specific code to handle its startup
dependancies. This is Software Engineering 101: If you're writing the
same code several times, you have probably done something wrong.
Sorry, but that's the argument from the launchd side of things.
That's what I want, at least; I want APPLE to provide the code to
handle
the fairly basic functionality of "launch this program only when
the system
can support it", so I don't have to maintain thirty-leven copies of
the
code which checks for and waits on services.
And here you fall back into your retrograde view of things.
Launch the program *whenever*. The system will follow the dependency
chain expressed by the program's normal actions as it runs, and bring
up the required services. There's nothing you have to add to your
program, only the ad-hoc synchronisation that you can *remove*.
It's not perfect, and there are some real reasons to try to improve
handling
of absentee services... But it'd be awfully nice to be able to get
some work
done in the mean time.
You can; from everything you've said so far, you are inventing
problems that just don't exist.
= Mike
_______________________________________________
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