Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Sep 2001 19:39:30 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Bakul Shah <bakul@bitblocks.com>
Cc:        Julian Elischer <julian@vicor-nb.com>, John Baldwin <jhb@FreeBSD.ORG>, <current@FreeBSD.ORG>
Subject:   Re: RFC: hack volatile bzero and bcopy 
Message-ID:  <20010908193015.X45840-100000@alphplex.bde.org>
In-Reply-To: <200109071956.PAA29905@thunderer.cnchost.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 7 Sep 2001, Bakul Shah wrote:

> > out-of order is probably ok for a buffer if you know that it's
> > presently yours to write into.
>
> If the area being bcopied/bzeroed has this behavior why not
> remove the volatile from the struct ptrs instead of "fixing"
> bcopy/bzero?

One reason is that the memory might be normal at the time of the bcopy
(because you have locked out concurrent accesses to it), but volatile
at other times.  I think this should be handled in general by declaring
it as normal and always locking it.

> > 2/ add to the prototype of bzero and bcopy so that volatile pointers are
> > acceptable
> > arguments. (I don't see any reason to not do this).
>
> Because the (informal) defn of bcopy/bzero does not allow
> volatile arguments.  You are wagging the dog.
>
> Why not just cast these ptrs at the call sites where you
> _know_ bcopy, bzero use is safe.  That sort of documents what
> is going on without opening a big hole.

FreeBSD turns on -Wcast-qual in order to prevent inadvertant loss of
type qualifiers, so using explicit casts just moves the warning from
the implicit casts caused by the prototype to the implicit casts.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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