diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-27 18:22:31 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-05 13:55:08 +0100 |
commit | 5b5e6deabb8b76bcd691c4e40429bd8478a49a32 (patch) | |
tree | 503fc8f657a968b9d68fdaad90229e35c96b4f1f /src/core/dbus.c | |
parent | 8b7f989a5824869a5ca9983b225758a8c2fd8f4a (diff) | |
download | systemd-5b5e6deabb8b76bcd691c4e40429bd8478a49a32.tar.gz |
bus: touch() the AF_UNIX sockets we listen() on after the fact
We'd like to use inotify to get notified when AF_UNIX sockets become
connectable. That happens at the moment of listen(), but this is doesn't
necessarily create in a watchable inotify event. Hence, let's synthesize
one whenever we generically create a socket, or when we know we created
it for a D-Bus server.
Ideally we wouldn't have to do this, and the kernel would generate an
event anyway for this. Doing this explicitly isn't too bad however, as
the event is still nicely associated with the AF_UNIX socket node, and
we generate all D-Bus sockets in our code hence it's safe.
Diffstat (limited to 'src/core/dbus.c')
-rw-r--r-- | src/core/dbus.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c index b7d8af9396..115d071eb4 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -37,6 +37,7 @@ #include "dbus-unit.h" #include "dbus.h" #include "fd-util.h" +#include "fs-util.h" #include "log.h" #include "missing.h" #include "mkdir.h" @@ -1005,6 +1006,9 @@ static int bus_init_private(Manager *m) { if (r < 0) return log_error_errno(errno, "Failed to make private socket listening: %m"); + /* Generate an inotify event in case somebody waits for this socket to appear using inotify() */ + (void) touch(sa.un.sun_path); + r = sd_event_add_io(m->event, &s, fd, EPOLLIN, bus_on_connection, m); if (r < 0) return log_error_errno(r, "Failed to allocate event source: %m"); |