New test.
[mono.git] / support / syslog.c
1 /*
2  * <syslog.h> wrapper functions.
3  *
4  * Authors:
5  *   Jonathan Pryor (jonpryor@vt.edu)
6  *
7  * Copyright (C) 2005 Jonathan Pryor
8  */
9
10 #include <stdarg.h>
11 #include <syslog.h>
12 #include <errno.h>
13
14 #include "map.h"
15 #include "mph.h"
16 #include <glib.h>
17
18 G_BEGIN_DECLS
19
20 int
21 Mono_Posix_Syscall_openlog (void* ident, int option, int facility)
22 {
23         errno = 0;
24         openlog ((const char*) ident, option, facility);
25         return errno == 0 ? 0 : -1;
26 }
27
28 int
29 Mono_Posix_Syscall_closelog (void)
30 {
31         errno = 0;
32         closelog ();
33         return errno == 0 ? 0 : -1;
34 }
35
36 int
37 Mono_Posix_Syscall_syslog (int priority, const char* message)
38 {
39         errno = 0;
40         syslog (priority, message);
41         return errno == 0 ? 0 : -1;
42 }
43
44 /* vararg version of syslog(3). */
45 gint32
46 Mono_Posix_Syscall_syslog2 (int priority, const char *format, ...)
47 {
48         va_list ap;
49
50         errno = 0;
51
52         va_start (ap, format);
53         vsyslog (priority, format, ap);
54         va_end (ap);
55
56         if (errno != 0)
57                 return -1;
58         return 0;
59 }
60
61
62 G_END_DECLS
63
64 /*
65  * vim: noexpandtab
66  */