Re: launchd and mach ports: Sample code?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Would there be a Darwin daemon using Mach Port to be started? _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com 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. 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. smime.p7s
participants (1)
-
Damien Sorresso