1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-13 13:17:43 +03:00

bus: when we cannot bus activate a service because we go down, drop one

message from the queue
This commit is contained in:
Lennart Poettering 2014-01-22 23:36:06 +01:00
parent 82cd413782
commit ff975efb2e
4 changed files with 16 additions and 2 deletions

1
TODO
View File

@ -166,7 +166,6 @@ Features:
- bus proxy should fake seclabel when connecting to kdbus
- allow updating attach flags during runtime
- pid1: peek into activating message when activating a service
- when service activation failed, drop one message from the activator queue
* sd-event
- allow multiple signal handlers per signal?

View File

@ -337,8 +337,8 @@ static void busname_enter_running(BusName *n) {
log_debug_unit(UNIT(n)->id, "Suppressing activation request on %s since unit stop is scheduled.", UNIT(n)->id);
/* Flush all queued activation reqeuest by closing and reopening the connection */
bus_kernel_drop_one(n->starter_fd);
busname_close_fd(n);
busname_enter_listening(n);
return;
}

View File

@ -1476,3 +1476,16 @@ int bus_kernel_try_close(sd_bus *bus) {
return 0;
}
int bus_kernel_drop_one(int fd) {
struct kdbus_cmd_recv recv = {
.flags = KDBUS_RECV_DROP
};
assert(fd >= 0);
if (ioctl(fd, KDBUS_CMD_MSG_RECV, &recv) < 0)
return -errno;
return 0;
}

View File

@ -79,3 +79,5 @@ int kdbus_translate_request_name_flags(uint64_t sd_bus_flags, uint64_t *kdbus_fl
int kdbus_translate_attach_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags);
int bus_kernel_try_close(sd_bus *bus);
int bus_kernel_drop_one(int fd);