• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: launchd daemon, spawning children?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: launchd daemon, spawning children?


  • Subject: Re: launchd daemon, spawning children?
  • From: Mario Emmenlauer <email@hidden>
  • Date: Thu, 25 Sep 2008 22:12:13 +0200


Hi Terry,

thanks for the quick, and really extensive reply! Can you (or somebody)
point me to a good readme/technote/book on Mac OS standards? Searching
apple.com for posix_spawn() lists almost exclusively the manpages of the
functions, no more.


Terry Lambert wrote:
On Sep 25, 2008, at 9:50 AM, Mario Emmenlauer wrote:

2) I haven't tried pthread_start(), but its very likely to be equal

This should have been posix_spawn(), not pthread_start()... but come on, they do sound similar :-D

posix_spawn() is morally equivalent to a vfork() followed by an execve(), with the ability to do a limited set of intermediate work in between.

Is this allowed behaviour for a launchd-daemon? From: http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html

I took:
   [...] This includes calling the daemon function, calling fork followed
   by exec, or calling fork followed by exit. [...]

and:
   [...] Do not close any stray file descriptors. [...]

The documentation is not consistent in disallowed behaviour. The
launchctl.plist manpage for example discourages calling fork()/exit()
only for the parent process (not for the child), and only because launchd
might assume it quit unexpectedly.

Is
  pid = fork()
  if (pid == 0) {
    exec("worker");
    // work
    exit();
  } else {
    // do nothing
  }
a problem?

Thanks and cheers,

   Mario

_______________________________________________
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


  • Follow-Ups:
    • Re: launchd daemon, spawning children?
      • From: Garth Cummings <email@hidden>
    • Re: launchd daemon, spawning children?
      • From: Jason Coco <email@hidden>
References: 
 >launchd daemon, spawning children? (From: Mario Emmenlauer <email@hidden>)
 >Re: launchd daemon, spawning children? (From: Mario Emmenlauer <email@hidden>)
 >Re: launchd daemon, spawning children? (From: Terry Lambert <email@hidden>)

  • Prev by Date: Re: launchd daemon, spawning children?
  • Next by Date: Re: launchd daemon, spawning children?
  • Previous by thread: Re: launchd daemon, spawning children?
  • Next by thread: Re: launchd daemon, spawning children?
  • Index(es):
    • Date
    • Thread