From: reyk Date: Mon, 18 Aug 2014 13:13:42 +0000 (+0000) Subject: Sync proc.c with httpd. httpd needs SIGUSR1 but snmpd will ignore it X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5f2be52b3617ad4fcf2fb6724e18253eae10e54d;p=openbsd Sync proc.c with httpd. httpd needs SIGUSR1 but snmpd will ignore it now instead of terminating the process. ok blambert@ --- diff --git a/usr.sbin/snmpd/proc.c b/usr.sbin/snmpd/proc.c index 5f692fcad0d..774848bc342 100644 --- a/usr.sbin/snmpd/proc.c +++ b/usr.sbin/snmpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.10 2014/07/12 14:15:04 reyk Exp $ */ +/* $OpenBSD: proc.c,v 1.11 2014/08/18 13:13:42 reyk Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -38,8 +38,6 @@ #include #include -#include - #include "snmpd.h" void proc_open(struct privsep *, struct privsep_proc *, @@ -163,7 +161,7 @@ proc_open(struct privsep *ps, struct privsep_proc *p, /* * Open socket pairs for our peers - */ + */ for (proc = 0; proc < nproc; proc++) { procs[proc].p_ps = ps; procs[proc].p_env = ps->ps_env; @@ -323,6 +321,7 @@ proc_sig_handler(int sig, short event, void *arg) case SIGCHLD: case SIGHUP: case SIGPIPE: + case SIGUSR1: /* ignore */ break; default: @@ -409,12 +408,14 @@ proc_run(struct privsep *ps, struct privsep_proc *p, signal_set(&ps->ps_evsigchld, SIGCHLD, proc_sig_handler, p); signal_set(&ps->ps_evsighup, SIGHUP, proc_sig_handler, p); signal_set(&ps->ps_evsigpipe, SIGPIPE, proc_sig_handler, p); + signal_set(&ps->ps_evsigusr1, SIGUSR1, proc_sig_handler, p); signal_add(&ps->ps_evsigint, NULL); signal_add(&ps->ps_evsigterm, NULL); signal_add(&ps->ps_evsigchld, NULL); signal_add(&ps->ps_evsighup, NULL); signal_add(&ps->ps_evsigpipe, NULL); + signal_add(&ps->ps_evsigusr1, NULL); proc_listen(ps, procs, nproc); diff --git a/usr.sbin/snmpd/snmpd.c b/usr.sbin/snmpd/snmpd.c index 37c5290b913..96044b4d15d 100644 --- a/usr.sbin/snmpd/snmpd.c +++ b/usr.sbin/snmpd/snmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.c,v 1.23 2014/05/23 18:37:20 benno Exp $ */ +/* $OpenBSD: snmpd.c,v 1.24 2014/08/18 13:13:42 reyk Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -110,6 +110,9 @@ snmpd_sig_handler(int sig, short event, void *arg) case SIGHUP: /* reconfigure */ break; + case SIGUSR1: + /* ignore */ + break; default: fatalx("unexpected signal"); } @@ -215,12 +218,14 @@ main(int argc, char *argv[]) signal_set(&ps->ps_evsigchld, SIGCHLD, snmpd_sig_handler, ps); signal_set(&ps->ps_evsighup, SIGHUP, snmpd_sig_handler, ps); signal_set(&ps->ps_evsigpipe, SIGPIPE, snmpd_sig_handler, ps); + signal_set(&ps->ps_evsigusr1, SIGUSR1, snmpd_sig_handler, ps); signal_add(&ps->ps_evsigint, NULL); signal_add(&ps->ps_evsigterm, NULL); signal_add(&ps->ps_evsigchld, NULL); signal_add(&ps->ps_evsighup, NULL); signal_add(&ps->ps_evsigpipe, NULL); + signal_add(&ps->ps_evsigusr1, NULL); proc_listen(ps, procs, nitems(procs)); diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index 6cef6e02fd0..173d3d6ae66 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.55 2014/05/14 09:42:22 mikeb Exp $ */ +/* $OpenBSD: snmpd.h,v 1.56 2014/08/18 13:13:42 reyk Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -149,6 +149,7 @@ struct privsep { struct event ps_evsigchld; struct event ps_evsighup; struct event ps_evsigpipe; + struct event ps_evsigusr1; void *ps_env; };