From owner-p4-projects@FreeBSD.ORG Sat Jul 1 03:06:31 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1E83716A697; Sat, 1 Jul 2006 03:06:31 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D21BF16A519 for ; Sat, 1 Jul 2006 03:06:30 +0000 (UTC) (envelope-from cdjones@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3548643FE3 for ; Sat, 1 Jul 2006 02:48:37 +0000 (GMT) (envelope-from cdjones@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k612mbW2015888 for ; Sat, 1 Jul 2006 02:48:37 GMT (envelope-from cdjones@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k612maJx015885 for perforce@freebsd.org; Sat, 1 Jul 2006 02:48:36 GMT (envelope-from cdjones@FreeBSD.org) Date: Sat, 1 Jul 2006 02:48:36 GMT Message-Id: <200607010248.k612maJx015885@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cdjones@FreeBSD.org using -f From: Chris Jones To: Perforce Change Reviews Cc: Subject: PERFORCE change 100377 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jul 2006 03:06:31 -0000 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 #include #include +#include #include #include #include @@ -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); }