[RFC] Common activation manager via external manager

Scott James Remnant scott at netsplit.com
Sun Jan 2 14:46:52 PST 2011


Thanks to everybody who commented on my previous patch to add support
for Upstart service activation alongside the existing systemd patch.
Since Lennart and I both appear keen to agree on a common interface, and
there is support from others for doing that, I present a new set of
patches for comments that replace the existing interface with a common
one.

I've followed Colin's suggestion that we always try to activate via the
activation manager if one is present, rather than relying on the
presence of a field in the .service file.  To allow the activation
manager to deal with services it doesn't directly know about, the
activation request includes the Exec= and User= lines from the .service
file.

In addition to allow activation of the session bus, the activation
environment is included as well.


Here's the interface:

  dbus-daemon --activation-manager=BUS-NAME

This declares that activation will be performed by the given BUS-NAME,
as with Lennart's patches, if this bus name isn't present a fake
activation is used to wait for it to appear before dispatching the other
queued activation requests.

.service files need no changes, but it may be useful to add an explicit
request string (e.g. the service name):

  [D-BUS Service]
  Name=com.netsplit.Test
  Exec=/my/program
  ActivationRequest=servicename

If this isn't present, it defaults to the service bus name.


As with Lennart's patches, activation is done by signal:

  org.freedesktop.DBus.Activation.ActivationRequest(
      out STRING request,
      out STRING exec,
      out STRING user,
      out ARRAY of STRING activation_environment)

No response is required for success, but for failure the activation
manager replies with the signal:

  org.freedesktop.DBus.Activation.ActivationFailure(
      out STRING request,
      out STRING code,
      out STRING message)


Comments most welcome,

Scott


Scott James Remnant (5):
  activation: change SystemdService to ActivationRequest
  activation: always perform activation with the manager
  activation: pass additional fields in activation request
  activation: use a D-Bus interface for activation
  activation: change activation parameter to be a bus name

 bus/activation.c    |  244 +++++++++++++++++++++++++++++++--------------------
 bus/activation.h    |    2 +-
 bus/bus.c           |   25 ++++--
 bus/bus.h           |    4 +-
 bus/dbus.service.in |    2 +-
 bus/desktop-file.h  |    2 +-
 bus/driver.c        |    4 +-
 bus/main.c          |   47 +++++++++--
 dbus/dbus-shared.h  |    6 ++
 9 files changed, 220 insertions(+), 116 deletions(-)



More information about the dbus mailing list