*/
#include "internal.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <signal.h>
#include <stdarg.h>
-#include <stdio.h>
-#include <sys/klog.h>
+#include <time.h>
+#include <unistd.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/param.h>
-#include <time.h>
-#include <unistd.h>
+#include <linux/unistd.h>
+
+#ifndef socklen_t
+typedef unsigned int socklen_t;
+#endif
+
+#if __GNU_LIBRARY__ < 5
+
+#ifndef __alpha__
+# define __NR_klogctl __NR_syslog
+static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
+#else /* __alpha__ */
+#define klogctl syslog
+#endif
+
+#else
+# include <sys/klog.h>
+#endif
-#define ksyslog klogctl
-extern int ksyslog(int type, char *buf, int len);
/* SYSLOG_NAMES defined to pull some extra junk from syslog.h */
}
#define BUFSIZE 1023
-static void serveConnection (int conn) __attribute__ ((noreturn));
-static void serveConnection (int conn)
+static int serveConnection (int conn)
{
char buf[ BUFSIZE + 1 ];
int n_read;
/* Now log it */
logMessage (pri, line);
}
- exit (0);
+ return (0);
}
static void doSyslogd (void) __attribute__ ((noreturn));
static void klogd_signal(int sig)
{
- ksyslog(7, NULL, 0);
- ksyslog(0, 0, 0);
+ klogctl(7, NULL, 0);
+ klogctl(0, 0, 0);
logMessage(0, "Kernel log daemon exiting.");
exit(TRUE);
}
logMessage(0, "klogd started: "
"BusyBox v" BB_VER " (" BB_BT ")");
- ksyslog(1, NULL, 0);
+ klogctl(1, NULL, 0);
while (1) {
/* Use kernel syscalls */
memset(log_buffer, '\0', sizeof(log_buffer));
- if (ksyslog(2, log_buffer, sizeof(log_buffer)) < 0) {
+ if (klogctl(2, log_buffer, sizeof(log_buffer)) < 0) {
char message[80];
if (errno == EINTR)
doSyslogd();
}
- exit(TRUE);
+ return(TRUE);
}
/*
*/
#include "internal.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <signal.h>
#include <stdarg.h>
-#include <stdio.h>
-#include <sys/klog.h>
+#include <time.h>
+#include <unistd.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/param.h>
-#include <time.h>
-#include <unistd.h>
+#include <linux/unistd.h>
+
+#ifndef socklen_t
+typedef unsigned int socklen_t;
+#endif
+
+#if __GNU_LIBRARY__ < 5
+
+#ifndef __alpha__
+# define __NR_klogctl __NR_syslog
+static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
+#else /* __alpha__ */
+#define klogctl syslog
+#endif
+
+#else
+# include <sys/klog.h>
+#endif
-#define ksyslog klogctl
-extern int ksyslog(int type, char *buf, int len);
/* SYSLOG_NAMES defined to pull some extra junk from syslog.h */
}
#define BUFSIZE 1023
-static void serveConnection (int conn) __attribute__ ((noreturn));
-static void serveConnection (int conn)
+static int serveConnection (int conn)
{
char buf[ BUFSIZE + 1 ];
int n_read;
/* Now log it */
logMessage (pri, line);
}
- exit (0);
+ return (0);
}
static void doSyslogd (void) __attribute__ ((noreturn));
static void klogd_signal(int sig)
{
- ksyslog(7, NULL, 0);
- ksyslog(0, 0, 0);
+ klogctl(7, NULL, 0);
+ klogctl(0, 0, 0);
logMessage(0, "Kernel log daemon exiting.");
exit(TRUE);
}
logMessage(0, "klogd started: "
"BusyBox v" BB_VER " (" BB_BT ")");
- ksyslog(1, NULL, 0);
+ klogctl(1, NULL, 0);
while (1) {
/* Use kernel syscalls */
memset(log_buffer, '\0', sizeof(log_buffer));
- if (ksyslog(2, log_buffer, sizeof(log_buffer)) < 0) {
+ if (klogctl(2, log_buffer, sizeof(log_buffer)) < 0) {
char message[80];
if (errno == EINTR)
doSyslogd();
}
- exit(TRUE);
+ return(TRUE);
}
/*