Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libkvm



Elad Efrat wrote:

> Andrew Doran wrote:
> 
> > Thanks for fixing this. Redefining kauth_cred_t in userland isn't the right
> > way to go about it though. Please change it so that kauth_cred_t is defined
> > in a non-installed header file under sys/sys.
> 
> I'd rather not. Having it exposed in sys/sys is just asking for people
> to access its members directly. Since libkvm must always be synchronized
> with the kernel when data-structures it cares about are modified, having
> a private copy in libkvm with the relevant members (note the lack of the
> specificdata reference) seems saner to me.

What about using a #define that makes it obvious that it shouldn't be
used as well?  For example, sys/sys/kauth_private.h that has:

        ...

        /*
         * This file contains a private definition for 'struct kauth_cred'
         * that must only be used by kern/kern_auth.c and kmem grovellers
         * like ps(1).
         */

        #ifdef _KAUTH_CRED_PRIVATE
        struct kauth_cred {
                ...
        }
        #endif /* _KAUTH_CRED_PRIVATE */

Anyone who obviously jumped through hoops to access it then deserves the
pain that everyone else would infliction upon them.

I agree with Andrew that have a duplicated definition in multiple C files
isn't a good thing - that way can only lead to confusion in the long term.

Cheers,
Simon.



Home | Main Index | Thread Index | Old Index