From owner-svn-src-all@freebsd.org Tue Jul 28 17:00:04 2015 Return-Path: Delivered-To: svn-src-all@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 1AB409AD86E; Tue, 28 Jul 2015 17:00:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 0B5E4C63; Tue, 28 Jul 2015 17:00:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SH03sS018106; Tue, 28 Jul 2015 17:00:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SH03RZ018105; Tue, 28 Jul 2015 17:00:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281700.t6SH03RZ018105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285964 - releng/10.2/sys/kern X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:00:04 -0000 Author: kib Date: Tue Jul 28 17:00:03 2015 New Revision: 285964 URL: https://svnweb.freebsd.org/changeset/base/285964 Log: MFC r285134 (by mjg): fd: de-k&r-ify functions + some whitespace fixes MFC r285269: Handle copyout for the fcntl(F_OGETLK) using oflock structure. Approved by: re (gjb) Modified: releng/10.2/sys/kern/kern_descrip.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/kern/kern_descrip.c ============================================================================== --- releng/10.2/sys/kern/kern_descrip.c Tue Jul 28 16:39:36 2015 (r285963) +++ releng/10.2/sys/kern/kern_descrip.c Tue Jul 28 17:00:03 2015 (r285964) @@ -418,9 +418,10 @@ kern_fcntl_freebsd(struct thread *td, in struct flock fl; struct __oflock ofl; intptr_t arg1; - int error; + int error, newcmd; error = 0; + newcmd = cmd; switch (cmd) { case F_OGETLK: case F_OSETLK: @@ -438,31 +439,31 @@ kern_fcntl_freebsd(struct thread *td, in switch (cmd) { case F_OGETLK: - cmd = F_GETLK; - break; + newcmd = F_GETLK; + break; case F_OSETLK: - cmd = F_SETLK; - break; + newcmd = F_SETLK; + break; case F_OSETLKW: - cmd = F_SETLKW; - break; + newcmd = F_SETLKW; + break; } arg1 = (intptr_t)&fl; break; - case F_GETLK: - case F_SETLK: - case F_SETLKW: + case F_GETLK: + case F_SETLK: + case F_SETLKW: case F_SETLK_REMOTE: - error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); - arg1 = (intptr_t)&fl; - break; + error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); + arg1 = (intptr_t)&fl; + break; default: arg1 = arg; break; } if (error) return (error); - error = kern_fcntl(td, fd, cmd, arg1); + error = kern_fcntl(td, fd, newcmd, arg1); if (error) return (error); if (cmd == F_OGETLK) { @@ -746,7 +747,7 @@ kern_fcntl(struct thread *td, int fd, in if ((flp->l_start > 0 && foffset > OFF_MAX - flp->l_start) || (flp->l_start < 0 && - foffset < OFF_MIN - flp->l_start)) { + foffset < OFF_MIN - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; fdrop(fp, td); @@ -954,13 +955,13 @@ funsetown(struct sigio **sigiop) struct pgrp *pg = (sigio)->sio_pgrp; PGRP_LOCK(pg); SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PGRP_UNLOCK(pg); } else { struct proc *p = (sigio)->sio_proc; PROC_LOCK(p); SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PROC_UNLOCK(p); } SIGIO_UNLOCK(); @@ -1214,18 +1215,14 @@ struct close_args { #endif /* ARGSUSED */ int -sys_close(td, uap) - struct thread *td; - struct close_args *uap; +sys_close(struct thread *td, struct close_args *uap) { return (kern_close(td, uap->fd)); } int -kern_close(td, fd) - struct thread *td; - int fd; +kern_close(struct thread *td, int fd) { struct filedesc *fdp; struct file *fp; @@ -2312,10 +2309,10 @@ closef(struct file *fp, struct thread *t fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; - fdtol != td->td_proc->p_fdtol; - fdtol = fdtol->fdl_next) { + fdtol != td->td_proc->p_fdtol; + fdtol = fdtol->fdl_next) { if ((fdtol->fdl_leader->p_flag & - P_ADVLOCK) == 0) + P_ADVLOCK) == 0) continue; fdtol->fdl_holdcount++; FILEDESC_XUNLOCK(fdp); @@ -2933,8 +2930,7 @@ filedesc_to_leader_alloc(struct filedesc struct filedesc_to_leader *fdtol; fdtol = malloc(sizeof(struct filedesc_to_leader), - M_FILEDESC_TO_LEADER, - M_WAITOK); + M_FILEDESC_TO_LEADER, M_WAITOK); fdtol->fdl_refcount = 1; fdtol->fdl_holdcount = 0; fdtol->fdl_wakeup = 0;