Bryan Steele(bry...@openbsd.org) on 2017.09.05 16:17:46 -0400:
> pflogd(8) currently spams the console on shutdown if syslogd wins the
> race to die, this logging probably comes from the fact that pflogd was
> largely based on syslogd.
i looked at that some time ago: a and found that lot of our daemons log the
fact that they exit.
Its actually nice to know that a daemon exited at a certain time. In the
case of pflogd you might want to know at what point your pflog files
stopped.
The reason you see the message on the console on halt and reboot is, because
syslogd is gone at that point, so the message goes to the console instead.
So i decided not to change this. Who cares about the message at that point?
> Also, cleanup some missed SIGCHLD handling code that is no longer
> neccesary, parent will exit when child closes its side of the
> socketpair(2).
that part is ok benno@
> -Bryan.
>
> Index: pflogd.c
> ===
> RCS file: /cvs/src/sbin/pflogd/pflogd.c,v
> retrieving revision 1.55
> diff -u -p -u -r1.55 pflogd.c
> --- sbin/pflogd/pflogd.c 5 Sep 2017 15:41:25 - 1.55
> +++ sbin/pflogd/pflogd.c 5 Sep 2017 20:06:57 -
> @@ -686,7 +686,6 @@ main(int argc, char **argv)
> }
> }
>
> - logmsg(LOG_NOTICE, "Exiting");
> if (dpcap) {
> flush_buffer(dpcap);
> fclose(dpcap);
> Index: privsep.c
> ===
> RCS file: /cvs/src/sbin/pflogd/privsep.c,v
> retrieving revision 1.28
> diff -u -p -u -r1.28 privsep.c
> --- sbin/pflogd/privsep.c 5 Sep 2017 15:41:25 - 1.28
> +++ sbin/pflogd/privsep.c 5 Sep 2017 20:06:57 -
> @@ -49,10 +49,7 @@ enum cmd_types {
> static int priv_fd = -1;
> static volatile pid_t child_pid = -1;
>
> -volatile sig_atomic_t gotsig_chld = 0;
> -
> static void sig_pass_to_chld(int);
> -static void sig_chld(int);
> static int may_read(int, void *, size_t);
> static void must_read(int, void *, size_t);
> static void must_write(int, void *, size_t);
> @@ -150,7 +147,6 @@ priv_exec(int child, int argc, char *arg
> signal(SIGHUP, sig_pass_to_chld);
> signal(SIGINT, sig_pass_to_chld);
> signal(SIGQUIT, sig_pass_to_chld);
> - signal(SIGCHLD, sig_chld);
>
> setproctitle("[priv]");
>
> @@ -160,7 +156,7 @@ BROKENif (pledge("stdio rpath wpath cpa
> err(1, "pledge");
> #endif
>
> - while (!gotsig_chld) {
> + while (1) {
> if (may_read(sock, , sizeof(int)))
> break;
> switch (cmd) {
> @@ -393,13 +389,6 @@ sig_pass_to_chld(int sig)
> if (child_pid != -1)
> kill(child_pid, sig);
> errno = oerrno;
> -}
> -
> -/* if parent gets a SIGCHLD, it will exit */
> -static void
> -sig_chld(int sig)
> -{
> - gotsig_chld = 1;
> }
>
> /* Read all data or return 1 for error. */
>