Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 1995 18:53:49 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        Andres.Vega_Garcia@sophia.inria.fr, julian@ref.tfs.com, hackers@FreeBSD.ORG
Subject:   Re: Notion of time in kernel + malloc
Message-ID:  <199511210153.SAA02761@phaeton.artisoft.com>
In-Reply-To: <199511210137.MAA19964@godzilla.zeta.org.au> from "Bruce Evans" at Nov 21, 95 12:37:26 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >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.



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