This source file includes following definitions.
- panic_setup
- panic
- bad_user_access_length
1
2
3
4
5
6
7
8
9
10
11 #include <stdarg.h>
12
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/delay.h>
16
17 asmlinkage void sys_sync(void);
18 extern void hard_reset_now(void);
19
20 static int timeout = -1;
21
22 void panic_setup(char *str, int *ints)
23 {
24 if (ints[0] == 1)
25 timeout = ints[1];
26 }
27
28 NORET_TYPE void panic(const char * fmt, ...)
29 {
30 static char buf[1024];
31 va_list args;
32 int i;
33
34 va_start(args, fmt);
35 vsprintf(buf, fmt, args);
36 va_end(args);
37 printk(KERN_EMERG "Kernel panic: %s\n",buf);
38 if (current == task[0])
39 printk(KERN_EMERG "In swapper task - not syncing\n");
40 else
41 sys_sync();
42 if (timeout >= 0)
43 {
44
45
46
47
48 printk(KERN_EMERG "Rebooting in %d seconds..",timeout);
49 for(i = 0; i < (timeout*1000); i++)
50 udelay(1000);
51 hard_reset_now();
52 }
53 for(;;);
54 }
55
56
57
58
59
60 int bad_user_access_length(void)
61 {
62 panic("bad_user_access_length executed (not cool, dude)");
63 }