Eliminated the "physstrat" wart and merged it into kern_physio.c. This
[unix-history] / sys / kern / kern_descrip.c
index c62a464..8c731f9 100644 (file)
@@ -30,9 +30,9 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)kern_descrip.c      7.28 (Berkeley) 6/25/91
+ *     from: @(#)kern_descrip.c        7.28 (Berkeley) 6/25/91
+ *     $Id: kern_descrip.c,v 1.6 1993/12/19 00:51:22 wollman Exp $
  */
  */
-static char rcsid[] = "$Header: /home/cvs/386BSD/src/sys.386bsd/kern/kern_descrip.c,v 1.1.1.1 1993/06/12 14:57:34 rgrimes Exp $";
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -50,6 +50,8 @@ static char rcsid[] = "$Header: /home/cvs/386BSD/src/sys.386bsd/kern/kern_descri
 #include "syslog.h"
 #include "resourcevar.h"
 
 #include "syslog.h"
 #include "resourcevar.h"
 
+#include "vm/vm_user.h"
+
 /*
  * Descriptor management.
  */
 /*
  * Descriptor management.
  */
@@ -61,6 +63,7 @@ extern int maxfdescs; /* maximum number of file descriptors to a process */
  * System calls on descriptors.
  */
 /* ARGSUSED */
  * System calls on descriptors.
  */
 /* ARGSUSED */
+int
 getdtablesize(p, uap, retval)
        struct proc *p;
        struct args *uap;
 getdtablesize(p, uap, retval)
        struct proc *p;
        struct args *uap;
@@ -74,22 +77,28 @@ getdtablesize(p, uap, retval)
 /*
  * Duplicate a file descriptor.
  */
 /*
  * Duplicate a file descriptor.
  */
+
+struct dup_args {
+       int     i;
+};
+
 /* ARGSUSED */
 /* ARGSUSED */
+int
 dup(p, uap, retval)
        struct proc *p;
 dup(p, uap, retval)
        struct proc *p;
-       struct args {
-               int     i;
-       } *uap;
+       struct dup_args *uap;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        struct file *fp;
        int fd, error;
 
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        struct file *fp;
        int fd, error;
 
+#if 0
        /*
         * XXX Compatibility
         */
        if (uap->i &~ 077) { uap->i &= 077; return (dup2(p, uap, retval)); }
        /*
         * XXX Compatibility
         */
        if (uap->i &~ 077) { uap->i &= 077; return (dup2(p, uap, retval)); }
+#endif
 
        if ((unsigned)uap->i >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[uap->i]) == NULL)
 
        if ((unsigned)uap->i >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[uap->i]) == NULL)
@@ -108,13 +117,17 @@ dup(p, uap, retval)
 /*
  * Duplicate a file descriptor to a particular value.
  */
 /*
  * Duplicate a file descriptor to a particular value.
  */
+
+struct dup2_args {
+       u_int   from;
+       u_int   to;
+};
+
 /* ARGSUSED */
 /* ARGSUSED */
+int
 dup2(p, uap, retval)
        struct proc *p;
 dup2(p, uap, retval)
        struct proc *p;
-       struct args {
-               u_int   from;
-               u_int   to;
-       } *uap;
+       struct dup2_args *uap;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
@@ -154,14 +167,18 @@ dup2(p, uap, retval)
 /*
  * The file control system call.
  */
 /*
  * The file control system call.
  */
+
+struct fcntl_args {
+       int     fd;
+       int     cmd;
+       int     arg;
+};
+
 /* ARGSUSED */
 /* ARGSUSED */
+int
 fcntl(p, uap, retval)
        struct proc *p;
 fcntl(p, uap, retval)
        struct proc *p;
-       register struct args {
-               int     fd;
-               int     cmd;
-               int     arg;
-       } *uap;
+       register struct fcntl_args *uap;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
@@ -304,11 +321,14 @@ fcntl(p, uap, retval)
  * Close a file descriptor.
  */
 /* ARGSUSED */
  * Close a file descriptor.
  */
 /* ARGSUSED */
