sleep doesn't need spl0 (idle does it)
[unix-history] / usr / src / sys / kern / uipc_syscalls.c
index 5e77fc8..8d9fbce 100644 (file)
@@ -2,11 +2,10 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)uipc_syscalls.c     7.21 (Berkeley) %G%
+ *     @(#)uipc_syscalls.c     7.24 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
-#include "user.h"
 #include "filedesc.h"
 #include "proc.h"
 #include "file.h"
 #include "filedesc.h"
 #include "proc.h"
 #include "file.h"
@@ -46,9 +45,8 @@ socket(p, uap, retval)
        fp->f_type = DTYPE_SOCKET;
        fp->f_ops = &socketops;
        if (error = socreate(uap->domain, &so, uap->type, uap->protocol)) {
        fp->f_type = DTYPE_SOCKET;
        fp->f_ops = &socketops;
        if (error = socreate(uap->domain, &so, uap->type, uap->protocol)) {
-               OFILE(fdp, fd) = 0;
-               crfree(fp->f_cred);
-               fp->f_count = 0;
+               fdp->fd_ofiles[fd] = 0;
+               ffree(fp);
        } else {
                fp->f_data = (caddr_t)so;
                *retval = fd;
        } else {
                fp->f_data = (caddr_t)so;
                *retval = fd;
@@ -308,13 +306,11 @@ socketpair(p, uap, retval)
        retval[1] = sv[1];              /* XXX ??? */
        return (error);
 free4:
        retval[1] = sv[1];              /* XXX ??? */
        return (error);
 free4:
-       crfree(fp2->f_cred);
-       fp2->f_count = 0;
-       OFILE(fdp, sv[1]) = 0;
+       ffree(fp2);
+       fdp->fd_ofiles[sv[1]] = 0;
 free3:
 free3:
-       crfree(fp1->f_cred);
-       fp1->f_count = 0;
-       OFILE(fdp, sv[0]) = 0;
+       ffree(fp1);
+       fdp->fd_ofiles[sv[0]] = 0;
 free2:
        (void)soclose(so2);
 free1:
 free2:
        (void)soclose(so2);
 free1:
@@ -473,6 +469,7 @@ sendit(p, s, mp, flags, retsize)
        auio.uio_iovcnt = mp->msg_iovlen;
        auio.uio_segflg = UIO_USERSPACE;
        auio.uio_rw = UIO_WRITE;
        auio.uio_iovcnt = mp->msg_iovlen;
        auio.uio_segflg = UIO_USERSPACE;
        auio.uio_rw = UIO_WRITE;
+       auio.uio_procp = p;
        auio.uio_offset = 0;                    /* XXX */
        auio.uio_resid = 0;
        iov = mp->msg_iov;
        auio.uio_offset = 0;                    /* XXX */
        auio.uio_resid = 0;
        iov = mp->msg_iov;
@@ -739,6 +736,7 @@ recvit(p, s, mp, namelenp, retsize)
        auio.uio_iovcnt = mp->msg_iovlen;
        auio.uio_segflg = UIO_USERSPACE;
        auio.uio_rw = UIO_READ;
        auio.uio_iovcnt = mp->msg_iovlen;
        auio.uio_segflg = UIO_USERSPACE;
        auio.uio_rw = UIO_READ;
+       auio.uio_procp = p;
        auio.uio_offset = 0;                    /* XXX */
        auio.uio_resid = 0;
        iov = mp->msg_iov;
        auio.uio_offset = 0;                    /* XXX */
        auio.uio_resid = 0;
        iov = mp->msg_iov;
@@ -967,11 +965,11 @@ pipe(p, uap, retval)
                goto free4;
        return (0);
 free4:
                goto free4;
        return (0);
 free4:
-       wf->f_count = 0;
-       OFILE(fdp, retval[1]) = 0;
+       ffree(wf);
+       fdp->fd_ofiles[retval[1]] = 0;
 free3:
 free3:
-       rf->f_count = 0;
-       OFILE(fdp, retval[0]) = 0;
+       ffree(rf);
+       fdp->fd_ofiles[retval[0]] = 0;
 free2:
        (void)soclose(wso);
 free1:
 free2:
        (void)soclose(wso);
 free1:
@@ -1188,8 +1186,8 @@ getsock(fdp, fdes, fpp)
 {
        register struct file *fp;
 
 {
        register struct file *fp;
 
-       if ((unsigned)fdes >= fdp->fd_maxfiles ||
-           (fp = OFILE(fdp, fdes)) == NULL)
+       if ((unsigned)fdes >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fdes]) == NULL)
                return (EBADF);
        if (fp->f_type != DTYPE_SOCKET)
                return (ENOTSOCK);
                return (EBADF);
        if (fp->f_type != DTYPE_SOCKET)
                return (ENOTSOCK);