AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull)
+AC_CHECK_HEADERS([syslog.h])
+if test "x$ac_cv_header_syslog_h" = "xyes"; then
+ AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include <syslog.h>]])
+fi
+
#### Check for broken poll; taken from Glib's configure
AC_MSG_CHECKING([for broken poll])
#endif
}
-void
+void
_dbus_init_system_log (void)
{
+#ifdef HAVE_DECL_LOG_PERROR
openlog ("dbus", LOG_PID | LOG_PERROR, LOG_DAEMON);
+#else
+ openlog ("dbus", LOG_PID, LOG_DAEMON);
+#endif
}
+
/**
* Log a message to the system log file (e.g. syslog on Unix).
*
return;
}
+#ifndef HAVE_DECL_LOG_PERROR
+ {
+ /* vsyslog() won't write to stderr, so we'd better do it */
+ va_list tmp;
+
+ DBUS_VA_COPY (tmp, args);
+ fprintf (stderr, "dbus[" DBUS_PID_FORMAT "]: ", _dbus_getpid ());
+ vfprintf (stderr, msg, tmp);
+ fputc ('\n', stderr);
+ va_end (tmp);
+ }
+#endif
+
vsyslog (flags, msg, args);
if (severity == DBUS_SYSTEM_LOG_FATAL)