summaryrefslogtreecommitdiff
path: root/src/core/busname.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-18 20:54:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-18 20:54:32 +0100
commit3f9da416457c4265b8f1179516a32ad1a987ff7d (patch)
treea9a66492e8ae1b0964046190e7253a06aaa65138 /src/core/busname.c
parent63405595065fb60811440680b148261e9ec50704 (diff)
core: add new AcceptFD= setting to .busname units
AcceptFD= defaults to true, thus making sure that by default fd passing is enabled for all activatable names. Since for normal bus connections fd passing is enabled too by default this makes sure fd passing works correctly regardless whether a service is already activated or not. Making this configurable on both busname units and in bus connections is messy, but unavoidable since busnames are established and may queue messages before the connection feature negotiation is done by the service eventually activated. Conversely, feature negotiation on bus connections takes place before the connection acquires its names. Of course, this means developers really should make sure to keep the settings in .busname units in sync with what they later intend to negotiate.
Diffstat (limited to 'src/core/busname.c')
-rw-r--r--src/core/busname.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/busname.c b/src/core/busname.c
index 9d7a796538..ccef32e9e7 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -43,6 +43,7 @@ static void busname_init(Unit *u) {
assert(u->load_state == UNIT_STUB);
n->starter_fd = -1;
+ n->accept_fd = true;
}
static void busname_done(Unit *u) {
@@ -170,10 +171,12 @@ static void busname_dump(Unit *u, FILE *f, const char *prefix) {
fprintf(f,
"%sBus Name State: %s\n"
"%sResult: %s\n"
- "%sName: %s\n",
+ "%sName: %s\n"
+ "%sAccept FD: %s\n",
prefix, busname_state_to_string(n->state),
prefix, busname_result_to_string(n->result),
- prefix, n->name);
+ prefix, n->name,
+ prefix, yes_no(n->accept_fd));
}
static void busname_unwatch_fd(BusName *n) {
@@ -226,8 +229,10 @@ static int busname_open_fd(BusName *n) {
if (n->starter_fd >= 0)
return 0;
- n->starter_fd = bus_kernel_create_starter(UNIT(n)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user",
- n->name, n->policy);
+ n->starter_fd = bus_kernel_create_starter(
+ UNIT(n)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user",
+ n->name, n->accept_fd, n->policy);
+
if (n->starter_fd < 0) {
log_warning_unit(UNIT(n)->id, "Failed to create starter fd: %s", strerror(-n->starter_fd));
return n->starter_fd;