Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2002 17:27:48 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        current@FreeBSD.ORG, Peter Wemm <peter@wemm.org>, Matthew Dillon <dillon@apollo.backplane.com>, Julian Elischer <julian@elischer.org>
Subject:   Re: Patch sets to date and timing tests with Giant out of userre
Message-ID:  <XFMail.020220172748.jhb@FreeBSD.org>
In-Reply-To: <3C720859.C77590F0@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 19-Feb-02 Terry Lambert wrote:
> Julian Elischer wrote:
>> The fully safe version of this code is:
>> td->td_retval[0] = td->td_ucred->cr_ruid;
>> td->td_retval[1] = td->td_ucred->cr_uid;
>> return (0);
>> 
>> because td->td_ucred is read-only for it's whole existance.
> 
> ???
> 
> Are you sure that td->td_ucred can't change in the middle,
> to point to a different ucred, as a result of kernel
> preemption?

Yes.  A thread's ucred pointer is constant teh entire time that it is in the
kernel.  If we get preempted who cares.  We will still be teh same thread when
we continue executing. :)

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

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?XFMail.020220172748.jhb>