2007-03-09 Chris Toshok <toshok@ximian.com>
[mono-project/dkf.git] / support / syslog.c
blob0ff9d4d107c4c32fda2533429db6ee0410b6ad5b
1 /*
2 * <syslog.h> wrapper functions.
4 * Authors:
5 * Jonathan Pryor (jonpryor@vt.edu)
7 * Copyright (C) 2005 Jonathan Pryor
8 */
10 #include <stdarg.h>
11 #include <syslog.h>
12 #include <errno.h>
14 #include "map.h"
15 #include "mph.h"
16 #include <glib.h>
18 G_BEGIN_DECLS
20 int
21 Mono_Posix_Syscall_openlog (void* ident, int option, int facility)
23 errno = 0;
24 openlog ((const char*) ident, option, facility);
25 return errno == 0 ? 0 : -1;
28 int
29 Mono_Posix_Syscall_closelog (void)
31 errno = 0;
32 closelog ();
33 return errno == 0 ? 0 : -1;
36 int
37 Mono_Posix_Syscall_syslog (int priority, const char* message)
39 errno = 0;
40 syslog (priority, message);
41 return errno == 0 ? 0 : -1;
44 /* vararg version of syslog(3). */
45 gint32
46 Mono_Posix_Syscall_syslog2 (int priority, const char *format, ...)
48 va_list ap;
50 errno = 0;
52 va_start (ap, format);
53 vsyslog (priority, format, ap);
54 va_end (ap);
56 if (errno != 0)
57 return -1;
58 return 0;
62 G_END_DECLS
65 * vim: noexpandtab