1 /* This file contains a collection of miscellaneous procedures:
2 * panic: abort MINIX due to a fatal error
3 * kputc: buffered putc used by kernel printf
9 #include <minix/syslib.h>
14 #include <minix/sys_config.h>
16 #define ARE_PANICING 0xDEADC0FF
18 /*===========================================================================*
20 *===========================================================================*/
21 PUBLIC
void panic(const char *fmt
, ...)
24 /* The system has run aground of a fatal kernel error. Terminate execution. */
25 if (minix_panicing
== ARE_PANICING
) {
28 minix_panicing
= ARE_PANICING
;
30 printf("kernel panic: ");
43 /*===========================================================================*
45 *===========================================================================*/
47 int c
; /* character to append */
49 /* Accumulate a single character for a kernel message. Send a notification
50 * to the output driver if an END_OF_KMESS is encountered.
52 if (c
!= END_OF_KMESS
) {
53 if (do_serial_debug
) {
58 kmess
.km_buf
[kmess
.km_next
] = c
; /* put normal char in buffer */
59 if (kmess
.km_size
< sizeof(kmess
.km_buf
))
61 kmess
.km_next
= (kmess
.km_next
+ 1) % _KMESS_BUF_SIZE
;
63 int p
, outprocs
[] = OUTPUT_PROCS_ARRAY
;
64 if(!(minix_panicing
|| do_serial_debug
)) {
65 for(p
= 0; outprocs
[p
] != NONE
; p
++) {
66 if(isokprocn(outprocs
[p
]) && !isemptyn(outprocs
[p
])) {
67 send_sig(outprocs
[p
], SIGKMESS
);