Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Nov 2000 13:22:29 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        arch@FreeBSD.org, (Alfred Perlstein) <bright@wintelcom.net>
Subject:   Re: HEADSUP user struct ucred -> xucred (Was: Re: serious proble
Message-ID:  <XFMail.001130132229.jhb@FreeBSD.org>
In-Reply-To: <200011300628.XAA06955@usr08.primenet.com>

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

On 30-Nov-00 Terry Lambert wrote:
>> > I recently locked down struct ucred, not a big deal, basically just
>> > a mutex in each struct to protect the refcount.
>> > 
>> > Unfortunetly struct ucred is used by some userland utils and
>> > sys/ucred is included in sys/mount.h as well as sys/user.h, this
>> > creates somewhat of a problem, forcing all users of sys/ucred.h to
>> > include sys/mutex.g.
>> > 
>> > I have a patch here that sort of takes care of this problem, the
>> > problem is that I had to add sys/mutex.h includes to both sys/mount.h
>> > and sys/user.h, this doesn't make me very happy.
>> 
>> After a short discussion it has been determined that there will be
>> a xucred exported to userland following the concention of xsocket
>> and the various other xfoo structs exported to the kernel.
>> 
>> Struct ucred will no longer be visible outside the kernel.
>> 
>> Any userland things using struct ucred will need to use xucred.
>> 
>> This will be the convention used to resolve mutex (or other MD 
>> fields) in kernel exported structures in the future.
> 
> This is a really gross way to handle this.  The ucred structure
> is used by a lot of user space programs.

Another way I suggested that was shotdown was to do something like this:

#ifdef _KERNEL
struct ucred {
     ... kernel structure ...
};

struct xucred {
#else
struct ucred {
#endif
     ... userland structure ...
};

So that ucred didn't change for userland, but the kernel would have ucred for
its internal ucred and xucred for the userland ucred.  This allows no userland
changes, and all you would need to do is convert ucred to xucred and vice versa
at the boundary.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


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




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