《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
583 B

10 years ago
  1. #include <defs.h>
  2. #include <stdarg.h>
  3. #include <stdio.h>
  4. #include <ulib.h>
  5. #include <error.h>
  6. void
  7. __panic(const char *file, int line, const char *fmt, ...) {
  8. // print the 'message'
  9. va_list ap;
  10. va_start(ap, fmt);
  11. cprintf("user panic at %s:%d:\n ", file, line);
  12. vcprintf(fmt, ap);
  13. cprintf("\n");
  14. va_end(ap);
  15. exit(-E_PANIC);
  16. }
  17. void
  18. __warn(const char *file, int line, const char *fmt, ...) {
  19. va_list ap;
  20. va_start(ap, fmt);
  21. cprintf("user warning at %s:%d:\n ", file, line);
  22. vcprintf(fmt, ap);
  23. cprintf("\n");
  24. va_end(ap);
  25. }