ia64/xen-unstable

changeset 18378:79d168323727

stubdom: add syslog functions

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Aug 27 09:45:42 2008 +0100 (2008-08-27)
parents ac9e7df89a8e
children 1c1404a0d435
files extras/mini-os/include/posix/syslog.h extras/mini-os/lib/sys.c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extras/mini-os/include/posix/syslog.h	Wed Aug 27 09:45:42 2008 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +#ifndef _POSIX_SYSLOG_H
     1.5 +#define _POSIX_SYSLOG_H
     1.6 +
     1.7 +#include <stdarg.h>
     1.8 +
     1.9 +#define LOG_PID 0
    1.10 +#define LOG_CONS 0
    1.11 +#define LOG_NDELAY 0
    1.12 +#define LOG_ODELAY 0
    1.13 +#define LOG_NOWAIT 0
    1.14 +
    1.15 +#define LOG_KERN 0
    1.16 +#define LOG_USER 0
    1.17 +#define LOG_MAIL 0
    1.18 +#define LOG_NEWS 0
    1.19 +#define LOG_UUCP 0
    1.20 +#define LOG_DAEMON 0
    1.21 +#define LOG_AUTH 0
    1.22 +#define LOG_CRON 0
    1.23 +#define LOG_LPR 0
    1.24 +
    1.25 +/* TODO: support */
    1.26 +#define LOG_EMERG 0
    1.27 +#define LOG_ALERT 1
    1.28 +#define LOG_CRIT 2
    1.29 +#define LOG_ERR 3
    1.30 +#define LOG_WARNING 4
    1.31 +#define LOG_NOTICE 5
    1.32 +#define LOG_INFO 6
    1.33 +#define LOG_DEBUG 7
    1.34 +
    1.35 +void openlog(const char *ident, int option, int facility);
    1.36 +void syslog(int priority, const char *format, ...);
    1.37 +void closelog(void);
    1.38 +void vsyslog(int priority, const char *format, va_list ap);
    1.39 +
    1.40 +#endif /* _POSIX_SYSLOG_H */
     2.1 --- a/extras/mini-os/lib/sys.c	Wed Aug 27 09:45:09 2008 +0100
     2.2 +++ b/extras/mini-os/lib/sys.c	Wed Aug 27 09:45:42 2008 +0100
     2.3 @@ -1007,6 +1007,34 @@ LWIP_STUB(ssize_t, sendto, (int s, void 
     2.4  LWIP_STUB(int, getsockname, (int s, struct sockaddr *name, socklen_t *namelen), (s, name, namelen))
     2.5  #endif
     2.6  
     2.7 +static char *syslog_ident;
     2.8 +void openlog(const char *ident, int option, int facility)
     2.9 +{
    2.10 +    if (syslog_ident)
    2.11 +        free(syslog_ident);
    2.12 +    syslog_ident = strdup(ident);
    2.13 +}
    2.14 +
    2.15 +void vsyslog(int priority, const char *format, va_list ap)
    2.16 +{
    2.17 +    printk("%s: ", syslog_ident);
    2.18 +    print(0, format, ap);
    2.19 +}
    2.20 +
    2.21 +void syslog(int priority, const char *format, ...)
    2.22 +{
    2.23 +    va_list ap;
    2.24 +    va_start(ap, format);
    2.25 +    vsyslog(priority, format, ap);
    2.26 +    va_end(ap);
    2.27 +}
    2.28 +
    2.29 +void closelog(void)
    2.30 +{
    2.31 +    free(syslog_ident);
    2.32 +    syslog_ident = NULL;
    2.33 +}
    2.34 +
    2.35  int nanosleep(const struct timespec *req, struct timespec *rem)
    2.36  {
    2.37      s_time_t start = NOW();