Date: Sat, 1 Jul 2006 02:48:36 GMT From: Chris Jones <cdjones@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 100377 for review Message-ID: <200607010248.k612maJx015885@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100377 Change 100377 by cdjones@cdjones-impulse on 2006/07/01 02:47:56 .. Affected files ... .. //depot/projects/soc2006/cdjones_jail/src/sys/kern/kern_jail.c#6 edit Differences ... ==== //depot/projects/soc2006/cdjones_jail/src/sys/kern/kern_jail.c#6 (text+ko) ==== @@ -15,6 +15,7 @@ #include <sys/param.h> #include <sys/types.h> #include <sys/kernel.h> +#include <sys/kthread.h> #include <sys/systm.h> #include <sys/errno.h> #include <sys/sysproto.h> @@ -92,6 +93,13 @@ SYSINIT(prison, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_prison, NULL); +static void +jsched_dummy(void) +{ + int x; + tsleep(&x, 0, "-", hz); +} + /* * MPSAFE * @@ -108,6 +116,9 @@ struct jail_attach_args jaa; int vfslocked, error, tryprid; + struct proc *j_sched_proc; + struct kproc_desc *j_sched_kp; + error = copyin(uap->jail, &j, sizeof(j)); if (error) return (error); @@ -135,6 +146,7 @@ goto e_dropvnref; pr->pr_ip = j.ip_number; pr->pr_linux = NULL; + pr->pr_priority = j.priority; pr->pr_securelevel = securelevel; /* Determine next pr_id and add prison to allprison list. */ @@ -159,26 +171,67 @@ prisoncount++; mtx_unlock(&allprison_mtx); + /* TODO --- Should probably be an #ifdef SCHED_HIER here. */ + printf("A"); + MALLOC(j_sched_kp, struct kproc_desc *, sizeof(struct kproc_desc), M_TEMP, M_WAITOK | M_ZERO); + printf("B"); + if (NULL == j_sched_kp) + goto e_dropprref; + printf("C"); + MALLOC(j_sched_kp->arg0, char *, (7 + 6 + 1) * sizeof(char), M_TEMP, M_WAITOK | M_ZERO); + printf("D"); + if (!j_sched_kp->arg0) + goto e_dropprref; + printf("E"); + snprintf(j_sched_kp->arg0, 7 + 6 + 1, "jsched/%6d", pr->pr_id); + printf("F"); + j_sched_kp->func = jsched_dummy; + printf("G"); + j_sched_kp->global_procpp = &j_sched_proc; + printf("H"); + kproc_start(&j_sched_kp); + printf("I"); + /* pr->pr_scheduler = (j_sched_kp->global_procpp)->p_pid; */ /* TODO - why won't this work? */ + FREE(j_sched_kp->arg0, M_TEMP); + printf("J"); + FREE(j_sched_kp, M_TEMP); + printf("K"); + /* TODO --- probable #endif */ + error = jail_attach(td, &jaa); + printf("L"); if (error) goto e_dropprref; + printf("M"); mtx_lock(&pr->pr_mtx); pr->pr_ref--; mtx_unlock(&pr->pr_mtx); + printf("N"); td->td_retval[0] = jaa.jid; + printf("O"); return (0); e_dropprref: + printf("P"); + if (j_sched_kp && j_sched_kp->arg0) + FREE(j_sched_kp->arg0, M_TEMP); + printf("P1"); + if (j_sched_kp) + FREE(j_sched_kp, M_TEMP); + printf("P2"); mtx_lock(&allprison_mtx); LIST_REMOVE(pr, pr_list); prisoncount--; mtx_unlock(&allprison_mtx); e_dropvnref: + printf("Q"); vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount); vrele(pr->pr_root); VFS_UNLOCK_GIANT(vfslocked); e_killmtx: + printf("R"); mtx_destroy(&pr->pr_mtx); FREE(pr, M_PRISON); + printf("Z"); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607010248.k612maJx015885>