Notification for launch of root daemon process?
Notification for launch of root daemon process?
- Subject: Notification for launch of root daemon process?
- From: Dave DeLong <email@hidden>
- Date: Mon, 17 Aug 2009 10:42:10 -0600
Hi everyone,
Is there some notification that's posted by the OS when a root daemon
process is launched? Here's what I've tried:
1. Carbon Events - I tried creating a CarbonEventHandler to listen
for kEventAppLaunched, but I did not observe any events come through
after running backupd. It would appear (and the documentation seems
to confirm this) that these notifications are posted only for
processes that interact with the WindowServer.
2. Distributed Notifications - I found that the root daemon I'm
trying to observe posts distributed notifications as it launches and
exits, but I've also found that these notifications are not reliable
and are sometimes dropped.
3. Polling attempt 1 - I created a timer that executes "ps aux" as an
NSTask and searches the results for the name of the daemon. This
works, but involves creating another process and searching through a
string every time I need to find if the daemon is running (which is
every couple seconds).
4. Polling attempt 2 - Again, I created a timer, but this time I used
the GetBSDProcessList function (defined here: http://developer.apple.com/qa/qa2001/qa1123.html
). This also works and is *significantly* faster than creating an
NSTask to run "ps", but it still requires me to poll. In addition, I
still have to search through the entire process structure looking for
the correct process name. However, since I don't have anything better
right now, this is what I'm currently using.
Is there a better way I could be doing this?
Thanks,
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden