[BACK]Return to sys_descrip.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/kern/sys_descrip.c between version 1.1.4.3 and 1.2

version 1.1.4.3, 2008/12/27 23:14:24 version 1.2, 2008/04/24 18:39:24
Line 12 
Line 12 
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
    * 3. All advertising materials mentioning features or use of this software
    *    must display the following acknowledgement:
    *      This product includes software developed by the NetBSD
    *      Foundation, Inc. and its contributors.
    * 4. Neither the name of The NetBSD Foundation nor the names of its
    *    contributors may be used to endorse or promote products derived
    *    from this software without specific prior written permission.
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS   * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
Line 111  sys_dup(struct lwp *l, const struct sys_
Line 118  sys_dup(struct lwp *l, const struct sys_
         if ((fp = fd_getfile(old)) == NULL) {          if ((fp = fd_getfile(old)) == NULL) {
                 return EBADF;                  return EBADF;
         }          }
         error = fd_dup(fp, 0, &new, false);          error = fd_dup(fp, 0, &new, 0);
         fd_putfile(old);          fd_putfile(old);
         *retval = new;          *retval = new;
         return error;          return error;
Line 136  sys_dup2(struct lwp *l, const struct sys
Line 143  sys_dup2(struct lwp *l, const struct sys
         if ((fp = fd_getfile(old)) == NULL) {          if ((fp = fd_getfile(old)) == NULL) {
                 return EBADF;                  return EBADF;
         }          }
         mutex_enter(&fp->f_lock);  
         fp->f_count++;  
         mutex_exit(&fp->f_lock);  
         fd_putfile(old);  
   
         if ((u_int)new >= curproc->p_rlimit[RLIMIT_NOFILE].rlim_cur ||          if ((u_int)new >= curproc->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
             (u_int)new >= maxfiles) {              (u_int)new >= maxfiles) {
                 error = EBADF;                  error = EBADF;
Line 149  sys_dup2(struct lwp *l, const struct sys
Line 151  sys_dup2(struct lwp *l, const struct sys
         } else {          } else {
                 error = fd_dup2(fp, new);                  error = fd_dup2(fp, new);
         }          }
         closef(fp);          fd_putfile(old);
         *retval = new;          *retval = new;
   
         return error;          return 0;
 }  }
   
 /*  /*
Line 314  sys_fcntl(struct lwp *l, const struct sy
Line 316  sys_fcntl(struct lwp *l, const struct sy
         filedesc_t *fdp;          filedesc_t *fdp;
         file_t *fp;          file_t *fp;
         fdfile_t *ff;          fdfile_t *ff;
           proc_t *p;
         struct flock fl;          struct flock fl;
   
           p = l->l_proc;
         fd = SCARG(uap, fd);          fd = SCARG(uap, fd);
         cmd = SCARG(uap, cmd);          cmd = SCARG(uap, cmd);
         fdp = l->l_fd;          fdp = p->p_fd;
         error = 0;          error = 0;
   
         switch (cmd) {          switch (cmd) {
Line 367  sys_fcntl(struct lwp *l, const struct sy
Line 371  sys_fcntl(struct lwp *l, const struct sy
         switch (cmd) {          switch (cmd) {
         case F_DUPFD:          case F_DUPFD:
                 newmin = (long)SCARG(uap, arg);                  newmin = (long)SCARG(uap, arg);
                 if ((u_int)newmin >=                  if ((u_int)newmin >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
                     l->l_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur ||  
                     (u_int)newmin >= maxfiles) {                      (u_int)newmin >= maxfiles) {
                         fd_putfile(fd);                          fd_putfile(fd);
                         return EINVAL;                          return EINVAL;
                 }                  }
                 error = fd_dup(fp, newmin, &i, false);                  error = fd_dup(fp, newmin, &i, 0);
                 *retval = i;                  *retval = i;
                 break;                  break;
   
Line 383  sys_fcntl(struct lwp *l, const struct sy
Line 386  sys_fcntl(struct lwp *l, const struct sy
   
         case F_SETFD:          case F_SETFD:
                 if ((long)SCARG(uap, arg) & 1) {                  if ((long)SCARG(uap, arg) & 1) {
                         ff->ff_exclose = true;                          ff->ff_exclose = 1;
                         fdp->fd_exclose = true;                          fdp->fd_exclose = 1;
                 } else {                  } else {
                         ff->ff_exclose = false;                          ff->ff_exclose = 0;
                 }                  }
                 break;                  break;
   
Line 433  sys_fcntl(struct lwp *l, const struct sy
Line 436  sys_fcntl(struct lwp *l, const struct sy
                 break;                  break;
   
         case F_SETOWN:          case F_SETOWN:
                 tmp = (int)(uintptr_t) SCARG(uap, arg);                  tmp = (int)(intptr_t) SCARG(uap, arg);
                 error = (*fp->f_ops->fo_ioctl)(fp, FIOSETOWN, &tmp);                  error = (*fp->f_ops->fo_ioctl)(fp, FIOSETOWN, &tmp);
                 break;                  break;
   
Line 484  do_sys_fstat(int fd, struct stat *sb)
Line 487  do_sys_fstat(int fd, struct stat *sb)
  * Return status information about a file descriptor.   * Return status information about a file descriptor.
  */   */
 int  int
 sys___fstat50(struct lwp *l, const struct sys___fstat50_args *uap,  sys___fstat30(struct lwp *l, const struct sys___fstat30_args *uap,
               register_t *retval)                register_t *retval)
 {  {
         /* {          /* {

Legend:
Removed from v.1.1.4.3  
changed lines
  Added in v.1.2

CVSweb <webmaster@jp.NetBSD.org>