Subject: Re: struct ucred changed.
To: None <>
From: David Laight <>
List: tech-kern
Date: 11/29/2001 17:35:29
> >Aren't uid_t and gid_t 32 bit?
> >If so you (probably) haven't changed the alignment!
> >
> >If the 'ucred' structure is zero'd on creation a little-endian
> >system won't see a difference.
> >But you will have changed the values seen on a big-endian system.
> You are right. So it will break on big endian systems. Ok, that means
> we need to version everything. Argh.

Why are you changing it?
>64k groups or >64k references?

The former would really require a dynamically sized cred structure.
The latter probably doesn't affect affect non-kernel code.

I'm also intrigued by the lack of fields in this structure!
One cred.h I have lurking has:

typedef struct cred {
        fspin_t cr_mutex;               /* state lock for cr_lwpref & cr_ref */
        ushort_t cr_ngroups;            /* number of groups in cr_groups */
        uid_t   cr_uid;                 /* effective user id */
        gid_t   cr_gid;                 /* effective group id */
        uid_t   cr_ruid;                /* real user id */
        gid_t   cr_rgid;                /* real group id */
        uid_t   cr_suid;                /* "saved" user id (from exec) */
        gid_t   cr_sgid;                /* "saved" group id (from exec) */
        pvec_t  cr_savpriv;             /* saved privilege vector */
        pvec_t  cr_wkgpriv;             /* working privilege vector */
        pvec_t  cr_maxpriv;             /* maximum privilege vector */
        lid_t   cr_lid;                 /* Level IDentifier (MAC) */
        lid_t   cr_cmwlid;              /* Level IDentifier (MAC) CMW */
        ulong_t cr_flags;               /* add'l cred flags (see below) */
        ulong_t cr_seqnum;              /* sequence number of cred */
        ulong_t cr_lwpref;              /* LWP reference count */
        long    cr_ref;                 /* non-LWP reference count */
        gid_t   cr_groups[1];           /* supplementary group list */
} cred_t;