lib - #ifndef _LIB_H_ #define _LIB_H_ /* * Miscellaneous...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #ifndef _LIB_H_ #define _LIB_H_ /* * Miscellaneous standard C functions for the kernel, and other widely used * kernel functions. */ #include <machine/setjmp.h> /* * Tell GCC to check printf formats. */ #ifdef __GNUC__ #define __PF(a,b) __attribute__((__format__(__printf__, a, b))) #else #define __PF(a,b) #endif /* * If not GCC, disable __PRETTY_FUNCTION__ */ #ifndef __GNUC__ #define __PRETTY_FUNCTION__ "<unknown function>" #endif /* * Standard assert macro. */ #define assert(x) { \ if (!(x)) { \ panic("Assertion failed: %s, at %s:%d (%s)\n", #x, \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ } \ } /* * Bit flags for DEBUG() */ #define DB_LOCORE 0x001 #define DB_SYSCALL 0x002 #define DB_INTERRUPT 0x004 #define DB_DEVICE 0x008 #define DB_THREADS 0x010 #define DB_VM 0x020 #define DB_EXEC 0x040 #define DB_VFS 0x080 #define DB_SFS 0x100 #define DB_NET 0x200 #define DB_NETFS 0x400 #define DB_KMALLOC 0x800 extern u_int32_t dbflags; /* * DEBUG() is for conditionally printing debug messages to the console. * * The idea is that you put lots of lines of the form * * DEBUG(DB_VM, "VM free pages: %u\n", free_pages); * * throughout the kernel; then you can toggle whether these messages * are printed or not at runtime by setting the value of dbflags with * the debugger. * * Unfortunately, as of this writing, there are only a very few such * messages actually present in the system yet. Feel free to add more.* messages actually present in the system yet....
View Full Document

Page1 / 4

lib - #ifndef _LIB_H_ #define _LIB_H_ /* * Miscellaneous...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online