diff options
author | Benjamin Reed <rangerrick@befunk.com> | 2009-07-19 11:45:34 -0400 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2010-12-06 21:33:14 +0100 |
commit | f1b9aac417d8fb716d6ed19128fe429e8a41adba (patch) | |
tree | 48684c21f9471938e45f4ad2bde37ef593c9c18b /README.launchd | |
parent | eb66c0a9c001ea08793b38470d12611ffaafa436 (diff) | |
download | dbus-f1b9aac417d8fb716d6ed19128fe429e8a41adba.tar.gz dbus-f1b9aac417d8fb716d6ed19128fe429e8a41adba.tar.bz2 dbus-f1b9aac417d8fb716d6ed19128fe429e8a41adba.zip |
Enable launchd.
This patch enables support for Mac OS X's launch daemon
for startup as well as sharing of the DBus session bus
environment. It includes a LaunchAgent plist for automatic
start of the session bus.
Diffstat (limited to 'README.launchd')
-rw-r--r-- | README.launchd | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/README.launchd b/README.launchd new file mode 100644 index 00000000..701e57dd --- /dev/null +++ b/README.launchd @@ -0,0 +1,61 @@ +Launchd[1,2] replaces init, inetd and cron on Mac OS X since 10.4 "Tiger". +dbus uses this service to provide a common session bus address for each user +and so deprecates the X11 enabled dbus-launcher. + +[1] http://developer.apple.com/MacOsX/launchd.html +[2] http://launchd.macosforge.org/ + + +Setup +=== + +Configure with --enable-launchd and --without-x (X11 should not harm but it's +simply not necessary any more) +After installation, to prevent a reboot, load the dbus session starter into +launchd by executing: +$ launchctl load /Library/LaunchAgents/org.freedesktop.dbus-session.plist + +You can change the launch agent dir via configure, but it's not recommended. +Make sure to execute the above line as the actual user for which you want to +use a session bus since launchd manages its agents on a per user basis. + + +How it works +=== + +Launchd allocates a socket and provides the unix path to it via the variable +DBUS_LAUNCHD_SESSION_BUS_SOCKET in launchd's environment. Every process +spawned by launchd (or dbus-daemon, if stared by launchd) can access it through +its own environment. Other processes can query launchd for it by executing: +$ launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET +However, this is normally done by the dbus client lib for you. + +If launchd start dbus-daemon with a config file containing a "launchd:env=FOO" +address, as the default session config does with env=DBUS_LAUNCHD_SESSION_BUS_SOCKET, +the daemon will get the file descriptor from launchd and start listening on it. +The environment variable is used to get the actual socket path which is passed +to every service spawned by dbus-daemon as a result from autolaunch messages. +Please note that it's not possible to start dbus-daemon manually when using a +"launchd:" address. Only child processes of launchd can access the above +mentioned file descriptor! + +To create custom buses just set up an other launch agent. As a quick start copy +/Library/LaunchAgents/org.freedesktop.dbus-session.plist, change the label +to i.e. "org.freedesktop.dbus-foo" and change the SecureSocketWithKey value, +i.e. to "DBUS_LAUNCHD_FOO_BUS_SOCKET". This environment variable has to be set +in the config file for your new bus in the <listen> element (see session.config). +Then edit your /Library/LaunchAgents/org.freedesktop.dbus-foo.plist to start +dbus-daemon with "--config-file=/opt/local/etc/dbus-1/foo.conf" instead of +"--session". Now load the new plist onto launchd as described in the setup +section of this document. +Executing "launchctl export" should now give you two sockets, one in +DBUS_LAUNCHD_SESSION_BUS_SOCKET and the new DBUS_LAUNCHD_FOO_BUS_SOCKET. +To connect to this new bus use "launchd:env=DBUS_LAUNCHD_FOO_BUS_SOCKET". + +Since Mac OS X 10.5 "Leopard" you can also configure launchd to start +dbus-daemon on demand as soon as some process connects to the socket. Since +it's broken on 10.4 this feature is disabled per default. Look at +/Library/LaunchAgents/org.freedesktop.dbus-session.plist to change it. + +On the client side, the envvar DBUS_SESSION_BUS_ADDRESS can be normally used +but if it's not set, launchd is queried for the session bus socket. |