Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2005 12:38:02 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   Re: PERFORCE change 71656 for review
Message-ID:  <200502231238.02637.jhb@FreeBSD.org>
In-Reply-To: <200502231158.j1NBwljD042625@repoman.freebsd.org>
References:  <200502231158.j1NBwljD042625@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 23 February 2005 06:58 am, Robert Watson wrote:
> http://perforce.freebsd.org/chv.cgi?CH=71656
>
> Change 71656 by rwatson@rwatson_paprika on 2005/02/23 11:58:23
>
> 	If oldp is set, sysctl returns the value of a MIB entry before
> 	modification, rather than after.

This is kind of wrong.  I tried to explain to Tom what should be done but he 
didn't really get it.  The correct order of operations should be this:

	SYSCTL_IN(&newrule);
	lock();
	oldrule = ...;
	update(&newrule);
	unlock();
	SYSCTL_OUT(&oldrule);

That is, the point is to do the entire read old and write new bit in a single 
locked section.  This more closely matches how most system calls work where 
they copyin() the arguments, perform actions, then copyout() the results.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502231238.02637.jhb>