• 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: Fri, 26 Sep 2008 09:52:17 +0200


Hi Damien,

Damien Sorresso wrote:
On Sep 25, 2008, at 3:20 PM, Mario Emmenlauer wrote:
launchd.plist(5) actually makes no statements on the launch.h API :-( The API seems quite undocumented. From your answer I deduce that one can not set up or change launchd.plist's dynamically through launch.h API calls.

Yes, the API is undocumented. But you can use it to set up a dynamic job. (The launchd.plist(5) is merely a persistent representation of the job data structure, not the job data structure itself.) This will not get you what you want with respect to launching GUI apps, however.
[...]
The short of it is that there's no good way to launch a GUI app from outside a user session. You could pull off what you want to do for simple, command-line utilities -- though you could easily run into problems with some of our APIs. If it's any consolation, I'm not very happy with that state of affairs either. :)

Now this was a misunderstanding (and its probably my fault because I didn't note it more explicit): I don't want to show GUI. Quoting myself, my application is a workload distribution process, that is basically similar to an ftp-daemon: user connects over network, daemon gets user request, daemon executes K workers that process user data. Executing the K workers is the problem I'm having now.

I don't need GUI (even though I wouldn't mind it, if it comes at no
additional cost). But I need access to the users data. That doesn't
enforce that the daemon is running as the specific user, a dedicated
incoming directory would do. But for security and simplicity it seemed
a good idea to setuid to the user, both for read-privileges and also
for security (not running as root if not needed).

So do I need to bootstrap user sessions for that?


Your idea of per-user daemons/agents is still good, because that would eliminate the need for the master daemon to run as root (only root processes can setuid?). It might work well in combination with launchd: - master daemon runs as dedicated user - upon event, master dynamically sets up launchd plist for worker daemon for user (can a non-root process do that?) - launchd starts worker daemon - worker daemon posix_spawn's K instances, that connect to master (Could I request launchd to start K instances?)

Or I'm going back to Terry's suggestion of posix_spawning with the
correct uid, which seems safe and sound for my case too.

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: Damien Sorresso <email@hidden>
References: 
 >launchd daemon, spawning children? (From: Mario Emmenlauer <email@hidden>)
 >Re: launchd daemon, spawning children? (From: Damien Sorresso <email@hidden>)
 >Re: launchd daemon, spawning children? (From: Mario Emmenlauer <email@hidden>)
 >Re: launchd daemon, spawning children? (From: Damien Sorresso <email@hidden>)

  • Prev by Date: hdiutil progress
  • 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