Author: mjg Date: Sat Apr 11 15:40:28 2015 New Revision: 281436 URL: https://svnweb.freebsd.org/changeset/base/281436
Log: fd: remove filedesc argument from fdclose Just accept a thread instead. This makes it consistent with fdalloc. No functional changes. Modified: head/sys/compat/svr4/svr4_stream.c head/sys/dev/streams/streams.c head/sys/kern/kern_descrip.c head/sys/kern/kern_fork.c head/sys/kern/sys_pipe.c head/sys/kern/tty_pts.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_sem.c head/sys/kern/uipc_shm.c head/sys/kern/uipc_syscalls.c head/sys/netinet/sctp_syscalls.c head/sys/ofed/include/linux/file.h head/sys/sys/filedesc.h Modified: head/sys/compat/svr4/svr4_stream.c ============================================================================== --- head/sys/compat/svr4/svr4_stream.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/compat/svr4/svr4_stream.c Sat Apr 11 15:40:28 2015 (r281436) @@ -1829,7 +1829,7 @@ svr4_do_getmsg(td, uap, fp) break; default: - fdclose(td->td_proc->p_fd, afp, st->s_afd, td); + fdclose(td, afp, st->s_afd); fdrop(afp, td); st->s_afd = -1; mtx_unlock(&Giant); @@ -1967,7 +1967,7 @@ svr4_do_getmsg(td, uap, fp) if (error) { if (afp) { - fdclose(td->td_proc->p_fd, afp, st->s_afd, td); + fdclose(td, afp, st->s_afd); fdrop(afp, td); st->s_afd = -1; } Modified: head/sys/dev/streams/streams.c ============================================================================== --- head/sys/dev/streams/streams.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/dev/streams/streams.c Sat Apr 11 15:40:28 2015 (r281436) @@ -180,7 +180,6 @@ MODULE_VERSION(streams, 1); static int streamsopen(struct cdev *dev, int oflags, int devtype, struct thread *td) { - struct filedesc *fdp; struct svr4_strm *st; struct socket *so; struct file *fp; @@ -236,14 +235,13 @@ streamsopen(struct cdev *dev, int oflags return EOPNOTSUPP; } - fdp = td->td_proc->p_fd; if ((error = falloc(td, &fp, &fd, 0)) != 0) return error; /* An extra reference on `fp' has been held for us by falloc(). */ error = socreate(family, &so, type, protocol, td->td_ucred, td); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return error; } Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/kern_descrip.c Sat Apr 11 15:40:28 2015 (r281436) @@ -2155,8 +2155,9 @@ fdsetugidsafety(struct thread *td) * file descriptor out from under the thread creating the file object. */ void -fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td) +fdclose(struct thread *td, struct file *fp, int idx) { + struct filedesc *fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); if (fdp->fd_ofiles[idx].fde_file == fp) { Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/kern_fork.c Sat Apr 11 15:40:28 2015 (r281436) @@ -949,7 +949,7 @@ fail2: vmspace_free(vm2); uma_zfree(proc_zone, newproc); if ((flags & RFPROCDESC) != 0 && fp_procdesc != NULL) { - fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td); + fdclose(td, fp_procdesc, *procdescp); fdrop(fp_procdesc, td); } pause("fork", hz / 2); Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/sys_pipe.c Sat Apr 11 15:40:28 2015 (r281436) @@ -406,13 +406,11 @@ kern_pipe(struct thread *td, int fildes[ int kern_pipe2(struct thread *td, int fildes[2], int flags) { - struct filedesc *fdp; struct file *rf, *wf; struct pipe *rpipe, *wpipe; struct pipepair *pp; int fd, fflags, error; - fdp = td->td_proc->p_fd; pipe_paircreate(td, &pp); rpipe = &pp->pp_rpipe; wpipe = &pp->pp_wpipe; @@ -438,7 +436,7 @@ kern_pipe2(struct thread *td, int fildes finit(rf, fflags, DTYPE_PIPE, rpipe, &pipeops); error = falloc(td, &wf, &fd, flags); if (error) { - fdclose(fdp, rf, fildes[0], td); + fdclose(td, rf, fildes[0]); fdrop(rf, td); /* rpipe has been closed by fdrop(). */ pipeclose(wpipe); Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/tty_pts.c Sat Apr 11 15:40:28 2015 (r281436) @@ -845,7 +845,7 @@ sys_posix_openpt(struct thread *td, stru /* Allocate the actual pseudo-TTY. */ error = pts_alloc(FFLAGS(uap->flags & O_ACCMODE), td, fp); if (error != 0) { - fdclose(td->td_proc->p_fd, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/uipc_mqueue.c Sat Apr 11 15:40:28 2015 (r281436) @@ -2022,7 +2022,7 @@ kern_kmq_open(struct thread *td, const c if (error) { sx_xunlock(&mqfs_data.mi_lock); - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/uipc_sem.c Sat Apr 11 15:40:28 2015 (r281436) @@ -471,7 +471,7 @@ ksem_create(struct thread *td, const cha */ error = ksem_create_copyout_semid(td, semidp, fd, compat32); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } @@ -491,7 +491,7 @@ ksem_create(struct thread *td, const cha if (error == 0 && path[0] != '/') error = EINVAL; if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); free(path, M_KSEM); return (error); @@ -542,7 +542,7 @@ ksem_create(struct thread *td, const cha if (error) { KASSERT(ks == NULL, ("ksem_create error with a ksem")); - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/uipc_shm.c Sat Apr 11 15:40:28 2015 (r281436) @@ -718,7 +718,7 @@ sys_shm_open(struct thread *td, struct s if (uap->path == SHM_ANON) { /* A read-only anonymous object is pointless. */ if ((uap->flags & O_ACCMODE) == O_RDONLY) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (EINVAL); } @@ -734,7 +734,7 @@ sys_shm_open(struct thread *td, struct s if (error == 0 && path[0] != '/') error = EINVAL; if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); free(path, M_SHMFD); return (error); @@ -800,7 +800,7 @@ sys_shm_open(struct thread *td, struct s sx_xunlock(&shm_dict_lock); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/kern/uipc_syscalls.c Sat Apr 11 15:40:28 2015 (r281436) @@ -216,7 +216,7 @@ sys_socket(td, uap) error = socreate(uap->domain, &so, type, uap->protocol, td->td_ucred, td); if (error != 0) { - fdclose(td->td_proc->p_fd, fp, fd, td); + fdclose(td, fp, fd); } else { finit(fp, FREAD | FWRITE | fflag, DTYPE_SOCKET, so, &socketops); if ((fflag & FNONBLOCK) != 0) @@ -373,7 +373,7 @@ accept1(td, s, uname, anamelen, flags) error = copyout(&namelen, anamelen, sizeof(namelen)); if (error != 0) - fdclose(td->td_proc->p_fd, fp, td->td_retval[0], td); + fdclose(td, fp, td->td_retval[0]); fdrop(fp, td); free(name, M_SONAME); return (error); @@ -520,7 +520,7 @@ noconnection: * out from under us. */ if (error != 0) - fdclose(fdp, nfp, fd, td); + fdclose(td, nfp, fd); /* * Release explicitly held references before returning. We return @@ -683,7 +683,6 @@ int kern_socketpair(struct thread *td, int domain, int type, int protocol, int *rsv) { - struct filedesc *fdp = td->td_proc->p_fd; struct file *fp1, *fp2; struct socket *so1, *so2; int fd, error, oflag, fflag; @@ -747,10 +746,10 @@ kern_socketpair(struct thread *td, int d fdrop(fp2, td); return (0); free4: - fdclose(fdp, fp2, rsv[1], td); + fdclose(td, fp2, rsv[1]); fdrop(fp2, td); free3: - fdclose(fdp, fp1, rsv[0], td); + fdclose(td, fp1, rsv[0]); fdrop(fp1, td); free2: if (so2 != NULL) Modified: head/sys/netinet/sctp_syscalls.c ============================================================================== --- head/sys/netinet/sctp_syscalls.c Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/netinet/sctp_syscalls.c Sat Apr 11 15:40:28 2015 (r281436) @@ -187,7 +187,7 @@ noconnection: * out from under us. */ if (error != 0) - fdclose(td->td_proc->p_fd, nfp, fd, td); + fdclose(td, nfp, fd); /* * Release explicitly held references before returning. Modified: head/sys/ofed/include/linux/file.h ============================================================================== --- head/sys/ofed/include/linux/file.h Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/ofed/include/linux/file.h Sat Apr 11 15:40:28 2015 (r281436) @@ -82,7 +82,7 @@ put_unused_fd(unsigned int fd) * installed, so no need to free the associated Linux file * structure. */ - fdclose(curthread->td_proc->p_fd, file, fd, curthread); + fdclose(curthread, file, fd); /* drop extra reference */ fdrop(file, curthread); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sat Apr 11 11:00:53 2015 (r281435) +++ head/sys/sys/filedesc.h Sat Apr 11 15:40:28 2015 (r281436) @@ -152,7 +152,7 @@ int finstall(struct thread *td, struct f int fdalloc(struct thread *td, int minfd, int *result); int fdallocn(struct thread *td, int minfd, int *fds, int n); int fdcheckstd(struct thread *td); -void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); +void fdclose(struct thread *td, struct file *fp, int idx); void fdcloseexec(struct thread *td); void fdsetugidsafety(struct thread *td); struct filedesc *fdcopy(struct filedesc *fdp); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"