mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 08:26:52 +03:00
udevd: fix SIGCHLD handling in --daemon mode
We were listening for SIGCHLD in the wrong process.
This commit is contained in:
parent
583c14fc04
commit
86c3bece38
@ -1288,13 +1288,6 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
|
|
||||||
static int manager_new(Manager **ret) {
|
static int manager_new(Manager **ret) {
|
||||||
_cleanup_(manager_freep) Manager *manager = NULL;
|
_cleanup_(manager_freep) Manager *manager = NULL;
|
||||||
struct epoll_event ep_ctrl = { .events = EPOLLIN };
|
|
||||||
struct epoll_event ep_inotify = { .events = EPOLLIN };
|
|
||||||
struct epoll_event ep_signal = { .events = EPOLLIN };
|
|
||||||
struct epoll_event ep_netlink = { .events = EPOLLIN };
|
|
||||||
struct epoll_event ep_worker = { .events = EPOLLIN };
|
|
||||||
sigset_t mask;
|
|
||||||
int r, one = 1;
|
|
||||||
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
@ -1323,6 +1316,23 @@ static int manager_new(Manager **ret) {
|
|||||||
udev_list_node_init(&manager->events);
|
udev_list_node_init(&manager->events);
|
||||||
udev_list_init(manager->udev, &manager->properties, true);
|
udev_list_init(manager->udev, &manager->properties, true);
|
||||||
|
|
||||||
|
*ret = manager;
|
||||||
|
manager = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int manager_listen(Manager *manager) {
|
||||||
|
struct epoll_event ep_ctrl = { .events = EPOLLIN };
|
||||||
|
struct epoll_event ep_inotify = { .events = EPOLLIN };
|
||||||
|
struct epoll_event ep_signal = { .events = EPOLLIN };
|
||||||
|
struct epoll_event ep_netlink = { .events = EPOLLIN };
|
||||||
|
struct epoll_event ep_worker = { .events = EPOLLIN };
|
||||||
|
sigset_t mask;
|
||||||
|
int r, one = 1;
|
||||||
|
|
||||||
|
assert(manager);
|
||||||
|
|
||||||
r = systemd_fds(&manager->fd_ctrl, &manager->fd_uevent);
|
r = systemd_fds(&manager->fd_ctrl, &manager->fd_uevent);
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
/* get control and netlink socket from systemd */
|
/* get control and netlink socket from systemd */
|
||||||
@ -1404,10 +1414,7 @@ static int manager_new(Manager **ret) {
|
|||||||
epoll_ctl(manager->fd_ep, EPOLL_CTL_ADD, manager->fd_worker, &ep_worker) < 0)
|
epoll_ctl(manager->fd_ep, EPOLL_CTL_ADD, manager->fd_worker, &ep_worker) < 0)
|
||||||
return log_error_errno(errno, "fail to add fds to epoll: %m");
|
return log_error_errno(errno, "fail to add fds to epoll: %m");
|
||||||
|
|
||||||
*ret = manager;
|
return 0;
|
||||||
manager = NULL;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
@ -1518,6 +1525,10 @@ int main(int argc, char *argv[]) {
|
|||||||
} else
|
} else
|
||||||
sd_notify(1, "READY=1");
|
sd_notify(1, "READY=1");
|
||||||
|
|
||||||
|
r = manager_listen(manager);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "failed to set up fds and listen for events: %m");
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
static usec_t last_usec;
|
static usec_t last_usec;
|
||||||
struct epoll_event ev[8];
|
struct epoll_event ev[8];
|
||||||
|
Loading…
Reference in New Issue
Block a user