os_kernel_lab/labcodes/lab6/user/libs/panic.c

29 lines
583 B
C
Raw Normal View History

2012-08-22 12:32:13 +08:00
#include <defs.h>
#include <stdarg.h>
#include <stdio.h>
#include <ulib.h>
#include <error.h>
void
__panic(const char *file, int line, const char *fmt, ...) {
// print the 'message'
va_list ap;
va_start(ap, fmt);
cprintf("user panic at %s:%d:\n ", file, line);
vcprintf(fmt, ap);
cprintf("\n");
va_end(ap);
exit(-E_PANIC);
}
void
__warn(const char *file, int line, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
cprintf("user warning at %s:%d:\n ", file, line);
vcprintf(fmt, ap);
cprintf("\n");
va_end(ap);
}