Reduce default LLVM/BTLS Visual Studio build output.
[mono-project.git] / support / syslog.c
blob44c11983483f1da803efde49dd3e4dca04ba7d75
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 openlog ((const char*) ident, option, facility);
24 return 0;
27 int
28 Mono_Posix_Syscall_closelog (void)
30 closelog ();
31 return 0;
34 #ifdef __GNUC__
35 #pragma GCC diagnostic push
36 #pragma GCC diagnostic ignored "-Wformat-security"
37 #endif
38 int
39 Mono_Posix_Syscall_syslog (int priority, const char* message)
41 syslog (priority, message);
42 return 0;
45 #ifdef __GNUC__
46 #pragma GCC diagnostic pop
47 #endif
49 /* vararg version of syslog(3). */
50 gint32
51 Mono_Posix_Syscall_syslog2 (int priority, const char *format, ...);
53 gint32
54 Mono_Posix_Syscall_syslog2 (int priority, const char *format, ...)
56 va_list ap;
58 #if HAVE_VSYSLOG
59 va_start (ap, format);
60 vsyslog (priority, format, ap);
61 va_end (ap);
62 #else
63 /* some OSes like AIX lack vsyslog; simulate with vsprintf */
64 char message[256];
66 va_start (ap, format);
67 vsnprintf(message, 256, format, ap);
68 va_end(ap);
70 syslog(priority, message);
71 #endif
72 return 0;
76 G_END_DECLS
79 * vim: noexpandtab