put redundant stuff in subroutines; add WILLRELE support
[unix-history] / usr / src / sys / kern / kern_subr.c
index a4e39f9..d1bb987 100644 (file)
@@ -1,14 +1,15 @@
 /*
  * Copyright (c) 1982, 1986, 1991 Regents of the University of California.
 /*
  * Copyright (c) 1982, 1986, 1991 Regents of the University of California.
- * All rights reserved. 
+ * All rights reserved.
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_subr.c 7.6 (Berkeley) %G%
+ *     @(#)kern_subr.c 7.9 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
  */
 
 #include "param.h"
 #include "systm.h"
+#include "proc.h"
 
 uiomove(cp, n, uio)
        register caddr_t cp;
 
 uiomove(cp, n, uio)
        register caddr_t cp;
@@ -19,8 +20,12 @@ uiomove(cp, n, uio)
        u_int cnt;
        int error = 0;
 
        u_int cnt;
        int error = 0;
 
+#ifdef DIAGNOSTIC
        if (uio->uio_rw != UIO_READ && uio->uio_rw != UIO_WRITE)
                panic("uiomove: mode");
        if (uio->uio_rw != UIO_READ && uio->uio_rw != UIO_WRITE)
                panic("uiomove: mode");
+       if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curproc)
+               panic("uiomove proc");
+#endif
        while (n > 0 && uio->uio_resid) {
                iov = uio->uio_iov;
                cnt = iov->iov_len;
        while (n > 0 && uio->uio_resid) {
                iov = uio->uio_iov;
                cnt = iov->iov_len;
@@ -101,35 +106,7 @@ again:
        return (0);
 }
 
        return (0);
 }
 
-strcat(src, append)
-       register char *src, *append;
-{
-
-       for (; *src; ++src)
-               ;
-       while (*src++ = *append++)
-               ;
-}
-
-strcpy(to, from)
-       register char *to, *from;
-{
-
-       for (; *from = *to; ++from, ++to)
-               ;
-}
-
-strncpy(to, from, cnt)
-       register char *to, *from;
-       register int cnt;
-{
-
-       for (; cnt && (*to = *from); --cnt, ++from, ++to)
-               ;
-       *to = '\0';
-}
-
-#ifndef lint   /* unused except by ct.c, other oddities XXX */
+#ifdef vax     /* unused except by ct.c, other oddities XXX */
 /*
  * Get next character written in by user from uio.
  */
 /*
  * Get next character written in by user from uio.
  */
@@ -173,4 +150,4 @@ again:
        uio->uio_offset++;
        return (c);
 }
        uio->uio_offset++;
        return (c);
 }
-#endif /* notdef */
+#endif /* vax */