Is syslog() reentrant? Was: OpenBSD's spamd.

Christopher Hilton chris at vindaloo.com
Tue Dec 19 14:07:59 PST 2006


Dan Nelson wrote:
> In the last episode (Dec 19), Christopher Hilton said:

>> A casual attempt to compile a fresher copy of the software shows that
>> spamd is using the OpenBSD's reentrant syslog functions (syslog_r,
>> openlog_r, etc) Is FreeBSD's syslog already reentrant?
> 
> It is, as of FreeBSD 5.4.  In previous versions only openlog() and
> syslog("%m") with an invalid errno were non-reentrant.
> 

Awesome. Then all I have to do to get the fresher code is either wrap 
the openlog_r and syslog_r calls in the spamd.c or write local functions 
which do the same. From the point of style which is preferable? Is it 
even possible to #define a C function to get around an argument? E.g. 
The openbsd syslog_r function has this call sequence:

      void
      syslog_r(int priority, struct syslog_data *data,
               const char *message,
               ...);



IIRC there isn't a way to get around the '...' argument with #define and 
deal with the extra argument.

-- Chris


More information about the freebsd-ports mailing list