From owner-svn-src-stable@freebsd.org Sat Jul 15 17:25:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF7D3AFE8CF; Sat, 15 Jul 2017 17:25:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A0E877C2A; Sat, 15 Jul 2017 17:25:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FHPfKd065313; Sat, 15 Jul 2017 17:25:41 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FHPeF5065300; Sat, 15 Jul 2017 17:25:40 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151725.v6FHPeF5065300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 17:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321020 - in stable/10/sys: compat/svr4 dev/streams kern netinet ofed/include/linux sys X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: compat/svr4 dev/streams kern netinet ofed/include/linux sys X-SVN-Commit-Revision: 321020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:25:42 -0000 Author: dchagin Date: Sat Jul 15 17:25:40 2017 New Revision: 321020 URL: https://svnweb.freebsd.org/changeset/base/321020 Log: MFC r281436 (by mjg@): fd: remove filedesc argument from fdclose Just accept a thread instead. This makes it consistent with fdalloc. No functional changes. Modified: stable/10/sys/compat/svr4/svr4_stream.c stable/10/sys/dev/streams/streams.c stable/10/sys/kern/kern_descrip.c stable/10/sys/kern/kern_fork.c stable/10/sys/kern/sys_pipe.c stable/10/sys/kern/tty_pts.c stable/10/sys/kern/uipc_mqueue.c stable/10/sys/kern/uipc_sem.c stable/10/sys/kern/uipc_shm.c stable/10/sys/kern/uipc_syscalls.c stable/10/sys/netinet/sctp_syscalls.c stable/10/sys/ofed/include/linux/file.h stable/10/sys/sys/filedesc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/svr4/svr4_stream.c ============================================================================== --- stable/10/sys/compat/svr4/svr4_stream.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/compat/svr4/svr4_stream.c Sat Jul 15 17:25:40 2017 (r321020) @@ -1828,7 +1828,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); @@ -1966,7 +1966,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: stable/10/sys/dev/streams/streams.c ============================================================================== --- stable/10/sys/dev/streams/streams.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/dev/streams/streams.c Sat Jul 15 17:25:40 2017 (r321020) @@ -188,7 +188,6 @@ MODULE_DEPEND(streams, svr4elf, 1, 1, 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; @@ -244,14 +243,13 @@ streamsopen(struct cdev *dev, int oflags, int devtype, 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: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/kern_descrip.c Sat Jul 15 17:25:40 2017 (r321020) @@ -2184,8 +2184,9 @@ setugidsafety(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: stable/10/sys/kern/kern_fork.c ============================================================================== --- stable/10/sys/kern/kern_fork.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/kern_fork.c Sat Jul 15 17:25:40 2017 (r321020) @@ -983,7 +983,7 @@ fail2: uma_zfree(proc_zone, newproc); #ifdef PROCDESC 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); } #endif Modified: stable/10/sys/kern/sys_pipe.c ============================================================================== --- stable/10/sys/kern/sys_pipe.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/sys_pipe.c Sat Jul 15 17:25:40 2017 (r321020) @@ -403,13 +403,11 @@ kern_pipe(struct thread *td, int fildes[2]) 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; @@ -435,7 +433,7 @@ kern_pipe2(struct thread *td, int fildes[2], int flags 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: stable/10/sys/kern/tty_pts.c ============================================================================== --- stable/10/sys/kern/tty_pts.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/tty_pts.c Sat Jul 15 17:25:40 2017 (r321020) @@ -839,7 +839,7 @@ sys_posix_openpt(struct thread *td, struct posix_openp /* 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: stable/10/sys/kern/uipc_mqueue.c ============================================================================== --- stable/10/sys/kern/uipc_mqueue.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_mqueue.c Sat Jul 15 17:25:40 2017 (r321020) @@ -2023,7 +2023,7 @@ kern_kmq_open(struct thread *td, const char *upath, in if (error) { sx_xunlock(&mqfs_data.mi_lock); - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: stable/10/sys/kern/uipc_sem.c ============================================================================== --- stable/10/sys/kern/uipc_sem.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_sem.c Sat Jul 15 17:25:40 2017 (r321020) @@ -515,7 +515,7 @@ ksem_create(struct thread *td, const char *name, semid */ 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); } @@ -535,7 +535,7 @@ ksem_create(struct thread *td, const char *name, semid 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); @@ -586,7 +586,7 @@ ksem_create(struct thread *td, const char *name, semid 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: stable/10/sys/kern/uipc_shm.c ============================================================================== --- stable/10/sys/kern/uipc_shm.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_shm.c Sat Jul 15 17:25:40 2017 (r321020) @@ -741,7 +741,7 @@ sys_shm_open(struct thread *td, struct shm_open_args * 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); } @@ -757,7 +757,7 @@ sys_shm_open(struct thread *td, struct shm_open_args * 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); @@ -823,7 +823,7 @@ sys_shm_open(struct thread *td, struct shm_open_args * sx_xunlock(&shm_dict_lock); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 17:25:40 2017 (r321020) @@ -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) @@ -386,7 +386,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); @@ -540,7 +540,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 @@ -710,7 +710,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; @@ -774,10 +773,10 @@ kern_socketpair(struct thread *td, int domain, int typ 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: stable/10/sys/netinet/sctp_syscalls.c ============================================================================== --- stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:25:40 2017 (r321020) @@ -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: stable/10/sys/ofed/include/linux/file.h ============================================================================== --- stable/10/sys/ofed/include/linux/file.h Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/ofed/include/linux/file.h Sat Jul 15 17:25:40 2017 (r321020) @@ -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: stable/10/sys/sys/filedesc.h ============================================================================== --- stable/10/sys/sys/filedesc.h Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/sys/filedesc.h Sat Jul 15 17:25:40 2017 (r321020) @@ -154,7 +154,7 @@ int fdalloc(struct thread *td, int minfd, int *result) int fdallocn(struct thread *td, int minfd, int *fds, int n); int fdavail(struct thread *td, 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); struct filedesc *fdcopy(struct filedesc *fdp); void fdunshare(struct thread *td);