diff options
author | Jean-Jacques Bernard-Gundol <jjbg@cvs.openbsd.org> | 2001-11-05 09:48:31 +0000 |
---|---|---|
committer | Jean-Jacques Bernard-Gundol <jjbg@cvs.openbsd.org> | 2001-11-05 09:48:31 +0000 |
commit | bb15117655d43d4d96ee568fb49eae49a88916be (patch) | |
tree | 7ee2a710de2bb59383f54ec4a9c9b5646776183b /lib | |
parent | 183590bdc39e8697681a1305d65a422fcbfec059 (diff) |
Some examples of how to use syslog_r() and why it is useful. deraadt@ ok.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/syslog.3 | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/libc/gen/syslog.3 b/lib/libc/gen/syslog.3 index 3f09655a030..6843766570b 100644 --- a/lib/libc/gen/syslog.3 +++ b/lib/libc/gen/syslog.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: syslog.3,v 1.13 2001/10/24 08:16:42 jjbg Exp $ +.\" $OpenBSD: syslog.3,v 1.14 2001/11/05 09:48:30 jjbg Exp $ .\" .\" Copyright (c) 1985, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -354,6 +354,13 @@ setlogmask(LOG_UPTO(LOG_ERR)); syslog(LOG_INFO, "Connection from host %d", CallingHost); syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m"); +.Pp +.Ed +For the reentrant functions: +.Bd -literal -offset indent -compact +struct syslog_data sdata = SYSLOG_DATA_INIT; + +syslog_r(LOG_INFO|LOG_LOCAL2, &sdata, "foobar error: %m"); .Ed .Sh SEE ALSO .Xr logger 1 , @@ -382,3 +389,13 @@ Always be sure to use the proper secure idiom: .Bd -literal -offset indent syslog("%s", string); .Ed +.Pp +.Fn syslog_r +and the other reentrant functions should only be used where +reentrancy is required (for instance in a signal handler). +.Fn syslog +being not reentrant, only +.Fn syslog_r +should be used here. For more information about reentrancy and signal +handlers, see +.Xr signal 3 . |