/*
* linux/kernel/panic.c
*
* (C) 1991 Linus Torvalds
*/
/*
* This function is used through-out the kernel (includeinh mm and fs)
* to indicate a major problem.
*/
#include <linux/kernel.h>
#include <linux/sched.h>
void sys_sync(void); /* it's really int int sys_sync(void)*/
volatile void panic(const char * s)//用于显示系统内核错误,并使系统进入死循环(死机),volatile说明本函数无参数返回
{
printk("Kernel panic: %s\n\r",s);
if (current == task[0])//如果是任务0的话,是空闲进程,不会修改内核数据,和文件系统没有瓜葛,所以不用调用sys_sync
printk("In swapper task - not syncing\n\r");
else
sys_sync();//系统同步
for(;;);//进入死循环(死机)
}
|