Re: launchd and mach ports: Sample code?
Re: launchd and mach ports: Sample code?
- Subject: Re: launchd and mach ports: Sample code?
- From: Damien Sorresso <email@hidden>
- Date: Sat, 29 Nov 2008 10:22:56 -0800
On Nov 29, 2008, at 3:35 PM, Jean-Daniel Dupas wrote:
Le 29 nov. 08 à 14:56, Iceberg-Dev a écrit :
Is there any official or unofficial sample code showing how to
trigger a launchd process using Mach Port?
According to TN 2083, it is possible starting with Mac OS X 10.5 to
start a daemon with launchd using a Mach Port. (1)
I looked for sample code in the documentation, Technote and Google
with no results so far.
Would there be a Darwin daemon using Mach Port to be started?
I think you just use the launchd API just like it's done in SampleD (http://developer.apple.com/samplecode/SampleD/
).
But instead of retreiving sockets (using LAUNCH_JOBKEY_SOCKETS and
launch_data_get_fd()) you retreive your mach port (using
LAUNCH_JOBKEY_MACHSERVICES and launch_data_get_machport()).
The way to define a service in your plist is defined in the
MachServices section of launchd.plist reference (man launchd.plist).
And in the client application, you retreive it using
bootstrap_look_up() (from <servers/bootstrap.h>).
You can use the launch(3) API, but it's far easier to just use
bootstrap_check_in() to get your receive right.
--
Damien Sorresso
BSD Engineering
Apple Inc.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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