Name or Names in service files? (Disconnect between the spec
and our implementation)
alexl at redhat.com
Wed Dec 6 10:23:29 PST 2006
On Wed, 2006-12-06 at 12:04 -0500, Havoc Pennington wrote:
> Alexander Larsson wrote:
> > Today I wanted it to support wildcards.
> > i.e. "Names=org.gnome.foo.*", and I'd get passed the used name via an
> > env var or a commandline argument. Any chance of that happening?
> It's certainly possible, though can you explain the use case?
I'm working on gvfs, a gnome-vfs replacement. It uses a "herd of
daemons" approach, where it generally split things up such that each
mount is handled by its own daemon (although its possible to merge
several mounts into one daemon. For instance, the smb backend would have
a daemon for each server+share tuple.
Consider the mount operation here. We need to spawn a daemon and then
talk to it, making sure we only spawn one such process per server+share
tuple. This sounds almost ideal for dbus activation, one would just
activate the "org.gtk.vfs.smb.<server>.<share>" bus name. Unfortunately
there is no way to specify this as a template for a single binary, so
instead the gvfs code has to do the spawning, etc.
> Something to consider (already an issue, but supporting multiple names
> makes worse); dbus-daemon tries to avoid starting two copies of
> something (if you activate the same name twice it will block both
> activators on the same fork/exec of the executable), but to be robust
> against multiple copies, the activated app really needs to exit if it
> does not get its expected name. This is doubly true if the app can have
> multiple names... I think dbus-daemon will start the same app more than
> once in that case.
In my case I *want* multiple copies.
The case where you list a set of names in your .service file and you
want them handled by the same process that is doable I think. The
service need to requests all the names at startup, always in the same
order, and releases them all if one isn't gotten.
Alexander Larsson Red Hat, Inc
alexl at redhat.com alla at lysator.liu.se
He's a world-famous soccer-playing waffle chef living undercover at Ringling
Bros. Circus. She's a violent out-of-work museum curator trying to make a
difference in a man's world. They fight crime!
More information about the dbus