- TAILQ_ENTRY(ucred) cr_link; /* never modify this without KAUTH_CRED_HASH_LOCK */
- u_long cr_ref; /* reference count */
-
- /* credential hash depends on everything from this point on (see kauth_cred_get_hashkey) */
- uid_t cr_uid; /* effective user id */
- uid_t cr_ruid; /* real user id */
- uid_t cr_svuid; /* saved user id */
- short cr_ngroups; /* number of groups in advisory list */
- gid_t cr_groups[NGROUPS]; /* advisory group list */
- gid_t cr_rgid; /* real group id */
- gid_t cr_svgid; /* saved group id */
- uid_t cr_gmuid; /* user id for group membership purposes */
- struct auditinfo cr_au; /* user auditing data */
+ LIST_ENTRY(ucred) cr_link; /* never modify this without KAUTH_CRED_HASH_LOCK */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
+ _Atomic u_long cr_ref; /* reference count */
+#elif defined(__cplusplus) && __cplusplus >= 201103L
+ _Atomic u_long cr_ref; /* reference count */
+#else
+ volatile u_long cr_ref; /* reference count */
+#endif
+
+ struct posix_cred {
+ /*
+ * The credential hash depends on everything from this point on
+ * (see kauth_cred_get_hashkey)
+ */
+ uid_t cr_uid; /* effective user id */
+ uid_t cr_ruid; /* real user id */
+ uid_t cr_svuid; /* saved user id */
+ short cr_ngroups; /* number of groups in advisory list */
+ gid_t cr_groups[NGROUPS];/* advisory group list */
+ gid_t cr_rgid; /* real group id */
+ gid_t cr_svgid; /* saved group id */
+ uid_t cr_gmuid; /* UID for group membership purposes */
+ int cr_flags; /* flags on credential */
+ } cr_posix;
+ struct label *cr_label; /* MAC label */
+ /*
+ * NOTE: If anything else (besides the flags)
+ * added after the label, you must change
+ * kauth_cred_find().
+ */
+ struct au_session cr_audit; /* user auditing data */