Date: Wed, 23 Feb 2005 14:41:59 -0500 From: Tom Rhodes <trhodes@FreeBSD.org> To: John Baldwin <jhb@FreeBSD.org> Cc: Robert Watson <rwatson@FreeBSD.org> Subject: Re: PERFORCE change 71656 for review Message-ID: <20050223144159.45fa8705@mobile.pittgoth.com> In-Reply-To: <200502231238.02637.jhb@FreeBSD.org> References: <200502231158.j1NBwljD042625@repoman.freebsd.org> <200502231238.02637.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 23 Feb 2005 12:38:02 -0500 John Baldwin <jhb@freebsd.org> wrote: > 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. You're right, from the previous email I didn't really get what you were trying to say. My bad. -- Tom Rhodes
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050223144159.45fa8705>