the kernel is zero, and that makes priority and facility/priority the
same value).
-The GNU C library provides functions to submit messages to Syslog. They
+@Theglibc{} provides functions to submit messages to Syslog. They
do it by writing to the @file{/dev/log} socket. @xref{Submitting Syslog
Messages}.
-The GNU C library functions only work to submit messages to the Syslog
+The @glibcadj{} functions only work to submit messages to the Syslog
facility on the same system. To submit a message to the Syslog facility
on another system, use the socket I/O functions to write a UDP datagram
to the @code{syslog} UDP port on that system. @xref{Sockets}.
@node Submitting Syslog Messages
@section Submitting Syslog Messages
-The GNU C library provides functions to submit messages to the Syslog
+@Theglibc{} provides functions to submit messages to the Syslog
facility:
@menu
@comment syslog.h
@comment BSD
@deftypefun void openlog (const char *@var{ident}, int @var{option}, int @var{facility})
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
+@c openlog @asulock @aculock @acsfd
+@c libc_lock_lock @asulock @aculock
+@c openlog_internal @acsfd [always guarded by syslog_lock, so no race]
+@c strncpy dup ok
+@c socket dup @acsfd
+@c fcntl dup ok
+@c connect dup ok
+@c close dup @acsfd
+@c cancel_handler(NULL) @aculock
+@c libc_lock_unlock @aculock
@code{openlog} opens or reopens a connection to Syslog in preparation
for submitting messages.
@c syslog() is implemented as a call to vsyslog().
@comment syslog.h
@comment BSD
-@deftypefun void syslog (int @var{facility_priority}, char *@var{format}, ...)
+@deftypefun void syslog (int @var{facility_priority}, const char *@var{format}, @dots{})
+@safety{@prelim{}@mtsafe{@mtsenv{} @mtslocale{}}@asunsafe{@asucorrupt{} @ascuheap{} @asulock{} @ascudlopen{}}@acunsafe{@acucorrupt{} @aculock{} @acsmem{} @acsfd{}}}
+@c syslog @mtsenv @mtslocale @asucorrupt @ascuheap @asulock @ascudlopen @acucorrupt @aculock @acsmem @acsfd
+@c va_start dup ok
+@c vsyslog_chk @mtsenv @mtslocale @asucorrupt @ascuheap @asulock @ascudlopen @acucorrupt @aculock @acsmem @acsfd
+@c syslog(INTERNALLOG) dup @mtsenv @mtslocale @asucorrupt @ascuheap @asulock @ascudlopen @acucorrupt @aculock @acsmem @acsfd
+@c open_memstream @ascuheap @acsmem
+@c stpcpy dup ok
+@c getpid dup ok
+@c mempcpy dup ok
+@c fsetlocking [no @mtasurace:stream @asulock for exclusive stream]
+@c fprintf @mtslocale @ascuheap @acsmem [no @asucorrupt @aculock @acucorrupt on temp memstream]
+@c time dup ok
+@c localtime_r dup @mtsenv @mtslocale @ascuheap @asulock @aculock @acsmem @acsfd
+@c strftime_l(C) dup @mtsenv @mtslocale @asucorrupt @ascuheap @asulock @ascudlopen @acucorrupt @aculock @acsmem @acsfd
+@c ftell dup ok [no @asucorrupt @aculock @acucorrupt on temp memstream]
+@c fputs_unlocked dup ok [no @mtasurace:stream @asucorrupt @acucorrupt on temp memstream]
+@c putc_unlocked dup ok [no @mtasurace:stream @asucorrupt @acucorrupt on temp memstream]
+@c vfprintf/vfprintf_chk dup @mtslocale @ascuheap @acsmem [no @mtasurace:stream @asucorrupt @acucorrupt on temp memstream]
+@c fclose dup @ascuheap @acsmem [no @asulock @aculock @acsfd on caller-locked memstream]
+@c writev dup ok
+@c libc_lock_lock dup @asulock @aculock
+@c memset dup ok
+@c sigemptyset dup ok
+@c sigaction(SIGPIPE) dup @mtasusig:PIPE @acusig:PIPE
+@c openlog_internal dup @acsfd
+@c send dup ok
+@c closelog_internal dup @acsfd
+@c open dup @acsfd
+@c dprintf dup ok
+@c libc_lock_unlock @asulock @aculock
+@c free dup @acsuheap @acsmem
+@c va_end dup ok
@code{syslog} submits a message to the Syslog facility. It does this by
writing to the Unix domain socket @code{/dev/log}.
Results are undefined if the facility code is anything else.
-@strong{note:} @code{syslog} recognizes one other facility code: that of
+@strong{NB:} @code{syslog} recognizes one other facility code: that of
the kernel. But you can't specify that facility code with these
functions. If you try, it looks the same to @code{syslog} as if you are
requesting the default facility. But you wouldn't want to anyway,
-because any program that uses the GNU C library is not the kernel.
+because any program that uses @theglibc{} is not the kernel.
You can use just a priority code as @var{facility_priority}. In that
case, @code{syslog} assumes the default facility established when the
connection options in @var{options} is as if those bits were off.
@code{syslog} leaves the Syslog connection open.
-If the @file{dev/log} socket is not open and connected, @code{syslog}
+If the @file{/dev/log} socket is not open and connected, @code{syslog}
opens and connects it, the same as @code{openlog} with the
@code{LOG_NDELAY} option would.
@comment syslog.h
@comment BSD
-@deftypefun void vsyslog (int @var{facility_priority}, char *@var{format}, va_list arglist)
+@deftypefun void vsyslog (int @var{facility_priority}, const char *@var{format}, va_list @var{arglist})
+@safety{@prelim{}@mtsafe{@mtsenv{} @mtslocale{}}@asunsafe{@asucorrupt{} @ascuheap{} @asulock{} @ascudlopen{}}@acunsafe{@acucorrupt{} @aculock{} @acsmem{} @acsfd{}}}
+@c vsyslog @mtsenv @mtslocale @asucorrupt @ascuheap @asulock @ascudlopen @acucorrupt @aculock @acsmem @acsfd
+@c vsyslog_chk dup @mtsenv @mtslocale @asucorrupt @ascuheap @asulock @ascudlopen @acucorrupt @aculock @acsmem @acsfd
This is functionally identical to @code{syslog}, with the BSD style variable
length argument.
@comment syslog.h
@comment BSD
@deftypefun void closelog (void)
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
+@c closelog @asulock @aculock @acsfd
+@c libc_lock_lock @asulock @aculock
+@c closelog_internal @acsfd [always guarded by syslog_lock, so no race]
+@c close dup@acsfd
+@c cancel_handler(NULL) @aculock
+@c libc_lock_unlock @aculock
@code{closelog} closes the current Syslog connection, if there is one.
-This includes closing the @file{dev/log} socket, if it is open.
+This includes closing the @file{/dev/log} socket, if it is open.
@code{closelog} also sets the identification string for Syslog messages
back to the default, if @code{openlog} was called with a non-NULL argument
to @var{ident}. The default identification string is the program name
taken from argv[0].
If you are writing shared library code that uses @code{openlog} to
-generate custom syslog output, you should use @code{closelog} to drop the
-GNU C library's internal reference to the @var{ident} pointer when you are
+generate custom syslog output, you should use @code{closelog} to drop
+@theglibc{}'s internal reference to the @var{ident} pointer when you are
done. Please read the section on @code{openlog} for more information:
@xref{openlog}.
@code{closelog} does not flush any buffers. You do not have to call
-@code{closelog} before re-opening a Syslog connection with @code{initlog}.
+@code{closelog} before re-opening a Syslog connection with @code{openlog}.
Syslog connections are automatically closed on exec or exit.
@end deftypefun
@comment syslog.h
@comment BSD
@deftypefun int setlogmask (int @var{mask})
+@safety{@prelim{}@mtunsafe{@mtasurace{:LogMask}}@asunsafe{}@acsafe{}}
+@c Read and modify are not guarded by syslog_lock, so concurrent changes
+@c or even uses are undefined. This should use an atomic swap instead,
+@c at least for modifications.
@code{setlogmask} sets a mask (the ``logmask'') that determines which
future @code{syslog} calls shall be ignored. If a program has not