2 #define _SANITYCHECK_H 1
10 #define PT_SANE(p) { pt_sanitycheck((p), __FILE__, __LINE__); }
12 /* This macro is used in the sanity check functions, where file and
13 * line are function arguments.
15 #define MYASSERT(c) do { if(!(c)) { \
16 printf("VM:%s:%d: %s failed (last sanity check %s:%d)\n", file, line, #c, sc_lastfile, sc_lastline); \
17 panic("sanity check failed"); } } while(0)
19 #define SLABSANITYCHECK(l) if(_minix_kerninfo) { \
20 slab_sanitycheck(__FILE__, __LINE__); }
22 #define SANITYCHECK(l) if(!nocheck && _minix_kerninfo && 0) { \
23 struct vmproc *vmpr; \
24 assert(incheck == 0); \
27 slab_sanitycheck(__FILE__, __LINE__); \
28 for(vmpr = vmproc; vmpr < &vmproc[VMP_NR]; vmpr++) { \
29 if((vmpr->vm_flags & (VMF_INUSE))) { \
30 PT_SANE(&vmpr->vm_pt); \
33 map_sanitycheck(__FILE__, __LINE__); \
34 mem_sanitycheck(__FILE__, __LINE__); \
35 assert(incheck == 1); \
37 /* printf("(%s:%d OK) ", __FILE__, __LINE__); */ \
38 sc_lastfile = __FILE__; sc_lastline = __LINE__; \
41 #define SLABSANE(ptr) { \
42 if(!slabsane_f(__FILE__, __LINE__, ptr, sizeof(*(ptr)))) { \
43 printf("VM:%s:%d: SLABSANE(%s)\n", __FILE__, __LINE__, #ptr); \
44 panic("SLABSANE failed"); \
49 #define SANITYCHECK(l)
50 #define SLABSANITYCHECK(l)
57 #define USE(obj, code) do { \
58 slabunlock(obj, sizeof(*obj)); \
62 slablock(obj, sizeof(*obj)); \
65 #define USE(obj, code) do { code } while(0)