netlib.narod.ru< Назад | Оглавление | Далее >

kernel/panic.c

25532 /*
25533  *  linux/kernel/panic.c
25534  *
25535  *  Copyright (C) 1991, 1992  Linus Torvalds
25536  */
25537 
25538 /* This function is used through-out the kernel
25539  * (including mm and fs) to indicate a major problem.  */
25540 #include <linux/sched.h>
25541 #include <linux/delay.h>
25542 #include <linux/reboot.h>
25543 #include <linux/init.h>
25544 #include <linux/sysrq.h>
25545 #include <linux/interrupt.h>
25546 
25547 #ifdef __alpha__
25548 #include <asm/machvec.h>
25549 #endif
25550 
25551 asmlinkage void sys_sync(void); /* it's really int */
25552 extern void unblank_console(void);
25553 extern int C_A_D;
25554 
25555 int panic_timeout = 0;
25556 
25557 void __init panic_setup(char *str, int *ints)
25558 {
25559   if (ints[0] == 1)
25560     panic_timeout = ints[1];
25561 }
25562 
25563 NORET_TYPE void panic(const char * fmt, ...)
25564 {
25565   static char buf[1024];
25566   va_list args;
25567 
25568   va_start(args, fmt);
25569   vsprintf(buf, fmt, args);
25570   va_end(args);
25571   printk(KERN_EMERG "Kernel panic: %s\n",buf);
25572   if (current == task[0])
25573     printk(KERN_EMERG "In swapper task - not syncing\n");
25574   else if (in_interrupt())
25575     printk(KERN_EMERG
25576            "In interrupt handler - not syncing\n");
25577   else
25578     sys_sync();
25579 
25580   unblank_console();
25581 
25582 #ifdef __SMP__
25583   smp_send_stop();
25584 #endif
25585   if (panic_timeout > 0)
25586   {
25587     /* Delay timeout seconds before rebooting the
25588      * machine.  We can't use the "normal" timers since
25589      * we just panicked..  */
25590     printk(KERN_EMERG
25591            "Rebooting in %d seconds..", panic_timeout);
25592     mdelay(panic_timeout*1000);
25593     /* Should we run the reboot notifier. For the moment
25594      * I'm choosing not to. It might crash, be corrupt,
25595      * or do more harm than good for other reasons.  */
25596     machine_restart(NULL);
25597   }
25598 #ifdef __sparc__
25599   printk("Press L1-A to return to the boot prom\n");
25600 #endif
25601 #ifdef __alpha__
25602   if (alpha_using_srm)
25603     halt();
25604 #endif
25605   sti();
25606   for(;;) {
25607     CHECK_EMERGENCY_SYNC
25608   }
25609 }

netlib.narod.ru< Назад | Оглавление | Далее >

Сайт управляется системой uCoz