NAME
	  syslog, syslog_r, openlog, openlog_r,	closelog, closelog_r,
	  setlogmask, setlogmask_r - Controls the system log

     LIBRARY
	  Standard C Library (libc.a)

     SYNOPSIS
	  #include <syslog.h>
	  int openlog (
	       char *id,
	       int log_option,
	       int facility );
	  int openlog_r	(
	       char *id,
	       int log_option,
	       int facility,
	       struct syslog_data *syslog_data );
	  int syslog (
	       int priority,
	       const char *message, ...);
	  int syslog_r (
	       int priority,
	       struct syslog_data *syslog_data,
	       const char *message, ...);
	  int closelog ( void );
	  void closelog_r (
	       struct syslog_data *syslog_data );
	  int setlogmask(
	       int mask_priority );
	  int setlogmask_r(
	       int mask_priority ,
	       struct syslog_data *syslog_data );


     PARAMETERS
	  id	    Specifies a	string that is attached	to the begin-
		    ning of every message.

	  log_option
		    Specifies logging options.	Values of the
		    log_option parameter include:


		    Log	the process ID with each message.
			      This option" is useful for identifying
			      daemons.

		    LOG_CONS  Send messages to the console if unable
			      to send them to syslogd. This option is
			      useful in	daemon processes that have no
			      controlling terminal.

		    LOG_NDELAY
			      Open the connection to syslogd immedi-
			      ately, instead of	when the first message
			      is logged. This option is	useful for
			      programs that need to manage the order
			      in which file descriptors	are allocated.

		    LOG_NOWAIT
			      Log messages to the console without
			      waiting for child	processes that are
			      forked. Use this option for processes
			      that enable notification of termination
			      of child processes through SIGCHLD; oth-
			      erwise, the syslog() function may	block,
			      waiting for a child process whose	exit
			      status has already been collected.


	  facility  Specifies the facility that	generated the message,
		    which is one of the	following:


		    LOG_KERN  Messages generated by the	kernel.	These
			      cannot be	generated by any user
			      processes.

		    LOG_USER  Messages generated by user processes.
			      This is the default facility when	none
			      is specified.

		    LOG_MAIL  Messages generated by the	mail system.

		    LOG_DAEMON
			      Messages generated by system daemons.

		    LOG_AUTH  Messages generated by the	authorization
			      system: login, su, and so	on.

		    LOG_LPR   Messages generated by the	line printer
			      spooling system.

		    LOG_RFS   Messages generated by remote file	sys-
			      tems.

		    LOG_LOCAL0 through LOG_LOCAL7
			      Reserved for local use.


	  priority  Messages are tagged	with codes indicating the type
		    of priority	for each.  The priority	parameter is
		    encoded as a facility (as listed above), which
		    describes the part of the system generating	the
		    message, and as a level, which indicates the
		    severity of	the message.  The level	of severity is
		    selected from the following	list:


		    A panic condition reported to all users.

		    LOG_ALERT A	condition to be	corrected immediately;
			      for example, a corrupted database.

		    LOG_CRIT  Critical conditions; for example,	hard
			      device errors.

		    LOG_ERR   Errors.

		    LOG_WARNING
			      Warning messages.

		    LOG_NOTICE
			      Not an error condition, but a condition
			      requiring	special	handling.

		    LOG_INFO  General information messages.

		    LOG_DEBUG Messages containing information useful
			      to debug a program.


	  message [ value ... ]
		    Similar to the printf fmt string, with the differ-
		    ence that %m is replaced by	the current error mes-
		    sage obtained from errno.

	  mask_priority
		    Specifies a	bit mask used to set the new log
		    priority mask and return the previous mask.	 The
		    LOG_MASK and LOG_UPTO macros in the	sys/syslog.h
		    file are used to create the	priority mask.

	  syslog_data
		    The	syslog_r(), openlog_r(), closelog_r(), and
		    setlogmask_r() functions use this opaque structure
		    to reentrantly keep	track of subsequent calls to
		    themselves.	 This structure	is in the <syslog.h>
		    file.


     DESCRIPTION
	  The syslog() function	writes messages	to the system log
	  maintained by	the syslogd daemon.

	  The message parameter	is similar to the printf() fmt string,
	  with the difference that %m is replaced by the current error
	  message obtained from	errno.	A trailing new line can	be
	  added	to the message if needed. The value parameters are the
	  same as the value parameters of the printf() function.

	  The syslogd daemon reads messages and	writes them to the
	  system console or to a log file, or forwards them to the
	  syslogd daemon on the	appropriate host.

	  If syslog() cannot pass the message to syslogd, it writes
	  the message on /dev/console, provided	the LOG_CONS option is
	  set.

	  If special processing	is required, the openlog() function
	  can be used to initialize the	log file.  The id parameter
	  contains a string that is attached to	the beginning of every
	  message.  The	facility parameter encodes a default facility
	  from the previous list to be assigned	to messages that do
	  not have an explicit facility	encoded.

	  The closelog() function closes the log file.

	  The setlogmask() function uses the bit mask in the
	  mask_priority	parameter to set the new log priority mask and
	  returns the previous mask.  Logging is enabled for the lev-
	  els indicated	by the bits in the mask	that are set and is
	  disabled where the bits are not set. The default mask	allows
	  all priorities to be logged.	If the syslog()	function is
	  called with a	priority mask that does	not allow logging of
	  that level of	message, then the function returns without
	  logging the message.

	  The syslog_r(), openlog_r(), closelog_r(), and
	  setlogmask_r() functions are the reentrant versions of the
	  syslog(), openlog(), closelog(), and setlogmask() functions.
	  They use the syslog_data structure to	keep threadsafe	track
	  of subsequent	calls to themselves.  The opaque data object
	  syslog_data should be	initialized to SYSLOG_DATA_INIT.

     RETURN VALUES
	  The syslog() function	returns	-1 if either the priority mask
	  excludes this	message	from being logged, or if an error
	  occurs and it	is impossible to send the message to the sys-
	  logd daemon or to the	system console.

     RELATED INFORMATION
	  Functions: profil(2)

	  Commands: cc(1)



Acknowledgement and Disclaimer