summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4aa4d2a)
This makes it easier to debug what is going on.
}
static int busname_open_fd(BusName *n) {
}
static int busname_open_fd(BusName *n) {
+ _cleanup_free_ char *path = NULL;
+ const char *mode;
+
assert(n);
if (n->starter_fd >= 0)
return 0;
assert(n);
if (n->starter_fd >= 0)
return 0;
- n->starter_fd = bus_kernel_open_bus_fd(UNIT(n)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user");
+ mode = UNIT(n)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user";
+ n->starter_fd = bus_kernel_open_bus_fd(mode, &path);
- log_warning_unit(UNIT(n)->id, "Failed to create starter fd: %s", strerror(-n->starter_fd));
+ log_warning_unit(UNIT(n)->id, "Failed to open %s: %s",
+ path ?: "kdbus", strerror(-n->starter_fd));
-int bus_kernel_open_bus_fd(const char *bus) {
+int bus_kernel_open_bus_fd(const char *bus, char **path) {
- p = alloca(strlen("/dev/kdbus/") + DECIMAL_STR_MAX(uid_t) + 1 + strlen(bus) + strlen("/bus") + 1);
+ len = strlen("/dev/kdbus/") + DECIMAL_STR_MAX(uid_t) + 1 + strlen(bus) + strlen("/bus") + 1;
+
+ if (path) {
+ p = malloc(len);
+ if (!p)
+ return -ENOMEM;
+ *path = p;
+ } else
+ p = alloca(len);
sprintf(p, "/dev/kdbus/" UID_FMT "-%s/bus", getuid(), bus);
fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
sprintf(p, "/dev/kdbus/" UID_FMT "-%s/bus", getuid(), bus);
fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
- fd = bus_kernel_open_bus_fd(bus);
+ fd = bus_kernel_open_bus_fd(bus, NULL);
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call);
int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority);
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call);
int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority);
-int bus_kernel_open_bus_fd(const char *bus);
+int bus_kernel_open_bus_fd(const char *bus, char **path);
int bus_kernel_make_starter(int fd, const char *name, bool activating, bool accept_fd, BusNamePolicy *policy, BusNamePolicyAccess world_policy);
int bus_kernel_create_bus(const char *name, bool world, char **s);
int bus_kernel_make_starter(int fd, const char *name, bool activating, bool accept_fd, BusNamePolicy *policy, BusNamePolicyAccess world_policy);
int bus_kernel_create_bus(const char *name, bool world, char **s);