diff options
author | pjd <pjd@FreeBSD.org> | 2005-03-20 10:35:23 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-03-20 10:35:23 +0000 |
commit | 2275c8c92e33f471bea52f1fefed5d8dc4c3c7ec (patch) | |
tree | dcadee16f40d4fcd17afaaea7d03cf295e616a7c | |
parent | 26ccbbe0103e9179d4bbf18cf158b0f163759bbe (diff) | |
download | FreeBSD-src-2275c8c92e33f471bea52f1fefed5d8dc4c3c7ec.zip FreeBSD-src-2275c8c92e33f471bea52f1fefed5d8dc4c3c7ec.tar.gz |
Add ki_jid field to the kinfo_proc structure and store jail ID there.
Reviewed by: gad
MFC after: 3 days
-rw-r--r-- | sys/kern/kern_proc.c | 6 | ||||
-rw-r--r-- | sys/sys/user.h | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 0924325..0b3ecfd 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -653,8 +653,12 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp) kp->ki_rgid = cred->cr_rgid; kp->ki_svgid = cred->cr_svgid; /* If jailed(cred), emulate the old P_JAILED flag. */ - if (jailed(cred)) + if (jailed(cred)) { kp->ki_flag |= P_JAILED; + /* If inside a jail, use 0 as a jail ID. */ + if (!jailed(curthread->td_ucred)) + kp->ki_jid = cred->cr_prison->pr_id; + } } ps = p->p_sigacts; if (ps) { diff --git a/sys/sys/user.h b/sys/sys/user.h index 4eaeacf..6707ade 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -74,7 +74,7 @@ * end of kinfo_proc. It may need to be overridden on a platform-specific * basis as new fields are added. */ -#define KI_NSPARE 16 +#define KI_NSPARE 15 #ifdef __alpha__ #define KINFO_PROC_SIZE 912 @@ -84,7 +84,7 @@ #endif #ifdef __arm__ #undef KI_NSPARE /* Fewer spare longs on this arch */ -#define KI_NSPARE 15 +#define KI_NSPARE 13 #define KINFO_PROC_SIZE 648 #endif #ifdef __ia64__ @@ -92,10 +92,12 @@ #endif #ifdef __i386__ #undef KI_NSPARE /* Fewer spare longs on this arch */ -#define KI_NSPARE 15 +#define KI_NSPARE 13 #define KINFO_PROC_SIZE 648 #endif #ifdef __powerpc__ +#undef KI_NSPARE /* Fewer spare longs on this arch */ +#define KI_NSPARE 14 #define KINFO_PROC_SIZE 656 #endif #ifdef __sparc64__ @@ -187,6 +189,8 @@ struct kinfo_proc { lwpid_t ki_tid; /* XXXKSE thread id */ int ki_numthreads; /* XXXKSE number of threads in total */ void *ki_udata; /* User convenience pointer */ + int ki_jid; /* Process jail ID */ + int ki_spare_int1; /* unused (just here for alignment) */ long ki_spare[KI_NSPARE]; /* spare room for later growth */ }; void fill_kinfo_proc(struct proc *, struct kinfo_proc *); |