Lines Matching defs:new
115 int finishdup(proc_t p, struct filedesc *fdp, int old, int new, register_t *retval);
371 * *retval (modified) The new descriptor
378 int new, error;
386 if ( (error = fdalloc(p, 0, &new)) ) {
391 error = finishdup(p, fdp, old, new, retval);
413 * *retval (modified) The new descriptor
419 int old = uap->from, new = uap->to;
430 if (new < 0 ||
431 (rlim_t)new >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
432 new >= maxfiles) {
437 if (old == new) {
439 *retval = new;
443 if (new < 0 || new >= fdp->fd_nfiles) {
444 if ( (error = fdalloc(p, new, &i)) ) {
449 if (new != i) {
455 while ((fdp->fd_ofileflags[new] & UF_RESERVED) == UF_RESERVED) {
457 procfdtbl_waitfd(p, new);
464 if ((fdp->fd_ofiles[new] != NULL) && ((error = fp_lookup(p, new, &nfp, 1)) == 0)) {
466 (void)close_internal_locked(p, new, nfp, FD_DUP2RESV);
470 procfdtbl_clearfd(p, new);
474 if (fdp->fd_ofiles[new] != NULL)
475 panic("dup2: unable to get ref on a fileproc %d\n", new);
477 procfdtbl_reservefd(p, new);
486 if (fdp->fd_ofiles[new] != 0)
487 panic("dup2-1: overwriting fd_ofiles with new %d\n", new);
488 if ((fdp->fd_ofileflags[new] & UF_RESERVED) == 0)
489 panic("dup2-1: unreserved fileflags with new %d\n", new);
491 error = finishdup(p, fdp, old, new, retval);
1626 * new The fd to dup it to
1634 * *retval (modified) The new descriptor
1644 finishdup(proc_t p, struct filedesc *fdp, int old, int new, register_t *retval)
1658 fdrelse(p, new);
1664 error = mac_file_check_dup(proc_ucred(p), ofp->f_fglob, new);
1667 fdrelse(p, new);
1681 fdrelse(p, new);
1692 if (fdp->fd_ofiles[new] != 0)
1693 panic("finishdup: overwriting fd_ofiles with new %d\n", new);
1694 if ((fdp->fd_ofileflags[new] & UF_RESERVED) == 0)
1695 panic("finishdup: unreserved fileflags with new %d\n", new);
1698 if (new > fdp->fd_lastfile)
1699 fdp->fd_lastfile = new;
1700 procfdtbl_releasefd(p, new, nfp);
1701 *retval = new;
2286 * and zero the new portion of each array.
3319 * Create a new open file structure and allocate
3389 * Allocate a new file descriptor.
3509 * will end up with a "ghost" socket reference in the new process.
3551 * forkproc() when forking a new process, to copy the per process
3552 * open file table over to the new process.
3560 * !NULL Pointer to new struct filedesc
3564 * Notes: Files are copied directly, ignoring the new resource limits
3605 * inherit the new current working directory from the current thread
3629 * we couldn't get a new reference on
3653 * We couldn't get a new reference on
3658 * the new process.
4155 * mode mode to set on new fd
4179 * closed, reject. Note, check for new == old is necessary as
4181 * as the new descriptor.