From owner-freebsd-hackers Mon Nov 20 17:58:24 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id RAA07236 for hackers-outgoing; Mon, 20 Nov 1995 17:58:24 -0800 Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id RAA07231 for ; Mon, 20 Nov 1995 17:58:21 -0800 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id SAA02761; Mon, 20 Nov 1995 18:53:50 -0700 From: Terry Lambert Message-Id: <199511210153.SAA02761@phaeton.artisoft.com> Subject: Re: Notion of time in kernel + malloc To: bde@zeta.org.au (Bruce Evans) Date: Mon, 20 Nov 1995 18:53:49 -0700 (MST) Cc: Andres.Vega_Garcia@sophia.inria.fr, julian@ref.tfs.com, hackers@FreeBSD.ORG In-Reply-To: <199511210137.MAA19964@godzilla.zeta.org.au> from "Bruce Evans" at Nov 21, 95 12:37:26 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 786 Sender: owner-hackers@FreeBSD.ORG Precedence: bulk > >the variable structure (struct timeval) time; > >can be examined directly to give time to the nearest 'tick' (100hz usually) > > It shouldn't be examined directly since direct access is not atomic. You > must use > > int s = splclock(); > struct timeval temp_tv = time; > splx(s); Yep. This is why I said access should be macrotized. Most of the time structure references that exist in the FS and other kernel code are *incorrectly* accessing it directly. Since everyone is already doing it, another violator won't really hurt anything... it will show up in the grep when someone decides to really fix everything to do it correctly. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.