diff options
author | bde <bde@FreeBSD.org> | 1998-07-12 08:10:33 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-07-12 08:10:33 +0000 |
commit | 5d983285b3e981a79fb1323695dd3fd491ce7484 (patch) | |
tree | a9f6c0b460bf198865ef57d3380a8cfd06af3355 /usr.sbin/config/mkoptions.c | |
parent | 82ecca82af17fd6c172a75947a0c6cfbb255cdf6 (diff) | |
download | FreeBSD-src-5d983285b3e981a79fb1323695dd3fd491ce7484.zip FreeBSD-src-5d983285b3e981a79fb1323695dd3fd491ce7484.tar.gz |
Convert the maxusers directive to a normal MAXUSERS option (normally
define MAXUSERS in opt_param.h as directed in /sys/conf/options;
if it's not mentioned there, then define it in IDENT; never define
it in PARAM). MAXUSERS probably should be a completely normal option.
Don't define PARAM now that it is empty.
Cleaned up similar conversion of cpu directives to XXX_CPU options.
Diffstat (limited to 'usr.sbin/config/mkoptions.c')
-rw-r--r-- | usr.sbin/config/mkoptions.c | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 45e6780..e638f20 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: mkoptions.c,v 1.6 1997/09/15 06:37:10 charnier Exp $"; + "$Id: mkoptions.c,v 1.7 1998/07/12 02:31:08 bde Exp $"; #endif /* not lint */ /* @@ -53,6 +53,24 @@ static const char rcsid[] = #define ns(s) strdup(s) +static struct users { + int u_default; + int u_min; + int u_max; +} users[] = { + { 8, 2, 512 }, /* MACHINE_VAX */ + { 8, 2, 512 }, /* MACHINE_TAHOE */ + { 8, 2, 512 }, /* MACHINE_HP300 */ + { 8, 2, 512 }, /* MACHINE_I386 */ + { 8, 2, 512 }, /* MACHINE_MIPS */ + { 8, 2, 512 }, /* MACHINE_PMAX */ + { 8, 2, 512 }, /* MACHINE_LUNA68K */ + { 8, 2, 512 }, /* MACHINE_NEWS3400 */ + { 8, 2, 512 }, /* MACHINE_PC98 */ + { 8, 2, 512 }, /* MACHINE_ALPHA */ +}; +#define NUSERS (sizeof (users) / sizeof (users[0])) + static char *lower __P((char *)); void read_options __P((void)); void do_option __P((char *)); @@ -60,21 +78,45 @@ void do_option __P((char *)); void options() { - struct opt_list *ol; - - /* fake the cpu types as options */ - /* Please forgive me for this hack.. :-) */ + char buf[40]; struct cputype *cp; + struct opt_list *ol; + struct opt *op; + struct users *up; - for (cp = cputype; cp; cp = cp->cpu_next) { - struct opt *op = (struct opt *)malloc(sizeof (struct opt)); + /* Fake the cpu types as options. */ + for (cp = cputype; cp != NULL; cp = cp->cpu_next) { + op = (struct opt *)malloc(sizeof(*op)); memset(op, 0, sizeof(*op)); op->op_name = ns(cp->cpu_name); - op->op_value = 0; op->op_next = opt; opt = op; } + /* Initialize `maxusers'. */ + if ((unsigned)machine > NUSERS) { + printf("maxusers config info isn't present, using vax\n"); + up = &users[MACHINE_VAX - 1]; + } else + up = &users[machine - 1]; + if (maxusers == 0) { + printf("maxusers not specified; %d assumed\n", up->u_default); + maxusers = up->u_default; + } else if (maxusers < up->u_min) { + printf("minimum of %d maxusers assumed\n", up->u_min); + maxusers = up->u_min; + } else if (maxusers > up->u_max) + printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); + + /* Fake MAXUSERS as an option. */ + op = (struct opt *)malloc(sizeof(*op)); + memset(op, 0, sizeof(*op)); + op->op_name = "MAXUSERS"; + sprintf(buf, "%d", maxusers); + op->op_value = ns(buf); + op->op_next = opt; + opt = op; + read_options(); for (ol = otab; ol != 0; ol = ol->o_next) do_option(ol->o_name); |