home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / kernel / panic.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-01  |  695 b   |  35 lines

  1. /*
  2.  *  linux/kernel/panic.c
  3.  *
  4.  *  Copyright (C) 1991, 1992  Linus Torvalds
  5.  */
  6.  
  7. /*
  8.  * This function is used through-out the kernel (includeinh mm and fs)
  9.  * to indicate a major problem.
  10.  */
  11. #include <stdarg.h>
  12.  
  13. #include <linux/kernel.h>
  14. #include <linux/sched.h>
  15.  
  16. asmlinkage void sys_sync(void);    /* it's really int */
  17.  
  18. extern int vsprintf(char * buf, const char * fmt, va_list args);
  19.  
  20. NORET_TYPE void panic(const char * fmt, ...)
  21. {
  22.     static char buf[1024];
  23.     va_list args;
  24.  
  25.     va_start(args, fmt);
  26.     vsprintf(buf, fmt, args);
  27.     va_end(args);
  28.     printk(KERN_EMERG "Kernel panic: %s\n",buf);
  29.     if (current == task[0])
  30.         printk(KERN_EMERG "In swapper task - not syncing\n");
  31.     else
  32.         sys_sync();
  33.     for(;;);
  34. }
  35.