PERFORCE change 71656 for review

John Baldwin jhb at FreeBSD.org
Wed Feb 23 17:37:18 GMT 2005


On Wednesday 23 February 2005 06:58 am, Robert Watson wrote:
> http://perforce.freebsd.org/chv.cgi?CH=71656
>
> Change 71656 by rwatson at 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 at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the p4-projects mailing list