Hiya,

syslogd -m in OpenBSD 5.7-RELEASE, 5.8-RELEASE and 5.8-current does not write
--MARK-- into the targets specified in /etc/syslog.conf, e.g.

mark.info       /var/log/messages

This was working in OpenBSD 5.6-RELEASE and before.

On a -current system where libevent was compiled with -DUSE_DEBUG it could
be observed that the evtimer for ev_mark was deleted after the first call
of mark_timercb().

Below is a patch against the -current version of syslogd.c that makes 
syslogd -m functional again.

I ran the regression tests for syslogd with the patch and found no 
differences so far to an unpatched syslogd.

Since the version of libevent on 5.8-current is 1.4.15-stable (as per 
commit-id KEvfcjWcxnyqdGAb) and the libevent documentation notes that

  "The EV_PERSIST flag did not interoperate sensibly with timeouts before
   Libevent 2.0. Instead resetting the timeout whenever the event was
   activated, the EV_PERSIST flag did nothing with the timeout." [0]

I decided to reactivate the timer in its own callback mark_timercb().
There are probably better ways to do it, thus I would be grateful for
comments.

Index: syslogd.c
===================================================================
RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.201
diff -u -p -r1.201 syslogd.c
--- syslogd.c   24 Oct 2015 12:49:37 -0000      1.201
+++ syslogd.c   10 Dec 2015 05:13:30 -0000
@@ -1995,7 +1995,14 @@ die_signalcb(int signum, short event, vo
 void
 mark_timercb(int unused, short event, void *arg)
 {
+       struct event    *ev = arg;
+       struct timeval  to;
+
        markit();
+
+       to.tv_sec = TIMERINTVL;
+       to.tv_usec = 0;
+       evtimer_add(ev, &to);
 }
 
 void


Bye,
rru142


[0] http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html
    second last paragraph on the page

Reply via email to