From owner-cvs-all@FreeBSD.ORG Wed Feb 4 13:53:00 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDECC16A4CE; Wed, 4 Feb 2004 13:53:00 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 950F043D3F; Wed, 4 Feb 2004 13:52:58 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i14Lqw0B073872; Wed, 4 Feb 2004 13:52:58 -0800 (PST) (envelope-from jhb@repoman.freebsd.org) Received: (from jhb@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i14Lqw7l073871; Wed, 4 Feb 2004 13:52:58 -0800 (PST) (envelope-from jhb) Message-Id: <200402042152.i14Lqw7l073871@repoman.freebsd.org> From: John Baldwin Date: Wed, 4 Feb 2004 13:52:58 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/alpha/linux linux_machdep.c src/sys/alpha/osf1 osf1_misc.c src/sys/compat/ia32 ia32_sysvec.c src/sys/compat/linux linux_misc.c src/sys/compat/svr4 imgact_svr4.c svr4_filio.c svr4_misc.c svr4_resource.c src/sys/fs/fdescfs fdesc_vfsops.c ... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2004 21:53:01 -0000 jhb 2004/02/04 13:52:58 PST FreeBSD src repository Modified files: sys/alpha/linux linux_machdep.c sys/alpha/osf1 osf1_misc.c sys/compat/ia32 ia32_sysvec.c sys/compat/linux linux_misc.c sys/compat/svr4 imgact_svr4.c svr4_filio.c svr4_misc.c svr4_resource.c sys/fs/fdescfs fdesc_vfsops.c sys/fs/msdosfs msdosfs_vnops.c sys/fs/nwfs nwfs_io.c sys/fs/procfs procfs_rlimit.c sys/fs/smbfs smbfs_io.c sys/gnu/ext2fs ext2_readwrite.c sys/i386/ibcs2 ibcs2_misc.c sys/i386/linux imgact_linux.c linux_machdep.c sys/kern imgact_aout.c imgact_elf.c imgact_gzip.c init_main.c kern_acct.c kern_descrip.c kern_exit.c kern_fork.c kern_resource.c kern_sig.c subr_trap.c sys_generic.c uipc_socket2.c sys/nfsclient nfs_bio.c sys/sys proc.h resource.h resourcevar.h sys/ufs/ffs ffs_vnops.c sys/vm vm_glue.c vm_map.c vm_mmap.c vm_pageout.c vm_unix.c Log: Locking for the per-process resource limits structure. - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists. Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64 Revision Changes Path 1.33 +8 -3 src/sys/alpha/linux/linux_machdep.c 1.45 +19 -16 src/sys/alpha/osf1/osf1_misc.c 1.16 +22 -39 src/sys/compat/ia32/ia32_sysvec.c 1.152 +19 -14 src/sys/compat/linux/linux_misc.c 1.22 +5 -3 src/sys/compat/svr4/imgact_svr4.c 1.31 +7 -4 src/sys/compat/svr4/svr4_filio.c 1.70 +31 -32 src/sys/compat/svr4/svr4_misc.c 1.16 +26 -26 src/sys/compat/svr4/svr4_resource.c 1.42 +3 -1 src/sys/fs/fdescfs/fdesc_vfsops.c 1.147 +7 -5 src/sys/fs/msdosfs/msdosfs_vnops.c 1.33 +7 -4 src/sys/fs/nwfs/nwfs_io.c 1.9 +18 -4 src/sys/fs/procfs/procfs_rlimit.c 1.26 +9 -5 src/sys/fs/smbfs/smbfs_io.c 1.27 +7 -7 src/sys/gnu/ext2fs/ext2_readwrite.c 1.53 +33 -51 src/sys/i386/ibcs2/ibcs2_misc.c 1.51 +5 -2 src/sys/i386/linux/imgact_linux.c 1.41 +3 -2 src/sys/i386/linux/linux_machdep.c 1.93 +5 -3 src/sys/kern/imgact_aout.c 1.144 +6 -5 src/sys/kern/imgact_elf.c 1.51 +4 -2 src/sys/kern/imgact_gzip.c 1.241 +11 -13 src/sys/kern/init_main.c 1.69 +9 -5 src/sys/kern/kern_acct.c 1.224 +16 -7 src/sys/kern/kern_descrip.c 1.220 +6 -5 src/sys/kern/kern_exit.c 1.213 +4 -5 src/sys/kern/kern_fork.c 1.129 +159 -64 src/sys/kern/kern_resource.c 1.270 +3 -5 src/sys/kern/kern_sig.c 1.263 +4 -4 src/sys/kern/subr_trap.c 1.128 +4 -1 src/sys/kern/sys_generic.c 1.119 +8 -2 src/sys/kern/uipc_socket2.c 1.127 +9 -6 src/sys/nfsclient/nfs_bio.c 1.367 +1 -2 src/sys/sys/proc.h 1.21 +1 -1 src/sys/sys/resource.h 1.37 +20 -2 src/sys/sys/resourcevar.h 1.126 +7 -5 src/sys/ufs/ffs/ffs_vnops.c 1.189 +8 -6 src/sys/vm/vm_glue.c 1.327 +16 -9 src/sys/vm/vm_map.c 1.178 +24 -11 src/sys/vm/vm_mmap.c 1.250 +3 -2 src/sys/vm/vm_pageout.c 1.44 +8 -4 src/sys/vm/vm_unix.c