don't allow process to attach to itself
[unix-history] / usr / src / sys / kern / subr_prf.c
index b49c5ea..39447e6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)subr_prf.c  7.34 (Berkeley) %G%
+ *     @(#)subr_prf.c  7.39 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -29,7 +29,7 @@
 #include <machine/stdarg.h>
 
 #ifdef KADB
 #include <machine/stdarg.h>
 
 #ifdef KADB
-#include "machine/kdbparam.h"
+#include <machine/kdbparam.h>
 #endif
 
 #define TOCONS 0x01
 #endif
 
 #define TOCONS 0x01
 
 struct tty *constty;                   /* pointer to console "window" tty */
 
 
 struct tty *constty;                   /* pointer to console "window" tty */
 
-#ifdef KADB
-extern cngetc();                       /* standard console getc */
-int    (*v_getc)() = cngetc;           /* "" getc from virtual console */
-extern cnpoll();
-int    (*v_poll)() = cnpoll;           /* kdb hook to enable input polling */
-#endif
 extern cnputc();                       /* standard console putc */
 int    (*v_putc)() = cnputc;           /* routine to putc on virtual console */
 
 extern cnputc();                       /* standard console putc */
 int    (*v_putc)() = cnputc;           /* routine to putc on virtual console */
 
@@ -71,13 +65,14 @@ const char *panicstr;
  * the disks as this often leads to recursive panics.
  */
 #ifdef __GNUC__
  * the disks as this often leads to recursive panics.
  */
 #ifdef __GNUC__
+volatile void boot(int flags); /* boot() does not return */
 volatile                       /* panic() does not return */
 #endif
 void
 #ifdef __STDC__
 panic(const char *fmt, ...)
 #else
 volatile                       /* panic() does not return */
 #endif
 void
 #ifdef __STDC__
 panic(const char *fmt, ...)
 #else
-panic(fmt /*, va_alist */)
+panic(fmt, va_alist)
        char *fmt;
 #endif
 {
        char *fmt;
 #endif
 {
@@ -98,13 +93,8 @@ panic(fmt /*, va_alist */)
        kgdb_panic();
 #endif
 #ifdef KADB
        kgdb_panic();
 #endif
 #ifdef KADB
-       if (boothowto & RB_KDB) {
-               int s;
-
-               s = splnet();   /* below kdb pri */
-               setsoftkdb();
-               splx(s);
-       }
+       if (boothowto & RB_KDB)
+               kdbpanic();
 #endif
        boot(bootopt);
 }
 #endif
        boot(bootopt);
 }
@@ -114,7 +104,7 @@ panic(fmt /*, va_alist */)
  */
 void
 tablefull(tab)
  */
 void
 tablefull(tab)
-       char *tab;
+       const char *tab;
 {
 
        log(LOG_ERR, "%s: table is full\n", tab);
 {
 
        log(LOG_ERR, "%s: table is full\n", tab);
@@ -348,7 +338,7 @@ kprintf(fmt, flags, tp, ap)
        struct tty *tp;
        va_list ap;
 {
        struct tty *tp;
        va_list ap;
 {
-       register char *p;
+       register char *p, *q;
        register int ch, n;
        u_long ul;
        int base, lflag, tmp, width;
        register int ch, n;
        u_long ul;
        int base, lflag, tmp, width;
@@ -382,7 +372,7 @@ reswitch:   switch (ch = *(u_char *)fmt++) {
                case 'b':
                        ul = va_arg(ap, int);
                        p = va_arg(ap, char *);
                case 'b':
                        ul = va_arg(ap, int);
                        p = va_arg(ap, char *);
-                       for (p = ksprintn(ul, *p++, NULL); ch = *p--;)
+                       for (q = ksprintn(ul, *p++, NULL); ch = *q--;)
                                putchar(ch, flags, tp);
 
                        if (!ul)
                                putchar(ch, flags, tp);
 
                        if (!ul)
@@ -395,7 +385,8 @@ reswitch:   switch (ch = *(u_char *)fmt++) {
                                                putchar(n, flags, tp);
                                        tmp = 1;
                                } else
                                                putchar(n, flags, tp);
                                        tmp = 1;
                                } else
-                                       for (; *p > ' '; ++p);
+                                       for (; *p > ' '; ++p)
+                                               continue;
                        }
                        if (tmp)
                                putchar('>', flags, tp);
                        }
                        if (tmp)
                                putchar('>', flags, tp);