Chinaunix首页 | 论坛 | 博客
  • 博客访问: 569255
  • 博文数量: 137
  • 博客积分: 4040
  • 博客等级: 上校
  • 技术积分: 1584
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-08 13:05
文章分类

全部博文(137)

文章存档

2011年(10)

2010年(23)

2009年(104)

分类: LINUX

2009-08-05 16:50:03

/*
 * 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(;;);//进入死循环(死机)

}

阅读(837) | 评论(0) | 转发(0) |
0

上一篇:printk.c

下一篇:blk.h

给主人留下些什么吧!~~