+struct close_args {
+       int     fd;
+};
+
+int
 close(p, uap, retval)
        struct proc *p;
 close(p, uap, retval)
        struct proc *p;
-       struct args {
-               int     fd;
-       } *uap;
+       struct close_args *uap;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
@@ -334,13 +354,17 @@ close(p, uap, retval)
 /*
  * Return status information about a file descriptor.
  */
 /*
  * Return status information about a file descriptor.
  */
+
+struct fstat_args {
+       int     fd;
+       struct  stat *sb;
+};
+
 /* ARGSUSED */
 /* ARGSUSED */
+int
 fstat(p, uap, retval)
        struct proc *p;
 fstat(p, uap, retval)
        struct proc *p;
-       register struct args {
-               int     fd;
-               struct  stat *sb;
-       } *uap;
+       register struct fstat_args *uap;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
@@ -375,6 +399,7 @@ fstat(p, uap, retval)
  */
 int fdexpand;
 
  */
 int fdexpand;
 
+int
 fdalloc(p, want, result)
        struct proc *p;
        int want;
 fdalloc(p, want, result)
        struct proc *p;
        int want;
@@ -443,6 +468,7 @@ fdalloc(p, want, result)
  * Check to see whether n user file descriptors
  * are available to the process p.
  */
  * Check to see whether n user file descriptors
  * are available to the process p.
  */
+int
 fdavail(p, n)
        struct proc *p;
        register int n;
 fdavail(p, n)
        struct proc *p;
        register int n;
@@ -465,6 +491,7 @@ fdavail(p, n)
  * Create a new open file structure and allocate
  * a file decriptor for the process that refers to it.
  */
  * Create a new open file structure and allocate
  * a file decriptor for the process that refers to it.
  */
+int
 falloc(p, resultfp, resultfd)
        register struct proc *p;
        struct file **resultfp;
 falloc(p, resultfp, resultfd)
        register struct proc *p;
        struct file **resultfp;
@@ -512,6 +539,7 @@ falloc(p, resultfp, resultfd)
 /*
  * Free a file descriptor.
  */
 /*
  * Free a file descriptor.
  */
+void
 ffree(fp)
        register struct file *fp;
 {
 ffree(fp)
        register struct file *fp;
 {
@@ -645,6 +673,7 @@ fdcloseexec(p)
  * Internal form of close.
  * Decrement reference count on file structure.
  */
  * Internal form of close.
  * Decrement reference count on file structure.
  */
+int
 closef(fp, p)
        register struct file *fp;
        register struct proc *p;
 closef(fp, p)
        register struct file *fp;
        register struct proc *p;
@@ -693,13 +722,16 @@ closef(fp, p)
  * the entire file (l_whence = SEEK_SET, l_start = 0, l_len = 0).
  */
 
  * the entire file (l_whence = SEEK_SET, l_start = 0, l_len = 0).
  */
 
+struct flock_args {
+       int     fd;
+       int     how;
+};
+
 /* ARGSUSED */
 /* ARGSUSED */
+int
 flock(p, uap, retval)
        struct proc *p;
 flock(p, uap, retval)
        struct proc *p;
-       register struct args {
-               int     fd;
-               int     how;
-       } *uap;
+       register struct flock_args *uap;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
        int *retval;
 {
        register struct filedesc *fdp = p->p_fd;
@@ -743,6 +775,7 @@ flock(p, uap, retval)
  * references to this file will be direct to the other driver.
  */
 /* ARGSUSED */
  * references to this file will be direct to the other driver.
  */
 /* ARGSUSED */
+int
 fdopen(dev, mode, type)
        dev_t dev;
        int mode, type;
 fdopen(dev, mode, type)
        dev_t dev;
        int mode, type;
@@ -763,6 +796,7 @@ fdopen(dev, mode, type)
 /*
  * Duplicate the specified descriptor to a free descriptor.
  */
 /*
  * Duplicate the specified descriptor to a free descriptor.
  */
+int
 dupfdopen(fdp, indx, dfd, mode)
        register struct filedesc *fdp;
        register int indx, dfd;
 dupfdopen(fdp, indx, dfd, mode)
        register struct filedesc *fdp;
        register int indx, dfd;