1 /* This file contains a collection of miscellaneous procedures:
2 * minix_panic: abort MINIX due to a fatal error
3 * kprintf: (from lib/sysutil/kprintf.c)
4 * kputc: buffered putc used by kernel kprintf
13 #include <minix/sys_config.h>
15 /*===========================================================================*
17 *===========================================================================*/
18 PUBLIC
void panic(char *what
, char *mess
,int nr
)
20 /* This function is for when a library call wants to panic.
21 * The library call calls printf() and tries to exit a process,
22 * which isn't applicable in the kernel.
24 minix_panic(mess
, nr
);
27 /*===========================================================================*
29 *===========================================================================*/
30 PUBLIC
void minix_panic(char *mess
,int nr
)
32 /* The system has run aground of a fatal kernel error. Terminate execution. */
33 if (minix_panicing
++) {
38 kprintf("kernel panic: %s", mess
);
52 /* Include system printf() implementation named kprintf() */
54 #define printf kprintf
55 #include "../lib/sysutil/kprintf.c"
57 /*===========================================================================*
59 *===========================================================================*/
61 int c
; /* character to append */
63 /* Accumulate a single character for a kernel message. Send a notification
64 * to the output driver if an END_OF_KMESS is encountered.
66 if (c
!= END_OF_KMESS
) {
67 if (do_serial_debug
) {
72 kmess
.km_buf
[kmess
.km_next
] = c
; /* put normal char in buffer */
73 if (kmess
.km_size
< sizeof(kmess
.km_buf
))
75 kmess
.km_next
= (kmess
.km_next
+ 1) % _KMESS_BUF_SIZE
;
77 int p
, outprocs
[] = OUTPUT_PROCS_ARRAY
;
78 if(!(minix_panicing
|| do_serial_debug
)) {
79 for(p
= 0; outprocs
[p
] != NONE
; p
++) {
80 if(isokprocn(outprocs
[p
]) && !isemptyn(outprocs
[p
])) {
81 send_sig(outprocs
[p
], SIGKMESS
);