]> sourceware.org Git - newlib-cygwin.git/blob - winsup/cygserver/bsd_log.h
cygserver: Speed up non-debug scenario
[newlib-cygwin.git] / winsup / cygserver / bsd_log.h
1 /* bsd_log.h: Helps integrating BSD kernel code
2
3 This file is part of Cygwin.
4
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 details. */
8 #ifndef _BSD_LOG_H
9 #define _BSD_LOG_H
10
11 #include <sys/types.h>
12 #include <sys/syslog.h>
13
14 extern int32_t log_level;
15 extern tun_bool_t log_debug;
16 extern tun_bool_t log_syslog;
17 extern tun_bool_t log_stderr;
18
19 void loginit (tun_bool_t, tun_bool_t);
20 void _vlog (const char *, int, int, const char *, va_list);
21 void _log (const char *, int, int, const char *, ...);
22
23 #define vlog(l,f,a) _vlog(NULL,0,(l),(f),(a))
24 #define log(l,f,...) _log(NULL,0,(l),(f),##__VA_ARGS__)
25
26 #define _vdebug(F,L,f,a) \
27 do { if (log_debug == TUN_TRUE) \
28 _vlog((F),(L),LOG_DEBUG,(f),(a)) \
29 } while (0)
30
31 #define _debug(F,L,f,...) \
32 do { if (log_debug == TUN_TRUE) \
33 _log((F),(L),LOG_DEBUG,(f),##__VA_ARGS__); \
34 } while (0)
35
36 #define vdebug(f,a) _vdebug(__FILE__,__LINE__,(f),(a))
37 #define debug(f,...) _debug(__FILE__,__LINE__,(f),##__VA_ARGS__)
38
39 void _vpanic (const char *, int, const char *, va_list)
40 __attribute__ ((noreturn));
41 void _panic (const char *, int, const char *, ...) __attribute__ ((noreturn));
42 #define vpanic(f,a) _vpanic(__FILE__,__LINE__,(f),(a))
43 #define panic(f,...) _panic(__FILE__,__LINE__,(f),##__VA_ARGS__)
44
45 #endif /* _BSD_LOG_H */
This page took 0.037637 seconds and 5 git commands to generate.