Add a flags field to struct ucred, and export that via kinfo_proc,

consuming one of its spare fields.  The cr_flags field is currently
unused, but will be used for features, including capability mode and
pay-as-you-go audit.

Discussed with:	jhb, sson
This commit is contained in:
Robert Watson 2009-06-01 20:26:51 +00:00
parent 4d9a5852aa
commit 820c518125
3 changed files with 4 additions and 1 deletions

View File

@ -736,6 +736,7 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp)
kp->ki_ngroups * sizeof(gid_t));
kp->ki_rgid = cred->cr_rgid;
kp->ki_svgid = cred->cr_svgid;
kp->ki_cr_flags = cred->cr_flags;
/* If jailed(cred), emulate the old P_JAILED flag. */
if (jailed(cred)) {
kp->ki_flag |= P_JAILED;

View File

@ -56,6 +56,7 @@ struct ucred {
struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */
struct prison *cr_prison; /* jail(2) */
struct vimage *cr_vimage; /* vimage */
u_int cr_flags; /* credential flags */
void *cr_pspare[2]; /* general use 2 */
#define cr_endcopy cr_label
struct label *cr_label; /* MAC label */

View File

@ -83,7 +83,7 @@
* it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and
* function kvm_proclist in lib/libkvm/kvm_proc.c .
*/
#define KI_NSPARE_INT 10
#define KI_NSPARE_INT 9
#define KI_NSPARE_LONG 12
#define KI_NSPARE_PTR 7
@ -190,6 +190,7 @@ struct kinfo_proc {
*/
char ki_sparestrings[68]; /* spare string space */
int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */
u_int ki_cr_flags; /* Credential flags */
int ki_jid; /* Process jail ID */
int ki_numthreads; /* XXXKSE number of threads in total */
lwpid_t ki_tid; /* XXXKSE thread id */