diff options
| author | Roy Marples <roy@marples.name> | 2021-01-28 11:54:05 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2021-01-28 11:54:05 +0000 |
| commit | 11baa2a1f51c8da51883ab341f6e00e4f73c6998 (patch) | |
| tree | 4a069f765b1466d7e1e40003e73a716c12245429 /src/privsep.c | |
| parent | 3ffb1dd5ee2a4962dd1384e00566996f791fcc78 (diff) | |
| download | dhcpcd-11baa2a1f51c8da51883ab341f6e00e4f73c6998.tar.xz | |
BSD: Implement kqueue(2) for eloop (again)
kqueue allows for O(1) processing of active fd's an a more
robust signal handling method without the need to use global
variables to avoid calling functions during signal delivery.
The problems with the prior implemenation have now been fixed.
Diffstat (limited to 'src/privsep.c')
| -rw-r--r-- | src/privsep.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/privsep.c b/src/privsep.c index 23ed9e7e..6dde4a1b 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -370,7 +370,8 @@ ps_dostart(struct dhcpcd_ctx *ctx, } pidfile_clean(); - eloop_clear(ctx->eloop); + eloop_clear(ctx->eloop, loggetfd(), -1); + eloop_forked(ctx->eloop); eloop_signal_set_cb(ctx->eloop, dhcpcd_signals, dhcpcd_signals_len, signal_cb, ctx); /* ctx->sigset aready has the initial sigmask set in main() */ @@ -607,13 +608,9 @@ ps_stop(struct dhcpcd_ctx *ctx) /* We've been chrooted, so we need to tell the * privileged actioneer to remove the pidfile. */ - ps_root_unlink(ctx, ctx->pidfile); + if (ps_root_unlink(ctx, ctx->pidfile) == -1) + ret = -1; - r = ps_root_stop(ctx); - if (r != 0) - ret = r; - - ctx->options &= ~DHCPCD_PRIVSEP; return ret; } |
