RLIMIT_OFILE => RLIMIT_NOFILE for compatibility with other UNIX's
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 2 Dec 1992 05:35:37 +0000 (21:35 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 2 Dec 1992 05:35:37 +0000 (21:35 -0800)
SCCS-vsn: sys/kern/kern_descrip.c 7.39

usr/src/sys/kern/kern_descrip.c

index 43e2286..4ebab3e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_descrip.c      7.38 (Berkeley) %G%
+ *     @(#)kern_descrip.c      7.39 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -42,7 +42,7 @@ getdtablesize(p, uap, retval)
        int *retval;
 {
 
        int *retval;
 {
 
-       *retval = p->p_rlimit[RLIMIT_OFILE].rlim_cur;
+       *retval = p->p_rlimit[RLIMIT_NOFILE].rlim_cur;
        return (0);
 }
 
        return (0);
 }
 
@@ -101,7 +101,7 @@ dup2(p, uap, retval)
 
        if (old >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[old]) == NULL ||
 
        if (old >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[old]) == NULL ||
-           new >= p->p_rlimit[RLIMIT_OFILE].rlim_cur)
+           new >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur)
                return (EBADF);
        *retval = new;
        if (old == new)
                return (EBADF);
        *retval = new;
        if (old == new)
@@ -154,7 +154,7 @@ fcntl(p, uap, retval)
        pop = &fdp->fd_ofileflags[uap->fd];
        switch(uap->cmd) {
        case F_DUPFD:
        pop = &fdp->fd_ofileflags[uap->fd];
        switch(uap->cmd) {
        case F_DUPFD:
-               if ((unsigned)uap->arg >= p->p_rlimit[RLIMIT_OFILE].rlim_cur)
+               if ((unsigned)uap->arg >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur)
                        return (EINVAL);
                if (error = fdalloc(p, uap->arg, &i))
                        return (error);
                        return (EINVAL);
                if (error = fdalloc(p, uap->arg, &i))
                        return (error);
@@ -413,7 +413,7 @@ fdalloc(p, want, result)
         * of want or fd_freefile.  If that fails, consider
         * expanding the ofile array.
         */
         * of want or fd_freefile.  If that fails, consider
         * expanding the ofile array.
         */
-       lim = p->p_rlimit[RLIMIT_OFILE].rlim_cur;
+       lim = p->p_rlimit[RLIMIT_NOFILE].rlim_cur;
        for (;;) {
                last = min(fdp->fd_nfiles, lim);
                if ((i = want) < fdp->fd_freefile)
        for (;;) {
                last = min(fdp->fd_nfiles, lim);
                if ((i = want) < fdp->fd_freefile)
@@ -473,7 +473,7 @@ fdavail(p, n)
        register struct file **fpp;
        register int i;
 
        register struct file **fpp;
        register int i;
 
-       if ((i = p->p_rlimit[RLIMIT_OFILE].rlim_cur - fdp->fd_nfiles) > 0 &&
+       if ((i = p->p_rlimit[RLIMIT_NOFILE].rlim_cur - fdp->fd_nfiles) > 0 &&
            (n -= i) <= 0)
                return (1);
        fpp = &fdp->fd_ofiles[fdp->fd_freefile];
            (n -= i) <= 0)
                return (1);
        fpp = &fdp->fd_ofiles[fdp->fd_freefile];