#define ctime __ctime
#define sigaction __sigaction_internal
+#define connect __connect
#define __FORCE_GLIBC
#define _GNU_SOURCE
static int LogMask = 0xff; /* mask of priorities to be logged */
static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
-static void closelog_intern( int );
-void syslog( int, const char *, ...);
-void vsyslog( int, const char *, va_list );
-void openlog( const char *, int, int );
-void closelog( void );
-int setlogmask(int pmask);
-
static void
closelog_intern(int to_default)
{
}
/*
+ * OPENLOG -- open system log
+ */
+void attribute_hidden
+__openlog( const char *ident, int logstat, int logfac )
+{
+ int logType = SOCK_DGRAM;
+
+ LOCK;
+
+ if (ident != NULL)
+ LogTag = ident;
+ LogStat = logstat;
+ if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
+ LogFacility = logfac;
+ if (LogFile == -1) {
+ SyslogAddr.sa_family = AF_UNIX;
+ (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG,
+ sizeof(SyslogAddr.sa_data));
+retry:
+ if (LogStat & LOG_NDELAY) {
+ if ((LogFile = socket(AF_UNIX, logType, 0)) == -1){
+ UNLOCK;
+ return;
+ }
+ /* fcntl(LogFile, F_SETFD, 1); */
+ }
+ }
+
+ if (LogFile != -1 && !connected) {
+ if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) -
+ sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1)
+ {
+ connected = 1;
+ } else if (logType == SOCK_DGRAM) {
+ logType = SOCK_STREAM;
+ if (LogFile != -1) {
+ __close(LogFile);
+ LogFile = -1;
+ }
+ goto retry;
+ } else {
+ if (LogFile != -1) {
+ __close(LogFile);
+ LogFile = -1;
+ }
+ }
+ }
+
+ UNLOCK;
+}
+strong_alias(__openlog,openlog)
+
+/*
* syslog, vsyslog --
* print message on log file; output is intended for syslogd(8).
*/
if (!(LogMask & LOG_MASK(LOG_PRI(pri))) || (pri &~ (LOG_PRIMASK|LOG_FACMASK)))
goto getout;
if (LogFile < 0 || !connected)
- openlog(LogTag, LogStat | LOG_NDELAY, 0);
+ __openlog(LogTag, LogStat | LOG_NDELAY, 0);
/* Set default facility if none specified. */
if ((pri & LOG_FACMASK) == 0)
strong_alias(__syslog,syslog)
/*
- * OPENLOG -- open system log
- */
-void attribute_hidden
-__openlog( const char *ident, int logstat, int logfac )
-{
- int logType = SOCK_DGRAM;
-
- LOCK;
-
- if (ident != NULL)
- LogTag = ident;
- LogStat = logstat;
- if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
- LogFacility = logfac;
- if (LogFile == -1) {
- SyslogAddr.sa_family = AF_UNIX;
- (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG,
- sizeof(SyslogAddr.sa_data));
-retry:
- if (LogStat & LOG_NDELAY) {
- if ((LogFile = socket(AF_UNIX, logType, 0)) == -1){
- UNLOCK;
- return;
- }
- /* fcntl(LogFile, F_SETFD, 1); */
- }
- }
-
- if (LogFile != -1 && !connected) {
- if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) -
- sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1)
- {
- connected = 1;
- } else if (logType == SOCK_DGRAM) {
- logType = SOCK_STREAM;
- if (LogFile != -1) {
- __close(LogFile);
- LogFile = -1;
- }
- goto retry;
- } else {
- if (LogFile != -1) {
- __close(LogFile);
- LogFile = -1;
- }
- }
- }
-
- UNLOCK;
-}
-strong_alias(__openlog,openlog)
-
-/*
* CLOSELOG -- close the system log
*/
void attribute_hidden