Date: Fri, 23 Jun 2006 08:29:21 GMT From: Chris Jones <cdjones@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 99857 for review Message-ID: <200606230829.k5N8TLrk073180@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99857 Change 99857 by cdjones@cdjones_ides on 2006/06/23 08:29:06 Add a 'priority' value to the jail and prison structs, with corresponding changes to jail(8). Affected files ... .. //depot/projects/soc2006/cdjones_jail/src/sys/kern/kern_jail.c#2 edit .. //depot/projects/soc2006/cdjones_jail/src/sys/sys/jail.h#2 edit .. //depot/projects/soc2006/cdjones_jail/src/usr.sbin/jail/jail.c#2 edit Differences ... ==== //depot/projects/soc2006/cdjones_jail/src/sys/kern/kern_jail.c#2 (text+ko) ==== @@ -135,6 +135,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. */ ==== //depot/projects/soc2006/cdjones_jail/src/sys/sys/jail.h#2 (text+ko) ==== @@ -18,6 +18,8 @@ char *path; char *hostname; u_int32_t ip_number; + unsigned int priority; +/* CJ TODO --- add reference to preferred scheduler, e.g. by name? */ }; struct xprison { @@ -29,6 +31,10 @@ }; #define XPRISON_VERSION 1 +#define JAIL_DEFAULT_PRIORITY 10 +#define JAIL_MINIMUM_PRIORITY 1 +#define JAIL_MAXIMUM_PRIORITY 100 + #ifndef _KERNEL int jail(struct jail *); @@ -73,6 +79,8 @@ int pr_securelevel; /* (p) securelevel */ struct task pr_task; /* (d) destroy task */ struct mtx pr_mtx; + unsigned int pr_priority; /* (p) jail priority */ +/* CJ TODO scheduler reference. */ }; #endif /* _KERNEL || _WANT_PRISON */ ==== //depot/projects/soc2006/cdjones_jail/src/usr.sbin/jail/jail.c#2 (text+ko) ==== @@ -63,11 +63,12 @@ FILE *fp; iflag = Jflag = lflag = uflag = Uflag = 0; + priority = JAIL_DEFAULT_PRIORITY; securelevel = -1; username = JidFile = cleanenv = NULL; fp = NULL; - while ((ch = getopt(argc, argv, "ils:u:U:J:")) != -1) { + while ((ch = getopt(argc, argv, "ilp:s:u:U:J:")) != -1) { switch (ch) { case 'i': iflag = 1; @@ -76,6 +77,12 @@ JidFile = optarg; Jflag = 1; break; + case 'p': + priority = atoi(optarg); + if (priority < JAIL_MINIMUM_PRIORITY || + priority > JAIL_MAXIMUM_PRIORITY) + errx(1, "invalid priority: `%s'", optarg); + break; case 's': ltmp = strtol(optarg, &ep, 0); if (*ep || ep == optarg || ltmp > INT_MAX || !ltmp) @@ -118,6 +125,7 @@ if (inet_aton(argv[2], &in) == 0) errx(1, "Could not make sense of ip-number: %s", argv[2]); j.ip_number = ntohl(in.s_addr); + j.priority = priority; if (Jflag) { fp = fopen(JidFile, "w"); if (fp == NULL) @@ -183,7 +191,8 @@ { (void)fprintf(stderr, "%s%s%s\n", - "usage: jail [-i] [-J jid_file] [-s securelevel] [-l -u ", + "usage: jail [-i] [-J jid_file] [-p priority] [-s securelevel]", + " [-l -u ", "username | -U username]", " path hostname ip-number command ..."); exit(1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606230829.k5N8TLrk073180>