summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2009-05-08 14:11:06 +0000
committerzec <zec@FreeBSD.org>2009-05-08 14:11:06 +0000
commit639797b2e609797fdaf2c8e88b9203bfc7c70b7e (patch)
tree070fe9c96176ed914dfefc12a45fea29b98c4122 /sys/kern/init_main.c
parentf851007175f37de5aec0c77eb852e3444150e653 (diff)
downloadFreeBSD-src-639797b2e609797fdaf2c8e88b9203bfc7c70b7e.zip
FreeBSD-src-639797b2e609797fdaf2c8e88b9203bfc7c70b7e.tar.gz
Introduce a new virtualization container, provisionally named vprocg, to hold
virtualized instances of hostname and domainname, as well as a new top-level virtualization struct vimage, which holds pointers to struct vnet and struct vprocg. Struct vprocg is likely to become replaced in the near future with a new jail management API import. As a consequence of this change, change struct ucred to point to a struct vimage, instead of directly pointing to a vnet. Merge vnet / vimage / ucred refcounting infrastructure from p4 / vimage branch. Permit kldload / kldunload operations to be executed only from the default vimage context. This change should have no functional impact on nooptions VIMAGE kernel builds. Reviewed by: bz Approved by: julian (mentor)
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 96ebf36..97b7f0f 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -454,7 +454,10 @@ proc0_init(void *dummy __unused)
p->p_ucred->cr_ruidinfo = uifind(0);
p->p_ucred->cr_prison = NULL; /* Don't jail it. */
#ifdef VIMAGE
- p->p_ucred->cr_vnet = LIST_FIRST(&vnet_head);
+ KASSERT(LIST_FIRST(&vimage_head) != NULL, ("vimage_head empty"));
+ P_TO_VIMAGE(p) = LIST_FIRST(&vimage_head); /* set ucred->cr_vimage */
+ refcount_acquire(&P_TO_VIMAGE(p)->vi_ucredrefc);
+ LIST_FIRST(&vprocg_head)->nprocs++;
#endif
#ifdef AUDIT
audit_cred_kproc0(p->p_ucred);
OpenPOWER on IntegriCloud