sun merge
[unix-history] / usr / src / sys / kern / subr_xxx.c
index bcc6d09..86efb60 100644 (file)
@@ -1,4 +1,6 @@
-/*     subr_xxx.c      4.15    82/08/13        */
+/*     subr_xxx.c      4.21    82/12/17        */
+
+#include "../machine/pte.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/proc.h"
 #include "../h/fs.h"
 #include "../h/vm.h"
 #include "../h/proc.h"
 #include "../h/fs.h"
 #include "../h/vm.h"
-#include "../h/pte.h"
 #include "../h/cmap.h"
 #include "../h/uio.h"
 
 /*
 #include "../h/cmap.h"
 #include "../h/uio.h"
 
 /*
- * Pass back  c  to the user at his location u_base;
- * update u_base, u_count, and u_offset.  Return -1
- * on the last character of the user's read.
- * u_base is in the user address space unless u_segflg is set.
- */
-passc(c)
-register c;
-{
-       register id;
-
-       if ((id = u.u_segflg) == 1)
-               *u.u_base = c;
-       else
-               if (id?suibyte(u.u_base, c):subyte(u.u_base, c) < 0) {
-                       u.u_error = EFAULT;
-                       return (-1);
-               }
-       u.u_count--;
-       u.u_offset++;
-       u.u_base++;
-       return (u.u_count == 0? -1: 0);
-}
-
-#include "ct.h"
-#if NCT > 0
-/*
- * Pick up and return the next character from the user's
- * write call at location u_base;
- * update u_base, u_count, and u_offset.  Return -1
- * when u_count is exhausted.  u_base is in the user's
- * address space unless u_segflg is set.
- */
-cpass()
-{
-       register c, id;
-
-       if (u.u_count == 0)
-               return (-1);
-       if ((id = u.u_segflg) == 1)
-               c = *u.u_base;
-       else
-               if ((c = id==0?fubyte(u.u_base):fuibyte(u.u_base)) < 0) {
-                       u.u_error = EFAULT;
-                       return (-1);
-               }
-       u.u_count--;
-       u.u_offset++;
-       u.u_base++;
-       return (c&0377);
-}
-#endif
-
-/*
- * Routine which sets a user error; placed in
- * illegal entries in the bdevsw and cdevsw tables.
+ * Routine placed in illegal entries in the bdevsw and cdevsw tables.
  */
 nodev()
 {
 
  */
 nodev()
 {
 
-       u.u_error = ENODEV;
+       return (ENODEV);
 }
 
 /*
 }
 
 /*
@@ -84,6 +31,7 @@ nodev()
 nulldev()
 {
 
 nulldev()
 {
 
+       return (0);
 }
 
 imin(a, b)
 }
 
 imin(a, b)
@@ -100,7 +48,7 @@ imax(a, b)
 
 unsigned
 min(a, b)
 
 unsigned
 min(a, b)
-       unsigned int a, b;
+       u_int a, b;
 {
 
        return (a < b ? a : b);
 {
 
        return (a < b ? a : b);
@@ -108,23 +56,12 @@ min(a, b)
 
 unsigned
 max(a, b)
 
 unsigned
 max(a, b)
-       unsigned int a, b;
+       u_int a, b;
 {
 
        return (a > b ? a : b);
 }
 
 {
 
        return (a > b ? a : b);
 }
 
-struct proc *
-pfind(pid)
-       int pid;
-{
-       register struct proc *p;
-
-       for (p = &proc[pidhash[PIDHASH(pid)]]; p != &proc[0]; p = &proc[p->p_idhash])
-               if (p->p_pid == pid)
-                       return (p);
-       return ((struct proc *)0);
-}
 extern cabase, calimit;
 extern struct pte camap[];
 
 extern cabase, calimit;
 extern struct pte camap[];
 
@@ -174,25 +111,12 @@ ffs(mask)
        return (0);
 }
 
        return (0);
 }
 
-ffs(mask)
-       register long mask;
-{
-       register int i;
-
-       for(i=1; i<NSIG; i++) {
-               if (mask & 1)
-                       return (i);
-               mask >>= 1;
-       }
-       return (0);
-}
-
 bcmp(s1, s2, len)
        register char *s1, *s2;
        register int len;
 {
 
 bcmp(s1, s2, len)
        register char *s1, *s2;
        register int len;
 {
 
-       while (--len)
+       while (len--)
                if (*s1++ != *s2++)
                        return (1);
        return (0);
                if (*s1++ != *s2++)
                        return (1);
        return (0);
@@ -209,35 +133,6 @@ strlen(s1)
 }
 #endif
 
 }
 #endif
 
-copyuout(uio, to, len)
-       register struct uio *uio;
-       caddr_t to;
-       int len;
-{
-       register struct iovec *iov = uio->uio_iov;
-       int error = 0;
-       int count;
-
-       while (uio->uio_iovcnt > 0) {
-               count = iov->iov_len;
-               if (count > len)
-                       count = len;
-               if (copyout(iov->iov_base, to, count)) {
-                       error = EFAULT;
-                       break;
-               }
-               iov->iov_base += len;
-               to += count;
-               uio->uio_resid -= count;
-               iov->iov_len -= len;
-               iov++;
-               uio->uio_iovcnt--;
-               if (iov->iov_len)
-                       break;
-       }
-       return (error);
-}
-
 /*
  * Pass back c to the user.
  */
 /*
  * Pass back c to the user.
  */
@@ -246,7 +141,6 @@ passuc(c, uio)
        struct uio *uio;
 {
        register struct iovec *iov = uio->uio_iov;
        struct uio *uio;
 {
        register struct iovec *iov = uio->uio_iov;
-       register id;
 
        switch (uio->uio_segflg) {
 
 
        switch (uio->uio_segflg) {