* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)subr_prf.c 7.30 (Berkeley) 6/29/91
+ * from: @(#)subr_prf.c 7.30 (Berkeley) 6/29/91
+ * $Id$
*/
#include "param.h"
struct tty *constty; /* pointer to console "window" tty */
-#ifdef KADB
+#if defined(KADB) || defined(PANICWAIT)
extern cngetc(); /* standard console getc */
+#endif
+#ifdef KADB
int (*v_getc)() = cngetc; /* "" getc from virtual console */
extern cnpoll();
int (*v_poll)() = cnpoll; /* kdb hook to enable input polling */
static void putchar __P((int ch, int flags, struct tty *tp));
static char *ksprintn __P((u_long num, int base, int *len));
void kprintf __P((const char *fmt, int flags, struct tty *tp, va_list));
+volatile void boot(int bootopt);
/*
* Variable panicstr contains argument to first call to panic; used
* as flag to indicate that the kernel has already called panic.
*/
-char *panicstr;
+const char *panicstr;
+
+/*
+ * Message buffer
+ */
+struct msgbuf *msgbufp;
+int msgbufmapped;
/*
* Panic is called on unresolvable fatal errors. It prints "panic: mesg",
* and then reboots. If we are called twice, then we avoid trying to sync
* the disks as this often leads to recursive panics.
*/
+#ifdef __STDC__
+volatile void
+panic(const char *msg)
+#else
void
panic(msg)
char *msg;
+#endif
{
int bootopt = RB_AUTOBOOT | RB_DUMP;
#if NDDB > 0
Debugger ();
#else
-/* pg("press key to boot/dump");*/
+#ifdef PANICWAIT
+ printf("hit any key to boot/dump...\n>");
+ cngetc();
+#endif /* PANICWAIT */
+#ifdef PANICDELAY
+ printf("Waiting 20 secs....\n");
+ DELAY(20000000);
+#endif /* PANICDELAY */
#endif
boot(bootopt);
}
putchar('>', TOLOG, NULL);
}
-void
+int
#ifdef __STDC__
addlog(const char *fmt, ...)
#else
va_end(ap);
}
logwakeup();
+ return (0);
}
int consintr = 1; /* ok to handle console interrupts? */
-void
+int
#ifdef __STDC__
printf(const char *fmt, ...)
#else
if (!panicstr)
logwakeup();
consintr = savintr; /* reenable interrupts */
+
+ return 0; /* for compatibility with libc's printf() */
}
/*
struct tty *tp;
va_list ap;
{
- register char *p;
+ register char *p, *p2;
register int ch, n;
u_long ul;
int base, lflag, tmp, width;
case 'b':
ul = va_arg(ap, int);
p = va_arg(ap, char *);
- for (p = ksprintn(ul, *p++, NULL); ch = *p--;)
+ for (p2 = ksprintn(ul, *p++, NULL); ch = *p2--;)
putchar(ch, flags, tp);
if (!ul)
int flags;
struct tty *tp;
{
- extern int msgbufmapped;
register struct msgbuf *mbp;
if (panicstr)
* Scaled down version of sprintf(3).
*/
#ifdef __STDC__
+int
sprintf(char *buf, const char *cfmt, ...)
#else
+int
sprintf(buf, cfmt /*, va_alist */)
char *buf, *cfmt;
#endif