stubdom: add syslog functions
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
diff -r c2472ded5c7c extras/mini-os/include/posix/syslog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/include/posix/syslog.h Tue Aug 26 17:06:09 2008 +0100
@@ -0,0 +1,37 @@
+#ifndef _POSIX_SYSLOG_H
+#define _POSIX_SYSLOG_H
+
+#include <stdarg.h>
+
+#define LOG_PID 0
+#define LOG_CONS 0
+#define LOG_NDELAY 0
+#define LOG_ODELAY 0
+#define LOG_NOWAIT 0
+
+#define LOG_KERN 0
+#define LOG_USER 0
+#define LOG_MAIL 0
+#define LOG_NEWS 0
+#define LOG_UUCP 0
+#define LOG_DAEMON 0
+#define LOG_AUTH 0
+#define LOG_CRON 0
+#define LOG_LPR 0
+
+/* TODO: support */
+#define LOG_EMERG 0
+#define LOG_ALERT 1
+#define LOG_CRIT 2
+#define LOG_ERR 3
+#define LOG_WARNING 4
+#define LOG_NOTICE 5
+#define LOG_INFO 6
+#define LOG_DEBUG 7
+
+void openlog(const char *ident, int option, int facility);
+void syslog(int priority, const char *format, ...);
+void closelog(void);
+void vsyslog(int priority, const char *format, va_list ap);
+
+#endif /* _POSIX_SYSLOG_H */
--- a/extras/mini-os/lib/sys.c Tue Aug 26 15:16:57 2008 +0100
+++ b/extras/mini-os/lib/sys.c Tue Aug 26 17:06:09 2008 +0100
@@ -1007,6 +1007,34 @@
LWIP_STUB(int, getsockname, (int s, struct sockaddr *name, socklen_t
*namelen), (s, name, namelen))
#endif
+static char *syslog_ident;
+void openlog(const char *ident, int option, int facility)
+{
+ if (syslog_ident)
+ free(syslog_ident);
+ syslog_ident = strdup(ident);
+}
+
+void vsyslog(int priority, const char *format, va_list ap)
+{
+ printk("%s: ", syslog_ident);
+ print(0, format, ap);
+}
+
+void syslog(int priority, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ vsyslog(priority, format, ap);
+ va_end(ap);
+}
+
+void closelog(void)
+{
+ free(syslog_ident);
+ syslog_ident = NULL;
+}
+
int nanosleep(const struct timespec *req, struct timespec *rem)
{
s_time_t start = NOW();
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|