Subject: CVS commit: src/sys
To: None <source-changes@NetBSD.org>
From: David Laight <dsl@netbsd.org>
List: source-changes
Date: 09/29/2007 12:22:32
Module Name:	src
Committed By:	dsl
Date:		Sat Sep 29 12:22:32 UTC 2007

Modified Files:
	src/sys/compat/irix: irix_prctl.c
	src/sys/compat/netbsd32: netbsd32_netbsd.c
	src/sys/kern: kern_acct.c kern_fork.c kern_proc.c kern_resource.c
	src/sys/sys: proc.h resourcevar.h

Log Message:
Change the way p->p_limit (and hence p->p_rlimit) is locked.
Should fix PR/36939 and make the rlimit code MP safe.
Posted for comment to tech-kern (non received!)

The p_limit field (for a process) is only be changed once (on the first
  write), and a reference to the old structure is kept (for code paths
  that have cached the pointer).
Only p->p_limit is now locked by p->p_mutex, and since the referenced memory
  will not go away, is only needed if the pointer is to be changed.
The contents of 'struct plimit' are all locked by pl_mutex, except that the
  code doesn't bother to acquire it for reads (which are basically atomic).
Add FORK_SHARELIMIT that causes fork1() to share the limits between parent
  and child, use it for the IRIX_PR_SULIMIT.
Fix borked test for both IRIX_PR_SUMASK and IRIX_PR_SDIR being set.


To generate a diff of this commit:
cvs rdiff -r1.38 -r1.39 src/sys/compat/irix/irix_prctl.c
cvs rdiff -r1.127 -r1.128 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -r1.76 -r1.77 src/sys/kern/kern_acct.c
cvs rdiff -r1.143 -r1.144 src/sys/kern/kern_fork.c
cvs rdiff -r1.116 -r1.117 src/sys/kern/kern_proc.c
cvs rdiff -r1.121 -r1.122 src/sys/kern/kern_resource.c
cvs rdiff -r1.254 -r1.255 src/sys/sys/proc.h
cvs rdiff -r1.39 -r1.40 src/sys/sys/resourcevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.