ia64/xen-unstable

view xen/include/xen/lib.h @ 3865:ac04aeeaf462

bitkeeper revision 1.1205.1.5 (42160256WLh3PYM-V5i-QJliGUxICA)

Added a toggle so that debugtrace_printk's can be redirected to the
console or to their own private buffer.
author maf46@burn.cl.cam.ac.uk
date Fri Feb 18 14:57:26 2005 +0000 (2005-02-18)
parents 33647e6b3f4e
children ad1d06d64313
line source
1 #ifndef __LIB_H__
2 #define __LIB_H__
4 #include <stdarg.h>
5 #include <xen/config.h>
6 #include <xen/types.h>
7 #include <xen/string.h>
9 #define BUG() do { \
10 debugtrace_dump(0); \
11 printk("BUG at %s:%d\n", __FILE__, __LINE__); \
12 FORCE_CRASH(); \
13 } while ( 0 )
15 #ifndef NDEBUG
16 #define ASSERT(_p) if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); BUG(); }
17 #else
18 #define ASSERT(_p) ((void)0)
19 #endif
21 #define SWAP(_a, _b) \
22 do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
24 #define reserve_bootmem(_p,_l) ((void)0)
26 struct domain;
28 void cmdline_parse(char *cmdline);
30 #ifndef NDEBUG
31 extern void debugtrace_reset(int send_to_console);
32 extern void debugtrace_dump(int send_to_console);
33 extern void debugtrace_printk(const char *fmt, ...);
34 #else
35 #define debugtrace_reset(_send_to_console) ((void)0)
36 #define debugtrace_dump(_send_to_console) ((void)0)
37 #define debugtrace_printk(_f, ...) ((void)0)
38 #endif
40 #define printk printf
41 void printf(const char *format, ...);
42 void panic(const char *format, ...);
43 long vm_assist(struct domain *, unsigned int, unsigned int);
45 /* vsprintf.c */
46 extern int sprintf(char * buf, const char * fmt, ...)
47 __attribute__ ((format (printf, 2, 3)));
48 extern int vsprintf(char *buf, const char *, va_list);
49 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
50 __attribute__ ((format (printf, 3, 4)));
51 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
53 long simple_strtol(const char *cp,char **endp,unsigned int base);
54 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
55 long long simple_strtoll(const char *cp,char **endp,unsigned int base);
57 #endif /* __LIB_H__ */