Re: Why is Leopard annoying my users?
Re: Why is Leopard annoying my users?
- Subject: Re: Why is Leopard annoying my users?
- From: Quinn <email@hidden>
- Date: Wed, 21 Nov 2007 10:18:19 +0000
At 11:30 -0700 20/11/07, James Bucanek wrote:
In the "if it were a snake it would have bitten me" department, the
simplest solution might be to switch back to Mach ports.
Well, I'm a big fan of UNIX domain sockets, so you won't get any real
opposition from me (-: OTOH, I'm also a big fan of "if it works,
don't mess with it", which is why I asked the question in the first
place.
This problem originally came up because I had some background
services that were being launched via cron. (If you're asking why
this wasn't a launchd process, it's because this was a user-level
process and I didn't want to have to ask for admin privileges to
install it. I'm actually still annoyed that Apple doesn't provide
for a "user daemon" class of processes in launchd ... but I can also
imagine what some of the problems might be too.)
I think we're suffering from terminological confusion here. By
definition, a daemon is system wide and thus, by definition, you
can't install one without admin privileges. Background programs that
act on behalf of a specific user are called agents.
In 10.5 launchd offers four different flavours of agents, depending
on the context that you need to run in. These are discussed in
detail in TN2083.
In Leopard, cron processes are launched in their own Mach namespace,
so user applications can't communicate with them. I was told that
the only Interprocess communications solution available was to use
sockets.
Recently, however, I've had to abandon cron because recent versions
of Tiger have now taken to SIGKILLing cron jobs when the user logs
out. So my only solution was to install everything as a launchd
daemon(s).
However, I was also told that child processes started by launchd
deamon were also in a child namespace and can't communicate with
other child (i.e. user) namespaces. Is this true, or will child
processes of a launcnd deamon run in the same Mach namespace as the
parent process? If they run in the same namespace, then maybe I can
go back to using Mach ports.
launchd daemons run in the global bootstrap namespace.
Can you explain the process lifecycle that you're trying to achieve.
Specifically:
o Does your background program want to run with privileges?
o Does it act on behalf of all users simultaneous, or just one specific user?
o When should it be launched? (for example, at startup, when someone
tries to use its services, when the user on whose behalf it's
operating logs in)
o How long should it persist? (for example, until the user on whose
behalf it's operating logs out, or until system restart, or after
some idle timeout)
With this info I can probably suggest a launch mechanism that meets your needs.
And apropos B, try setting a
breakpoint on bind and see what's getting bound, what it's bound to,
and what the backtrace looks like.
I'll give that a shot (just out of curiosity of nothing else).
OK. Let us know what you find out.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden