• 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
Dependancies, theory and practice (Was: StartupItems)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dependancies, theory and practice (Was: StartupItems)


  • Subject: Dependancies, theory and practice (Was: StartupItems)
  • From: Dave Zarzycki <email@hidden>
  • Date: Tue, 23 May 2006 10:20:10 -0700

There seems to be a lot of confusion over how dependancies are expressed in launchd, so let me give a classic example.

#include <pwd.h>

int main(void)
{
struct passwd *pwe = getpwnam("bob");
...


There you go, an entire dependancy tree has been implicitly expressed. getpwnam() talks to lookupd, lookupd in turn may talk to netinfod and/or the DirectoryServices daemon, or some off network directory such as LDAP. Either way, the client of such services doesn't care.

The simple matter is that the use of IPC is an implementation detail of APIs. When launchd is used properly, it allows for races to be avoided in IPC setup. When launchd is used properly, it allows for daemons to be spawned on demand based on when their actually needed.

Applications shouldn't need to explicitly express their dependancies, be it out of band via a configuration file or blatantly in the code with calls like: i_depend_on("foo"). Explicit dependancy engines are inherently fragile and ultimately unsustainable.

This is really a problem of library maintainers doing the right thing, and consumers of those libraries using them properly. In some cases, the libraries have evolved, and the developer needs to catch up. In this particular case, the result of getpwnam() might be NULL, a.k.a. user-not-found. Sometimes, that might be okay, and the application can proceed. Other times, the application may consider the result critical to their operation, and therefore must register for a callback to discover when the answer to the question might be different and then proceed as normal.

I hope this clears things up.

Cheers,

davez
 _______________________________________________
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

  • Prev by Date: Re: StartupItems
  • Next by Date: Re: StartupItems
  • Previous by thread: Ooops, I thought this (ppc/x86 JNI cross compile) was working
  • Next by thread: gdb and mach exceptions
  • Index(es):
    • Date
    • Thread