SCCS-vsn: sys/kern/subr_prf.c 7.2
SCCS-vsn: sys/kern/tty.c 7.2
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)subr_prf.c 7.1 (Berkeley) %G%
+ * @(#)subr_prf.c 7.2 (Berkeley) %G%
+extern cnputc(); /* standard console putc */
+extern struct tty cons; /* standard console tty */
+struct tty *constty; /* pointer to console "window" tty */
+int (*v_console)() = cnputc; /* routine to putc on virtual console */
+
/*
* Scaled down version of C Library printf.
* Used to print diagnostic information directly on console tty.
/*
* Scaled down version of C Library printf.
* Used to print diagnostic information directly on console tty.
unsigned x1;
{
int flags = TOTTY | TOLOG;
unsigned x1;
{
int flags = TOTTY | TOLOG;
- extern struct tty cons;
- if (tp == (struct tty *)NULL)
- tp = &cons;
+ if (tp == (struct tty *)NULL) {
+ tp = constty;
+ if (tp == (struct tty *)NULL)
+ tp = &cons;
+ }
if (ttycheckoutq(tp, 0) == 0)
flags = TOLOG;
prf(fmt, &x1, flags, tp);
if (ttycheckoutq(tp, 0) == 0)
flags = TOLOG;
prf(fmt, &x1, flags, tp);
+ if ((flags & TOCONS) && panicstr == 0 && tp == 0 && constty) {
+ tp = constty;
+ flags |= TOTTY;
+ }
if (flags & TOTTY) {
register s = spltty();
if (flags & TOTTY) {
register s = spltty();
(void) ttyoutput('\r', tp);
(void) ttyoutput(c, tp);
ttstart(tp);
(void) ttyoutput('\r', tp);
(void) ttyoutput(c, tp);
ttstart(tp);
+ flags &= ~TOCONS;
+ } else if ((flags & TOCONS) && tp == constty)
+ constty = 0;
splx(s);
}
if ((flags & TOLOG) && c != '\0' && c != '\r' && c != 0177
splx(s);
}
if ((flags & TOLOG) && c != '\0' && c != '\r' && c != 0177
msgbuf.msg_bufx = 0;
}
if ((flags & TOCONS) && c != '\0')
msgbuf.msg_bufx = 0;
}
if ((flags & TOCONS) && c != '\0')
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)tty.c 7.1 (Berkeley) %G%
+ * @(#)tty.c 7.2 (Berkeley) %G%
*/
#include "../machine/reg.h"
*/
#include "../machine/reg.h"
*(struct winsize *)data = tp->t_winsize;
break;
*(struct winsize *)data = tp->t_winsize;
break;
+ case TIOCCONS:
+ {
+ extern struct tty *constty;
+
+ if (constty != NULL)
+ return (EBUSY);
+#ifndef UCONSOLE
+ if (!suser())
+ return (EPERM);
+#endif
+ constty = tp;
+ break;
+ }
+