MCLALLOC must be called at splimp
[unix-history] / usr / src / sys / kern / subr_xxx.c
index 67ff7b4..c2a540d 100644 (file)
@@ -1,18 +1,25 @@
-/*     subr_xxx.c      4.19    82/10/17        */
-
-#include "../h/param.h"
-#include "../h/systm.h"
-#include "../h/conf.h"
-#include "../h/inode.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/buf.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"
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)subr_xxx.c  7.1 (Berkeley) %G%
+ */
+
+#include "../machine/pte.h"
+
+#include "param.h"
+#include "systm.h"
+#include "conf.h"
+#include "inode.h"
+#include "dir.h"
+#include "user.h"
+#include "buf.h"
+#include "proc.h"
+#include "fs.h"
+#include "vm.h"
+#include "cmap.h"
+#include "uio.h"
 
 /*
  * Routine placed in illegal entries in the bdevsw and cdevsw tables.
 
 /*
  * Routine placed in illegal entries in the bdevsw and cdevsw tables.
@@ -33,6 +40,7 @@ nulldev()
        return (0);
 }
 
        return (0);
 }
 
+#ifdef notdef
 imin(a, b)
 {
 
 imin(a, b)
 {
 
@@ -60,6 +68,7 @@ max(a, b)
 
        return (a > b ? a : b);
 }
 
        return (a > b ? a : b);
 }
+#endif notdef
 
 extern cabase, calimit;
 extern struct pte camap[];
 
 extern cabase, calimit;
 extern struct pte camap[];
@@ -96,26 +105,25 @@ calloc(size)
        return (res);
 }
 
        return (res);
 }
 
-#ifndef vax
-ffs(mask)
-       register long mask;
+#ifdef GPROF
+/*
+ * Stub routine in case it is ever possible to free space.
+ */
+cfreemem(cp, size)
+       caddr_t cp;
+       int size;
 {
 {
-       register int i;
-
-       for(i=1; i<NSIG; i++) {
-               if (mask & 1)
-                       return (i);
-               mask >>= 1;
-       }
-       return (0);
+       printf("freeing %x, size %d\n", cp, size);
 }
 }
+#endif
 
 
+#ifndef vax
 ffs(mask)
        register long mask;
 {
        register int i;
 
 ffs(mask)
        register long mask;
 {
        register int i;
 
-       for(i=1; i<NSIG; i++) {
+       for(i = 1; i < NSIG; i++) {
                if (mask & 1)
                        return (i);
                mask >>= 1;
                if (mask & 1)
                        return (i);
                mask >>= 1;
@@ -128,7 +136,7 @@ bcmp(s1, s2, len)
        register int len;
 {
 
        register int len;
 {
 
-       while (--len)
+       while (len--)
                if (*s1++ != *s2++)
                        return (1);
        return (0);
                if (*s1++ != *s2++)
                        return (1);
        return (0);
@@ -144,41 +152,3 @@ strlen(s1)
        return (len);
 }
 #endif
        return (len);
 }
 #endif
-
-/*
- * Pass back c to the user.
- */
-passuc(c, uio)
-       register c;
-       struct uio *uio;
-{
-       register struct iovec *iov = uio->uio_iov;
-
-       switch (uio->uio_segflg) {
-
-       case 0:
-               if (subyte(iov->iov_base, c) < 0)
-                       goto fault;
-               break;
-
-       case 1:
-               *iov->iov_base = c;
-               break;
-
-       case 2:
-               if (suibyte(iov->iov_base, c) < 0)
-                       goto fault;
-               break;
-       }
-       iov->iov_base++;
-       iov->iov_len--;
-       uio->uio_resid--;
-       uio->uio_offset++;
-       if (iov->iov_len <= 0) {
-               uio->uio_iov++;
-               uio->uio_iovcnt--;
-       }
-       return (0);
-fault:
-       return (EFAULT);
-}