name resolution checking (need kern/kern_malloc.c 7.25.1.1,
[unix-history] / usr / src / sys / kern / kern_subr.c
index 7d25018..9980444 100644 (file)
@@ -1,27 +1,32 @@
 /*
 /*
- * Copyright (c) 1982 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1982, 1986, 1991 Regents of the University of California.
+ * All rights reserved. 
  *
  *
- *     @(#)kern_subr.c 6.5 (Berkeley) %G%
+ * %sccs.include.redist.c%
+ *
+ *     @(#)kern_subr.c 7.7 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
  */
 
 #include "param.h"
 #include "systm.h"
-#include "dir.h"
-#include "user.h"
-#include "uio.h"
+#include "proc.h"
 
 
-uiomove(cp, n, rw, uio)
+uiomove(cp, n, uio)
        register caddr_t cp;
        register int n;
        register caddr_t cp;
        register int n;
-       enum uio_rw rw;
        register struct uio *uio;
 {
        register struct iovec *iov;
        u_int cnt;
        int error = 0;
 
        register struct uio *uio;
 {
        register struct iovec *iov;
        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_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;
@@ -36,7 +41,7 @@ uiomove(cp, n, rw, uio)
 
                case UIO_USERSPACE:
                case UIO_USERISPACE:
 
                case UIO_USERSPACE:
                case UIO_USERISPACE:
-                       if (rw == UIO_READ)
+                       if (uio->uio_rw == UIO_READ)
                                error = copyout(cp, iov->iov_base, cnt);
                        else
                                error = copyin(iov->iov_base, cp, cnt);
                                error = copyout(cp, iov->iov_base, cnt);
                        else
                                error = copyin(iov->iov_base, cp, cnt);
@@ -45,7 +50,7 @@ uiomove(cp, n, rw, uio)
                        break;
 
                case UIO_SYSSPACE:
                        break;
 
                case UIO_SYSSPACE:
-                       if (rw == UIO_READ)
+                       if (uio->uio_rw == UIO_READ)
                                bcopy((caddr_t)cp, iov->iov_base, cnt);
                        else
                                bcopy(iov->iov_base, (caddr_t)cp, cnt);
                                bcopy((caddr_t)cp, iov->iov_base, cnt);
                        else
                                bcopy(iov->iov_base, (caddr_t)cp, cnt);
@@ -102,6 +107,35 @@ 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 */
 /*
  * Get next character written in by user from uio.
  */
 /*
  * Get next character written in by user from uio.
  */
@@ -130,7 +164,7 @@ again:
                break;
 
        case UIO_SYSSPACE:
                break;
 
        case UIO_SYSSPACE:
-               c = *iov->iov_base & 0377;
+               c = *(u_char *) iov->iov_base;
                break;
 
        case UIO_USERISPACE:
                break;
 
        case UIO_USERISPACE:
@@ -143,5 +177,6 @@ again:
        iov->iov_len--;
        uio->uio_resid--;
        uio->uio_offset++;
        iov->iov_len--;
        uio->uio_resid--;
        uio->uio_offset++;
-       return (c & 0377);
+       return (c);
 }
 }
+#endif /* notdef */