From owner-freebsd-audit Sun Jul 15 3:36:27 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 682E637B405 for ; Sun, 15 Jul 2001 03:36:25 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id C81603E2F; Sun, 15 Jul 2001 03:36:24 -0700 (PDT) To: audit@freebsd.org Cc: mike@q9media.com Subject: Applied patches Date: Sun, 15 Jul 2001 03:36:24 -0700 From: Dima Dorfman Message-Id: <20010715103624.C81603E2F@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I've applied the following patches submitted by Mike Barcroft: adjkerntz.20010629.patch sbin.20010708.patch bin.20010628.patch shutdown.20010705.patch lib.20010709.patch tunefs.20010706.patch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 4:37:21 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 466D437B401 for ; Sun, 15 Jul 2001 04:36:43 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id C42CC3E2F for ; Sun, 15 Jul 2001 04:36:42 -0700 (PDT) To: audit@freebsd.org Subject: queue(3) patch for config(8) Date: Sun, 15 Jul 2001 04:36:42 -0700 From: Dima Dorfman Message-Id: <20010715113642.C42CC3E2F@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Attached is a patch which converts config(8) to use the queue(3) API. Please review. Index: config.h =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.h,v retrieving revision 1.49 diff -u -r1.49 config.h --- config.h 2001/07/12 02:08:51 1.49 +++ config.h 2001/07/15 11:35:25 @@ -38,11 +38,12 @@ * Config. */ #include +#include #include #include struct file_list { - struct file_list *f_next; + TAILQ_ENTRY(file_list) f_list; char *f_fn; /* the name */ int f_type; /* type or count */ u_char f_flags; /* see below */ @@ -52,6 +53,8 @@ char *f_needs; char *f_warn; /* warning message */ }; +TAILQ_HEAD(file_list_headt, file_list); +extern struct file_list_headt ftab_head; /* * Types. @@ -74,12 +77,14 @@ #define ISDUP 16 struct device { + TAILQ_ENTRY(device) d_list; int d_done; /* processed */ char *d_name; /* name of device (e.g. rk11) */ int d_count; /* device count */ #define UNKNOWN -2 /* -2 means not set yet */ - struct device *d_next; /* Next one in list */ }; +TAILQ_HEAD(device_headt, device); +extern struct device_headt dtab_head; struct config { char *s_sysname; @@ -99,9 +104,11 @@ * These and the options (below) are put in the C flags in the makefile. */ struct cputype { + LIST_ENTRY(cputype) cpu_list; char *cpu_name; - struct cputype *cpu_next; -} *cputype; +}; +LIST_HEAD(cputype_headt, cputype); +extern struct cputype_headt cputype_head; /* * A set of options may also be specified which are like CPU types, @@ -109,17 +116,20 @@ * A separate set of options may be defined for make-style options. */ struct opt { + LIST_ENTRY(opt) op_list; char *op_name; char *op_value; int op_ownfile; /* true = own file, false = makefile */ - struct opt *op_next; -} *opt, *mkopt; +}; +LIST_HEAD(opt_headt, opt); +extern struct opt_headt opt_head, mkopt_head; struct opt_list { + LIST_ENTRY(opt_list) o_list; char *o_name; char *o_file; - struct opt_list *o_next; } *otab; +LIST_HEAD(opt_list_headt, opt_list); extern char *ident; extern char *hints; @@ -138,13 +148,9 @@ void makefile(void); void headers(void); -extern struct device *dtab; - extern char errbuf[80]; extern int yyline; extern const char *yyfile; - -extern struct file_list *ftab; extern int profiling; extern int debugging; Index: config.y =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.y,v retrieving revision 1.55 diff -u -r1.55 config.y --- config.y 2001/07/12 02:08:51 1.55 +++ config.y 2001/07/15 11:35:25 @@ -71,15 +71,13 @@ #include "config.h" -static struct device *curp = 0; - -struct device *dtab; +struct device_headt dtab_head; char *ident; char *hints; int hintmode; int yyline; const char *yyfile; -struct file_list *ftab; +struct file_list_headt ftab_head; char errbuf[80]; int maxusers; @@ -130,8 +128,7 @@ (struct cputype *)malloc(sizeof (struct cputype)); memset(cp, 0, sizeof(*cp)); cp->cpu_name = $2; - cp->cpu_next = cputype; - cputype = cp; + LIST_INSERT_HEAD(&cputype_head, cp, cpu_list); } | OPTIONS Opt_list | @@ -163,7 +160,7 @@ System_id: Save_id - = { newopt(&mkopt, ns("KERNEL"), $1); }; + = { newopt(&mkopt_head, ns("KERNEL"), $1); }; System_parameter_list: System_parameter_list ID @@ -181,14 +178,14 @@ = { char *s; - newopt(&opt, $1, NULL); + newopt(&opt_head, $1, NULL); if ((s = strchr($1, '='))) errx(1, "%s:%d: The `=' in options should not be " "quoted", yyfile, yyline); } | Save_id EQUALS Opt_value = { - newopt(&opt, $1, $3); + newopt(&opt_head, $1, $3); } ; Opt_value: @@ -215,7 +212,7 @@ Mkoption: Save_id EQUALS Opt_value - = { newopt(&mkopt, $1, $3); } ; + = { newopt(&mkopt_head, $1, $3); } ; Dev: ID @@ -225,13 +222,13 @@ Device_spec: DEVICE Dev = { - newopt(&opt, devopt($2), ns("1")); + newopt(&opt_head, devopt($2), ns("1")); /* and the device part */ newdev($2, UNKNOWN); } | DEVICE Dev NUMBER = { - newopt(&opt, devopt($2), ns("1")); + newopt(&opt_head, devopt($2), ns("1")); /* and the device part */ newdev($2, $3); if ($3 == 0) @@ -260,16 +257,11 @@ memset(np, 0, sizeof(*np)); np->d_name = name; np->d_count = count; - np->d_next = 0; - if (curp == 0) - dtab = np; - else - curp->d_next = np; - curp = np; + TAILQ_INSERT_TAIL(&dtab_head, np, d_list); } static void -newopt(struct opt **list, char *name, char *value) +newopt(struct opt_headt *headp, char *name, char *value) { struct opt *op; @@ -278,6 +270,5 @@ op->op_name = name; op->op_ownfile = 0; op->op_value = value; - op->op_next = *list; - *list = op; + LIST_INSERT_HEAD(headp, op, op_list); } Index: main.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/main.c,v retrieving revision 1.53 diff -u -r1.53 main.c --- main.c 2001/07/12 02:08:51 1.53 +++ main.c 2001/07/15 11:35:25 @@ -143,7 +143,7 @@ else if ((buf.st_mode & S_IFMT) != S_IFDIR) errx(2, "%s isn't a directory", p); - dtab = NULL; + TAILQ_INIT(&dtab_head); yyfile = *argv; if (yyparse()) exit(3); @@ -421,7 +421,7 @@ remember("y.tab.h"); remember("setdefs.h"); - for (fl = ftab; fl != NULL; fl = fl->f_next) + TAILQ_FOREACH(fl, &ftab_head, f_list) remember(fl->f_fn); /* Index: mkheaders.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkheaders.c,v retrieving revision 1.22 diff -u -r1.22 mkheaders.c --- mkheaders.c 2001/01/31 11:18:49 1.22 +++ mkheaders.c 2001/07/15 11:35:25 @@ -62,10 +62,10 @@ struct device *dp; int match; - for (fl = ftab; fl != 0; fl = fl->f_next) { + TAILQ_FOREACH(fl, &ftab_head, f_list) { if (fl->f_needs != 0) { match = 0; - for (dp = dtab; dp != 0; dp = dp->d_next) { + TAILQ_FOREACH(dp, &dtab_head, d_list) { if (eq(dp->d_name, fl->f_needs)) { match++; dp->d_done |= DEVDONE; @@ -75,7 +75,7 @@ do_header(fl->f_needs, match); } } - for (dp = dtab; dp != 0; dp = dp->d_next) { + TAILQ_FOREACH(dp, &dtab_head, d_list) { if (!(dp->d_done & DEVDONE)) errx(1, "Error: device \"%s\" is unknown", dp->d_name); @@ -86,7 +86,8 @@ do_header(char *dev, int match) { char *file, *name, *inw; - struct file_list *fl, *fl_head, *tflp; + struct file_list *fl; + struct file_list_headt localfl_head; struct device *dp; FILE *inf, *outf; int inc, oldcount; @@ -97,7 +98,8 @@ * and "hicount" will be the highest unit declared. do_header() * must use this higher of these values. */ - for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) { + hicount = count = 0; + TAILQ_FOREACH(dp, &dtab_head, d_list) { if (eq(dp->d_name, dev)) { count = dp->d_count != UNKNOWN ? dp->d_count : 1; @@ -119,7 +121,7 @@ (void) fclose(outf); return; } - fl_head = NULL; + TAILQ_INIT(&localfl_head); for (;;) { char *cp; if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) @@ -142,13 +144,13 @@ bzero(fl, sizeof(*fl)); fl->f_fn = inw; /* malloced */ fl->f_type = inc; - fl->f_next = fl_head; - fl_head = fl; + TAILQ_INSERT_HEAD(&localfl_head, fl, f_list); } (void) fclose(inf); if (count == oldcount) { - for (fl = fl_head; fl != NULL; fl = tflp) { - tflp = fl->f_next; + while (!TAILQ_EMPTY(&localfl_head)) { + fl = TAILQ_FIRST(&localfl_head); + TAILQ_REMOVE(&localfl_head, fl, f_list); free(fl->f_fn); free(fl); } @@ -159,16 +161,16 @@ bzero(fl, sizeof(*fl)); fl->f_fn = ns(name); fl->f_type = count; - fl->f_next = fl_head; - fl_head = fl; + TAILQ_INSERT_HEAD(&localfl_head, fl, f_list); } outf = fopen(file, "w"); if (outf == 0) err(1, "%s", file); - for (fl = fl_head; fl != NULL; fl = tflp) { + while (!TAILQ_EMPTY(&localfl_head)) { + fl = TAILQ_FIRST(&localfl_head); + TAILQ_REMOVE(&localfl_head, fl, f_list); fprintf(outf, "#define %s %u\n", fl->f_fn, count ? fl->f_type : 0); - tflp = fl->f_next; free(fl->f_fn); free(fl); } Index: mkmakefile.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkmakefile.c,v retrieving revision 1.68 diff -u -r1.68 mkmakefile.c --- mkmakefile.c 2001/02/28 02:53:32 1.68 +++ mkmakefile.c 2001/07/15 11:35:25 @@ -69,8 +69,6 @@ wd = word; \ } -static struct file_list *fcur; - static char *tail(char *); static void do_clean(FILE *); static void do_rules(FILE *); @@ -88,7 +86,7 @@ { struct file_list *fp; - for (fp = ftab ; fp != 0; fp = fp->f_next) { + TAILQ_FOREACH(fp, &ftab_head, f_list) { if (eq(fp->f_fn, file)) return (fp); } @@ -105,11 +103,7 @@ fp = (struct file_list *) malloc(sizeof *fp); bzero(fp, sizeof *fp); - if (fcur == 0) - fcur = ftab = fp; - else - fcur->f_next = fp; - fcur = fp; + TAILQ_INSERT_TAIL(&ftab_head, fp, f_list); return (fp); } @@ -142,12 +136,12 @@ if (profiling) fprintf(ofp, " -DGPROF"); - if (cputype == 0) { + if (LIST_EMPTY(&cputype_head)) { printf("cpu type must be specified\n"); exit(1); } fprintf(ofp, "\n"); - for (op = mkopt; op; op = op->op_next) + LIST_FOREACH(op, &mkopt_head, op_list) fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); if (debugging) fprintf(ofp, "DEBUG=-g\n"); @@ -254,7 +248,7 @@ /* * Read in the information about files used in making the system. - * Store it in the ftab linked list. + * Store it in the ftab_head list. */ static void read_files(void) @@ -268,7 +262,7 @@ int nreqs, first = 1, isdup, std, filetype, imp_rule, no_obj, needcount, before_depend, mandatory; - ftab = 0; + TAILQ_INIT(&ftab_head); if (ident == NULL) { printf("no ident line specified\n"); exit(1); @@ -428,7 +422,7 @@ needs = ns(wd); if (isdup) goto invis; - for (dp = dtab; dp != 0; dp = dp->d_next) + TAILQ_FOREACH(dp, &dtab_head, d_list) if (eq(dp->d_name, wd)) { if (std && dp->d_count <= 0) dp->d_count = 1; @@ -444,7 +438,7 @@ this, wd); exit(1); } - for (op = opt; op != 0; op = op->op_next) + LIST_FOREACH(op, &opt_head, op_list) if (op->op_value == 0 && opteq(op->op_name, wd)) { if (nreqs == 1) { free(needs); @@ -531,7 +525,7 @@ fputs("BEFORE_DEPEND=", fp); lpos = 15; - for (tp = ftab; tp; tp = tp->f_next) + TAILQ_FOREACH(tp, &ftab_head, f_list) if (tp->f_flags & BEFORE_DEPEND) { len = strlen(tp->f_fn); if ((len = 3 + len) + lpos > 72) { @@ -557,7 +551,7 @@ fprintf(fp, "OBJS="); lpos = 6; - for (tp = ftab; tp != 0; tp = tp->f_next) { + TAILQ_FOREACH(tp, &ftab_head, f_list) { if (tp->f_type == INVISIBLE || tp->f_flags & NO_OBJ) continue; sp = tail(tp->f_fn); @@ -593,7 +587,7 @@ fprintf(fp, "%sFILES=", SUFF); lpos = 8; - for (tp = ftab; tp; tp = tp->f_next) + TAILQ_FOREACH(tp, &ftab_head, f_list) if (tp->f_type != INVISIBLE && tp->f_type != NODEPEND) { len = strlen(tp->f_fn); if (tp->f_fn[len - slen - 1] != '.') @@ -636,7 +630,7 @@ struct file_list *ftp; char *compilewith; - for (ftp = ftab; ftp != 0; ftp = ftp->f_next) { + TAILQ_FOREACH(ftp, &ftab_head, f_list) { if (ftp->f_type == INVISIBLE) continue; if (ftp->f_warn) @@ -702,7 +696,7 @@ fputs("CLEAN=", fp); lpos = 7; - for (tp = ftab; tp; tp = tp->f_next) + TAILQ_FOREACH(tp, &ftab_head, f_list) if (tp->f_clean) { len = strlen(tp->f_clean); if (len + lpos > 72) { Index: mkoptions.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkoptions.c,v retrieving revision 1.28 diff -u -r1.28 mkoptions.c --- mkoptions.c 2001/02/28 02:07:47 1.28 +++ mkoptions.c 2001/07/15 11:35:25 @@ -52,6 +52,11 @@ #include "config.h" #include "y.tab.h" +struct cputype_headt cputype_head = LIST_HEAD_INITIALIZER(cputype_head); +struct opt_headt opt_head = LIST_HEAD_INITIALIZER(opt_head); +struct opt_headt mkopt_head = LIST_HEAD_INITIALIZER(mkopt_head); +struct opt_list_headt otab_head = LIST_HEAD_INITIALIZER(otab_head); + static struct users { int u_default; int u_min; @@ -72,12 +77,11 @@ struct opt *op; /* Fake the cpu types as options. */ - for (cp = cputype; cp != NULL; cp = cp->cpu_next) { + LIST_FOREACH(cp, &cputype_head, cpu_list) { op = (struct opt *)malloc(sizeof(*op)); memset(op, 0, sizeof(*op)); op->op_name = ns(cp->cpu_name); - op->op_next = opt; - opt = op; + LIST_INSERT_HEAD(&opt_head, op, op_list); } if (maxusers == 0) { @@ -95,13 +99,12 @@ op->op_name = ns("MAXUSERS"); snprintf(buf, sizeof(buf), "%d", maxusers); op->op_value = ns(buf); - op->op_next = opt; - opt = op; + LIST_INSERT_HEAD(&opt_head, op, op_list); read_options(); - for (ol = otab; ol != 0; ol = ol->o_next) + LIST_FOREACH(ol, &otab_head, o_list) do_option(ol->o_name); - for (op = opt; op; op = op->op_next) { + LIST_FOREACH(op, &opt_head, op_list) { if (!op->op_ownfile && strncmp(op->op_name, "DEV_", 4)) { printf("%s: unknown option \"%s\"\n", PREFIX, op->op_name); @@ -120,7 +123,8 @@ char *file, *inw; const char *basefile; struct opt_list *ol; - struct opt *op, *op_head, *topp; + struct opt *op; + struct opt_headt localopt_head; FILE *inf, *outf; char *value; char *oldvalue; @@ -133,7 +137,7 @@ * Check to see if the option was specified.. */ value = NULL; - for (op = opt; op; op = op->op_next) { + LIST_FOREACH(op, &opt_head, op_list) { if (eq(name, op->op_name)) { oldvalue = value; value = op->op_value; @@ -164,13 +168,13 @@ return; } basefile = ""; - for (ol = otab; ol != 0; ol = ol->o_next) + LIST_FOREACH(ol, &otab_head, o_list) if (eq(name, ol->o_name)) { basefile = ol->o_file; break; } oldvalue = NULL; - op_head = NULL; + LIST_INIT(&localopt_head); seen = 0; tidy = 0; for (;;) { @@ -194,7 +198,7 @@ invalue = value; seen++; } - for (ol = otab; ol != 0; ol = ol->o_next) + LIST_FOREACH(ol, &otab_head, o_list) if (eq(inw, ol->o_name)) break; if (!eq(inw, name) && !ol) { @@ -210,8 +214,7 @@ bzero(op, sizeof(*op)); op->op_name = inw; op->op_value = invalue; - op->op_next = op_head; - op_head = op; + LIST_INSERT_HEAD(&localopt_head, op, op_list); } /* EOL? */ @@ -221,9 +224,10 @@ } (void) fclose(inf); if (!tidy && ((value == NULL && oldvalue == NULL) || - (value && oldvalue && eq(value, oldvalue)))) { - for (op = op_head; op != NULL; op = topp) { - topp = op->op_next; + (value && oldvalue && eq(value, oldvalue)))) { + while (!LIST_EMPTY(&localopt_head)) { + op = LIST_FIRST(&localopt_head); + LIST_REMOVE(op, op_list); free(op->op_name); free(op->op_value); free(op); @@ -237,20 +241,20 @@ bzero(op, sizeof(*op)); op->op_name = ns(name); op->op_value = value ? ns(value) : NULL; - op->op_next = op_head; - op_head = op; + LIST_INSERT_HEAD(&localopt_head, op, op_list); } outf = fopen(file, "w"); if (outf == 0) err(1, "%s", file); - for (op = op_head; op != NULL; op = topp) { + while (!LIST_EMPTY(&localopt_head)) { + op = LIST_FIRST(&localopt_head); + LIST_REMOVE(op, op_list); /* was the option in the config file? */ if (op->op_value) { fprintf(outf, "#define %s %s\n", op->op_name, op->op_value); } - topp = op->op_next; free(op->op_name); free(op->op_value); free(op); @@ -271,7 +275,7 @@ /* "cannot happen"? the otab list should be complete.. */ (void) strlcpy(nbuf, "options.h", sizeof(nbuf)); - for (po = otab ; po != 0; po = po->o_next) { + LIST_FOREACH(po, &otab_head, o_list) { if (eq(po->o_name, name)) { strlcpy(nbuf, po->o_file, sizeof(nbuf)); break; @@ -341,7 +345,7 @@ } val = ns(val); - for (po = otab ; po != 0; po = po->o_next) { + LIST_FOREACH(po, &otab_head, o_list) { if (eq(po->o_name, this)) { printf("%s: Duplicate option %s.\n", fname, this); @@ -353,8 +357,7 @@ bzero(po, sizeof(*po)); po->o_name = this; po->o_file = val; - po->o_next = otab; - otab = po; + LIST_INSERT_HEAD(&otab_head, po, o_list); goto next; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 4:51:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 6699937B401; Sun, 15 Jul 2001 04:49:04 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 9D78C3E2F; Sun, 15 Jul 2001 04:49:03 -0700 (PDT) To: stable@freebsd.org, audit@freebsd.org Subject: Patch to remove most of DEVFS from -stable Date: Sun, 15 Jul 2001 04:49:03 -0700 From: Dima Dorfman Message-Id: <20010715114903.9D78C3E2F@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG As previously discussed on -stable, I'l planning to remove the old, non-working DEVFS from RELENG_4. This is mostly so that people won't confuse the DEVFS stuff that's going on in -current with what's in -stable; the implementations are totally unrelated. Attached please find a patch that removes most of the devfs-related code from -stable. Actually, it only removes things that use or depend on devfs; the actual devfs implementation will be removed later. I've been running with this stuff for a while, but since it's going directly into -stable I don't plan to apply it for a week, perhaps more. Please test and review. Thanks, Dima Dorfman dima@unixfreak.org Index: etc/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/etc/Makefile,v retrieving revision 1.219.2.16 diff -u -r1.219.2.16 Makefile --- etc/Makefile 2001/06/04 14:58:44 1.219.2.16 +++ etc/Makefile 2001/07/04 23:18:36 @@ -12,7 +12,7 @@ inetd.conf login.access login.conf \ motd modems networks newsyslog.conf \ pam.conf phones printcap profile protocols \ - rc rc.atm rc.devfs rc.diskless1 rc.diskless2 rc.firewall rc.firewall6 \ + rc rc.atm rc.diskless1 rc.diskless2 rc.firewall rc.firewall6 \ rc.isdn rc.network rc.network6 rc.pccard rc.serial rc.shutdown \ rc.syscons rc.sysctl remote rpc security services shells syslog.conf \ usbd.conf \ Index: etc/rc.diskless2 =================================================================== RCS file: /stl/src/FreeBSD/src/etc/rc.diskless2,v retrieving revision 1.5.2.7 diff -u -r1.5.2.7 rc.diskless2 --- etc/rc.diskless2 2001/05/11 17:46:57 1.5.2.7 +++ etc/rc.diskless2 2001/07/04 23:18:36 @@ -76,12 +76,7 @@ mount_md ${tmpsize:=20480} /tmp 2 fi -if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then - # we have DEVFS, no worries... - true -else - # extract a list of device entries, then copy them to a writable fs - (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp - mount_md 4096 /dev 3 512 - (cd /; cpio -i -H newc -d < /tmp/dev.tmp) -fi +# extract a list of device entries, then copy them to a writable fs +(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp +mount_md 4096 /dev 3 512 +(cd /; cpio -i -H newc -d < /tmp/dev.tmp) Index: sbin/init/init.c =================================================================== RCS file: /stl/src/FreeBSD/src/sbin/init/init.c,v retrieving revision 1.38.2.4 diff -u -r1.38.2.4 init.c --- sbin/init/init.c 2001/05/22 22:57:56 1.38.2.4 +++ sbin/init/init.c 2001/07/04 23:19:53 @@ -134,8 +134,6 @@ int Reboot = FALSE; int howto = RB_AUTOBOOT; -int devfs; - void transition __P((state_t)); state_t requested_transition = runcom; @@ -264,11 +262,8 @@ * This code assumes that we always get arguments through flags, * never through bits set in some random machine register. */ - while ((c = getopt(argc, argv, "dsf")) != -1) + while ((c = getopt(argc, argv, "sf")) != -1) switch (c) { - case 'd': - devfs = 1; - break; case 's': requested_transition = single_user; break; @@ -282,10 +277,6 @@ if (optind != argc) warning("ignoring excess arguments"); - - if (devfs) { - mount("devfs", _PATH_DEV, MNT_NOEXEC|MNT_RDONLY, 0); - } /* * We catch or block signals rather than ignore them, Index: sbin/mount/mount.8 =================================================================== RCS file: /stl/src/FreeBSD/src/sbin/mount/mount.8,v retrieving revision 1.31.2.5 diff -u -r1.31.2.5 mount.8 --- sbin/mount/mount.8 2001/03/05 19:33:45 1.31.2.5 +++ sbin/mount/mount.8 2001/07/04 23:19:53 @@ -369,7 +369,6 @@ .Xr fstab 5 , .Xr kldload 8 , .Xr mount_cd9660 8 , -.Xr mount_devfs 8 , .Xr mount_fdesc 8 , .Xr mount_kernfs 8 , .Xr mount_mfs 8 , Index: sbin/mount_std/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/sbin/mount_std/Makefile,v retrieving revision 1.4.6.2 diff -u -r1.4.6.2 Makefile --- sbin/mount_std/Makefile 2001/04/25 10:58:39 1.4.6.2 +++ sbin/mount_std/Makefile 2001/07/04 23:19:53 @@ -4,7 +4,7 @@ PROG= mount_std SRCS= mount_std.c getmntopts.c MAN= mount_std.8 -MLINKS= mount_std.8 mount_devfs.8 mount_std.8 mount_fdesc.8 \ +MLINKS= mount_std.8 mount_fdesc.8 \ mount_std.8 mount_kernfs.8 mount_std.8 mount_linprocfs.8 \ mount_std.8 mount_procfs.8 @@ -12,8 +12,7 @@ CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} -LINKS= ${BINDIR}/mount_std ${BINDIR}/mount_devfs \ - ${BINDIR}/mount_std ${BINDIR}/mount_fdesc \ +LINKS= ${BINDIR}/mount_std ${BINDIR}/mount_fdesc \ ${BINDIR}/mount_std ${BINDIR}/mount_kernfs \ ${BINDIR}/mount_std ${BINDIR}/mount_linprocfs \ ${BINDIR}/mount_std ${BINDIR}/mount_procfs Index: sbin/mount_std/mount_std.8 =================================================================== RCS file: /stl/src/FreeBSD/src/sbin/mount_std/mount_std.8,v retrieving revision 1.9.2.3 diff -u -r1.9.2.3 mount_std.8 --- sbin/mount_std/mount_std.8 2000/12/14 12:12:32 1.9.2.3 +++ sbin/mount_std/mount_std.8 2001/07/04 23:19:53 @@ -41,7 +41,6 @@ .Os FreeBSD .Sh NAME .Nm mount_std , -.Nm mount_devfs , .Nm mount_fdesc , .Nm mount_kernfs , .Nm mount_linprocfs , @@ -59,7 +58,6 @@ the filesystem. The .Nm command currently supports the following filesystems: -.Nm devfs , .Nm fdesc , .Nm kernfs , .Nm linprocfs @@ -120,7 +118,6 @@ .Pp Refer to the following manual pages for detailed information on these file system: -.Xr devfs 5 , .Xr fdesc 5 , .Xr kernfs 5 , .Xr linprocfs 5 @@ -144,7 +141,6 @@ .Xr mount 2 , .Xr unmount 2 , .Xr getvfsbyname 3 , -.Xr devfs 5 , .Xr fdesc 5 , .Xr fstab 5 , .Xr kernfs 5 , @@ -167,10 +163,6 @@ .Dq procfs filesystem types first appeared in .Fx 2.0 ; -the -.Dq devfs -filesystem type first appeared in -.Fx 2.2 ; the .Dq linprocfs filesystem type first appeared in Index: share/man/man4/intro.4 =================================================================== RCS file: /stl/src/FreeBSD/src/share/man/man4/intro.4,v retrieving revision 1.13.2.2 diff -u -r1.13.2.2 intro.4 --- share/man/man4/intro.4 2000/12/14 12:14:29 1.13.2.2 +++ share/man/man4/intro.4 2001/07/04 23:20:16 @@ -72,9 +72,7 @@ in the file system hierarchy .Pq see also Xr hier 7 . .Pp -Until -.Xr devfs 5 -is fully functional, each device node must be created statically and +Each device node must be created statically and independently of the existence of the associated device driver, usually by running .Xr MAKEDEV 8 . @@ -160,7 +158,6 @@ .Xr select 2 , .Xr socket 2 , .Xr write 2 , -.Xr devfs 5 , .Xr hier 7 , .Xr config 8 , .Xr MAKEDEV 8 Index: share/man/man4/psm.4 =================================================================== RCS file: /stl/src/FreeBSD/src/share/man/man4/psm.4,v retrieving revision 1.24.2.4 diff -u -r1.24.2.4 psm.4 --- share/man/man4/psm.4 2001/03/06 19:08:11 1.24.2.4 +++ share/man/man4/psm.4 2001/07/04 23:20:16 @@ -618,8 +618,7 @@ .It Pa /dev/psm0 `non-blocking' device node .It Pa /dev/bpsm0 -`blocking' device node under -.Em devfs . +`blocking' device node .El .Sh EXAMPLES .Dl "device psm0 at atkbdc? irq 12 flags 0x2000" Index: share/man/man4/man4.i386/mse.4 =================================================================== RCS file: /stl/src/FreeBSD/src/share/man/man4/man4.i386/mse.4,v retrieving revision 1.10.2.1 diff -u -r1.10.2.1 mse.4 --- share/man/man4/man4.i386/mse.4 2000/12/08 14:59:14 1.10.2.1 +++ share/man/man4/man4.i386/mse.4 2001/07/04 23:20:17 @@ -330,13 +330,9 @@ .Sh FILES .Bl -tag -width /dev/nmse0 -compact .It Pa /dev/mse0 -`non-blocking' device node in the system without -.Em devfs , -`blocking' under -.Em devfs . +`non-blocking' device node .It Pa /dev/nmse0 -`non-blocking' device node under -.Em devfs . +`non-blocking' device node .El .Sh EXAMPLES .Dl "device mse0 at isa? port 0x23c irq 5" Index: share/man/man9/DEVICE_ATTACH.9 =================================================================== RCS file: /stl/src/FreeBSD/src/share/man/man9/DEVICE_ATTACH.9,v retrieving revision 1.3 diff -u -r1.3 DEVICE_ATTACH.9 --- share/man/man9/DEVICE_ATTACH.9 1999/08/28 00:21:05 1.3 +++ share/man/man9/DEVICE_ATTACH.9 2001/07/04 23:20:17 @@ -44,7 +44,8 @@ Attach a device to the system. The probe method will have been called and will have indicated that the device exists. This routine should initialise the hardware and allocate other system resources (such as -devfs entries). +.Pa /dev +entries). .Sh RETURN VALUES Zero is returned on success, otherwise an appropriate error is returned. .Sh SEE ALSO Index: share/man/man9/make_dev.9 =================================================================== RCS file: /stl/src/FreeBSD/src/share/man/man9/make_dev.9,v retrieving revision 1.2 diff -u -r1.2 make_dev.9 --- share/man/man9/make_dev.9 1999/12/23 17:16:31 1.2 +++ share/man/man9/make_dev.9 2001/07/04 23:20:17 @@ -30,7 +30,7 @@ .Sh NAME .Nm make_dev , .Nm destroy_dev -.Nd "Create or destroy dev_t and devfs registration for a new device" +.Nd "Create or destroy dev_t for a new device" .Sh SYNOPSIS .Fd #include .Fd #include @@ -43,8 +43,8 @@ .Fn make_dev function creates a .Fa dev_t -structure for a new device. If DEVFS is available, it is also notified of -the presence of the new device. The device will be owned by +structure for a new device. +The device will be owned by .Va uid , with the group ownership as .Va gid , Index: share/man/man9/vnode.9 =================================================================== RCS file: /stl/src/FreeBSD/src/share/man/man9/vnode.9,v retrieving revision 1.10.2.1 diff -u -r1.10.2.1 vnode.9 --- share/man/man9/vnode.9 2000/12/29 10:18:08 1.10.2.1 +++ share/man/man9/vnode.9 2001/07/04 23:20:17 @@ -52,7 +52,7 @@ enum vtagtype { VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS + VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS }; /* Index: sys/conf/files =================================================================== RCS file: /stl/src/FreeBSD/src/sys/conf/files,v retrieving revision 1.340.2.63 diff -u -r1.340.2.63 files --- sys/conf/files 2001/06/20 06:12:51 1.340.2.63 +++ sys/conf/files 2001/07/04 23:20:26 @@ -589,9 +589,6 @@ kern/kern_threads.c standard kern/vfs_aio.c standard miscfs/deadfs/dead_vnops.c standard -miscfs/devfs/devfs_tree.c optional devfs -miscfs/devfs/devfs_vfsops.c optional devfs -miscfs/devfs/devfs_vnops.c optional devfs miscfs/fdesc/fdesc_vfsops.c optional fdesc miscfs/fdesc/fdesc_vnops.c optional fdesc miscfs/fifofs/fifo_vnops.c standard Index: sys/conf/options =================================================================== RCS file: /stl/src/FreeBSD/src/sys/conf/options,v retrieving revision 1.191.2.27 diff -u -r1.191.2.27 options --- sys/conf/options 2001/06/09 16:18:10 1.191.2.27 +++ sys/conf/options 2001/07/04 23:20:26 @@ -63,7 +63,6 @@ DDB DDB_UNATTENDED opt_ddb.h GDB_REMOTE_CHAT opt_ddb.h -DEVFS HW_WDOG KTRACE LIBICONV Index: sys/i4b/driver/i4b_ctl.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/i4b/driver/i4b_ctl.c,v retrieving revision 1.10 diff -u -r1.10 i4b_ctl.c --- sys/i4b/driver/i4b_ctl.c 1999/12/14 20:48:12 1.10 +++ sys/i4b/driver/i4b_ctl.c 2001/07/04 23:20:39 @@ -62,18 +62,6 @@ #include #ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__ */ - -#ifdef __FreeBSD__ #include #include #elif defined(__bsdi__) @@ -137,12 +125,6 @@ #define PDEVSTATIC static #endif /* __FreeBSD__ */ -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS -static void *devfs_token; -#endif -#endif - #ifndef __FreeBSD__ #define PDEVSTATIC /* */ void i4bctlattach __P((void)); @@ -217,17 +199,7 @@ #endif #if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - devfs_token = devfs_add_devswf(&i4bctl_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4bctl"); -#endif - -#else make_dev(&i4bctl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4bctl"); -#endif #endif } Index: sys/i4b/driver/i4b_rbch.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/i4b/driver/i4b_rbch.c,v retrieving revision 1.10 diff -u -r1.10 i4b_rbch.c --- sys/i4b/driver/i4b_rbch.c 1999/12/14 20:48:13 1.10 +++ sys/i4b/driver/i4b_rbch.c 2001/07/04 23:20:39 @@ -56,18 +56,6 @@ #define termioschars(t) memcpy((t)->c_cc, &ttydefchars, sizeof((t)->c_cc)) #endif -#ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__ */ - #ifdef __NetBSD__ #include #define bootverbose 0 @@ -136,12 +124,6 @@ struct selinfo selp; /* select / poll */ -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS - void *devfs_token; /* device filesystem */ -#endif -#endif - #if I4BRBCHACCT #if defined(__FreeBSD__) struct callout_handle sc_callout; @@ -296,19 +278,8 @@ for(i=0; i < NI4BRBCH; i++) { #if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - rbch_softc[i].devfs_token = - devfs_add_devswf(&i4brbch_cdevsw, i, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4brbch%d", i); -#endif - -#else make_dev(&i4brbch_cdevsw, i, UID_ROOT, GID_WHEEL, 0600, "i4brbch%d", i); -#endif #endif #if I4BRBCHACCT Index: sys/i4b/driver/i4b_tel.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/i4b/driver/i4b_tel.c,v retrieving revision 1.10 diff -u -r1.10 i4b_tel.c --- sys/i4b/driver/i4b_tel.c 1999/12/14 20:48:13 1.10 +++ sys/i4b/driver/i4b_tel.c 2001/07/04 23:20:40 @@ -61,18 +61,6 @@ #include #include -#ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__ */ - #ifdef __bsdi__ #include #endif @@ -136,13 +124,6 @@ #define ST_WRWAITEMPTY 0x08 /* userland write waiting */ struct selinfo selp; /* select / poll */ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS - void *devfs_token; /* token for DEVFS */ -#endif -#endif - } tel_sc_t; static tel_sc_t tel_sc[NI4BTEL][NOFUNCS]; @@ -316,17 +297,6 @@ tel_sc[i][j].result = 0; #if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - -/* XXX */ tel_sc[i][j].devfs_token - = devfs_add_devswf(&i4btel_cdevsw, i, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4btel%d", i); -#endif - -#else switch(j) { case FUNCTEL: /* normal i4btel device */ @@ -341,7 +311,6 @@ 0600, "i4bteld%d", i); break; } -#endif #endif } tel_init_linktab(i); Index: sys/i4b/driver/i4b_trace.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/i4b/driver/i4b_trace.c,v retrieving revision 1.9 diff -u -r1.9 i4b_trace.c --- sys/i4b/driver/i4b_trace.c 1999/12/14 20:48:13 1.9 +++ sys/i4b/driver/i4b_trace.c 2001/07/04 23:20:40 @@ -72,10 +72,6 @@ #ifdef __FreeBSD__ -#ifdef DEVFS -#include -#endif - #include #include @@ -100,12 +96,6 @@ #define ST_ISOPEN 0x01 #define ST_WAITDATA 0x02 -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS -static void *devfs_token[NI4BTRC]; -#endif -#endif - static int analyzemode = 0; static int rxunit = -1; static int txunit = -1; @@ -242,19 +232,8 @@ { #if defined(__FreeBSD__) -#if __FreeBSD__ < 4 - -#ifdef DEVFS - devfs_token[i] - = devfs_add_devswf(&i4btrc_cdevsw, i, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4btrc%d", i); -#endif - -#else make_dev(&i4btrc_cdevsw, i, UID_ROOT, GID_WHEEL, 0600, "i4btrc%d", i); -#endif #endif trace_queue[i].ifq_maxlen = IFQ_MAXLEN; device_state[i] = ST_IDLE; Index: sys/i4b/layer4/i4b_i4bdrv.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/i4b/layer4/i4b_i4bdrv.c,v retrieving revision 1.11 diff -u -r1.11 i4b_i4bdrv.c --- sys/i4b/layer4/i4b_i4bdrv.c 1999/12/14 20:48:34 1.11 +++ sys/i4b/layer4/i4b_i4bdrv.c 2001/07/04 23:20:40 @@ -72,18 +72,6 @@ #include #ifdef __FreeBSD__ - -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#include "opt_devfs.h" -#endif - -#ifdef DEVFS -#include -#endif - -#endif /* __FreeBSD__*/ - -#ifdef __FreeBSD__ #include #include #include @@ -110,12 +98,6 @@ static int selflag = 0; static int readflag = 0; -#if defined(__FreeBSD__) && __FreeBSD__ == 3 -#ifdef DEVFS -static void *devfs_token; -#endif -#endif - #ifndef __FreeBSD__ #define PDEVSTATIC /* - not static - */ @@ -253,17 +235,7 @@ i4b_rdqueue.ifq_maxlen = IFQ_MAXLEN; #if defined(__FreeBSD__) -#if __FreeBSD__ == 3 - -#ifdef DEVFS - devfs_token = devfs_add_devswf(&i4b_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "i4b"); -#endif - -#else make_dev(&i4b_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4b"); -#endif #endif } Index: sys/kern/Make.tags.inc =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/Make.tags.inc,v retrieving revision 1.6 diff -u -r1.6 Make.tags.inc --- sys/kern/Make.tags.inc 2000/01/27 01:21:58 1.6 +++ sys/kern/Make.tags.inc 2001/07/04 23:20:40 @@ -32,7 +32,6 @@ ${SYS}/isofs/cd9660/*.[ch] \ ${SYS}/kern/*.[ch] \ ${SYS}/miscfs/deadfs/*.[ch] \ - ${SYS}/miscfs/devfs/*.[ch] \ ${SYS}/miscfs/fdesc/*.[ch] \ ${SYS}/miscfs/fifofs/*.[ch] \ ${SYS}/miscfs/kernfs/*.[ch] \ @@ -97,7 +96,6 @@ ${SYS}/dev/vx \ ${SYS}/isofs/cd9660 \ ${SYS}/miscfs/deadfs \ - ${SYS}/miscfs/devfs \ ${SYS}/miscfs/fdesc \ ${SYS}/miscfs/fifofs \ ${SYS}/miscfs/kernfs \ Index: sys/kern/device_if.m =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/device_if.m,v retrieving revision 1.7 diff -u -r1.7 device_if.m --- sys/kern/device_if.m 1999/08/28 00:46:09 1.7 +++ sys/kern/device_if.m 2001/07/04 23:20:40 @@ -86,8 +86,8 @@ # # Attach a device to the system. The probe method will have been # called and will have indicated that the device exists. This routine -# should initialise the hardware and allocate other system resources -# (such as devfs entries). Returns 0 on success. +# should initialise the hardware and allocate other system resources. +# Returns 0 on success. # METHOD int attach { device_t dev; Index: sys/kern/kern_conf.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/kern_conf.c,v retrieving revision 1.73 diff -u -r1.73 kern_conf.c --- sys/kern/kern_conf.c 2000/01/23 15:47:46 1.73 +++ sys/kern/kern_conf.c 2001/07/04 23:20:40 @@ -68,9 +68,6 @@ static LIST_HEAD(, specinfo) dev_free; -devfs_create_t *devfs_create_hook; -devfs_remove_t *devfs_remove_hook; - static int free_devt; SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); @@ -305,16 +302,12 @@ va_end(ap); dev->si_devsw = devsw; - if (devfs_create_hook) - devfs_create_hook(dev, uid, gid, perms); return (dev); } void destroy_dev(dev_t dev) { - if (devfs_remove_hook) - devfs_remove_hook(dev); dev->si_drv1 = 0; dev->si_drv2 = 0; dev->si_devsw = 0; Index: sys/kern/subr_diskslice.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/subr_diskslice.c,v retrieving revision 1.82.2.5 diff -u -r1.82.2.5 subr_diskslice.c --- sys/kern/subr_diskslice.c 2001/03/05 13:09:01 1.82.2.5 +++ sys/kern/subr_diskslice.c 2001/07/04 23:20:40 @@ -46,15 +46,10 @@ * $FreeBSD: src/sys/kern/subr_diskslice.c,v 1.82.2.5 2001/03/05 13:09:01 obrien Exp $ */ -#include "opt_devfs.h" - #include #include #include #include -#ifdef DEVFS -#include -#endif #include #include #include @@ -76,17 +71,11 @@ static char *fixlabel __P((char *sname, struct diskslice *sp, struct disklabel *lp, int writeflag)); static void free_ds_label __P((struct diskslices *ssp, int slice)); -#ifdef DEVFS -static void free_ds_labeldevs __P((struct diskslices *ssp, int slice)); -#endif static void partition_info __P((char *sname, int part, struct partition *pp)); static void slice_info __P((char *sname, struct diskslice *sp)); static void set_ds_label __P((struct diskslices *ssp, int slice, struct disklabel *lp)); static void set_ds_labeldevs __P((dev_t dev, struct diskslices *ssp)); -#ifdef DEVFS -static void set_ds_labeldevs_unaliased __P((dev_t dev, struct diskslices *ssp)); -#endif static void set_ds_wlabel __P((struct diskslices *ssp, int slice, int wlabel)); @@ -334,10 +323,6 @@ for (slice = 0, ssp = *sspp; slice < ssp->dss_nslices; slice++) { sp = &ssp->dss_slices[slice]; -#ifdef DEVFS - if (sp->ds_dev != NULL) - devfs_remove_dev(sp->ds_dev); -#endif free_ds_label(ssp, slice); } free(ssp, M_DEVBUF); @@ -517,16 +502,13 @@ S_IFCHR, ssp->dss_oflags, sspp, lp); if (error != 0) { - /* XXX should free devfs toks. */ free(lp, M_DEVBUF); - /* XXX should restore devfs toks. */ *sspp = ssp; return (EBUSY); } } } - /* XXX devfs tokens? */ free(lp, M_DEVBUF); dsgone(&ssp); return (0); @@ -675,9 +657,6 @@ struct disklabel *lp1; char *msg; u_char mask; -#ifdef DEVFS - int mynor; -#endif bool_t need_init; int part; char partname[2]; @@ -752,7 +731,7 @@ /* * Initialize secondary info for all slices. It is needed for more - * than the current slice in the DEVFS case. + * than the current slice in the DEVFS case. XXX DEVFS is no more. */ for (slice = 0; slice < ssp->dss_nslices; slice++) { sp = &ssp->dss_slices[slice]; @@ -764,16 +743,6 @@ continue; dev1 = dkmodslice(dkmodpart(dev, RAW_PART), slice); sname = dsname(dev, unit, slice, RAW_PART, partname); -#ifdef DEVFS - if (slice != COMPATIBILITY_SLICE && sp->ds_dev == NULL - && sp->ds_size != 0) { - mynor = minor(dev1); - sp->ds_dev = - devfs_add_devswf(devsw(dev1), mynor, DV_CHR, - UID_ROOT, GID_OPERATOR, 0640, - "r%s", sname); - } -#endif /* * XXX this should probably only be done for the need_init * case, but there may be a problem with DIOCSYNCSLICEINFO. @@ -879,40 +848,10 @@ lp = sp->ds_label; if (lp == NULL) return; -#ifdef DEVFS - free_ds_labeldevs(ssp, slice); - if (slice == COMPATIBILITY_SLICE) - free_ds_labeldevs(ssp, ssp->dss_first_bsd_slice); - else if (slice == ssp->dss_first_bsd_slice) - free_ds_labeldevs(ssp, COMPATIBILITY_SLICE); -#endif free(lp, M_DEVBUF); set_ds_label(ssp, slice, (struct disklabel *)NULL); } -#ifdef DEVFS -static void -free_ds_labeldevs(ssp, slice) - struct diskslices *ssp; - int slice; -{ - struct disklabel *lp; - int part; - struct diskslice *sp; - - sp = &ssp->dss_slices[slice]; - lp = sp->ds_label; - if (lp == NULL) - return; - for (part = 0; part < lp->d_npartitions; part++) { - if (sp->ds_devs[part] != NULL) { - devfs_remove_dev(sp->ds_devs[part]); - sp->ds_devs[part] = NULL; - } - } -} -#endif - static char * fixlabel(sname, sp, lp, writeflag) char *sname; @@ -1032,66 +971,13 @@ ssp->dss_slices[COMPATIBILITY_SLICE].ds_label = lp; } +/* XXX remove this? */ static void set_ds_labeldevs(dev, ssp) dev_t dev; struct diskslices *ssp; { -#ifdef DEVFS - int slice; - - set_ds_labeldevs_unaliased(dev, ssp); - if (ssp->dss_first_bsd_slice == COMPATIBILITY_SLICE) - return; - slice = dkslice(dev); - if (slice == COMPATIBILITY_SLICE) - set_ds_labeldevs_unaliased( - dkmodslice(dev, ssp->dss_first_bsd_slice), ssp); - else if (slice == ssp->dss_first_bsd_slice) - set_ds_labeldevs_unaliased( - dkmodslice(dev, COMPATIBILITY_SLICE), ssp); -#endif /* DEVFS */ -} - -#ifdef DEVFS -static void -set_ds_labeldevs_unaliased(dev, ssp) - dev_t dev; - struct diskslices *ssp; -{ - struct disklabel *lp; - int mynor; - int part; - char partname[2]; - struct partition *pp; - int slice; - char *sname; - struct diskslice *sp; - - slice = dkslice(dev); - sp = &ssp->dss_slices[slice]; - if (sp->ds_size == 0) - return; - lp = sp->ds_label; - for (part = 0; part < lp->d_npartitions; part++) { - pp = &lp->d_partitions[part]; - if (pp->p_size == 0) - continue; - sname = dsname(dev, dkunit(dev), slice, part, partname); - if (part == RAW_PART && sp->ds_dev != NULL) { - sp->ds_devs[part] = - devfs_makelink(sp->ds_dev, - "r%s%s", sname, partname); - } else { - mynor = minor(dkmodpart(dev, part)); - sp->ds_devs[part] = - devfs_add_devswf(devsw(dev), mynor, DV_CHR, - UID_ROOT, GID_OPERATOR, 0640, - "r%s%s", sname, partname); - } - } } -#endif /* DEVFS */ static void set_ds_wlabel(ssp, slice, wlabel) Index: sys/kern/tty_pty.c =================================================================== RCS file: /stl/src/FreeBSD/src/sys/kern/tty_pty.c,v retrieving revision 1.74.2.2 diff -u -r1.74.2.2 tty_pty.c --- sys/kern/tty_pty.c 2001/06/11 09:08:52 1.74.2.2 +++ sys/kern/tty_pty.c 2001/07/04 23:20:41 @@ -178,6 +178,7 @@ /* * XXX: Gross hack for DEVFS: + * XXX: DEVFS is no more, should this be removed? * If we openned this device, ensure we have the * next one too, so people can open it. */ @@ -826,6 +827,7 @@ cdevsw_add(&pts_cdevsw); cdevsw_add(&ptc_cdevsw); /* XXX: Gross hack for DEVFS */ + /* XXX: DEVFS is no more, should this be removed? */ ptyinit(0); } Index: sys/modules/coda/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/sys/modules/coda/Makefile,v retrieving revision 1.7 diff -u -r1.7 Makefile --- sys/modules/coda/Makefile 1999/12/12 16:47:23 1.7 +++ sys/modules/coda/Makefile 2001/07/04 23:20:45 @@ -4,7 +4,7 @@ KMOD= coda SRCS= vnode_if.h \ coda_fbsd.c coda_namecache.c coda_psdev.c coda_subr.c \ - coda_venus.c coda_vfsops.c coda_vnops.c opt_devfs.h vcoda.h + coda_venus.c coda_vfsops.c coda_vnops.c vcoda.h NOMAN= CLEANFILES= vcoda.h Index: sys/modules/if_tap/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/sys/modules/if_tap/Makefile,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 Makefile --- sys/modules/if_tap/Makefile 2000/07/27 13:57:05 1.1.2.1 +++ sys/modules/if_tap/Makefile 2001/07/04 23:20:45 @@ -7,9 +7,9 @@ .PATH: ${.CURDIR}/../../net KMOD= if_tap -SRCS= if_tap.c opt_devfs.h opt_inet.h vnode_if.h +SRCS= if_tap.c opt_inet.h vnode_if.h -CLEANFILES+= opt_devfs.h opt_inet.h vnode_if.h +CLEANFILES+= opt_inet.h vnode_if.h opt_inet.h: echo "#define INET 1" > opt_inet.h Index: sys/modules/if_tun/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/sys/modules/if_tun/Makefile,v retrieving revision 1.19 diff -u -r1.19 Makefile --- sys/modules/if_tun/Makefile 2000/01/29 01:11:03 1.19 +++ sys/modules/if_tun/Makefile 2001/07/04 23:20:45 @@ -2,7 +2,7 @@ .PATH: ${.CURDIR}/../../net KMOD= if_tun -SRCS= if_tun.c opt_devfs.h opt_inet.h vnode_if.h +SRCS= if_tun.c opt_inet.h vnode_if.h NOMAN= NBPF?= 1 Index: sys/modules/streams/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/sys/modules/streams/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- sys/modules/streams/Makefile 1999/11/28 18:53:23 1.4 +++ sys/modules/streams/Makefile 2001/07/04 23:20:53 @@ -7,7 +7,7 @@ .PATH: ${.CURDIR}/../../dev/streams KMOD= streams -SRCS= streams.c opt_streams.h opt_devfs.h +SRCS= streams.c opt_streams.h NOMAN= Index: sys/modules/vn/Makefile =================================================================== RCS file: /stl/src/FreeBSD/src/sys/modules/vn/Attic/Makefile,v retrieving revision 1.5 diff -u -r1.5 Makefile --- sys/modules/vn/Makefile 1999/11/28 18:53:42 1.5 +++ sys/modules/vn/Makefile 2001/07/04 23:20:58 @@ -2,7 +2,7 @@ .PATH: ${.CURDIR}/../../dev/vn KMOD= vn -SRCS= vn.c vnode_if.h opt_devfs.h +SRCS= vn.c vnode_if.h NOMAN= .include Index: sys/sys/conf.h =================================================================== RCS file: /stl/src/FreeBSD/src/sys/sys/conf.h,v retrieving revision 1.103.2.1 diff -u -r1.103.2.1 conf.h --- sys/sys/conf.h 2001/02/26 04:23:21 1.103.2.1 +++ sys/sys/conf.h 2001/07/04 23:20:58 @@ -59,8 +59,6 @@ char si_name[SPECNAMELEN + 1]; void *si_drv1, *si_drv2; struct cdevsw *si_devsw; - void *si_devfs; /* save cookie for devfs operations */ - void *si_bdevfs; /* XXX block device (should go away) */ int si_iosize_max; /* maximum I/O size (for physio &al) */ union { struct { @@ -127,10 +125,6 @@ typedef int l_start_t __P((struct tty *tp)); typedef int l_modem_t __P((struct tty *tp, int flag)); -/* This is type of the function DEVFS uses to hook into the kernel with */ -typedef void devfs_create_t __P((dev_t dev, uid_t uid, gid_t gid, int perms)); -typedef void devfs_remove_t __P((dev_t dev)); - /* * XXX: The dummy argument can be used to do what strategy1() never * did anywhere: Create a per device flag to lock the device during @@ -274,8 +268,6 @@ dev_t make_dev __P((struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, char *fmt, ...)) __printflike(6, 7); int lminor __P((dev_t dev)); void setconf __P((void)); - -extern devfs_create_t *devfs_create_hook; /* * XXX: This included for when DEVFS resurfaces Index: sys/sys/kernel.h =================================================================== RCS file: /stl/src/FreeBSD/src/sys/sys/kernel.h,v retrieving revision 1.63.2.1 diff -u -r1.63.2.1 kernel.h --- sys/sys/kernel.h 2001/06/15 09:37:43 1.63.2.1 +++ sys/sys/kernel.h 2001/07/04 23:20:58 @@ -119,7 +119,6 @@ SI_SUB_VM_CONF = 0x2300000, /* config VM, set limits*/ SI_SUB_RUN_QUEUE = 0x2400000, /* the run queue*/ SI_SUB_CREATE_INIT = 0x2500000, /* create the init process */ - SI_SUB_DEVFS = 0x3000000, /* get DEVFS ready */ SI_SUB_DRIVERS = 0x3100000, /* Let Drivers initialize */ SI_SUB_CONFIGURE = 0x3800000, /* Configure devices */ SI_SUB_VFS = 0x4000000, /* virtual file system*/ Index: sys/sys/vnode.h =================================================================== RCS file: /stl/src/FreeBSD/src/sys/sys/vnode.h,v retrieving revision 1.111.2.8 diff -u -r1.111.2.8 vnode.h --- sys/sys/vnode.h 2001/06/03 05:00:10 1.111.2.8 +++ sys/sys/vnode.h 2001/07/04 23:21:01 @@ -63,7 +63,7 @@ enum vtagtype { VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, + VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, VT_HPFS, VT_NWFS, VT_SMBFS }; @@ -427,8 +427,7 @@ || (vp)->v_tag == VT_NFS \ || (vp)->v_tag == VT_LFS \ || (vp)->v_tag == VT_ISOFS \ - || (vp)->v_tag == VT_MSDOSFS \ - || (vp)->v_tag == VT_DEVFS) + || (vp)->v_tag == VT_MSDOSFS) #define ASSERT_VOP_LOCKED(vp, str) \ do { \ Index: usr.sbin/dpt/dpt_softc/dpt_softc.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/dpt/dpt_softc/dpt_softc.c,v retrieving revision 1.3 diff -u -r1.3 dpt_softc.c --- usr.sbin/dpt/dpt_softc/dpt_softc.c 1999/08/28 01:16:10 1.3 +++ usr.sbin/dpt/dpt_softc/dpt_softc.c 2001/07/04 23:21:41 @@ -54,7 +54,6 @@ * If you build a kernel without these options, edit here and recompile. */ #define DPT_MEASURE_PERFORMANCE -#define DEVFS #include To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 5:54:46 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 14F1537B401 for ; Sun, 15 Jul 2001 05:54:30 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id WAA28012; Sun, 15 Jul 2001 22:54:22 +1000 Date: Sun, 15 Jul 2001 22:52:08 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: nohup(1) enhancements patch In-Reply-To: <200107131450.f6DEoXF24866@coffee.q9media.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 13 Jul 2001, Mike Barcroft wrote: > Bruce Evans writes: > > > I would appreciate comments on the patch at the end of this > > > message, also available at: > > > http://testbed.q9media.net/freebsd/nohup.20010713.patch > > >... > > > o Remove some FreeBSD specific access(2) cruft. > > > > This summarily blows away rev.1.2. > > Do you mean rev 1.3? If so, yes, access(2) suffers from a race, so Oops, yes. > you can't guarantee that your appending and not creating a new file. > I even thought about doing a series of open(2)s, one without O_CREAT > and one with it, but that too is a race because you can't guarentee > that the file wasn't created between your first and second open(2). > Better to be less discriptive, than lie to the user IMO. I hate access(2) too, but didn't care about this race. The more detailed message seemed to be useful enough to keep. On thinking about this some more, I see some longer races and larger bugs: - the message became out of date if another nohup process "appends" to nohup.out. - the message was misleading. nohup(1) doesn't actually append to nohup.out. It writes to the beginning, clobbering any existing output. - clobbering existing output is a bug. Both the man page and POSIX say that nohup(2) _appends_ to the file nohup.out. I didn't notice that you already fixed this (it's the most important change but you didn't mention it in the summary :-). > [snipped style bugs] > > Non-KNF-formatted comment. > > May violate POSIX's copyright. > > NetBSD and OpenBSD already have these POSIX requirements in their > source trees. What's the correct solution? Contact IEEE and see > if we can obtain permission, just leave it in, or pull it out? I don't really know. Large parts of out man pages could be improved by replacing them by the POSIX.1 or even the SUSv2 wording verbatim. SUSv2 apparently has permission to copy POSIX or vice versa. This doesn't matter so much for program source, but I feel that quoting whole paragraphs that give all the details for the subsequent C code goes a bit beyond fair use. > > > - if ((p = getenv("HOME"))) { > > > - (void)strcpy(path, p); > > > - (void)strcat(path, "/"); > > > - (void)strcat(path, FILENAME); > > > - append = !access(path, F_OK); > > > - if ((fd = open(p = path, > > > - O_RDWR|O_CREAT, S_IRUSR | S_IWUSR)) >= 0) > > > + if ((p = getenv("HOME")) != NULL && *p != '\0' && > > > + (strlen(p) + strlen(FILENAME) + 1) < sizeof(path)) { > > > + (void)snprintf(path, sizeof(path), "%s/%s", p, FILENAME); > > > > Why both check that the string fits and use snprintf()? > > I thought it was a bit easier to read, but it isn't very useful. > Reverted back to strcpy/strcat. I meant that you could replace the check by a check on the value returned by snprintf(). > nohup.20010714.patch > > o Integrate security enhancements from OpenBSD. > - Don't assume environment variable HOME is not NULL. > o Integrate standards compliance from NetBSD. > - Allow -- before the command. > - Blocking SIGQUIT isn't standards compliant. > - Proper exit(3) levels. - Actually append to nohup.out (as documented and required by standard) instead of clobbering it. > o Remove some FreeBSD specific access(2) cruft. (related to incorrect appending). > o Constify; Staticize functions; Set WARNS?=2 > o Tested on i386, and alpha. > Index: nohup/nohup.c > =================================================================== > RCS file: /home/ncvs/src/usr.bin/nohup/nohup.c,v > retrieving revision 1.5 > diff -u -r1.5 nohup.c > --- nohup/nohup.c 2000/03/26 14:46:41 1.5 > +++ nohup/nohup.c 2001/07/13 14:00:51 > @@ -57,67 +57,92 @@ > #include > #include > > -void dofile __P((void)); > +static void dofile __P((void)); > static void usage __P((void)); > > +#define FILENAME "nohup.out" > +/* Should be "/*-" (indent(1) protection for hand-formatted comment). > + * nohup shall exit with one of the following values: > + * 126 - The utility was found, but could not be invoked. > + * 127 - An error occurred in the nohup utility, or the utility could > + * not be found. > + */ > ... > + /* The nohup utility shall take the standard action for all signals > + except that SIGHUP shall be ignored. */ Still non-KNF formatting. > + /* If the standard output is a terminal, all output written to /* * If the standard output is a terminal, all output written to > + if ((p = getenv("HOME")) != NULL && *p != '\0' && > + (strlen(p) + strlen(FILENAME) + 1) < sizeof(path)) { > (void)strcpy(path, p); > (void)strcat(path, "/"); > (void)strcat(path, FILENAME); See above. > - if (append) > - (void)fprintf(stderr, "appending output to existing %s\n", p); > - else > - (void)fprintf(stderr, "sending output to %s\n", p); > + err(EXIT_MISC, NULL); > + (void)fprintf(stderr, "sending output to %s\n", p); I think "appending" is better than "sending" for all cases now. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 9:14:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl1x01.coxmail.com [206.157.231.23]) by hub.freebsd.org (Postfix) with ESMTP id 1E19037B401 for ; Sun, 15 Jul 2001 09:14:11 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010715161409.DAIE2144.iatl0x01@enterprise.muriel.penguinpowered.com>; Sun, 15 Jul 2001 12:14:09 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010715121233:57103=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <20010715113642.C42CC3E2F@bazooka.unixfreak.org> Date: Sun, 15 Jul 2001 12:12:33 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Dima Dorfman Subject: RE: queue(3) patch for config(8) Cc: audit@freebsd.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010715121233:57103=_ Content-Type: text/plain; charset=us-ascii On 15-Jul-2001 Dima Dorfman wrote: | Attached is a patch which converts config(8) to use the queue(3) API. | Please review. I only did a quick glance at it, but it looks alright. | | Index: mkheaders.c | =================================================================== | RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkheaders.c,v | retrieving revision 1.22 | diff -u -r1.22 mkheaders.c | --- mkheaders.c 2001/01/31 11:18:49 1.22 | +++ mkheaders.c 2001/07/15 11:35:25 ... | @@ -97,7 +98,8 @@ | * and "hicount" will be the highest unit declared. do_header() | * must use this higher of these values. | */ | - for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) { | + hicount = count = 0; | + TAILQ_FOREACH(dp, &dtab_head, d_list) { | if (eq(dp->d_name, dev)) { | count = | dp->d_count != UNKNOWN ? dp->d_count : 1; `hicount' can probably be axed altogether, it appears to have lost its use in r1.16. Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010715121233:57103=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7UcDxFokZQs3sv5kRAm5PAJ9F2/GjiNsWIhGoBbc8dNVcujIAPACghX/u 0GHkLHSkuKzqQTpR76BhGic= =iL/U -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010715121233:57103=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 9:43:30 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 6CF2B37B406 for ; Sun, 15 Jul 2001 09:43:22 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6FGxZe30439; Sun, 15 Jul 2001 12:59:35 -0400 (EDT) (envelope-from mike) Date: Sun, 15 Jul 2001 12:59:35 -0400 (EDT) Message-Id: <200107151659.f6FGxZe30439@coffee.q9media.com> To: Bruce Evans From: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: nohup(1) enhancements patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce, This patch resolves all the remaining issues with my previous patches. Would you mind committing this for me? New patch at the end of this message. Also at: http://testbed.q9media.net/freebsd/nohup.20010715.patch Best regards, Mike Barcroft ---------------------------------------------------------------------- nohup.20010715.patch o Integrate security enhancements from OpenBSD. - Don't assume environment variable HOME is not NULL. o Integrate standards compliance from NetBSD. - Allow -- before the command. - Blocking SIGQUIT isn't standards compliant. - Proper exit(3) levels. - Actually append to nohup.out (as documented and required by standard) instead of clobbering it. o Remove some FreeBSD specific access(2) cruft (relating to incorrect appending). o Document the fact that two or more instances of nohup can append to the same file. o Constify; Staticize functions; Set WARNS?=2 o Tested on i386, and alpha. Index: nohup/Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/nohup/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- nohup/Makefile 1994/05/27 12:32:27 1.1.1.1 +++ nohup/Makefile 2001/07/15 16:24:04 @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= nohup +WARNS?= 2 .include Index: nohup/nohup.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/nohup/nohup.1,v retrieving revision 1.8 diff -u -r1.8 nohup.1 --- nohup/nohup.1 2000/11/20 19:21:00 1.8 +++ nohup/nohup.1 2001/07/15 16:24:04 @@ -43,6 +43,7 @@ .Nd invoke a command immune to hangups .Sh SYNOPSIS .Nm +.Op Ar -- .Ar command .Op Ar arguments .Sh DESCRIPTION @@ -50,16 +51,11 @@ .Nm utility invokes .Ar command -with -its +with its .Ar arguments and at this time sets the signal .Dv SIGHUP to be ignored. -The signal -.Dv SIGQUIT -may also be set -to be ignored. If the standard output is a terminal, the standard output is appended to the file .Pa nohup.out @@ -67,10 +63,6 @@ If standard error is a terminal, it is directed to the same place as the standard output. .Pp -.Nm Nohup -exits 1 if an error occurs, otherwise the exit status is that of -.Ar command . -.Pp Some shells may provide a builtin .Nm command which is similar or identical to this utility. @@ -90,6 +82,26 @@ .Ev HOME to create the file. .El +.Sh DIAGNOSTICS +The +.Nm +utility exits with one of the following values: +.Bl -tag -width Ds +.It 126 +The +.Ar command +was found, but could not be invoked. +.It 127 +The +.Ar command +could not be found or an error occurred in +.Nm . +.El +.Pp +Otherwise, the exit status of +.Nm +will be that of +.Ar command . .Sh SEE ALSO .Xr builtin 1 , .Xr csh 1 , @@ -100,3 +112,7 @@ utility is expected to be .St -p1003.2 compatible. +.Sh BUGS +Two or more instances of +.Nm +can append to the same file, which makes for a confusing output. Index: nohup/nohup.c =================================================================== RCS file: /home/ncvs/src/usr.bin/nohup/nohup.c,v retrieving revision 1.5 diff -u -r1.5 nohup.c --- nohup/nohup.c 2000/03/26 14:46:41 1.5 +++ nohup/nohup.c 2001/07/15 16:24:04 @@ -57,67 +57,84 @@ #include #include -void dofile __P((void)); +static void dofile __P((void)); static void usage __P((void)); +#define FILENAME "nohup.out" +/* + * POSIX mandates that we exit with: + * 126 - If the utility was found, but failed to execute. + * 127 - If any other error occurred. + */ +#define EXIT_NOEXEC 126 +#define EXIT_NOTFOUND 127 +#define EXIT_MISC 127 + int main(argc, argv) int argc; char *argv[]; { - if (argc < 2) + int exit_status; + + while (getopt(argc, argv, "") != -1) usage(); + argc -= optind; + argv += optind; + if (argc < 1) + usage(); if (isatty(STDOUT_FILENO)) dofile(); - if (isatty(STDERR_FILENO) && dup2(STDOUT_FILENO, STDERR_FILENO) == -1) { + if (isatty(STDERR_FILENO) && dup2(STDOUT_FILENO, STDERR_FILENO) == -1) /* may have just closed stderr */ - (void)fprintf(stdin, "nohup: %s\n", strerror(errno)); - exit(1); - } + err(EXIT_MISC, "%s", argv[0]); (void)signal(SIGHUP, SIG_IGN); - (void)signal(SIGQUIT, SIG_IGN); - execvp(argv[1], &argv[1]); - err(1, "%s", argv[1]); + execvp(argv[0], &argv[0]); + exit_status = (errno == ENOENT) ? EXIT_NOTFOUND : EXIT_NOEXEC; + err(exit_status, "%s", argv[0]); } -void +static void dofile() { - int append; int fd; - char *p, path[MAXPATHLEN]; + char path[MAXPATHLEN]; + const char *p; -#define FILENAME "nohup.out" + /* + * POSIX mandates if the standard output is a terminal, the standard + * output is appended to nohup.out in the working directory. Failing + * that, it will be appended to nohup.out in the directory obtained + * from the HOME environment variable. If file creation is required, + * the mode_t is set to S_IRUSR | S_IWUSR. + */ p = FILENAME; - append = !access(p, F_OK); - if ((fd = open(p, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR)) >= 0) + fd = open(p, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); + if (fd != -1) goto dupit; - if ((p = getenv("HOME"))) { - (void)strcpy(path, p); - (void)strcat(path, "/"); - (void)strcat(path, FILENAME); - append = !access(path, F_OK); - if ((fd = open(p = path, - O_RDWR|O_CREAT, S_IRUSR | S_IWUSR)) >= 0) + if ((p = getenv("HOME")) != NULL && *p != '\0' && + (size_t)snprintf(path, sizeof(path), "%s/%s", p, FILENAME) < + sizeof(path)) { + fd = open(p = path, O_RDWR | O_CREAT | O_APPEND, + S_IRUSR | S_IWUSR); + if (fd != -1) goto dupit; } - errx(1, "can't open a nohup.out file"); + errx(EXIT_MISC, "can't open a nohup.out file"); -dupit: (void)lseek(fd, (off_t)0, SEEK_END); +dupit: + (void)lseek(fd, (off_t)0, SEEK_END); if (dup2(fd, STDOUT_FILENO) == -1) - err(1, NULL); - if (append) - (void)fprintf(stderr, "appending output to existing %s\n", p); - else - (void)fprintf(stderr, "sending output to %s\n", p); + err(EXIT_MISC, NULL); + (void)fprintf(stderr, "appending output to %s\n", p); } -void +static void usage() { - (void)fprintf(stderr, "usage: nohup command [arguments]\n"); - exit(1); + (void)fprintf(stderr, "usage: nohup [--] command [arguments]\n"); + exit(EXIT_MISC); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 13:25:11 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl1x01.coxmail.com [206.157.231.23]) by hub.freebsd.org (Postfix) with ESMTP id DC1CD37B401 for ; Sun, 15 Jul 2001 13:25:07 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010715202506.DDUE2144.iatl0x01@enterprise.muriel.penguinpowered.com>; Sun, 15 Jul 2001 16:25:06 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010715162333:57103=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <20010715103624.C81603E2F@bazooka.unixfreak.org> Date: Sun, 15 Jul 2001 16:23:33 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Dima Dorfman Subject: RE: Applied patches Cc: audit@freebsd.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010715162333:57103=_ Content-Type: text/plain; charset=us-ascii On 15-Jul-2001 Dima Dorfman wrote: | I've applied the following patches submitted by Mike Barcroft: | | adjkerntz.20010629.patch sbin.20010708.patch | bin.20010628.patch shutdown.20010705.patch | lib.20010709.patch tunefs.20010706.patch Thanks Dima! Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010715162333:57103=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7UfvEFokZQs3sv5kRApapAJ0fXTPWEQUR09lhWRf7KL2XYMQwFwCfQDmi hF1SkwiuE7FI0Wx100PHKIk= =thYF -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010715162333:57103=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 13:45:28 2001 Delivered-To: freebsd-audit@freebsd.org Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by hub.freebsd.org (Postfix) with ESMTP id 190F037B405; Sun, 15 Jul 2001 13:45:21 -0700 (PDT) (envelope-from brdavis@odin.ac.hmc.edu) Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.11.0/8.11.0) id f6FKjJK19528; Sun, 15 Jul 2001 13:45:19 -0700 Date: Sun, 15 Jul 2001 13:45:19 -0700 From: Brooks Davis To: net@FreeBSD.ORG, audit@FreeBSD.ORG Subject: Re: review request: if_faith modernization Message-ID: <20010715134519.A19048@Odin.AC.HMC.Edu> References: <20010714144147.A27610@Odin.AC.HMC.Edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010714144147.A27610@Odin.AC.HMC.Edu>; from brooks@one-eyed-alien.net on Sat, Jul 14, 2001 at 02:41:47PM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 14, 2001 at 02:41:47PM -0700, Brooks Davis wrote: > Please review the following patch. It makes the faith interface > loadable, unloadable, and clonable. It also converts it from a count > device to an option device. A copy is also available at: >=20 > http://people.freebsd.org/~brooks/patches/faith.diff I've updated the patch at the above URL. It no longer bogusly contains the (commited) style change to sys/modules/Makefile or an unrelated addition to sys/conf/files. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --6TrnltStXW4iwmi0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7UgDeXY6L6fI4GtQRAiSpAKCb9PZOWedoNqaowob2lDjOogiDNgCgiTSq Tg4rga2oo3Pe6Ou17sGzZu0= =+LBm -----END PGP SIGNATURE----- --6TrnltStXW4iwmi0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 19:44:12 2001 Delivered-To: freebsd-audit@freebsd.org Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by hub.freebsd.org (Postfix) with ESMTP id 9969C37B401 for ; Sun, 15 Jul 2001 19:43:43 -0700 (PDT) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.9.3/8.9.1) id UAA60459; Sun, 15 Jul 2001 20:43:36 -0600 (MDT) (envelope-from ken) Date: Sun, 15 Jul 2001 20:43:36 -0600 From: "Kenneth D. Merry" To: audit@FreeBSD.org Subject: new devstat statistics function Message-ID: <20010715204336.A60429@panzer.kdm.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline User-Agent: Mutt/1.2i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Attached is a patch to add a new devstat(3) statistics calculation function. The code was developed by Sergey Osokin and myself. It includes a patch to iostat(8) to change over to the new statistics calculation function. Anyway, comments would be appreciated. This is likely a portion of the devstat changes that will be coming down the pipe in the near term. Thomas Moestl has some patches to allow devstat use on core files/kernels, and we're talking about some more changes besides. Ken -- Kenneth Merry ken@kdm.org --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="devstat.stats.20010715" ==== //depot/FreeBSD-ken/src/lib/libdevstat/devstat.3#5 - /usr/home/ken/perforce/FreeBSD-ken/src/lib/libdevstat/devstat.3 ==== *** /tmp/tmp.1875.0 Sun Jul 15 20:36:42 2001 --- /usr/home/ken/perforce/FreeBSD-ken/src/lib/libdevstat/devstat.3 Sun Jul 15 20:33:42 2001 *************** *** 1,5 **** .\" ! .\" Copyright (c) 1998, 1999 Kenneth D. Merry. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without --- 1,5 ---- .\" ! .\" Copyright (c) 1998, 1999, 2001 Kenneth D. Merry. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without *************** *** 27,33 **** .\" .\" $FreeBSD: src/lib/libdevstat/devstat.3,v 1.13 2001/07/10 13:41:33 ru Exp $ .\" ! .Dd May 21, 1998 .Dt DEVSTAT 3 .Os .Sh NAME --- 27,33 ---- .\" .\" $FreeBSD: src/lib/libdevstat/devstat.3,v 1.13 2001/07/10 13:41:33 ru Exp $ .\" ! .Dd July 15, 2001 .Dt DEVSTAT 3 .Os .Sh NAME *************** *** 99,104 **** --- 99,111 ---- .Fa "struct timeval cur_time" .Fa "struct timeval prev_time" .Fc + .Ft int + .Fo devstat_compute_statistics + .Fa "struct devstat *current" + .Fa "struct devstat *previous" + .Fa "long double *etime" + .Fa "..." + .Fc .Sh DESCRIPTION The .Nm *************** *** 466,471 **** --- 473,728 ---- each time it fetches the current .Nm list. + .Pp + .Fn devstat_compute_statistics + is an updated version of + .Fn compute_stats + that provides more complete statistics calculation. There are four + arguments for which values \fBmust\fR be supplied: + .Va current , + .Va previous , + .Va etime , + and the terminating argument for the varargs list, + .Va DSM_NONE . + For most applications, the user will want to supply valid devstat + structures for both + .Va current + and + .Va previous . + In some instances, for instance when calculating statistics since system + boot, the user may pass in a NULL pointer for the + .Va previous + argument. In that case, + .Fn devstat_compute_statistics + will use the total stats in the + .Va current + structure to calculate statistics over + .Va etime . + For each statistic to be calculated, the user should supply the proper + enumerated type (listed below), and a variable of the indicated type. All + statistics are either integer values, for which a u_int64_t is used, or + floating point, for which a long double is used. + The statistics that may be calculated are: + .Bl -tag -width DSM_TRANSFERS_PER_SECOND_OTHER + .It DSM_NONE + type: N/A + .Pp + This \fBmust\fR + be the last argument passed to + .Fn devstat_compute_statistics . + It is an argument list terminator. + .It DSM_TOTAL_BYTES + type: u_int64_t * + .Pp + The total number of bytes transferred between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_BYTES_READ + type: u_int64_t * + .Pp + The total number of bytes read between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_BYTES_WRITE + type: u_int64_t * + .Pp + The total number of bytes written between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_TRANSFERS + type: u_int64_t * + .Pp + The total number of transfers between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_TRANSFERS_READ + type: u_int64_t * + .Pp + The total number of reads between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_TRANSFERS_WRITE + type: u_int64_t * + .Pp + The total number of writes between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_TRANSFERS_OTHER + type: u_int64_t * + .Pp + The total number of transactions that are not reads or writes that occurred + between the acquisition of + .Va previous + and + .Va current . + .It DSM_TOTAL_BLOCKS + type: u_int64_t * + .Pp + The total number of blocks transferred between the acquisition of + .Va previous + and + .Va current . + This number is in terms of the blocksize reported by the device. If no + blocksize has been reported (i.e. the block size is 0), a default + blocksize of 512 bytes will be used in the calculation. + .It DSM_TOTAL_BLOCKS_READ + type: u_int64_t * + .Pp + The total number of blocks read between the acquisition of + .Va previous + and + .Va current . + This number is in terms of the blocksize reported by the device. If no + blocksize has been reported (i.e. the block size is 0), a default + blocksize of 512 bytes will be used in the calculation. + .It DSM_TOTAL_BLOCKS_WRITE + type: u_int64_t * + .Pp + The total number of blocks written between the acquisition of + .Va previous + and + .Va current . + This number is in terms of the blocksize reported by the device. If no + blocksize has been reported (i.e. the block size is 0), a default + blocksize of 512 bytes will be used in the calculation. + .It DSM_KB_PER_TRANSFER + type: long double * + .Pp + The average number of kilobytes per transfer between the acquisition of + .Va previous + and + .Va current . + .It DSM_KB_PER_TRANSFER_READ + type: long double * + .Pp + The average number of kilobytes per read transaction between the acquisition of + .Va previous + and + .Va current . + .It DSM_KB_PER_TRANSFER_WRITE + type: long double * + .Pp + The average number of kilobytes per write transaction between the acquisition of + .Va previous + and + .Va current . + .It DSM_TRANSFERS_PER_SECOND + type: long double * + .Pp + The average number of transfers per second between the acquisition of + .Va previous + and + .Va current . + .It DSM_TRANSFERS_PER_SECOND_READ + type: long double * + .Pp + The average number of reads per second between the acquisition of + .Va previous + and + .Va current . + .It DSM_TRANSFERS_PER_SECOND_WRITE + type: long double * + .Pp + The average number of writes per second between the acquisition of + .Va previous + and + .Va current . + .It DSM_TRANSFERS_PER_SECOND_OTHER + type: long double * + .Pp + The average number of non-read, non-write transactions per second between + the acquisition of + .Va previous + and + .Va current . + .It DSM_MB_PER_SECOND + type: long double * + .Pp + The average number of megabytes transferred per second between the + acquisition of + .Va previous + and + .Va current . + .It DSM_MB_PER_SECOND_READ + type: long double * + .Pp + The average number of megabytes read per second between the acquisition of + .Va previous + and + .Va current . + .It DSM_MB_PER_SECOND_WRITE + type: long double * + .Pp + The average number of megabytes written per second between the acquisition of + .Va previous + and + .Va current . + .It DSM_BLOCKS_PER_SECOND + type: long double * + .Pp + The average number of blocks transferred per second between the acquisition of + .Va previous + and + .Va current . + This number is in terms of the blocksize reported by the device. If no + blocksize has been reported (i.e. the block size is 0), a default + blocksize of 512 bytes will be used in the calculation. + .It DSM_BLOCKS_PER_SECOND_READ + type: long double * + .Pp + The average number of blocks read per second between the acquisition of + .Va previous + and + .Va current . + This number is in terms of the blocksize reported by the device. If no + blocksize has been reported (i.e. the block size is 0), a default + blocksize of 512 bytes will be used in the calculation. + .It DSM_BLOCKS_PER_SECOND_WRITE + type: long double * + .Pp + The average number of blocks written per second between the acquisition of + .Va previous + and + .Va current . + This number is in terms of the blocksize reported by the device. If no + blocksize has been reported (i.e. the block size is 0), a default + blocksize of 512 bytes will be used in the calculation. + .It DSM_MS_PER_TRANSACTION + type: long double * + .Pp + The average rate of transaction completion between the acquisition of + .Va previous + and + .Va current . + Note that this isn't a true reflection of the average number of + milliseconds per transaction, but rather is the average rate of transaction + completion. The number is derived by dividing the time elapsed by + the number of transactions completed. + .It DSM_MS_PER_TRANSACTION_READ + type: long double * + .Pp + The average rate of read completions between the acquisition of + .Va previous + and + .Va current . + As above, this is not the true number of milliseconds per transaction, but + rather the average rate of read transaction completion. + .It DSM_MS_PER_TRANSACTION_WRITE + type: long double * + .Pp + The average rate of write transaction completion between the acquisition of + .Va previous + and + .Va current . + As above, this is not the true number of milliseconds per transaction, but + rather the average rate of write transaction completion. + .El .Sh RETURN VALUES .Fn getnumdevs , .Fn getgeneration , *************** *** 497,502 **** --- 754,762 ---- .Pp .Fn compute_etime returns the computed elapsed time. + .Pp + .Fn devstat_compute_statistics + returns -1 for error, and 0 for success. .Pp If an error is returned from one of the .Nm ==== //depot/FreeBSD-ken/src/lib/libdevstat/devstat.c#1 - /usr/home/ken/perforce/FreeBSD-ken/src/lib/libdevstat/devstat.c ==== *** /tmp/tmp.1875.1 Sun Jul 15 20:36:42 2001 --- /usr/home/ken/perforce/FreeBSD-ken/src/lib/libdevstat/devstat.c Mon May 28 15:33:57 2001 *************** *** 38,46 **** --- 38,53 ---- #include #include #include + #include #include "devstat.h" + typedef enum { + DEVSTAT_ARG_NOTYPE, + DEVSTAT_ARG_UINT64, + DEVSTAT_ARG_LD + } devstat_arg_type; + char devstat_errbuf[DEVSTAT_ERRBUF_SIZE]; /* *************** *** 68,73 **** --- 75,113 ---- {NULL, 0, 0} }; + struct devstat_args { + devstat_metric metric; + devstat_arg_type argtype; + } devstat_arg_list[] = { + { DSM_NONE, DEVSTAT_ARG_NOTYPE }, + { DSM_TOTAL_BYTES, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_BYTES_READ, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_BYTES_WRITE, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_TRANSFERS, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_TRANSFERS_READ, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_TRANSFERS_WRITE, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_TRANSFERS_OTHER, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_BLOCKS, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_BLOCKS_READ, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_BLOCKS_WRITE, DEVSTAT_ARG_UINT64 }, + { DSM_KB_PER_TRANSFER, DEVSTAT_ARG_LD }, + { DSM_KB_PER_TRANSFER_READ, DEVSTAT_ARG_LD }, + { DSM_KB_PER_TRANSFER_WRITE, DEVSTAT_ARG_LD }, + { DSM_TRANSFERS_PER_SECOND, DEVSTAT_ARG_LD }, + { DSM_TRANSFERS_PER_SECOND_READ, DEVSTAT_ARG_LD }, + { DSM_TRANSFERS_PER_SECOND_WRITE, DEVSTAT_ARG_LD }, + { DSM_TRANSFERS_PER_SECOND_OTHER, DEVSTAT_ARG_LD }, + { DSM_MB_PER_SECOND, DEVSTAT_ARG_LD }, + { DSM_MB_PER_SECOND_READ, DEVSTAT_ARG_LD }, + { DSM_MB_PER_SECOND_WRITE, DEVSTAT_ARG_LD }, + { DSM_BLOCKS_PER_SECOND, DEVSTAT_ARG_LD }, + { DSM_BLOCKS_PER_SECOND_READ, DEVSTAT_ARG_LD }, + { DSM_BLOCKS_PER_SECOND_WRITE, DEVSTAT_ARG_LD }, + { DSM_MS_PER_TRANSACTION, DEVSTAT_ARG_LD }, + { DSM_MS_PER_TRANSACTION_READ, DEVSTAT_ARG_LD }, + { DSM_MS_PER_TRANSACTION_WRITE, DEVSTAT_ARG_LD } + }; + /* * Local function declarations. */ *************** *** 1125,1128 **** --- 1165,1467 ---- etime /= 1000000; return(etime); + } + + int + devstat_compute_statistics(struct devstat *current, struct devstat *previous, + long double etime, ...) + { + char *func_name = "devstat_compute_statistics"; + u_int64_t totalbytes, totalbytesread, totalbyteswrite; + u_int64_t totaltransfers, totaltransfersread, totaltransferswrite; + u_int64_t totaltransfersother, totalblocks, totalblocksread; + u_int64_t totalblockswrite; + va_list ap; + devstat_metric metric; + u_int64_t *destu64; + long double *destld; + int retval; + + retval = 0; + + /* + * current is the only mandatory field. + */ + if (current == NULL) { + sprintf(devstat_errbuf, "%s: current stats structure was NULL", + func_name); + return(-1); + } + + totalbytesread = current->bytes_read - + ((previous) ? previous->bytes_read : 0); + totalbyteswrite = current->bytes_written - + ((previous) ? previous->bytes_written : 0); + + totalbytes = totalbytesread + totalbyteswrite; + + totaltransfersread = current->num_reads - + ((previous) ? previous->num_reads : 0); + + totaltransferswrite = current->num_writes - + ((previous) ? previous->num_writes : 0); + + totaltransfersother = current->num_other - + ((previous) ? previous->num_other : 0); + + totaltransfers = totaltransfersread + totaltransferswrite + + totaltransfersother; + + totalblocks = totalbytes; + totalblocksread = totalbytesread; + totalblockswrite = totalbyteswrite; + + if (current->block_size > 0) { + totalblocks /= current->block_size; + totalblocksread /= current->block_size; + totalblockswrite /= current->block_size; + } else { + totalblocks /= 512; + totalblocksread /= 512; + totalblockswrite /= 512; + } + + va_start(ap, etime); + + while ((metric = (devstat_metric)va_arg(ap, devstat_metric)) != 0) { + + if (metric == DSM_NONE) + break; + + if (metric >= DSM_MAX) { + sprintf(devstat_errbuf, "%s: metric %d is out of " + "range", func_name, metric); + retval = -1; + goto bailout; + } + + switch (devstat_arg_list[metric].argtype) { + case DEVSTAT_ARG_UINT64: + destu64 = (u_int64_t *)va_arg(ap, u_int64_t *); + if (destu64 == NULL) { + sprintf(devstat_errbuf, "%s: argument type not" + " u_int64_t * or argument type missing", + func_name); + retval = -1; + goto bailout; + break; /* NOTREACHED */ + } + break; + case DEVSTAT_ARG_LD: + destld = (long double *)va_arg(ap, long double *); + if (destld == NULL) { + sprintf(devstat_errbuf, "%s: argument type not" + " long double * or argument type " + "missing", func_name); + retval = -1; + goto bailout; + break; /* NOTREACHED */ + } + break; + default: + sprintf(devstat_errbuf, "%s: unknown argument type %d", + func_name, devstat_arg_list[metric].argtype); + retval = -1; + goto bailout; + break; /* NOTREACHED */ + } + + switch (metric) { + case DSM_TOTAL_BYTES: + *destu64 = totalbytes; + break; + case DSM_TOTAL_BYTES_READ: + *destu64 = totalbytesread; + break; + case DSM_TOTAL_BYTES_WRITE: + *destu64 = totalbyteswrite; + break; + case DSM_TOTAL_TRANSFERS: + *destu64 = totaltransfers; + break; + case DSM_TOTAL_TRANSFERS_READ: + *destu64 = totaltransfersread; + break; + case DSM_TOTAL_TRANSFERS_WRITE: + *destu64 = totaltransferswrite; + break; + case DSM_TOTAL_TRANSFERS_OTHER: + *destu64 = totaltransfersother; + break; + case DSM_TOTAL_BLOCKS: + *destu64 = totalblocks; + break; + case DSM_TOTAL_BLOCKS_READ: + *destu64 = totalblocksread; + break; + case DSM_TOTAL_BLOCKS_WRITE: + *destu64 = totalblockswrite; + break; + case DSM_KB_PER_TRANSFER: + *destld = totalbytes; + *destld /= 1024; + if (totaltransfers > 0) + *destld /= totaltransfers; + else + *destld = 0.0; + break; + case DSM_KB_PER_TRANSFER_READ: + *destld = totalbytesread; + *destld /= 1024; + if (totaltransfersread > 0) + *destld /= totaltransfersread; + else + *destld = 0.0; + break; + case DSM_KB_PER_TRANSFER_WRITE: + *destld = totalbyteswrite; + *destld /= 1024; + if (totaltransferswrite > 0) + *destld /= totaltransferswrite; + else + *destld = 0.0; + break; + case DSM_TRANSFERS_PER_SECOND: + if (etime > 0.0) { + *destld = totaltransfers; + *destld /= etime; + } else + *destld = 0.0; + break; + case DSM_TRANSFERS_PER_SECOND_READ: + if (etime > 0.0) { + *destld = totaltransfersread; + *destld /= etime; + } else + *destld = 0.0; + break; + case DSM_TRANSFERS_PER_SECOND_WRITE: + if (etime > 0.0) { + *destld = totaltransferswrite; + *destld /= etime; + } else + *destld = 0.0; + break; + case DSM_TRANSFERS_PER_SECOND_OTHER: + if (etime > 0.0) { + *destld = totaltransfersother; + *destld /= etime; + } else + *destld = 0.0; + break; + case DSM_MB_PER_SECOND: + *destld = totalbytes; + *destld /= 1024 * 1024; + if (etime > 0.0) + *destld /= etime; + else + *destld = 0.0; + break; + case DSM_MB_PER_SECOND_READ: + *destld = totalbytesread; + *destld /= 1024 * 1024; + if (etime > 0.0) + *destld /= etime; + else + *destld = 0.0; + break; + case DSM_MB_PER_SECOND_WRITE: + *destld = totalbyteswrite; + *destld /= 1024 * 1024; + if (etime > 0.0) + *destld /= etime; + else + *destld = 0.0; + break; + case DSM_BLOCKS_PER_SECOND: + *destld = totalblocks; + if (etime > 0.0) + *destld /= etime; + else + *destld = 0.0; + break; + case DSM_BLOCKS_PER_SECOND_READ: + *destld = totalblocksread; + if (etime > 0.0) + *destld /= etime; + else + *destld = 0.0; + break; + case DSM_BLOCKS_PER_SECOND_WRITE: + *destld = totalblockswrite; + if (etime > 0.0) + *destld /= etime; + else + *destld = 0.0; + break; + /* + * This calculation is somewhat bogus. It simply divides + * the elapsed time by the total number of transactions + * completed. While that does give the caller a good + * picture of the average rate of transaction completion, + * it doesn't necessarily give the caller a good view of + * how long transactions took to complete on average. + * Those two numbers will be different for a device that + * can handle more than one transaction at a time. e.g. + * SCSI disks doing tagged queueing. + * + * The only way to accurately determine the real average + * time per transaction would be to compute and store the + * time on a per-transaction basis. That currently isn't + * done in the kernel, and would only be desireable if it + * could be implemented in a somewhat non-intrusive and high + * performance way. + */ + case DSM_MS_PER_TRANSACTION: + if (totaltransfers > 0) { + *destld = etime; + *destld /= totaltransfers; + *destld *= 1000; + } else + *destld = 0.0; + break; + /* + * As above, these next two really only give the average + * rate of completion for read and write transactions, not + * the average time the transaction took to complete. + */ + case DSM_MS_PER_TRANSACTION_READ: + if (totaltransfersread > 0) { + *destld = etime; + *destld /= totaltransfersread; + *destld *= 1000; + } else + *destld = 0.0; + break; + case DSM_MS_PER_TRANSACTION_WRITE: + if (totaltransferswrite > 0) { + *destld = etime; + *destld /= totaltransferswrite; + *destld *= 1000; + } else + *destld = 0.0; + break; + default: + /* + * This shouldn't happen, since we should have + * caught any out of range metrics at the top of + * the loop. + */ + sprintf(devstat_errbuf, "%s: unknown metric %d", + func_name, metric); + retval = -1; + goto bailout; + break; /* NOTREACHED */ + } + } + + bailout: + + va_end(ap); + return(retval); } ==== //depot/FreeBSD-ken/src/lib/libdevstat/devstat.h#1 - /usr/home/ken/perforce/FreeBSD-ken/src/lib/libdevstat/devstat.h ==== *** /tmp/tmp.1875.2 Sun Jul 15 20:36:42 2001 --- /usr/home/ken/perforce/FreeBSD-ken/src/lib/libdevstat/devstat.h Mon May 28 15:31:45 2001 *************** *** 44,49 **** --- 44,80 ---- DEVSTAT_MATCH_PASS = 0x04 } devstat_match_flags; + typedef enum { + DSM_NONE, + DSM_TOTAL_BYTES, + DSM_TOTAL_BYTES_READ, + DSM_TOTAL_BYTES_WRITE, + DSM_TOTAL_TRANSFERS, + DSM_TOTAL_TRANSFERS_READ, + DSM_TOTAL_TRANSFERS_WRITE, + DSM_TOTAL_TRANSFERS_OTHER, + DSM_TOTAL_BLOCKS, + DSM_TOTAL_BLOCKS_READ, + DSM_TOTAL_BLOCKS_WRITE, + DSM_KB_PER_TRANSFER, + DSM_KB_PER_TRANSFER_READ, + DSM_KB_PER_TRANSFER_WRITE, + DSM_TRANSFERS_PER_SECOND, + DSM_TRANSFERS_PER_SECOND_READ, + DSM_TRANSFERS_PER_SECOND_WRITE, + DSM_TRANSFERS_PER_SECOND_OTHER, + DSM_MB_PER_SECOND, + DSM_MB_PER_SECOND_READ, + DSM_MB_PER_SECOND_WRITE, + DSM_BLOCKS_PER_SECOND, + DSM_BLOCKS_PER_SECOND_READ, + DSM_BLOCKS_PER_SECOND_WRITE, + DSM_MS_PER_TRANSACTION, + DSM_MS_PER_TRANSACTION_READ, + DSM_MS_PER_TRANSACTION_WRITE, + DSM_MAX + } devstat_metric; + struct devstat_match { devstat_match_flags match_fields; devstat_type_flags device_type; *************** *** 110,115 **** --- 141,149 ---- long double *blocks_per_second, long double *ms_per_transaction); long double compute_etime(struct timeval cur_time, struct timeval prev_time); + int devstat_compute_statistics(struct devstat *current, + struct devstat *previous, + long double etime, ...); __END_DECLS #endif /* _DEVSTAT_H */ ==== //depot/FreeBSD-ken/src/usr.sbin/iostat/iostat.c#4 - /usr/home/ken/perforce/FreeBSD-ken/src/usr.sbin/iostat/iostat.c ==== *** /tmp/tmp.1875.4 Sun Jul 15 20:36:42 2001 --- /usr/home/ken/perforce/FreeBSD-ken/src/usr.sbin/iostat/iostat.c Mon May 28 20:14:42 2001 *************** *** 608,619 **** di = dev_select[dn].position; ! if (compute_stats(&cur.dinfo->devices[di], ! &last.dinfo->devices[di], busy_seconds, ! &total_bytes, &total_transfers, ! &total_blocks, &kb_per_transfer, ! &transfers_per_second, &mb_per_second, ! &blocks_per_second, &ms_per_transaction)!= 0) errx(1, "%s", devstat_errbuf); if (perf_select != 0) { --- 608,624 ---- di = dev_select[dn].position; ! if (devstat_compute_statistics(&cur.dinfo->devices[di], ! &last.dinfo->devices[di], busy_seconds, ! DSM_TOTAL_BYTES, &total_bytes, ! DSM_TOTAL_TRANSFERS, &total_transfers, ! DSM_TOTAL_BLOCKS, &total_blocks, ! DSM_KB_PER_TRANSFER, &kb_per_transfer, ! DSM_TRANSFERS_PER_SECOND, &transfers_per_second, ! DSM_MB_PER_SECOND, &mb_per_second, ! DSM_BLOCKS_PER_SECOND, &blocks_per_second, ! DSM_MS_PER_TRANSACTION, &ms_per_transaction, ! DSM_NONE) != 0) errx(1, "%s", devstat_errbuf); if (perf_select != 0) { --h31gzZEtNLTqOjlF-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sun Jul 15 21:52: 3 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id C253937B408; Sun, 15 Jul 2001 21:51:55 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6G58HF31122; Mon, 16 Jul 2001 01:08:17 -0400 (EDT) (envelope-from mike) Date: Mon, 16 Jul 2001 01:08:17 -0400 (EDT) Message-Id: <200107160508.f6G58HF31122@coffee.q9media.com> To: dwmalone@FreeBSD.org From: Mike Barcroft Cc: audit@FreeBSD.org Subject: inetd(8) warns patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David, I would appreciate your comments on the patch at the end of this message. I'm not entirely sure about removing the legacy setproctitle stuff. If you'd like to keep it in there, the prototype for main() will need two versions. One for the legacy setproctitle and one for normal use. The patch is also available at: http://testbed.q9media.net/freebsd/inetd.20010716.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- inetd.20010716.patch o Remove legacy setproctitle. o Mark unused variables. o Set WARNS?=2 o Tested on i386, alpha. Index: inetd/Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/Makefile,v retrieving revision 1.22 diff -u -r1.22 Makefile --- inetd/Makefile 2001/06/24 09:20:42 1.22 +++ inetd/Makefile 2001/07/16 04:37:56 @@ -5,6 +5,7 @@ PROG= inetd SRCS= inetd.c builtins.c +WARNS?= 2 MAN= inetd.8 MLINKS= inetd.8 inetd.conf.5 Index: inetd/builtins.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/builtins.c,v retrieving revision 1.35 diff -u -r1.35 builtins.c --- inetd/builtins.c 2001/06/24 09:20:07 1.35 +++ inetd/builtins.c 2001/07/16 04:37:57 @@ -223,7 +223,7 @@ void daytime_stream(s, sep) /* Return human-readable time of day */ int s; - struct servtab *sep; + struct servtab *sep __unused; { char buffer[256]; time_t now; @@ -243,7 +243,7 @@ void discard_dg(s, sep) /* Discard service -- ignore data */ int s; - struct servtab *sep; + struct servtab *sep __unused; { char buffer[BUFSIZE]; @@ -737,7 +737,7 @@ void machtime_stream(s, sep) int s; - struct servtab *sep; + struct servtab *sep __unused; { unsigned long result; Index: inetd/inetd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/inetd.c,v retrieving revision 1.93 diff -u -r1.93 inetd.c --- inetd/inetd.c 2001/06/24 09:20:07 1.93 +++ inetd/inetd.c 2001/07/16 04:37:58 @@ -267,11 +267,6 @@ const char *CONFIG = _PATH_INETDCONF; const char *pid_file = _PATH_INETDPID; -#ifdef OLD_SETPROCTITLE -char **Argv; -char *LastArg; -#endif - int getvalue(arg, value, whine) const char *arg, *whine; @@ -290,9 +285,9 @@ } int -main(argc, argv, envp) +main(argc, argv) int argc; - char *argv[], *envp[]; + char *argv[]; { struct servtab *sep; struct passwd *pwd; @@ -322,16 +317,6 @@ const char *servname; int error; - -#ifdef OLD_SETPROCTITLE - Argv = argv; - if (envp == 0 || *envp == 0) - envp = argv; - while (*envp) - envp++; - LastArg = envp[-1] + strlen(envp[-1]); -#endif - openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); while ((ch = getopt(argc, argv, "dlwWR:a:c:C:p:")) != -1) @@ -856,7 +841,7 @@ void flag_reapchild(signo) - int signo; + int signo __unused; { flag_signal('C'); } @@ -894,7 +879,7 @@ void flag_config(signo) - int signo; + int signo __unused; { flag_signal('H'); } @@ -1123,7 +1108,7 @@ void flag_retry(signo) - int signo; + int signo __unused; { flag_signal('A'); } @@ -1969,36 +1954,11 @@ exit(EX_OSERR); } -#ifdef OLD_SETPROCTITLE void inetd_setproctitle(a, s) const char *a; int s; { - int size; - char *cp; - struct sockaddr_storage ss; - char buf[80], pbuf[INET6_ADDRSTRLEN]; - - cp = Argv[0]; - size = sizeof(ss); - if (getpeername(s, (struct sockaddr *)&ss, &size) == 0) { - getnameinfo((struct sockaddr *)&ss, size, pbuf, sizeof(pbuf), - NULL, 0, NI_NUMERICHOST|NI_WITHSCOPEID); - (void) sprintf(buf, "-%s [%s]", a, pbuf); - } else - (void) sprintf(buf, "-%s", a); - strncpy(cp, buf, LastArg - cp); - cp += strlen(cp); - while (cp < LastArg) - *cp++ = ' '; -} -#else -void -inetd_setproctitle(a, s) - const char *a; - int s; -{ socklen_t size; struct sockaddr_storage ss; char buf[80], pbuf[INET6_ADDRSTRLEN]; @@ -2012,8 +1972,6 @@ (void) sprintf(buf, "%s", a); setproctitle("%s", buf); } -#endif - int check_loop(sa, sep) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 1:51:40 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 7798437B403 for ; Mon, 16 Jul 2001 01:51:38 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 16 Jul 2001 09:51:37 +0100 (BST) To: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: inetd(8) warns patch In-reply-to: Your message of "Mon, 16 Jul 2001 01:08:17 EDT." <200107160508.f6G58HF31122@coffee.q9media.com> X-Request-Do: Date: Mon, 16 Jul 2001 09:51:37 +0100 From: David Malone Message-ID: <200107160951.aa79104@salmon.maths.tcd.ie> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > I would appreciate your comments on the patch at the end of this > message. I'm not entirely sure about removing the legacy setproctitle > stuff. If you'd like to keep it in there, the prototype for main() > will need two versions. One for the legacy setproctitle and one > for normal use. Looks fine to me, as long as __unused is considered acceptable in our code. (I know you can get rid of the __unused for compilers that don't understand it by using a #define, but if another compiler denotes unused variables/parameters by "unused int blah;" then you can't generate this statement.) Would you like me to commit it? (I'm also slightly suprised that the WARNS flags don't whine about the nasty SWAP marco which contains a gccism.) BTW - I was looking at doing WARNS stuff for syslogd and it doesn't seem to be very easy 'cos syslogd uses writev(2) and iov_base pointers are of type "char *" not "const char *". I'm not subscribed to -audit so I don't know if anyone has a suggested workaround for these situations. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 1:55:27 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 3915437B407 for ; Mon, 16 Jul 2001 01:55:26 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id D423B3E28; Mon, 16 Jul 2001 01:55:25 -0700 (PDT) To: David Malone Cc: audit@FreeBSD.org Subject: Re: inetd(8) warns patch In-Reply-To: <200107160951.aa79104@salmon.maths.tcd.ie>; from dwmalone@maths.tcd.ie on "Mon, 16 Jul 2001 09:51:37 +0100" Date: Mon, 16 Jul 2001 01:55:25 -0700 From: Dima Dorfman Message-Id: <20010716085525.D423B3E28@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David Malone writes: > (I'm also slightly suprised that the WARNS flags don't whine about > the nasty SWAP marco which contains a gccism.) IIRC WARNS doesn't set -ansi or -pedantic because some of our header files don't compile cleanly with them. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 1:59:27 2001 Delivered-To: freebsd-audit@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id E710837B405 for ; Mon, 16 Jul 2001 01:59:24 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 16 Jul 2001 09:59:24 +0100 (BST) To: Dima Dorfman Cc: audit@FreeBSD.org Subject: Re: inetd(8) warns patch In-reply-to: Your message of "Mon, 16 Jul 2001 01:55:25 PDT." <20010716085525.D423B3E28@bazooka.unixfreak.org> X-Request-Do: Date: Mon, 16 Jul 2001 09:59:23 +0100 From: David Malone Message-ID: <200107160959.aa79657@salmon.maths.tcd.ie> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > David Malone writes: > > (I'm also slightly suprised that the WARNS flags don't whine about > > the nasty SWAP marco which contains a gccism.) > IIRC WARNS doesn't set -ansi or -pedantic because some of our header > files don't compile cleanly with them. TenDRA had a neat feature in this respect. It wouldn't give warnings about system header files unless you specifically asked for them. This way you could have compilerisms in the system headerfiles (where they should be I guess) and still make sure that your compiler-independant code was checked correctly. Maybe we should ask the gcc people for such a feature. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 2:25: 4 2001 Delivered-To: freebsd-audit@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id 76FDD37B405 for ; Mon, 16 Jul 2001 02:25:00 -0700 (PDT) (envelope-from sheldonh@starjuice.net) Received: from sheldonh (helo=axl.seasidesoftware.co.za) by axl.seasidesoftware.co.za with local-esmtp (Exim 3.31 #1) id 15M4d8-0001BU-00; Mon, 16 Jul 2001 11:25:30 +0200 From: Sheldon Hearn To: "Jacques A. Vidrine" Cc: freebsd-audit@freebsd.org Subject: Re: syslogd: bind to localhost only In-reply-to: Your message of "Fri, 13 Jul 2001 13:54:48 EST." <20010713135448.A67153@madman.nectar.com> Date: Mon, 16 Jul 2001 11:25:30 +0200 Message-ID: <4555.995275530@axl.seasidesoftware.co.za> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 13 Jul 2001 13:54:48 EST, "Jacques A. Vidrine" wrote: > The following patch adds a "-L" option to syslogd to force binding to > localhost only. This is useful for running syslogd in a chroot'd > environment, where the log socket will not be available. This seems like an awfully specific kludge. First, what does this give me that -a and -l don't? Second, assuming I'm missing something above, why not implement the option such that the operator can choose to bind to _any_ address(es) using some kind of -i option? Why _only_ localhost? Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 2:26:18 2001 Delivered-To: freebsd-audit@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id EF9DD37B407 for ; Mon, 16 Jul 2001 02:26:15 -0700 (PDT) (envelope-from sheldonh@starjuice.net) Received: from sheldonh (helo=axl.seasidesoftware.co.za) by axl.seasidesoftware.co.za with local-esmtp (Exim 3.31 #1) id 15M4eW-0001CF-00; Mon, 16 Jul 2001 11:26:56 +0200 From: Sheldon Hearn To: "Jacques A. Vidrine" Cc: freebsd-audit@freebsd.org Subject: Re: Add `ServerPrincipalFromSocket' option to sshd In-reply-to: Your message of "Fri, 13 Jul 2001 15:39:46 EST." <20010713153946.G67153@madman.nectar.com> Date: Mon, 16 Jul 2001 11:26:56 +0200 Message-ID: <4602.995275616@axl.seasidesoftware.co.za> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 13 Jul 2001 15:39:46 EST, "Jacques A. Vidrine" wrote: > Our sshd very annoyingly uses the hostname to form the principal it > uses for Kerberos authentication. This is especially a problem on > machines with multiple IP addresses. Interesting. You know about k5init --no-address, though, yes? Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 2:45:28 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.39]) by hub.freebsd.org (Postfix) with SMTP id E128B37B405 for ; Mon, 16 Jul 2001 02:45:23 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 2705 invoked by uid 1000); 16 Jul 2001 09:49:37 -0000 Date: Mon, 16 Jul 2001 12:49:37 +0300 From: Peter Pentchev To: Sheldon Hearn Cc: "Jacques A. Vidrine" , freebsd-audit@freebsd.org Subject: Re: syslogd: bind to localhost only Message-ID: <20010716124937.E1766@ringworld.oblivion.bg> Mail-Followup-To: Sheldon Hearn , "Jacques A. Vidrine" , freebsd-audit@freebsd.org References: <20010713135448.A67153@madman.nectar.com> <4555.995275530@axl.seasidesoftware.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <4555.995275530@axl.seasidesoftware.co.za>; from sheldonh@starjuice.net on Mon, Jul 16, 2001 at 11:25:30AM +0200 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Jul 16, 2001 at 11:25:30AM +0200, Sheldon Hearn wrote: > > > On Fri, 13 Jul 2001 13:54:48 EST, "Jacques A. Vidrine" wrote: > > > The following patch adds a "-L" option to syslogd to force binding to > > localhost only. This is useful for running syslogd in a chroot'd > > environment, where the log socket will not be available. > > This seems like an awfully specific kludge. > > First, what does this give me that -a and -l don't? You still get a syslogd process listening on INADDR_ANY, which might be wasteful, e.g. if you want to run *another* syslogd process, say in a jail. > Second, assuming I'm missing something above, why not implement the > option such that the operator can choose to bind to _any_ address(es) > using some kind of -i option? Why _only_ localhost? I was about to ask this, too :) A generalization would be better IMHO. G'luck, Peter -- This sentence contains exactly threee erors. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 3:35:14 2001 Delivered-To: freebsd-audit@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id ABD3A37B401 for ; Mon, 16 Jul 2001 03:35:11 -0700 (PDT) (envelope-from sheldonh@starjuice.net) Received: from sheldonh (helo=axl.seasidesoftware.co.za) by axl.seasidesoftware.co.za with local-esmtp (Exim 3.31 #1) id 15M5j9-0001nA-00; Mon, 16 Jul 2001 12:35:47 +0200 From: Sheldon Hearn To: Mike Heffner Cc: Dima Dorfman , audit@freebsd.org Subject: Re: queue(3) patch for config(8) In-reply-to: Your message of "Sun, 15 Jul 2001 12:12:33 -0400." Date: Mon, 16 Jul 2001 12:35:47 +0200 Message-ID: <6891.995279747@axl.seasidesoftware.co.za> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 15 Jul 2001 12:12:33 -0400, Mike Heffner wrote: > | Attached is a patch which converts config(8) to use the queue(3) API. > | Please review. > > I only did a quick glance at it, but it looks alright. This one should almost certainly go past Peter Wemm. Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 5:17:56 2001 Delivered-To: freebsd-audit@freebsd.org Received: from gw.nectar.com (gw.nectar.com [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id AA39237B403 for ; Mon, 16 Jul 2001 05:17:48 -0700 (PDT) (envelope-from nectar@nectar.com) Received: from madman.nectar.com (madman.nectar.com [10.0.1.111]) by gw.nectar.com (Postfix) with ESMTP id EC0B6AF481; Mon, 16 Jul 2001 07:17:47 -0500 (CDT) Received: (from nectar@localhost) by madman.nectar.com (8.11.3/8.11.3) id f6GCHl911073; Mon, 16 Jul 2001 07:17:47 -0500 (CDT) (envelope-from nectar) Date: Mon, 16 Jul 2001 07:17:47 -0500 From: "Jacques A. Vidrine" To: Sheldon Hearn Cc: freebsd-audit@freebsd.org Subject: Re: syslogd: bind to localhost only Message-ID: <20010716071747.D10944@madman.nectar.com> Mail-Followup-To: "Jacques A. Vidrine" , Sheldon Hearn , freebsd-audit@freebsd.org References: <20010713135448.A67153@madman.nectar.com> <4555.995275530@axl.seasidesoftware.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <4555.995275530@axl.seasidesoftware.co.za>; from sheldonh@starjuice.net on Mon, Jul 16, 2001 at 11:25:30AM +0200 X-Url: http://www.nectar.com/ Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Jul 16, 2001 at 11:25:30AM +0200, Sheldon Hearn wrote: > > > On Fri, 13 Jul 2001 13:54:48 EST, "Jacques A. Vidrine" wrote: > > > The following patch adds a "-L" option to syslogd to force binding to > > localhost only. This is useful for running syslogd in a chroot'd > > environment, where the log socket will not be available. > > This seems like an awfully specific kludge. > > First, what does this give me that -a and -l don't? It causes syslogd to bind to INADDR_LOOPBACK rather than INADDR_ANY. syslogd then never `sees' packets that are not destined for the loopback interface. Using `-a', syslogd needs to process all packets sent to the syslog port on that machine. > Second, assuming I'm missing something above, why not implement the > option such that the operator can choose to bind to _any_ address(es) > using some kind of -i option? Why _only_ localhost? No, you are not missing anything. You are right, `-i ip-address-or-hostname' would be better. I think the `-L' evolved from wanting something kind of "between" `-s' and `-s -s'. Cheers, -- Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 5:18:29 2001 Delivered-To: freebsd-audit@freebsd.org Received: from gw.nectar.com (gw.nectar.com [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id 6233D37B403 for ; Mon, 16 Jul 2001 05:18:26 -0700 (PDT) (envelope-from nectar@nectar.com) Received: from madman.nectar.com (madman.nectar.com [10.0.1.111]) by gw.nectar.com (Postfix) with ESMTP id D3CD2AF589; Mon, 16 Jul 2001 07:18:25 -0500 (CDT) Received: (from nectar@localhost) by madman.nectar.com (8.11.3/8.11.3) id f6GCIPV11087; Mon, 16 Jul 2001 07:18:25 -0500 (CDT) (envelope-from nectar) Date: Mon, 16 Jul 2001 07:18:25 -0500 From: "Jacques A. Vidrine" To: Sheldon Hearn Cc: freebsd-audit@freebsd.org Subject: Re: Add `ServerPrincipalFromSocket' option to sshd Message-ID: <20010716071825.E10944@madman.nectar.com> Mail-Followup-To: "Jacques A. Vidrine" , Sheldon Hearn , freebsd-audit@freebsd.org References: <20010713153946.G67153@madman.nectar.com> <4602.995275616@axl.seasidesoftware.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <4602.995275616@axl.seasidesoftware.co.za>; from sheldonh@starjuice.net on Mon, Jul 16, 2001 at 11:26:56AM +0200 X-Url: http://www.nectar.com/ Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Jul 16, 2001 at 11:26:56AM +0200, Sheldon Hearn wrote: > On Fri, 13 Jul 2001 15:39:46 EST, "Jacques A. Vidrine" wrote: > > > Our sshd very annoyingly uses the hostname to form the principal it > > uses for Kerberos authentication. This is especially a problem on > > machines with multiple IP addresses. > > Interesting. You know about k5init --no-address, though, yes? Yes, but that is something entirely different. `--no-addresses' is used to obtain a TGT that has, well, no addresses. `ServerPrincipalFromSocket' is used by the server to determine which principal name to use. Maybe an example will help. Pretend we have a machine with two IP addresses which reverse map to A.COMPANY.COM and B.COMPANY.COM respectively. Pretend further that the machine's hostname (as returned by gethostname()) is A.COMPANY.COM. Then in the following table, the `ssh to' column is the hostname given to ssh (e.g. the user typed `ssh a.company.com' in the first row); the `AP-REQ' column lists the server principal name that will be in the client's AP-REQ as a result of the hostname given to ssh; the `[1]' column is the setting of `ServerPrincipalFromSocket'; the `sshd expects' is the server principal name used by sshd; and the `result' column specifies whether authentication will work or not. ssh to AP-REQ [1] sshd expects result a.company.com host/a.company.com no host/a.company.com OK b.company.com host/b.company.com no host/a.company.com fail a.company.com host/a.company.com yes host/a.company.com OK b.company.com host/b.company.com yes host/b.company.com OK As I mentioned earlier, `ServerPrincipalFromSocket yes' causes sshd to select the server principal in much the same way as telnetd and ftpd do. I hope this helps, -- Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 7:19: 2 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 3F97837B407 for ; Mon, 16 Jul 2001 07:18:59 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6GEZM631927; Mon, 16 Jul 2001 10:35:22 -0400 (EDT) (envelope-from mike) Date: Mon, 16 Jul 2001 10:35:22 -0400 (EDT) Message-Id: <200107161435.f6GEZM631927@coffee.q9media.com> To: David Malone From: Mike Barcroft Cc: audit@FreeBSD.org Subject: Re: inetd(8) warns patch Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David Malone writes: > > I would appreciate your comments on the patch at the end of this > > message. I'm not entirely sure about removing the legacy setproctitle > > stuff. If you'd like to keep it in there, the prototype for main() > > will need two versions. One for the legacy setproctitle and one > > for normal use. > > Looks fine to me, as long as __unused is considered acceptable in > our code. (I know you can get rid of the __unused for compilers > that don't understand it by using a #define, but if another compiler > denotes unused variables/parameters by "unused int blah;" then > you can't generate this statement.) __unused is the preferred way to mark unused variables. It's our wrapper for gcc's __attribute__((__unused__)). See for details. > Would you like me to commit it? Yes, thanks. > (I'm also slightly suprised that the WARNS flags don't whine about > the nasty SWAP marco which contains a gccism.) gcc doesn't really care about gccisms unless -ansi and -pedantic are specified. That macro could probably be made portable using a third argument and a union. > BTW - I was looking at doing WARNS stuff for syslogd and it doesn't > seem to be very easy 'cos syslogd uses writev(2) and iov_base > pointers are of type "char *" not "const char *". I'm not subscribed > to -audit so I don't know if anyone has a suggested workaround for > these situations. Gererally speaking, it's usually a good idea to fix the root problem. If writev(2) and friends don't need to write to that variable, it's questionable why it's a char *. Some things just don't work with WARNS, such as RPC, because of library evilness. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 8:10:56 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.39]) by hub.freebsd.org (Postfix) with SMTP id BF84637B407 for ; Mon, 16 Jul 2001 08:10:41 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 56553 invoked by uid 1000); 16 Jul 2001 15:14:56 -0000 Date: Mon, 16 Jul 2001 18:14:56 +0300 From: Peter Pentchev To: Mike Barcroft Cc: David Malone , audit@FreeBSD.org Subject: Re: inetd(8) warns patch Message-ID: <20010716181456.A56285@ringworld.oblivion.bg> Mail-Followup-To: Mike Barcroft , David Malone , audit@FreeBSD.org References: <200107161435.f6GEZM631927@coffee.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200107161435.f6GEZM631927@coffee.q9media.com>; from mike@q9media.com on Mon, Jul 16, 2001 at 10:35:22AM -0400 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Jul 16, 2001 at 10:35:22AM -0400, Mike Barcroft wrote: [snip] > > BTW - I was looking at doing WARNS stuff for syslogd and it doesn't > > seem to be very easy 'cos syslogd uses writev(2) and iov_base > > pointers are of type "char *" not "const char *". I'm not subscribed > > to -audit so I don't know if anyone has a suggested workaround for > > these situations. > > Gererally speaking, it's usually a good idea to fix the root problem. > If writev(2) and friends don't need to write to that variable, it's > questionable why it's a char *. Some things just don't work with > WARNS, such as RPC, because of library evilness. Basically, the problem is that although writev(2) doesn't need to write to the buffer pointed to in its iov parameter, readv(2) does. The obvious solution would be to separate the write- and read-vector structures into two different iov_r and iov_w structures, but this was not done back in 4.2BSD (when writev() and readv() appeared), and trying to do it now would just create a gratuitous incompatibility with next to all OS's out there.. G'luck, Peter -- I am the thought you are now thinking. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jul 16 9:51:49 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 64EAB37B403 for ; Mon, 16 Jul 2001 09:51:45 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id CAA19419; Tue, 17 Jul 2001 02:51:17 +1000 Date: Tue, 17 Jul 2001 02:49:02 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Peter Pentchev Cc: Mike Barcroft , David Malone , audit@FreeBSD.ORG Subject: Re: inetd(8) warns patch In-Reply-To: <20010716181456.A56285@ringworld.oblivion.bg> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 16 Jul 2001, Peter Pentchev wrote: > On Mon, Jul 16, 2001 at 10:35:22AM -0400, Mike Barcroft wrote: > > Gererally speaking, it's usually a good idea to fix the root problem. > > If writev(2) and friends don't need to write to that variable, it's > > questionable why it's a char *. Some things just don't work with > > WARNS, such as RPC, because of library evilness. > > Basically, the problem is that although writev(2) doesn't need to write > to the buffer pointed to in its iov parameter, readv(2) does. > The obvious solution would be to separate the write- and read-vector > structures into two different iov_r and iov_w structures, but this > was not done back in 4.2BSD (when writev() and readv() appeared), > and trying to do it now would just create a gratuitous incompatibility > with next to all OS's out there.. And with POSIX.1-200x drafts. POSIX is only non-gratuitously incompatible (it changes the type of iov_base from "char *" to "void *"). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 17 12:36:41 2001 Delivered-To: freebsd-audit@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id A708837B401 for ; Tue, 17 Jul 2001 12:36:36 -0700 (PDT) (envelope-from des@ofug.org) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.3) id VAA99250; Tue, 17 Jul 2001 21:36:31 +0200 (CEST) (envelope-from des@ofug.org) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: David Malone Cc: Mike Barcroft , audit@FreeBSD.ORG Subject: Re: inetd(8) warns patch References: <200107160951.aa79104@salmon.maths.tcd.ie> From: Dag-Erling Smorgrav Date: 17 Jul 2001 21:36:31 +0200 In-Reply-To: <200107160951.aa79104@salmon.maths.tcd.ie> Message-ID: Lines: 13 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David Malone writes: > Looks fine to me, as long as __unused is considered acceptable in > our code. (I know you can get rid of the __unused for compilers > that don't understand it by using a #define, but if another compiler > denotes unused variables/parameters by "unused int blah;" then > you can't generate this statement.) __unused is already a macro. I believe the corresponding GCCism is __attribute__((__unused__)). DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 17 12:43:23 2001 Delivered-To: freebsd-audit@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 92EB837B408 for ; Tue, 17 Jul 2001 12:43:20 -0700 (PDT) (envelope-from des@ofug.org) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.3) id VAA99271; Tue, 17 Jul 2001 21:43:17 +0200 (CEST) (envelope-from des@ofug.org) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Peter Pentchev Cc: Mike Barcroft , David Malone , audit@FreeBSD.ORG Subject: Re: inetd(8) warns patch References: <200107161435.f6GEZM631927@coffee.q9media.com> <20010716181456.A56285@ringworld.oblivion.bg> From: Dag-Erling Smorgrav Date: 17 Jul 2001 21:43:17 +0200 In-Reply-To: <20010716181456.A56285@ringworld.oblivion.bg> Message-ID: Lines: 17 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Peter Pentchev writes: > On Mon, Jul 16, 2001 at 10:35:22AM -0400, Mike Barcroft wrote: > > Gererally speaking, it's usually a good idea to fix the root problem. > > If writev(2) and friends don't need to write to that variable, it's > > questionable why it's a char *. Some things just don't work with > > WARNS, such as RPC, because of library evilness. > Basically, the problem is that although writev(2) doesn't need to write > to the buffer pointed to in its iov parameter, readv(2) does. You can work around this by casting the LHS to (const char *): (const char *)iov[n].iov_base = str; iov[n].iov_len = len; DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Tue Jul 17 18:28:53 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id E84D837B401 for ; Tue, 17 Jul 2001 18:28:44 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6I1jP951471; Tue, 17 Jul 2001 21:45:25 -0400 (EDT) (envelope-from mike) Date: Tue, 17 Jul 2001 21:45:24 -0400 From: Mike Barcroft To: audit@FreeBSD.org Cc: Dag-Erling Smorgrav , Alexey Zelkin Subject: whois(1) changes Message-ID: <20010717214524.A51455@coffee.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate comments on the patch to whois(1) located at the end of this e-mail and also available at: http://people.FreeBSD.org/~mike/patches/whois.20010718.patch If there are no objections, I plan on committing it in a two days. Best regards, Mike Barcroft --------------------------------------------------------------------- whois.20010717.patch o Reintegrate part of phantom's patch which adds gethostinfo(). o Create a wrapper for asprintf(3) which checks for failure. o Tested on i386, alpha. Index: whois/whois.c =================================================================== RCS file: /home/ncvs/src/usr.bin/whois/whois.c,v retrieving revision 1.21 diff -u -r1.21 whois.c --- whois/whois.c 2001/07/17 20:40:41 1.21 +++ whois/whois.c 2001/07/17 21:45:30 @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -80,16 +81,18 @@ const char *ip_whois[] = { RNICHOST, PNICHOST, NULL }; static char *choose_server(char *); +static struct addrinfo *gethostinfo(char const *host, int exit_on_error); +static void s_asprintf(char **ret, const char *format, ...); static void usage(void); static void whois(char *, struct addrinfo *, int); int main(int argc, char *argv[]) { - struct addrinfo hints, *res; + struct addrinfo *res; const char *host; char *qnichost; - int ch, error, flags, use_qnichost; + int ch, flags, use_qnichost; #ifdef SOCKS SOCKSinit(argv[0]); @@ -159,29 +162,11 @@ flags |= WHOIS_INIC_FALLBACK | WHOIS_RECURSE; } while (argc--) { - if (use_qnichost) { - if ((qnichost = choose_server(*argv)) != NULL) { - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = 0; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(qnichost, "whois", - &hints, &res); - if (error != 0) - errx(EX_NOHOST, "%s: %s", qnichost, - gai_strerror(error)); - } - } - if (qnichost == NULL) { - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = 0; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(host, "whois", &hints, &res); - if (error != 0) - errx(EX_NOHOST, "%s: %s", host, - gai_strerror(error)); - } + if (use_qnichost) + if ((qnichost = choose_server(*argv)) != NULL) + res = gethostinfo(qnichost, 1); + if (qnichost == NULL) + res = gethostinfo(host, 1); free(qnichost); qnichost = NULL; @@ -208,23 +193,56 @@ errx(EX_USAGE, "can't search for a null string"); while (pos > domain && *pos != '.') --pos; - if (isdigit(*++pos)) { - if (asprintf(&retval, "%s", ANICHOST) == -1) - err(1, "asprintf()"); - } else { - if (asprintf(&retval, "%s%s", pos, QNICHOST_TAIL) == -1) - err(1, "asprintf()"); - } + if (isdigit(*++pos)) + s_asprintf(&retval, "%s", ANICHOST); + else + s_asprintf(&retval, "%s%s", pos, QNICHOST_TAIL); return (retval); } +static struct addrinfo * +gethostinfo(char const *host, int exit_on_error) +{ + struct addrinfo hints, *res; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = 0; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(host, "whois", &hints, &res); + if (error) { + warnx("%s: %s", host, gai_strerror(error)); + if (exit_on_error) + exit(EX_NOHOST); + return (NULL); + } + return (res); +} + +/* + * Wrapper for asprintf(3) that exits on error. + */ +static void +s_asprintf(char **ret, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + if (vasprintf(ret, format, ap) == -1) { + va_end(ap); + err(EX_OSERR, "vasprintf()"); + } + va_end(ap); +} + static void whois(char *name, struct addrinfo *res, int flags) { FILE *sfi, *sfo; - struct addrinfo hints, *res2; + struct addrinfo *res2; char *buf, *nhost, *p; - int i, nomatch, error, s; + int i, nomatch, s; size_t len; for (; res; res = res->ai_next) { @@ -255,17 +273,13 @@ if (p != NULL) { p += sizeof(WHOIS_SERVER_ID) - 1; if ((len = strcspn(p, " \t\n\r")) != 0) { - asprintf(&nhost, "%s", p); - if (nhost == NULL) - err(1, "asprintf()"); + s_asprintf(&nhost, "%s", p); } } else { for (i = 0; ip_whois[i] != NULL; i++) { if (strstr(buf, ip_whois[i]) == NULL) continue; - nhost = strdup(ip_whois[i]); - if (nhost == NULL) - err(1, "strdup()"); + s_asprintf(&nhost, "%s", ip_whois[i]); } } } @@ -285,18 +299,11 @@ /* Do second lookup as needed. */ if (nomatch && nhost == NULL) { printf("Looking up %s at %s.\n\n", name, INICHOST); - if ((nhost = strdup(INICHOST)) == NULL) - err(1, "strdup()"); + s_asprintf(&nhost, "%s", INICHOST); } if (nhost != NULL) { - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = 0; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(nhost, "whois", &hints, &res2); - if (error != 0) { - warnx("%s: %s", nhost, gai_strerror(error)); + if ((res2 = gethostinfo(nhost, 0)) == NULL) { free(nhost); return; } - To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 2: 1:39 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 2761337B403; Wed, 18 Jul 2001 02:01:17 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 8CCCB3E2F; Wed, 18 Jul 2001 02:01:16 -0700 (PDT) To: Sheldon Hearn Cc: audit@freebsd.org, peter@freebsd.org Subject: Re: queue(3) patch for config(8) In-Reply-To: <6891.995279747@axl.seasidesoftware.co.za>; from sheldonh@starjuice.net on "Mon, 16 Jul 2001 12:35:47 +0200" Date: Wed, 18 Jul 2001 02:01:16 -0700 From: Dima Dorfman Message-Id: <20010718090116.8CCCB3E2F@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Sheldon Hearn writes: > This one should almost certainly go past Peter Wemm. Okay. Peter (cc'd), the discussion is about a patch (attached below) to config(8) which converts all of its lists to the queue(3) API. This will make future modifications (esp. those which start removing arbitrary nodes from these lists) less error-prone. Please review. Thanks, Dima Dorfman dima@unixfreak.org Index: config.h =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.h,v retrieving revision 1.49 diff -u -r1.49 config.h --- config.h 2001/07/12 02:08:51 1.49 +++ config.h 2001/07/15 11:35:25 @@ -38,11 +38,12 @@ * Config. */ #include +#include #include #include struct file_list { - struct file_list *f_next; + TAILQ_ENTRY(file_list) f_list; char *f_fn; /* the name */ int f_type; /* type or count */ u_char f_flags; /* see below */ @@ -52,6 +53,8 @@ char *f_needs; char *f_warn; /* warning message */ }; +TAILQ_HEAD(file_list_headt, file_list); +extern struct file_list_headt ftab_head; /* * Types. @@ -74,12 +77,14 @@ #define ISDUP 16 struct device { + TAILQ_ENTRY(device) d_list; int d_done; /* processed */ char *d_name; /* name of device (e.g. rk11) */ int d_count; /* device count */ #define UNKNOWN -2 /* -2 means not set yet */ - struct device *d_next; /* Next one in list */ }; +TAILQ_HEAD(device_headt, device); +extern struct device_headt dtab_head; struct config { char *s_sysname; @@ -99,9 +104,11 @@ * These and the options (below) are put in the C flags in the makefile. */ struct cputype { + LIST_ENTRY(cputype) cpu_list; char *cpu_name; - struct cputype *cpu_next; -} *cputype; +}; +LIST_HEAD(cputype_headt, cputype); +extern struct cputype_headt cputype_head; /* * A set of options may also be specified which are like CPU types, @@ -109,17 +116,20 @@ * A separate set of options may be defined for make-style options. */ struct opt { + LIST_ENTRY(opt) op_list; char *op_name; char *op_value; int op_ownfile; /* true = own file, false = makefile */ - struct opt *op_next; -} *opt, *mkopt; +}; +LIST_HEAD(opt_headt, opt); +extern struct opt_headt opt_head, mkopt_head; struct opt_list { + LIST_ENTRY(opt_list) o_list; char *o_name; char *o_file; - struct opt_list *o_next; } *otab; +LIST_HEAD(opt_list_headt, opt_list); extern char *ident; extern char *hints; @@ -138,13 +148,9 @@ void makefile(void); void headers(void); -extern struct device *dtab; - extern char errbuf[80]; extern int yyline; extern const char *yyfile; - -extern struct file_list *ftab; extern int profiling; extern int debugging; Index: config.y =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.y,v retrieving revision 1.55 diff -u -r1.55 config.y --- config.y 2001/07/12 02:08:51 1.55 +++ config.y 2001/07/15 11:35:25 @@ -71,15 +71,13 @@ #include "config.h" -static struct device *curp = 0; - -struct device *dtab; +struct device_headt dtab_head; char *ident; char *hints; int hintmode; int yyline; const char *yyfile; -struct file_list *ftab; +struct file_list_headt ftab_head; char errbuf[80]; int maxusers; @@ -130,8 +128,7 @@ (struct cputype *)malloc(sizeof (struct cputype)); memset(cp, 0, sizeof(*cp)); cp->cpu_name = $2; - cp->cpu_next = cputype; - cputype = cp; + LIST_INSERT_HEAD(&cputype_head, cp, cpu_list); } | OPTIONS Opt_list | @@ -163,7 +160,7 @@ System_id: Save_id - = { newopt(&mkopt, ns("KERNEL"), $1); }; + = { newopt(&mkopt_head, ns("KERNEL"), $1); }; System_parameter_list: System_parameter_list ID @@ -181,14 +178,14 @@ = { char *s; - newopt(&opt, $1, NULL); + newopt(&opt_head, $1, NULL); if ((s = strchr($1, '='))) errx(1, "%s:%d: The `=' in options should not be " "quoted", yyfile, yyline); } | Save_id EQUALS Opt_value = { - newopt(&opt, $1, $3); + newopt(&opt_head, $1, $3); } ; Opt_value: @@ -215,7 +212,7 @@ Mkoption: Save_id EQUALS Opt_value - = { newopt(&mkopt, $1, $3); } ; + = { newopt(&mkopt_head, $1, $3); } ; Dev: ID @@ -225,13 +222,13 @@ Device_spec: DEVICE Dev = { - newopt(&opt, devopt($2), ns("1")); + newopt(&opt_head, devopt($2), ns("1")); /* and the device part */ newdev($2, UNKNOWN); } | DEVICE Dev NUMBER = { - newopt(&opt, devopt($2), ns("1")); + newopt(&opt_head, devopt($2), ns("1")); /* and the device part */ newdev($2, $3); if ($3 == 0) @@ -260,16 +257,11 @@ memset(np, 0, sizeof(*np)); np->d_name = name; np->d_count = count; - np->d_next = 0; - if (curp == 0) - dtab = np; - else - curp->d_next = np; - curp = np; + TAILQ_INSERT_TAIL(&dtab_head, np, d_list); } static void -newopt(struct opt **list, char *name, char *value) +newopt(struct opt_headt *headp, char *name, char *value) { struct opt *op; @@ -278,6 +270,5 @@ op->op_name = name; op->op_ownfile = 0; op->op_value = value; - op->op_next = *list; - *list = op; + LIST_INSERT_HEAD(headp, op, op_list); } Index: main.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/main.c,v retrieving revision 1.53 diff -u -r1.53 main.c --- main.c 2001/07/12 02:08:51 1.53 +++ main.c 2001/07/15 11:35:25 @@ -143,7 +143,7 @@ else if ((buf.st_mode & S_IFMT) != S_IFDIR) errx(2, "%s isn't a directory", p); - dtab = NULL; + TAILQ_INIT(&dtab_head); yyfile = *argv; if (yyparse()) exit(3); @@ -421,7 +421,7 @@ remember("y.tab.h"); remember("setdefs.h"); - for (fl = ftab; fl != NULL; fl = fl->f_next) + TAILQ_FOREACH(fl, &ftab_head, f_list) remember(fl->f_fn); /* Index: mkheaders.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkheaders.c,v retrieving revision 1.22 diff -u -r1.22 mkheaders.c --- mkheaders.c 2001/01/31 11:18:49 1.22 +++ mkheaders.c 2001/07/15 11:35:25 @@ -62,10 +62,10 @@ struct device *dp; int match; - for (fl = ftab; fl != 0; fl = fl->f_next) { + TAILQ_FOREACH(fl, &ftab_head, f_list) { if (fl->f_needs != 0) { match = 0; - for (dp = dtab; dp != 0; dp = dp->d_next) { + TAILQ_FOREACH(dp, &dtab_head, d_list) { if (eq(dp->d_name, fl->f_needs)) { match++; dp->d_done |= DEVDONE; @@ -75,7 +75,7 @@ do_header(fl->f_needs, match); } } - for (dp = dtab; dp != 0; dp = dp->d_next) { + TAILQ_FOREACH(dp, &dtab_head, d_list) { if (!(dp->d_done & DEVDONE)) errx(1, "Error: device \"%s\" is unknown", dp->d_name); @@ -86,7 +86,8 @@ do_header(char *dev, int match) { char *file, *name, *inw; - struct file_list *fl, *fl_head, *tflp; + struct file_list *fl; + struct file_list_headt localfl_head; struct device *dp; FILE *inf, *outf; int inc, oldcount; @@ -97,7 +98,8 @@ * and "hicount" will be the highest unit declared. do_header() * must use this higher of these values. */ - for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) { + hicount = count = 0; + TAILQ_FOREACH(dp, &dtab_head, d_list) { if (eq(dp->d_name, dev)) { count = dp->d_count != UNKNOWN ? dp->d_count : 1; @@ -119,7 +121,7 @@ (void) fclose(outf); return; } - fl_head = NULL; + TAILQ_INIT(&localfl_head); for (;;) { char *cp; if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) @@ -142,13 +144,13 @@ bzero(fl, sizeof(*fl)); fl->f_fn = inw; /* malloced */ fl->f_type = inc; - fl->f_next = fl_head; - fl_head = fl; + TAILQ_INSERT_HEAD(&localfl_head, fl, f_list); } (void) fclose(inf); if (count == oldcount) { - for (fl = fl_head; fl != NULL; fl = tflp) { - tflp = fl->f_next; + while (!TAILQ_EMPTY(&localfl_head)) { + fl = TAILQ_FIRST(&localfl_head); + TAILQ_REMOVE(&localfl_head, fl, f_list); free(fl->f_fn); free(fl); } @@ -159,16 +161,16 @@ bzero(fl, sizeof(*fl)); fl->f_fn = ns(name); fl->f_type = count; - fl->f_next = fl_head; - fl_head = fl; + TAILQ_INSERT_HEAD(&localfl_head, fl, f_list); } outf = fopen(file, "w"); if (outf == 0) err(1, "%s", file); - for (fl = fl_head; fl != NULL; fl = tflp) { + while (!TAILQ_EMPTY(&localfl_head)) { + fl = TAILQ_FIRST(&localfl_head); + TAILQ_REMOVE(&localfl_head, fl, f_list); fprintf(outf, "#define %s %u\n", fl->f_fn, count ? fl->f_type : 0); - tflp = fl->f_next; free(fl->f_fn); free(fl); } Index: mkmakefile.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkmakefile.c,v retrieving revision 1.68 diff -u -r1.68 mkmakefile.c --- mkmakefile.c 2001/02/28 02:53:32 1.68 +++ mkmakefile.c 2001/07/15 11:35:25 @@ -69,8 +69,6 @@ wd = word; \ } -static struct file_list *fcur; - static char *tail(char *); static void do_clean(FILE *); static void do_rules(FILE *); @@ -88,7 +86,7 @@ { struct file_list *fp; - for (fp = ftab ; fp != 0; fp = fp->f_next) { + TAILQ_FOREACH(fp, &ftab_head, f_list) { if (eq(fp->f_fn, file)) return (fp); } @@ -105,11 +103,7 @@ fp = (struct file_list *) malloc(sizeof *fp); bzero(fp, sizeof *fp); - if (fcur == 0) - fcur = ftab = fp; - else - fcur->f_next = fp; - fcur = fp; + TAILQ_INSERT_TAIL(&ftab_head, fp, f_list); return (fp); } @@ -142,12 +136,12 @@ if (profiling) fprintf(ofp, " -DGPROF"); - if (cputype == 0) { + if (LIST_EMPTY(&cputype_head)) { printf("cpu type must be specified\n"); exit(1); } fprintf(ofp, "\n"); - for (op = mkopt; op; op = op->op_next) + LIST_FOREACH(op, &mkopt_head, op_list) fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); if (debugging) fprintf(ofp, "DEBUG=-g\n"); @@ -254,7 +248,7 @@ /* * Read in the information about files used in making the system. - * Store it in the ftab linked list. + * Store it in the ftab_head list. */ static void read_files(void) @@ -268,7 +262,7 @@ int nreqs, first = 1, isdup, std, filetype, imp_rule, no_obj, needcount, before_depend, mandatory; - ftab = 0; + TAILQ_INIT(&ftab_head); if (ident == NULL) { printf("no ident line specified\n"); exit(1); @@ -428,7 +422,7 @@ needs = ns(wd); if (isdup) goto invis; - for (dp = dtab; dp != 0; dp = dp->d_next) + TAILQ_FOREACH(dp, &dtab_head, d_list) if (eq(dp->d_name, wd)) { if (std && dp->d_count <= 0) dp->d_count = 1; @@ -444,7 +438,7 @@ this, wd); exit(1); } - for (op = opt; op != 0; op = op->op_next) + LIST_FOREACH(op, &opt_head, op_list) if (op->op_value == 0 && opteq(op->op_name, wd)) { if (nreqs == 1) { free(needs); @@ -531,7 +525,7 @@ fputs("BEFORE_DEPEND=", fp); lpos = 15; - for (tp = ftab; tp; tp = tp->f_next) + TAILQ_FOREACH(tp, &ftab_head, f_list) if (tp->f_flags & BEFORE_DEPEND) { len = strlen(tp->f_fn); if ((len = 3 + len) + lpos > 72) { @@ -557,7 +551,7 @@ fprintf(fp, "OBJS="); lpos = 6; - for (tp = ftab; tp != 0; tp = tp->f_next) { + TAILQ_FOREACH(tp, &ftab_head, f_list) { if (tp->f_type == INVISIBLE || tp->f_flags & NO_OBJ) continue; sp = tail(tp->f_fn); @@ -593,7 +587,7 @@ fprintf(fp, "%sFILES=", SUFF); lpos = 8; - for (tp = ftab; tp; tp = tp->f_next) + TAILQ_FOREACH(tp, &ftab_head, f_list) if (tp->f_type != INVISIBLE && tp->f_type != NODEPEND) { len = strlen(tp->f_fn); if (tp->f_fn[len - slen - 1] != '.') @@ -636,7 +630,7 @@ struct file_list *ftp; char *compilewith; - for (ftp = ftab; ftp != 0; ftp = ftp->f_next) { + TAILQ_FOREACH(ftp, &ftab_head, f_list) { if (ftp->f_type == INVISIBLE) continue; if (ftp->f_warn) @@ -702,7 +696,7 @@ fputs("CLEAN=", fp); lpos = 7; - for (tp = ftab; tp; tp = tp->f_next) + TAILQ_FOREACH(tp, &ftab_head, f_list) if (tp->f_clean) { len = strlen(tp->f_clean); if (len + lpos > 72) { Index: mkoptions.c =================================================================== RCS file: /stl/src/FreeBSD/src/usr.sbin/config/mkoptions.c,v retrieving revision 1.28 diff -u -r1.28 mkoptions.c --- mkoptions.c 2001/02/28 02:07:47 1.28 +++ mkoptions.c 2001/07/15 11:35:25 @@ -52,6 +52,11 @@ #include "config.h" #include "y.tab.h" +struct cputype_headt cputype_head = LIST_HEAD_INITIALIZER(cputype_head); +struct opt_headt opt_head = LIST_HEAD_INITIALIZER(opt_head); +struct opt_headt mkopt_head = LIST_HEAD_INITIALIZER(mkopt_head); +struct opt_list_headt otab_head = LIST_HEAD_INITIALIZER(otab_head); + static struct users { int u_default; int u_min; @@ -72,12 +77,11 @@ struct opt *op; /* Fake the cpu types as options. */ - for (cp = cputype; cp != NULL; cp = cp->cpu_next) { + LIST_FOREACH(cp, &cputype_head, cpu_list) { op = (struct opt *)malloc(sizeof(*op)); memset(op, 0, sizeof(*op)); op->op_name = ns(cp->cpu_name); - op->op_next = opt; - opt = op; + LIST_INSERT_HEAD(&opt_head, op, op_list); } if (maxusers == 0) { @@ -95,13 +99,12 @@ op->op_name = ns("MAXUSERS"); snprintf(buf, sizeof(buf), "%d", maxusers); op->op_value = ns(buf); - op->op_next = opt; - opt = op; + LIST_INSERT_HEAD(&opt_head, op, op_list); read_options(); - for (ol = otab; ol != 0; ol = ol->o_next) + LIST_FOREACH(ol, &otab_head, o_list) do_option(ol->o_name); - for (op = opt; op; op = op->op_next) { + LIST_FOREACH(op, &opt_head, op_list) { if (!op->op_ownfile && strncmp(op->op_name, "DEV_", 4)) { printf("%s: unknown option \"%s\"\n", PREFIX, op->op_name); @@ -120,7 +123,8 @@ char *file, *inw; const char *basefile; struct opt_list *ol; - struct opt *op, *op_head, *topp; + struct opt *op; + struct opt_headt localopt_head; FILE *inf, *outf; char *value; char *oldvalue; @@ -133,7 +137,7 @@ * Check to see if the option was specified.. */ value = NULL; - for (op = opt; op; op = op->op_next) { + LIST_FOREACH(op, &opt_head, op_list) { if (eq(name, op->op_name)) { oldvalue = value; value = op->op_value; @@ -164,13 +168,13 @@ return; } basefile = ""; - for (ol = otab; ol != 0; ol = ol->o_next) + LIST_FOREACH(ol, &otab_head, o_list) if (eq(name, ol->o_name)) { basefile = ol->o_file; break; } oldvalue = NULL; - op_head = NULL; + LIST_INIT(&localopt_head); seen = 0; tidy = 0; for (;;) { @@ -194,7 +198,7 @@ invalue = value; seen++; } - for (ol = otab; ol != 0; ol = ol->o_next) + LIST_FOREACH(ol, &otab_head, o_list) if (eq(inw, ol->o_name)) break; if (!eq(inw, name) && !ol) { @@ -210,8 +214,7 @@ bzero(op, sizeof(*op)); op->op_name = inw; op->op_value = invalue; - op->op_next = op_head; - op_head = op; + LIST_INSERT_HEAD(&localopt_head, op, op_list); } /* EOL? */ @@ -221,9 +224,10 @@ } (void) fclose(inf); if (!tidy && ((value == NULL && oldvalue == NULL) || - (value && oldvalue && eq(value, oldvalue)))) { - for (op = op_head; op != NULL; op = topp) { - topp = op->op_next; + (value && oldvalue && eq(value, oldvalue)))) { + while (!LIST_EMPTY(&localopt_head)) { + op = LIST_FIRST(&localopt_head); + LIST_REMOVE(op, op_list); free(op->op_name); free(op->op_value); free(op); @@ -237,20 +241,20 @@ bzero(op, sizeof(*op)); op->op_name = ns(name); op->op_value = value ? ns(value) : NULL; - op->op_next = op_head; - op_head = op; + LIST_INSERT_HEAD(&localopt_head, op, op_list); } outf = fopen(file, "w"); if (outf == 0) err(1, "%s", file); - for (op = op_head; op != NULL; op = topp) { + while (!LIST_EMPTY(&localopt_head)) { + op = LIST_FIRST(&localopt_head); + LIST_REMOVE(op, op_list); /* was the option in the config file? */ if (op->op_value) { fprintf(outf, "#define %s %s\n", op->op_name, op->op_value); } - topp = op->op_next; free(op->op_name); free(op->op_value); free(op); @@ -271,7 +275,7 @@ /* "cannot happen"? the otab list should be complete.. */ (void) strlcpy(nbuf, "options.h", sizeof(nbuf)); - for (po = otab ; po != 0; po = po->o_next) { + LIST_FOREACH(po, &otab_head, o_list) { if (eq(po->o_name, name)) { strlcpy(nbuf, po->o_file, sizeof(nbuf)); break; @@ -341,7 +345,7 @@ } val = ns(val); - for (po = otab ; po != 0; po = po->o_next) { + LIST_FOREACH(po, &otab_head, o_list) { if (eq(po->o_name, this)) { printf("%s: Duplicate option %s.\n", fname, this); @@ -353,8 +357,7 @@ bzero(po, sizeof(*po)); po->o_name = this; po->o_file = val; - po->o_next = otab; - otab = po; + LIST_INSERT_HEAD(&otab_head, po, o_list); goto next; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 2:26:52 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id AA53237B401 for ; Wed, 18 Jul 2001 02:26:48 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id TAA06582; Wed, 18 Jul 2001 19:26:24 +1000 Date: Wed, 18 Jul 2001 19:24:11 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Dag-Erling Smorgrav Cc: Peter Pentchev , Mike Barcroft , David Malone , audit@FreeBSD.ORG Subject: Re: inetd(8) warns patch In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 17 Jul 2001, Dag-Erling Smorgrav wrote: > Peter Pentchev writes: > > Basically, the problem is that although writev(2) doesn't need to write > > to the buffer pointed to in its iov parameter, readv(2) does. > > You can work around this by casting the LHS to (const char *): > > (const char *)iov[n].iov_base = str; > iov[n].iov_len = len; Only if you are not writing in C. E.g., this is just a syntax error according to TenDRA: Script started on Wed Jul 18 19:17:01 2001 ttyv2:bde@besplex:/tmp> cat z.c #include #include struct iovec iov[1]; char *str; size_t len; const int n = 1; void test(void) { (const char *)iov[n].iov_base = str; iov[n].iov_len = len; } ttyv2:bde@besplex:/tmp> tcc -Ysystem -c z.c "z.c", line 12: Error: [Syntax]: Parse error before '='. [Syntax]: Can't recover from this error. ttyv2:bde@besplex:/tmp> exit Script done on Wed Jul 18 19:17:09 2001 Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 3:54:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id D0E2737B405 for ; Wed, 18 Jul 2001 03:54:12 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f6IAsCM19359 for ; Wed, 18 Jul 2001 03:54:12 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 78F7238FD; Wed, 18 Jul 2001 03:54:12 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Dima Dorfman Cc: Sheldon Hearn , audit@freebsd.org Subject: Re: queue(3) patch for config(8) In-Reply-To: <20010718090116.8CCCB3E2F@bazooka.unixfreak.org> Date: Wed, 18 Jul 2001 03:54:12 -0700 From: Peter Wemm Message-Id: <20010718105412.78F7238FD@overcee.netplex.com.au> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dima Dorfman wrote: > Sheldon Hearn writes: > > This one should almost certainly go past Peter Wemm. > > Okay. Peter (cc'd), the discussion is about a patch (attached below) > to config(8) which converts all of its lists to the queue(3) API. > This will make future modifications (esp. those which start removing > arbitrary nodes from these lists) less error-prone. Please review. > > Thanks, Please keep in mind that: 1: This code is doomed and will not live to 5.0-RELEASE. 2: TAILQ_FOREACH() etc is not portable. If you're going to use this, then please provide fallbacks. The strl*() needs to be fixed in the same way as it is a major headache to build a newer kernel on an older system. 3: We dont remove nodes from lists at all right now, at all. The TAILQ_REMOVE()'s you've added are artificial as we're destroying the entire list. There was no need to remove the notes as we're free()'ing it as we go. This change just seems to complicate the code. 4: config (in general) doesn't free memory. The few token places that do free memory (eg: the ones you're touching) are just a drop in the bucket compared to some of the other stuff. There are no reference counts etc, things are just strdup()'ed all over the place "in case". If you still want to do it, then go for your life. But keep in mind that it is right up on the top of my personal todo list for nuking this entire block of code. For now, what is there is quite adequate. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 3:56: 2 2001 Delivered-To: freebsd-audit@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 0181737B406 for ; Wed, 18 Jul 2001 03:56:00 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f6IAtxM19376 for ; Wed, 18 Jul 2001 03:55:59 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id AF163380B; Wed, 18 Jul 2001 03:55:59 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Dima Dorfman Cc: Sheldon Hearn , audit@freebsd.org Subject: Re: queue(3) patch for config(8) In-Reply-To: <20010718090116.8CCCB3E2F@bazooka.unixfreak.org> Date: Wed, 18 Jul 2001 03:55:59 -0700 From: Peter Wemm Message-Id: <20010718105559.AF163380B@overcee.netplex.com.au> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dima Dorfman wrote: > Sheldon Hearn writes: > > This one should almost certainly go past Peter Wemm. > > Okay. Peter (cc'd), the discussion is about a patch (attached below) > to config(8) which converts all of its lists to the queue(3) API. > This will make future modifications (esp. those which start removing > arbitrary nodes from these lists) less error-prone. Please review. > > Thanks, Please keep in mind that: 1: This code is doomed and will not live to 5.0-RELEASE. 2: TAILQ_FOREACH() etc is not portable. If you're going to use this, then please provide fallbacks. The strl*() needs to be fixed in the same way as it is a major headache to build a newer kernel on an older system. 3: We dont remove nodes from lists at all right now, at all. The TAILQ_REMOVE()'s you've added are artificial as we're destroying the entire list. There was no need to remove the notes as we're free()'ing it as we go. This change just seems to complicate the code. 4: config (in general) doesn't free memory. The few token places that do free memory (eg: the ones you're touching) are just a drop in the bucket compared to some of the other stuff. There are no reference counts etc, things are just strdup()'ed all over the place "in case". If you still want to do it, then go for your life. But keep in mind that it is right up on the top of my personal todo list for nuking this entire block of code. For now, what is there is quite adequate. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 4:11:34 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 5FF5337B401 for ; Wed, 18 Jul 2001 04:11:30 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 720EF3E2F; Wed, 18 Jul 2001 04:11:29 -0700 (PDT) To: Peter Wemm Cc: audit@freebsd.org Subject: Re: queue(3) patch for config(8) In-Reply-To: <20010718105412.78F7238FD@overcee.netplex.com.au>; from peter@wemm.org on "Wed, 18 Jul 2001 03:54:12 -0700" Date: Wed, 18 Jul 2001 04:11:29 -0700 From: Dima Dorfman Message-Id: <20010718111129.720EF3E2F@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Peter Wemm writes: > Dima Dorfman wrote: > > Sheldon Hearn writes: > > > This one should almost certainly go past Peter Wemm. > > > > Okay. Peter (cc'd), the discussion is about a patch (attached below) > > to config(8) which converts all of its lists to the queue(3) API. > > This will make future modifications (esp. those which start removing > > arbitrary nodes from these lists) less error-prone. Please review. > > > > Thanks, > > Please keep in mind that: > 1: This code is doomed and will not live to 5.0-RELEASE. What's included in `this code'? You're planning to do away with config(8) entirely? > 2: TAILQ_FOREACH() etc is not portable. If you're going to use this, then > please provide fallbacks. The strl*() needs to be fixed in the same way > as it is a major headache to build a newer kernel on an older system. Okay, I'll get rid of *_FOREACH. > 3: We dont remove nodes from lists at all right now, at all. I know. Some people wanted nooption/nodevice directives that will undo option/device to go along with 'include'. Those will need to remove nodes. > The > TAILQ_REMOVE()'s you've added are artificial as we're destroying the > entire list. There was no need to remove the notes as we're free()'ing > it as we go. This change just seems to complicate the code. > 4: config (in general) doesn't free memory. The few token places that > do free memory (eg: the ones you're touching) are just a drop in the > bucket compared to some of the other stuff. There are no reference > counts etc, things are just strdup()'ed all over the place "in case". > > If you still want to do it, then go for your life. But keep in mind that > it is right up on the top of my personal todo list for nuking this entire > block of code. As asked above, which part of the code is going away? I did this in preparation of adding nooption/nodevice directives as described above. People on -hackers (mostly jhb) wanted to split the kernels into MD and MI parts; the include directive I added will allow us to do that, but people wanted 'nooption' and 'nodevice' so that (in theory) it'd be possible to have a 'base' kernel config file for, e.g., a group ("cluster"?) of machines, with a small per-machine config file that would customize the base one (by adding or removing options and/or devices). As long as kernel config files and kernel options aren't going away, it seems like this would be pretty useful. Thanks, Dima Dorfman dima@unixfreak.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 5: 0:13 2001 Delivered-To: freebsd-audit@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 4C50237B401 for ; Wed, 18 Jul 2001 05:00:07 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f6IC07M19515 for ; Wed, 18 Jul 2001 05:00:07 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 0BAF4380B; Wed, 18 Jul 2001 05:00:07 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Dima Dorfman Cc: audit@freebsd.org Subject: Re: queue(3) patch for config(8) In-Reply-To: <20010718111129.720EF3E2F@bazooka.unixfreak.org> Date: Wed, 18 Jul 2001 05:00:07 -0700 From: Peter Wemm Message-Id: <20010718120007.0BAF4380B@overcee.netplex.com.au> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dima Dorfman wrote: > Peter Wemm writes: > > Dima Dorfman wrote: > > > Sheldon Hearn writes: > > > > This one should almost certainly go past Peter Wemm. > > > > > > Okay. Peter (cc'd), the discussion is about a patch (attached below) > > > to config(8) which converts all of its lists to the queue(3) API. > > > This will make future modifications (esp. those which start removing > > > arbitrary nodes from these lists) less error-prone. Please review. > > > > > > Thanks, > > > > Please keep in mind that: > > 1: This code is doomed and will not live to 5.0-RELEASE. > > What's included in `this code'? You're planning to do away with > config(8) entirely? Yes. I have several incomplete prototypes for replacements. The most promising ones use a hybrid C / script arrangement that have a script call a helper to parse the user config file and spit out a bunch of simple tables. The scripts generate the rest of the build structure from there. > > 2: TAILQ_FOREACH() etc is not portable. If you're going to use this, then > > please provide fallbacks. The strl*() needs to be fixed in the same way > > as it is a major headache to build a newer kernel on an older system. > > Okay, I'll get rid of *_FOREACH. Or provide #ifndef TAILQ_FOREACH / #define TAILQ_FOREACH in the config.h file. That's relatively harmless. > > 3: We dont remove nodes from lists at all right now, at all. > > I know. Some people wanted nooption/nodevice directives that will > undo option/device to go along with 'include'. Those will need to > remove nodes. Ahh, I see. > > The > > TAILQ_REMOVE()'s you've added are artificial as we're destroying the > > entire list. There was no need to remove the notes as we're free()'ing > > it as we go. This change just seems to complicate the code. > > 4: config (in general) doesn't free memory. The few token places that > > do free memory (eg: the ones you're touching) are just a drop in the > > bucket compared to some of the other stuff. There are no reference > > counts etc, things are just strdup()'ed all over the place "in case". > > > > If you still want to do it, then go for your life. But keep in mind that > > it is right up on the top of my personal todo list for nuking this entire > > block of code. > > As asked above, which part of the code is going away? I did this in > preparation of adding nooption/nodevice directives as described above. > People on -hackers (mostly jhb) wanted to split the kernels into MD > and MI parts; the include directive I added will allow us to do that, > but people wanted 'nooption' and 'nodevice' so that (in theory) it'd > be possible to have a 'base' kernel config file for, e.g., a group > ("cluster"?) of machines, with a small per-machine config file that > would customize the base one (by adding or removing options and/or > devices). > > As long as kernel config files and kernel options aren't going away, > it seems like this would be pretty useful. As I said before, if you still want to do it, feel free and go right ahead. I have a system that has elements of what you describe above on the agenda to replace config entirely (part of the unified kernel / modules build stuff). I see no harm at all in adding missing functionality in the meantime and it will keep me on my toes. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 5:44:50 2001 Delivered-To: freebsd-audit@freebsd.org Received: from columbus.cris.net (ns.cris.net [212.110.128.65]) by hub.freebsd.org (Postfix) with ESMTP id D9E3B37B403; Wed, 18 Jul 2001 05:44:40 -0700 (PDT) (envelope-from phantom@phantom.cris.net) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by columbus.cris.net (8.9.3/8.9.3) with ESMTP id PAA04459; Wed, 18 Jul 2001 15:44:28 +0300 (EEST) Received: (from phantom@localhost) by phantom.cris.net (8.11.1/8.11.1) id f6ICiPJ66208; Wed, 18 Jul 2001 15:44:25 +0300 (EEST) (envelope-from phantom) Date: Wed, 18 Jul 2001 15:44:25 +0300 From: Alexey Zelkin To: Mike Barcroft Cc: audit@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: whois(1) changes Message-ID: <20010718154425.A65945@phantom.cris.net> References: <20010717214524.A51455@coffee.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010717214524.A51455@coffee.q9media.com>; from mike@FreeBSD.org on Tue, Jul 17, 2001 at 09:45:24PM -0400 X-Operating-System: FreeBSD 4.2-STABLE i386 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG hi, On Tue, Jul 17, 2001 at 09:45:24PM -0400, Mike Barcroft wrote: > > I would appreciate comments on the patch to whois(1) located at the > end of this e-mail and also available at: > http://people.FreeBSD.org/~mike/patches/whois.20010718.patch > > If there are no objections, I plan on committing it in a two days. > > --------------------------------------------------------------------- > > whois.20010717.patch > > o Reintegrate part of phantom's patch which adds gethostinfo(). > o Create a wrapper for asprintf(3) which checks for failure. > o Tested on i386, alpha. [patch skiped] 1. isdigit()'s argument should be explicitly casted to 'unsigned char' per ache's guidelines. 2. I think it's time to go thru include files and cleanup it. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 7:31: 0 2001 Delivered-To: freebsd-audit@freebsd.org Received: from technokratis.com (modemcable052.174-202-24.mtl.mc.videotron.ca [24.202.174.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D33537B407; Wed, 18 Jul 2001 07:30:55 -0700 (PDT) (envelope-from bmilekic@technokratis.com) Received: (from bmilekic@localhost) by technokratis.com (8.11.3/8.11.3) id f6IEgWI96955; Wed, 18 Jul 2001 10:42:32 -0400 (EDT) (envelope-from bmilekic) Date: Wed, 18 Jul 2001 10:42:32 -0400 From: Bosko Milekic To: Matthew Jacob Cc: smp@freebsd.org, audit@freebsd.org Subject: Re: planned change to mbinit code and minor changes to mp startup Message-ID: <20010718104232.A96785@technokratis.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from mjacob@feral.com on Sat, Jul 14, 2001 at 11:25:46AM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Matthew, Thanks for looking into this. It is clearly a problem. The proposed solution is also good. However, it poses a problem when it comes to netstat(1) and systat(1). They both presently rely on mp_ncpus and fetch the PCPU stats treating the whole thing as a dense array. This isn't your fault (it's mine), and I'd ask for this patch to sit pending for a while until I get to cleaning up some of systat(1) and netstat(1) again (when I re-enable mbtypes stats). It's relatively high on the TODO and I should be there soon, so just bear with me as I re-settle in. On Sat, Jul 14, 2001 at 11:25:46AM -0700, Matthew Jacob wrote: > > Problem: the MB init and alloc code assumes that in the SMP case that there is > a dense array of CPU ids for the CPUs present and reported via mp_ncpus. [...] As for moving toward the (c) point you mention: I wonder how reasonable it would be to offer (a) hook(s) to subsystems which they can use to configure PCPU-specific intialization routines to be called when a processor is enabled during runtime. i.e.: time 1: CPU 1 off; CPU 2 off; CPU 3 on; CPU 4 on; time 2: CPU 1 off -> on; hook_for_cpu1(); CPU 2 off -> on; hook_for_cpu2(); CPU 3 on; CPU 4 on; The hook functions could include, amongst other things, the code to malloc() the necessary structures for the relevant per-CPU container. Cheers, -- Bosko Milekic bmilekic@technokratis.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 7:44:16 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 2187437B405 for ; Wed, 18 Jul 2001 07:44:14 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6IF0pw52839; Wed, 18 Jul 2001 11:00:51 -0400 (EDT) (envelope-from mike) Date: Wed, 18 Jul 2001 11:00:51 -0400 From: Mike Barcroft To: Alexey Zelkin Cc: audit@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: whois(1) changes Message-ID: <20010718110051.A52720@coffee.q9media.com> References: <20010717214524.A51455@coffee.q9media.com> <20010718154425.A65945@phantom.cris.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010718154425.A65945@phantom.cris.net>; from phantom@FreeBSD.org.ua on Wed, Jul 18, 2001 at 03:44:25PM +0300 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jul 18, 2001 at 03:44:25PM +0300, Alexey Zelkin wrote: > On Tue, Jul 17, 2001 at 09:45:24PM -0400, Mike Barcroft wrote: > > whois.20010717.patch > > > > o Reintegrate part of phantom's patch which adds gethostinfo(). > > o Create a wrapper for asprintf(3) which checks for failure. > > o Tested on i386, alpha. > > [patch skiped] > > 1. isdigit()'s argument should be explicitly casted to 'unsigned char' per > ache's guidelines. Can you explain this in more detail? To my understanding, one only does this when using setlocale(3) and friends. > 2. I think it's time to go thru include files and cleanup it. As far as I can tell, all the current includes are required. Do you see any includes that can safely be removed? Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 7:52:26 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.39]) by hub.freebsd.org (Postfix) with SMTP id ECCCA37B407 for ; Wed, 18 Jul 2001 07:52:22 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 68155 invoked by uid 1000); 18 Jul 2001 14:56:37 -0000 Date: Wed, 18 Jul 2001 17:56:37 +0300 From: Peter Pentchev To: Mike Barcroft Cc: Alexey Zelkin , audit@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: whois(1) changes Message-ID: <20010718175637.D29731@ringworld.oblivion.bg> Mail-Followup-To: Mike Barcroft , Alexey Zelkin , audit@FreeBSD.org, Dag-Erling Smorgrav References: <20010717214524.A51455@coffee.q9media.com> <20010718154425.A65945@phantom.cris.net> <20010718110051.A52720@coffee.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010718110051.A52720@coffee.q9media.com>; from mike@FreeBSD.org on Wed, Jul 18, 2001 at 11:00:51AM -0400 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jul 18, 2001 at 11:00:51AM -0400, Mike Barcroft wrote: > On Wed, Jul 18, 2001 at 03:44:25PM +0300, Alexey Zelkin wrote: > > On Tue, Jul 17, 2001 at 09:45:24PM -0400, Mike Barcroft wrote: > > > whois.20010717.patch > > > > > > o Reintegrate part of phantom's patch which adds gethostinfo(). > > > o Create a wrapper for asprintf(3) which checks for failure. > > > o Tested on i386, alpha. > > > > [patch skiped] > > > > 1. isdigit()'s argument should be explicitly casted to 'unsigned char' per > > ache's guidelines. > > Can you explain this in more detail? To my understanding, one only does > this when using setlocale(3) and friends. It's only the sane thing to do. Someone, some day, may decide to go ahead and make whois(1) locale-aware. You might as well make their job easier by using (logically correct) unsigned char arguments to functions that accept characters as opposed to arbitrary integer values. (And then somebody in the audience mutters something about multibyte characters and wchar_t, and I hastily scurry back into the hole I crawled out of.. ;) G'luck, Peter -- This sentence was in the past tense. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 8: 2: 6 2001 Delivered-To: freebsd-audit@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 840C837B406; Wed, 18 Jul 2001 08:02:02 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.11.4/8.11.4) id f6IF1wD42348; Wed, 18 Jul 2001 19:01:59 +0400 (MSD) (envelope-from ache) Date: Wed, 18 Jul 2001 19:01:56 +0400 From: =?koi8-r?B?4c7E0sXKIP7F0s7P1w==?= To: Mike Barcroft Cc: Alexey Zelkin , audit@FreeBSD.ORG, Dag-Erling Smorgrav Subject: Re: whois(1) changes Message-ID: <20010718190154.A42262@nagual.pp.ru> References: <20010717214524.A51455@coffee.q9media.com> <20010718154425.A65945@phantom.cris.net> <20010718110051.A52720@coffee.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010718110051.A52720@coffee.q9media.com> User-Agent: Mutt/1.3.19i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jul 18, 2001 at 11:00:51 -0400, Mike Barcroft wrote: > > 1. isdigit()'s argument should be explicitly casted to 'unsigned char' per > > ache's guidelines. > > Can you explain this in more detail? To my understanding, one only does > this when using setlocale(3) and friends. Far before any locale, it is ANSI C -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 8: 5: 6 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id BAAE837B408 for ; Wed, 18 Jul 2001 08:05:03 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f6IFLgQ52914; Wed, 18 Jul 2001 11:21:42 -0400 (EDT) (envelope-from mike) Date: Wed, 18 Jul 2001 11:21:42 -0400 From: Mike Barcroft To: Peter Pentchev Cc: Alexey Zelkin , audit@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: whois(1) changes Message-ID: <20010718112142.B52720@coffee.q9media.com> References: <20010717214524.A51455@coffee.q9media.com> <20010718154425.A65945@phantom.cris.net> <20010718110051.A52720@coffee.q9media.com> <20010718175637.D29731@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010718175637.D29731@ringworld.oblivion.bg>; from roam@orbitel.bg on Wed, Jul 18, 2001 at 05:56:37PM +0300 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jul 18, 2001 at 05:56:37PM +0300, Peter Pentchev wrote: > On Wed, Jul 18, 2001 at 11:00:51AM -0400, Mike Barcroft wrote: > > On Wed, Jul 18, 2001 at 03:44:25PM +0300, Alexey Zelkin wrote: > > > 1. isdigit()'s argument should be explicitly casted to 'unsigned char' per > > > ache's guidelines. > > > > Can you explain this in more detail? To my understanding, one only does > > this when using setlocale(3) and friends. > > It's only the sane thing to do. > > Someone, some day, may decide to go ahead and make whois(1) locale-aware. > You might as well make their job easier by using (logically correct) > unsigned char arguments to functions that accept characters as opposed > to arbitrary integer values. That sounds reasonable. I'll add the cast before committing. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 11:53:48 2001 Delivered-To: freebsd-audit@freebsd.org Received: from Veronica.wmol.com (veronica.wmol.com [208.242.83.241]) by hub.freebsd.org (Postfix) with ESMTP id 3FBB737B401 for ; Wed, 18 Jul 2001 11:53:46 -0700 (PDT) (envelope-from david@phobia.ms) Received: from rain.hill.hom (081bc122.chartermi.net [24.247.81.122]) by Veronica.wmol.com (Vircom SMTPRS 4.6.189) with ESMTP id for ; Wed, 18 Jul 2001 14:51:12 -0400 Date: Wed, 18 Jul 2001 14:52:58 -0400 From: David Hill To: audit@freebsd.org Subject: strlcpy patches Message-Id: <20010718145258.1d829df6.david@phobia.ms> X-Mailer: Sylpheed version 0.5.0 (GTK+ 1.2.10; i386-unknown-freebsd4.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Greetings. I have patched some source files replacing: strncpy(dst, src, sizeof(dst) - 1); dst[sizeof(dst)-1] = '\0'; with strlcpy(dst, src, sizeof dst); They are located at http://www.phobia.ms/patches What are your thoughts? Thanks - David To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 13:28: 2 2001 Delivered-To: freebsd-audit@freebsd.org Received: from Veronica.wmol.com (veronica.wmol.com [208.242.83.241]) by hub.freebsd.org (Postfix) with ESMTP id 50BC737B406 for ; Wed, 18 Jul 2001 13:28:00 -0700 (PDT) (envelope-from david@phobia.ms) Received: from rain.hill.hom (081bc122.chartermi.net [24.247.81.122]) by Veronica.wmol.com (Vircom SMTPRS 4.6.189) with ESMTP id for ; Wed, 18 Jul 2001 15:56:35 -0400 Date: Wed, 18 Jul 2001 15:58:20 -0400 From: David Hill To: audit@freebsd.org Subject: STD*_FILENO Message-Id: <20010718155820.30dd3f23.david@phobia.ms> X-Mailer: Sylpheed version 0.5.1 (GTK+ 1.2.10; i386-unknown-freebsd4.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello. I request that the 0, 1, and 2's in the source files need to be changed to STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO respectively. This would allow for better code readability. If you agree, I will be happy to send in the diff's Thanks - David Hill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 13:52:35 2001 Delivered-To: freebsd-audit@freebsd.org Received: from beppo.feral.com (beppo.feral.com [192.67.166.79]) by hub.freebsd.org (Postfix) with ESMTP id 3F3C037B405; Wed, 18 Jul 2001 13:52:27 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from beppo (mjacob@beppo [192.67.166.79]) by beppo.feral.com (8.11.3/8.11.3) with ESMTP id f6IKqOS49934; Wed, 18 Jul 2001 13:52:24 -0700 (PDT) (envelope-from mjacob@feral.com) Date: Wed, 18 Jul 2001 13:52:23 -0700 (PDT) From: Matthew Jacob X-Sender: mjacob@beppo Reply-To: mjacob@feral.com To: Bosko Milekic Cc: smp@freebsd.org, audit@freebsd.org Subject: Re: planned change to mbinit code and minor changes to mp startup In-Reply-To: <20010718104232.A96785@technokratis.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 18 Jul 2001, Bosko Milekic wrote: > > Hi Matthew, > > Thanks for looking into this. It is clearly a problem. The proposed > solution is also good. However, it poses a problem when it comes to > netstat(1) and systat(1). They both presently rely on mp_ncpus and fetch > the PCPU stats treating the whole thing as a dense array. This isn't your > fault (it's mine), and I'd ask for this patch to sit pending for a while > until I get to cleaning up some of systat(1) and netstat(1) again (when I > re-enable mbtypes stats). It's relatively high on the TODO and I should be > there soon, so just bear with me as I re-settle in. The only thing that is really directly hanging up for me on this is to make support for the Alpha 8X00s work again (booting cpu is ID 8). I'd like to check the changes back in to support that, but there's no great overriding hurry on this. It's also true that the alternative to all of this is that 'cpuid' should in fact be considered a virtual construct. There's nothing that says that the Nth platform that FreeBSD is ported to programmatically identifies each specific CPU with a completely arbitrary 32 bit value. It's still fair to say that NCPU (defined at 32 or whatever) is a fair way to establish the overall upper limit. So, I'm still back a bit on the fence over whether or not I shouldn't just try and fix the alpha port to have cpuid be virtual and mp_ncpus be dense- at least until the spinup/spindown stuff is worked out. Now that you're back from vacation and agree that this is an issue that needs to be solved, I feel confident that you'll be able to do the right thing relatively soon. > On Sat, Jul 14, 2001 at 11:25:46AM -0700, Matthew Jacob wrote: > > > > Problem: the MB init and alloc code assumes that in the SMP case that there is > > a dense array of CPU ids for the CPUs present and reported via mp_ncpus. > [...] > > As for moving toward the (c) point you mention: I wonder how > reasonable it would be to offer (a) hook(s) to subsystems which they can > use to configure PCPU-specific intialization routines to be called when a > processor is enabled during runtime. i.e.: > > time 1: > CPU 1 off; > CPU 2 off; > CPU 3 on; > CPU 4 on; > > time 2: > CPU 1 off -> on; hook_for_cpu1(); > CPU 2 off -> on; hook_for_cpu2(); > CPU 3 on; > CPU 4 on; > > The hook functions could include, amongst other things, the code to > malloc() the necessary structures for the relevant per-CPU container. These are desirable. I just don't myself know the cleanest way to implement this. Or I could propose something, but as soon as that happens, a bunch of people who clearly know better while point out the deficiencies. It'd be nice if we skip this interim step and ask them to write it to begin with. -matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 15:47:46 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id A7D0037B403 for ; Wed, 18 Jul 2001 15:47:43 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f6IMlfD19812; Wed, 18 Jul 2001 18:47:41 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20010718145258.1d829df6.david@phobia.ms> References: <20010718145258.1d829df6.david@phobia.ms> Date: Wed, 18 Jul 2001 18:47:39 -0400 To: David Hill , audit@FreeBSD.ORG From: Garance A Drosihn Subject: Re: strlcpy patches Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 2:52 PM -0400 7/18/01, David Hill wrote: >I have patched some source files replacing: > > strncpy(dst, src, sizeof(dst) - 1); > dst[sizeof(dst)-1] = '\0'; > >with > > strlcpy(dst, src, sizeof dst); > >They are located at http://www.phobia.ms/patches > >What are your thoughts? Speaking only wrt usr.sbin/lpr, I have been working on doing like this sometime soon. In fact, I would have finished it last weekend except that I got sidetracked while working on some of my other lpr changes. However, I don't much like changing strncpy(...) to (void)strlcpy(...) Some of the str*cpy() calls also need to be changed for other reasons, as I remember, so I'll want to look this over more closely before doing the lpr changes. Some changes along these lines will (hopefully!) go into lpr this weekend, but I can't speak for the rest of the patches you've made. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 23: 5:48 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 2D76B37B401 for ; Wed, 18 Jul 2001 23:05:46 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f6J65iD46742; Thu, 19 Jul 2001 02:05:44 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20010718145258.1d829df6.david@phobia.ms> References: <20010718145258.1d829df6.david@phobia.ms> Date: Thu, 19 Jul 2001 02:05:42 -0400 To: David Hill , audit@FreeBSD.ORG From: Garance A Drosihn Subject: Re: strlcpy patches Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 2:52 PM -0400 7/18/01, David Hill wrote: >with > strlcpy(dst, src, sizeof dst); > >They are located at http://www.phobia.ms/patches > >What are your thoughts? Also on usr.sbin/lpr, it looks like you took a snapshot of lpr in stable to do this. The 'runqueue' directory doesn't exist at all in -current (well, it is there, but there aren't any source files in it), and there isn't any 'printjob.c' in the common_source directory either. The same is effectively true in -stable, too, except that for some reason the extra files still show up when one checks out stable. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Wed Jul 18 23:12: 7 2001 Delivered-To: freebsd-audit@freebsd.org Received: from obsecurity.dyndns.org (adsl-63-207-60-215.dsl.lsan03.pacbell.net [63.207.60.215]) by hub.freebsd.org (Postfix) with ESMTP id 988A337B406 for ; Wed, 18 Jul 2001 23:12:01 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 85D1566C4D; Wed, 18 Jul 2001 23:12:00 -0700 (PDT) Date: Wed, 18 Jul 2001 23:12:00 -0700 From: Kris Kennaway To: David Hill Cc: audit@FreeBSD.ORG Subject: Re: STD*_FILENO Message-ID: <20010718231156.A25683@xor.obsecurity.org> References: <20010718155820.30dd3f23.david@phobia.ms> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010718155820.30dd3f23.david@phobia.ms>; from david@phobia.ms on Wed, Jul 18, 2001 at 03:58:20PM -0400 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jul 18, 2001 at 03:58:20PM -0400, David Hill wrote: > Hello. > I request that the 0, 1, and 2's in the source files need to be changed to STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO respectively. This would allow for better code readability. Only in the cases where they actually correspond to file descriptors ;-) > If you agree, I will be happy to send in the diff's Sounds good! Kris --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7VnorWry0BWjoQKURAhFmAJ9dEzG9WbFIoozu3EBYjEFSRNRmKgCdEOUK a2XqCy6QBeCi1oD1GXk6LNQ= =Wj6y -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 19 8:41: 3 2001 Delivered-To: freebsd-audit@freebsd.org Received: from Veronica.wmol.com (veronica.wmol.com [208.242.83.241]) by hub.freebsd.org (Postfix) with ESMTP id 36B7637B408 for ; Thu, 19 Jul 2001 08:41:00 -0700 (PDT) (envelope-from david@phobia.ms) Received: from rain (081bc122.chartermi.net [24.247.81.122]) by Veronica.wmol.com (Vircom SMTPRS 4.6.189) with ESMTP id ; Thu, 19 Jul 2001 11:39:13 -0400 Message-ID: <006901c11069$304f5300$0201a8c0@hill.hom> From: "David Hill" To: , "Garance A Drosihn" References: <20010718145258.1d829df6.david@phobia.ms> Subject: Re: strlcpy patches Date: Thu, 19 Jul 2001 11:40:50 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Alright I am just about to install -CURRENT. I will redo them. - David ----- Original Message ----- From: "Garance A Drosihn" To: "David Hill" ; Sent: Thursday, July 19, 2001 2:05 AM Subject: Re: strlcpy patches > At 2:52 PM -0400 7/18/01, David Hill wrote: > >with > > strlcpy(dst, src, sizeof dst); > > > >They are located at http://www.phobia.ms/patches > > > >What are your thoughts? > > Also on usr.sbin/lpr, it looks like you took a snapshot of > lpr in stable to do this. The 'runqueue' directory doesn't > exist at all in -current (well, it is there, but there aren't > any source files in it), and there isn't any 'printjob.c' in > the common_source directory either. > > The same is effectively true in -stable, too, except that for > some reason the extra files still show up when one checks out > stable. > > -- > Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu > Senior Systems Programmer or gad@freebsd.org > Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jul 19 10:23:13 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 24E6437B403 for ; Thu, 19 Jul 2001 10:23:11 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f6JHN8e119168; Thu, 19 Jul 2001 13:23:08 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <006901c11069$304f5300$0201a8c0@hill.hom> References: <20010718145258.1d829df6.david@phobia.ms> <006901c11069$304f5300$0201a8c0@hill.hom> Date: Thu, 19 Jul 2001 13:23:07 -0400 To: "David Hill" , From: Garance A Drosihn Subject: Re: strlcpy patches Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 11:40 AM -0400 7/19/01, David Hill wrote: >Alright > I am just about to install -CURRENT. I will redo them. You can just skip the updates wrt everything under usr.sbin/lpr. As I mentioned, I'm already in the middle of several similar updates to lpr, some of which were installed last weekend, and I hope to finish off his weekend. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 2:27:55 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 5B4E437B41A for ; Fri, 20 Jul 2001 02:27:28 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 80CE13E31 for ; Fri, 20 Jul 2001 02:27:27 -0700 (PDT) To: audit@freebsd.org Subject: libmp implementation in terms of libcrypto Date: Fri, 20 Jul 2001 02:27:27 -0700 From: Dima Dorfman Message-Id: <20010720092727.80CE13E31@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Attached is a sharball of a libmp implementation in terms of libcrypto. This was discussed on -arch, and the consensus is that although it'd be nice if the world used the BIGNUM API directly, it can't hurt to be backwards compatible. I would appreciate it if somebody could review and/or test this. To test it, just build it, install it, and link all programs that use it using "-lmp -lcrypto". Once this is in the tree, the GPV'd libgmp monster can be taken out and shot. I've tested all the in-tree programs that use it except for the Kerberized telnets, and they seem to work as well as they have before. Thanks in advance, Dima Dorfman P.S. The libmp installed in /usr/lib has major number 3; the sharball below bumps it to 4. Is this actually necessary? # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # libmp # libmp/Makefile # libmp/mp.h # libmp/mpasbn.c # echo c - libmp mkdir -p libmp > /dev/null 2>&1 echo x - libmp/Makefile sed 's/^X//' >libmp/Makefile << 'END-of-libmp/Makefile' X# $FreeBSD$ X XLIB= mp XCFLAGS+= -ansi -pedantic XWARNS?= 2 XNO_WERROR= yes XSHLIB_MAJOR= 4 XSRCS= mpasbn.c X Xbeforeinstall: X ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ X ${.CURDIR}/mp.h ${DESTDIR}/usr/include X X.include END-of-libmp/Makefile echo x - libmp/mp.h sed 's/^X//' >libmp/mp.h << 'END-of-libmp/mp.h' X#ifndef _MP_H_ X#define _MP_H_ X X#include X Xtypedef struct _mint { X BIGNUM *bn; X} MINT; X X Xvoid gcd(const MINT *, const MINT *, MINT *); XMINT *itom(short); Xvoid madd(const MINT *, const MINT *, MINT *); Xint mcmp(const MINT *, const MINT *); Xvoid mdiv(const MINT *, const MINT *, MINT *, MINT *); Xvoid mfree(MINT *); Xvoid min(MINT *); Xvoid mout(const MINT *); Xvoid move(const MINT *, MINT *); Xvoid msqrt(const MINT *, MINT *, MINT *); Xvoid msub(const MINT *, const MINT *, MINT *); Xchar *mtox(const MINT *); Xvoid mult(const MINT *, const MINT *, MINT *); Xvoid pow(const MINT *, const MINT *, const MINT *, MINT *); Xvoid rpow(const MINT *, short, MINT *); Xvoid sdiv(const MINT *, short, MINT *, short *); XMINT *xtom(const char *); X X#endif /* !_MP_H_ */ END-of-libmp/mp.h echo x - libmp/mpasbn.c sed 's/^X//' >libmp/mpasbn.c << 'END-of-libmp/mpasbn.c' X/* X * Copyright (c) 2001 Dima Dorfman. X * All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X * SUCH DAMAGE. X */ X X/* X * This is the traditional Berkeley MP library implemented in terms of X * the OpenSSL BIGNUM library. It was written to replace libgmp, and X * is meant to be as compatible with the latter as feasible. X * X * There seems to be a lack of documentation for the Berkeley MP X * interface. All I could find was libgmp documentation (which didn't X * talk about the semantics of the functions) and an old SunOS 4.1 X * manual page from 1989. The latter wasn't very detailed, either, X * but at least described what the function's arguments were. In X * general the interface seems to be archaic, somewhat poorly X * designed, and poorly, if at all, documented. It is considered X * harmful. X * X * Miscellaneous notes on this implementation: X * X * - The SunOS manual page mentioned above indicates that if an error X * occurs, the library should "produce messages and core images." X * Given that most of the functions don't have return values (and X * thus no sane way of alerting the caller to an error), this seems X * reasonable. The MPERR and MPERRX macros call warn and warnx, X * respectively, then abort(). X * X * - All the functions which take an argument to be "filled in" X * assume that the argument has been initialized by one of the *tom() X * routines before being passed to it. I never saw this documented X * anywhere, but this seems to be consistent with the way this X * library is used. X * X * - msqrt() is the only routine which had to be implemented which X * doesn't have a close counterpart in the OpenSSL BIGNUM library. X * It was implemented by hand using Newton's recursive formula. X * Doing it this way, although more error-prone, has the positive X * sideaffect of testing a lot of other functions; if msqrt() X * produces the correct results, most of the other routines will as X * well. X * X * - Internal-use-only routines (i.e., those defined here statically X * and not in mp.h) have an underscore prepended to their name (this X * is more for aesthetical reasons than technical). All such X * routines take an extra argument, 'msg', that denotes what they X * should call themselves in an error message. This is so a user X * doesn't get an error message from a function they didn't call. X */ X X#ifndef lint Xstatic const char rcsid[] = X "$FreeBSD$"; X#endif /* not lint */ X X#include X#include X#include X#include X#include X#include X X#include X#include X#include X X#include "mp.h" X X#define MPERR(s) do { warn s; abort(); } while (0) X#define MPERRX(s) do { warnx s; abort(); } while (0) X#define BN_ERRCHECK(msg, expr) do { \ X if (!(expr)) _bnerr(msg); \ X} while (0) X Xstatic void _bnerr(const char *); Xstatic MINT *_dtom(const char *, const char *); Xstatic MINT *_itom(const char *, short); Xstatic void _madd(const char *, const MINT *, const MINT *, MINT *); Xstatic int _mcmpa(const char *, const MINT *, const MINT *); Xstatic void _mdiv(const char *, const MINT *, const MINT *, MINT *, MINT *); Xstatic void _mfree(const char *, MINT *); Xstatic void _moveb(const char *, const BIGNUM *, MINT *); Xstatic void _movem(const char *, const MINT *, MINT *); Xstatic void _msub(const char *, const MINT *, const MINT *, MINT *); Xstatic char *_mtod(const char *, const MINT *); Xstatic char *_mtox(const char *, const MINT *); Xstatic void _mult(const char *, const MINT *, const MINT *, MINT *); Xstatic void _sdiv(const char *, const MINT *, short, MINT *, short *); Xstatic MINT *_xtom(const char *, const char *); X X/* X * Report an error from one of the BN_* functions using MPERRX. X */ Xstatic void X_bnerr(const char *msg) X{ X X ERR_load_crypto_strings(); X MPERRX(("%s: %s", msg, ERR_reason_error_string(ERR_get_error()))); X} X X/* X * Convert a decimal string to an MINT. X */ Xstatic MINT * X_dtom(const char *msg, const char *s) X{ X MINT *mp; X X mp = malloc(sizeof(*mp)); X if (mp == NULL) X MPERR(("%s", msg)); X mp->bn = BN_new(); X if (mp->bn == NULL) X _bnerr(msg); X BN_ERRCHECK(msg, BN_dec2bn(&mp->bn, s)); X return (mp); X} X X/* X * Compute the greatest common divisor of mp1 and mp2; result goes in rmp. X */ Xvoid Xgcd(const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X BIGNUM b; X BN_CTX c; X X BN_CTX_init(&c); X BN_init(&b); X BN_ERRCHECK("gcd", BN_gcd(&b, mp1->bn, mp2->bn, &c)); X _moveb("gcd", &b, rmp); X BN_free(&b); X BN_CTX_free(&c); X} X X/* X * Make an MINT out of a short integer. Return value must be mfree()'d. X */ Xstatic MINT * X_itom(const char *msg, short n) X{ X MINT *mp; X char *s; X X asprintf(&s, "%x", n); X if (s == NULL) X MPERR(("%s", msg)); X mp = _xtom(msg, s); X free(s); X return (mp); X} X XMINT * Xitom(short n) X{ X X return (_itom("itom", n)); X} X X/* X * Compute rmp=mp1+mp2. X */ Xstatic void X_madd(const char *msg, const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X BIGNUM b; X X BN_init(&b); X BN_ERRCHECK(msg, BN_add(&b, mp1->bn, mp2->bn)); X _moveb(msg, &b, rmp); X BN_free(&b); X} X Xvoid Xmadd(const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X X _madd("madd", mp1, mp2, rmp); X} X X/* X * Return -1, 0, or 1 if mp1mp2, respectivley. X */ Xint Xmcmp(const MINT *mp1, const MINT *mp2) X{ X X return (BN_cmp(mp1->bn, mp2->bn)); X} X X/* X * Same as mcmp but compares absolute values. X */ Xstatic int X_mcmpa(const char *msg __unused, const MINT *mp1, const MINT *mp2) X{ X X return (BN_ucmp(mp1->bn, mp2->bn)); X} X X/* X * Compute qmp=nmp/dmp and rmp=nmp%dmp. X */ Xstatic void X_mdiv(const char *msg, const MINT *nmp, const MINT *dmp, MINT *qmp, MINT *rmp) X{ X BIGNUM q, r; X BN_CTX c; X X BN_CTX_init(&c); X BN_init(&r); X BN_init(&q); X BN_ERRCHECK(msg, BN_div(&q, &r, nmp->bn, dmp->bn, &c)); X _moveb(msg, &q, qmp); X _moveb(msg, &r, rmp); X BN_free(&q); X BN_free(&r); X BN_CTX_free(&c); X} X Xvoid Xmdiv(const MINT *nmp, const MINT *dmp, MINT *qmp, MINT *rmp) X{ X X _mdiv("mdiv", nmp, dmp, qmp, rmp); X} X X/* X * Free memory associated with an MINT. X */ Xstatic void X_mfree(const char *msg __unused, MINT *mp) X{ X X BN_clear(mp->bn); X BN_free(mp->bn); X free(mp); X} X Xvoid Xmfree(MINT *mp) X{ X X _mfree("mfree", mp); X} X X/* X * Read an integer from standard input and stick the result in mp. X * The input is treated to be in base 10. This must be the silliest X * API in existence; why can't the program read in a string and call X * xtom()? (Or if base 10 is desires, perhaps dtom() could be X * exported.) X */ Xvoid Xmin(MINT *mp) X{ X MINT *rmp; X char *line, *nline; X size_t linelen; X X line = fgetln(stdin, &linelen); X if (line == NULL) X MPERR(("min")); X nline = malloc(linelen); X if (nline == NULL) X MPERR(("min")); X strncpy(nline, line, linelen); X nline[linelen] = '\0'; X rmp = _dtom("min", nline); X _movem("min", rmp, mp); X _mfree("min", rmp); X free(nline); X} X X/* X * Print the value of mp to standard output in base 10. See blurb X * above min() for why this is so useless. X */ Xvoid Xmout(const MINT *mp) X{ X char *s; X X s = _mtod("mout", mp); X printf("%s", s); X free(s); X} X X/* X * Set the value of tmp to the value of smp (i.e., tmp=smp). X */ Xvoid Xmove(const MINT *smp, MINT *tmp) X{ X X _movem("move", smp, tmp); X} X X X/* X * Internal routine to set the value of tmp to that of sbp. X */ Xstatic void X_moveb(const char *msg, const BIGNUM *sbp, MINT *tmp) X{ X X BN_ERRCHECK(msg, BN_copy(tmp->bn, sbp)); X} X X/* X * Internal routine to set the value of tmp to that of smp. X */ Xstatic void X_movem(const char *msg, const MINT *smp, MINT *tmp) X{ X X BN_ERRCHECK(msg, BN_copy(tmp->bn, smp->bn)); X} X X/* X * Compute the square root of nmp and put the result in xmp. The X * remainder goes in rmp. Should satisfy: rmp=nmp-(xmp*xmp). X * X * Note that the OpenSSL BIGNUM library does not have a square root X * function, so this had to be implemented by hand using Newton's X * recursive formula: X * X * x = (x + (n / x)) / 2 X * X * where x is the square root of the positive number n. In the X * beginning, x should be a reasonable guess, but the value 1, X * although suboptimal, works, too; this is that is used below. X */ Xvoid Xmsqrt(const MINT *nmp, MINT *xmp, MINT *rmp) X{ X MINT *tolerance; X MINT *ox, *x; X MINT *z1, *z2, *z3; X short i; X X tolerance = _itom("msqrt", 1); X x = _itom("msqrt", 1); X ox = _itom("msqrt", 0); X z1 = _itom("msqrt", 0); X z2 = _itom("msqrt", 0); X z3 = _itom("msqrt", 0); X do { X _movem("msqrt", x, ox); X _mdiv("msqrt", nmp, x, z1, z2); X _madd("msqrt", x, z1, z2); X _sdiv("msqrt", z2, 2, x, &i); X _msub("msqrt", ox, x, z3); X } while (_mcmpa("msqrt", z3, tolerance) == 1); X _movem("msqrt", x, xmp); X _mult("msqrt", x, x, z1); X _msub("msqrt", nmp, z1, z2); X _movem("msqrt", z2, rmp); X _mfree("msqrt", tolerance); X _mfree("msqrt", ox); X _mfree("msqrt", x); X _mfree("msqrt", z1); X _mfree("msqrt", z2); X _mfree("msqrt", z3); X} X X/* X * Compute rmp=mp1-mp2. X */ Xstatic void X_msub(const char *msg, const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X BIGNUM b; X X BN_init(&b); X BN_ERRCHECK(msg, BN_sub(&b, mp1->bn, mp2->bn)); X _moveb(msg, &b, rmp); X BN_free(&b); X} X Xvoid Xmsub(const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X X _msub("msub", mp1, mp2, rmp); X} X X/* X * Return a decimal representation of mp. Return value must be X * free()'d. X */ Xstatic char * X_mtod(const char *msg, const MINT *mp) X{ X char *s, *s2; X X s = BN_bn2dec(mp->bn); X if (s == NULL) X _bnerr(msg); X asprintf(&s2, "%s", s); X if (s2 == NULL) X MPERR(("%s", msg)); X OPENSSL_free(s); X return (s2); X} X X/* X * Return a hexadecimal representation of mp. Return value must be X * free()'d. X */ Xstatic char * X_mtox(const char *msg, const MINT *mp) X{ X char *p, *s, *s2; X int len; X X s = BN_bn2hex(mp->bn); X if (s == NULL) X _bnerr(msg); X asprintf(&s2, "%s", s); X if (s2 == NULL) X MPERR(("%s", msg)); X OPENSSL_free(s); X X /* X * This is a kludge for libgmp compatibility. The latter's X * implementation of this function returns lower-case letters, X * but BN_bn2hex returns upper-case. Some programs (e.g., X * newkey(1)) are sensitive to this. Although it's probably X * their fault, it's nice to be compatible. X */ X len = strlen(s2); X for (p = s2; p < s2 + len; p++) X *p = tolower(*p); X X return (s2); X} X Xchar * Xmtox(const MINT *mp) X{ X X return (_mtox("mtox", mp)); X} X X/* X * Compute rmp=mp1*mp2. X */ Xstatic void X_mult(const char *msg, const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X BIGNUM b; X BN_CTX c; X X BN_CTX_init(&c); X BN_init(&b); X BN_ERRCHECK(msg, BN_mul(&b, mp1->bn, mp2->bn, &c)); X _moveb(msg, &b, rmp); X BN_free(&b); X BN_CTX_free(&c); X} X Xvoid Xmult(const MINT *mp1, const MINT *mp2, MINT *rmp) X{ X X _mult("mult", mp1, mp2, rmp); X} X X/* X * Compute rmp=(bmp^emp)mod mmp. (Note that here and above rpow() '^' X * means 'raise to power', not 'bitwise XOR'.) X */ Xvoid Xpow(const MINT *bmp, const MINT *emp, const MINT *mmp, MINT *rmp) X{ X BIGNUM b; X BN_CTX c; X X BN_CTX_init(&c); X BN_init(&b); X BN_ERRCHECK("pow", BN_mod_exp(&b, bmp->bn, emp->bn, mmp->bn, &c)); X _moveb("pow", &b, rmp); X BN_free(&b); X BN_CTX_free(&c); X} X X/* X * Compute rmp=bmp^e. (See note above pow().) X */ Xvoid Xrpow(const MINT *bmp, short e, MINT *rmp) X{ X MINT *emp; X BIGNUM b; X BN_CTX c; X X BN_CTX_init(&c); X BN_init(&b); X emp = _itom("rpow", e); X BN_ERRCHECK("rpow", BN_exp(&b, bmp->bn, emp->bn, &c)); X _moveb("rpow", &b, rmp); X _mfree("rpow", emp); X BN_free(&b); X BN_CTX_free(&c); X} X X/* X * Compute qmp=nmp/d and ro=nmp%d. X */ Xstatic void X_sdiv(const char *msg, const MINT *nmp, short d, MINT *qmp, short *ro) X{ X MINT *dmp, *rmp; X BIGNUM q, r; X BN_CTX c; X char *s; X X BN_CTX_init(&c); X BN_init(&q); X BN_init(&r); X dmp = _itom(msg, d); X rmp = _itom(msg, 0); X BN_ERRCHECK(msg, BN_div(&q, &r, nmp->bn, dmp->bn, &c)); X _moveb(msg, &q, qmp); X _moveb(msg, &r, rmp); X s = _mtox(msg, rmp); X errno = 0; X *ro = strtol(s, NULL, 16); X if (errno != 0) X MPERR(("%s underflow or overflow", msg)); X free(s); X _mfree(msg, dmp); X _mfree(msg, rmp); X BN_free(&r); X BN_free(&q); X BN_CTX_free(&c); X} X Xvoid Xsdiv(const MINT *nmp, short d, MINT *qmp, short *ro) X{ X X _sdiv("sdiv", nmp, d, qmp, ro); X} X X/* X * Convert a hexadecimal string to an MINT. X */ Xstatic MINT * X_xtom(const char *msg, const char *s) X{ X MINT *mp; X X mp = malloc(sizeof(*mp)); X if (mp == NULL) X MPERR(("%s", msg)); X mp->bn = BN_new(); X if (mp->bn == NULL) X _bnerr(msg); X BN_ERRCHECK(msg, BN_hex2bn(&mp->bn, s)); X return (mp); X} X XMINT * Xxtom(const char *s) X{ X X return (_xtom("xtom", s)); X} END-of-libmp/mpasbn.c exit To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 2:40:39 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.39]) by hub.freebsd.org (Postfix) with SMTP id 32FFC37B401 for ; Fri, 20 Jul 2001 02:40:36 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 675 invoked by uid 1000); 20 Jul 2001 09:44:42 -0000 Date: Fri, 20 Jul 2001 12:44:41 +0300 From: Peter Pentchev To: Dima Dorfman Cc: audit@freebsd.org Subject: Re: libmp implementation in terms of libcrypto Message-ID: <20010720124441.A510@ringworld.oblivion.bg> Mail-Followup-To: Dima Dorfman , audit@freebsd.org References: <20010720092727.80CE13E31@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010720092727.80CE13E31@bazooka.unixfreak.org>; from dima@unixfreak.org on Fri, Jul 20, 2001 at 02:27:27AM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Jul 20, 2001 at 02:27:27AM -0700, Dima Dorfman wrote: > Attached is a sharball of a libmp implementation in terms of > libcrypto. This was discussed on -arch, and the consensus is that > although it'd be nice if the world used the BIGNUM API directly, it > can't hurt to be backwards compatible. > > I would appreciate it if somebody could review and/or test this. To > test it, just build it, install it, and link all programs that use it > using "-lmp -lcrypto". Once this is in the tree, the GPV'd libgmp > monster can be taken out and shot. I've tested all the in-tree > programs that use it except for the Kerberized telnets, and they seem > to work as well as they have before. > > Thanks in advance, > > Dima Dorfman > > P.S. The libmp installed in /usr/lib has major number 3; the sharball > below bumps it to 4. Is this actually necessary? Haven't really tested this, just to answer this question: the library version bump will only be needed if you decide to install this as libgmp, not libmp. In that case, all executables compiled earlier will contain a reference to libgmp.so.3, and no reference to libcrypto. Thus, they would fail with the (new) libgmp.so.3, so there needs to be a version bump. If this is installed as libmp, then you might as well start over again with mp.1, and keep gmp.3 in a compat4x distribution or something. G'luck, Peter -- This sentence would be seven words long if it were six words shorter. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 3: 6: 2 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id C0CF337B403; Fri, 20 Jul 2001 03:05:58 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 4233B3E2F; Fri, 20 Jul 2001 03:05:58 -0700 (PDT) To: roam@freebsd.org Cc: audit@freebsd.org Subject: Re: libmp implementation in terms of libcrypto In-Reply-To: <20010720124441.A510@ringworld.oblivion.bg>; from roam@orbitel.bg on "Fri, 20 Jul 2001 12:44:41 +0300" Date: Fri, 20 Jul 2001 03:05:58 -0700 From: Dima Dorfman Message-Id: <20010720100558.4233B3E2F@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Peter Pentchev writes: > On Fri, Jul 20, 2001 at 02:27:27AM -0700, Dima Dorfman wrote: > > Attached is a sharball of a libmp implementation in terms of > > libcrypto. This was discussed on -arch, and the consensus is that > > although it'd be nice if the world used the BIGNUM API directly, it > > can't hurt to be backwards compatible. > > > > I would appreciate it if somebody could review and/or test this. To > > test it, just build it, install it, and link all programs that use it > > using "-lmp -lcrypto". Once this is in the tree, the GPV'd libgmp > > monster can be taken out and shot. I've tested all the in-tree > > programs that use it except for the Kerberized telnets, and they seem > > to work as well as they have before. > > > > Thanks in advance, > > > > Dima Dorfman > > > > P.S. The libmp installed in /usr/lib has major number 3; the sharball > > below bumps it to 4. Is this actually necessary? > > Haven't really tested this, just to answer this question: the library > version bump will only be needed if you decide to install this as libgmp, > not libmp. In that case, all executables compiled earlier will contain > a reference to libgmp.so.3, and no reference to libcrypto. Thus, they > would fail with the (new) libgmp.so.3, so there needs to be a version bump. > > If this is installed as libmp, then you might as well start over again > with mp.1, and keep gmp.3 in a compat4x distribution or something. This makes sense assuming that we have no libmp right now. That assumption is false. Observe: dima@hornet% ll /usr/lib/libmp* -r--r--r-- 1 root wheel 82274 Jul 13 01:51 /usr/lib/libmp.a lrwxr-xr-x 1 root wheel 10 Jul 13 01:51 /usr/lib/libmp.so -> libmp.so.3 -r--r--r-- 1 root wheel 39948 Jul 13 01:51 /usr/lib/libmp.so.3 All programs that need a libmp interface are linked as "-lmp -lgmp". I'm guessing that /usr/lib/libmp.so that we have now is a libmp interface in terms of libgmp. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 3:16:24 2001 Delivered-To: freebsd-audit@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.39]) by hub.freebsd.org (Postfix) with SMTP id 8C55F37B403 for ; Fri, 20 Jul 2001 03:16:20 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 3427 invoked by uid 1000); 20 Jul 2001 10:20:26 -0000 Date: Fri, 20 Jul 2001 13:20:26 +0300 From: Peter Pentchev To: Dima Dorfman Cc: audit@freebsd.org Subject: Re: libmp implementation in terms of libcrypto Message-ID: <20010720132026.B510@ringworld.oblivion.bg> Mail-Followup-To: Dima Dorfman , audit@freebsd.org References: <20010720124441.A510@ringworld.oblivion.bg> <20010720100558.4233B3E2F@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010720100558.4233B3E2F@bazooka.unixfreak.org>; from dima@unixfreak.org on Fri, Jul 20, 2001 at 03:05:58AM -0700 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Jul 20, 2001 at 03:05:58AM -0700, Dima Dorfman wrote: > Peter Pentchev writes: > > On Fri, Jul 20, 2001 at 02:27:27AM -0700, Dima Dorfman wrote: > > > Attached is a sharball of a libmp implementation in terms of > > > libcrypto. This was discussed on -arch, and the consensus is that > > > although it'd be nice if the world used the BIGNUM API directly, it > > > can't hurt to be backwards compatible. > > > > > > I would appreciate it if somebody could review and/or test this. To > > > test it, just build it, install it, and link all programs that use it > > > using "-lmp -lcrypto". Once this is in the tree, the GPV'd libgmp > > > monster can be taken out and shot. I've tested all the in-tree > > > programs that use it except for the Kerberized telnets, and they seem > > > to work as well as they have before. > > > > > > Thanks in advance, > > > > > > Dima Dorfman > > > > > > P.S. The libmp installed in /usr/lib has major number 3; the sharball > > > below bumps it to 4. Is this actually necessary? > > > > Haven't really tested this, just to answer this question: the library > > version bump will only be needed if you decide to install this as libgmp, > > not libmp. In that case, all executables compiled earlier will contain > > a reference to libgmp.so.3, and no reference to libcrypto. Thus, they > > would fail with the (new) libgmp.so.3, so there needs to be a version bump. > > > > If this is installed as libmp, then you might as well start over again > > with mp.1, and keep gmp.3 in a compat4x distribution or something. > > This makes sense assuming that we have no libmp right now. That > assumption is false. Observe: > > dima@hornet% ll /usr/lib/libmp* > -r--r--r-- 1 root wheel 82274 Jul 13 01:51 /usr/lib/libmp.a > lrwxr-xr-x 1 root wheel 10 Jul 13 01:51 /usr/lib/libmp.so -> libmp.so.3 > -r--r--r-- 1 root wheel 39948 Jul 13 01:51 /usr/lib/libmp.so.3 > > All programs that need a libmp interface are linked as "-lmp -lgmp". > I'm guessing that /usr/lib/libmp.so that we have now is a libmp > interface in terms of libgmp. Erm. Of course. Don't know where I was looking; I *thought* I had checked that we had no libmp right now. In that case, yes, you need to bump the library version number, so precompiled binaries get the right one instead of getting unresolved references to libcrypto symbols. G'luck, Peter -- If wishes were fishes, the antecedent of this conditional would be true. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 11:51:56 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id AB26137B401 for ; Fri, 20 Jul 2001 11:51:46 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f6KIpj4138148; Fri, 20 Jul 2001 14:51:45 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: <3B5713AB.79322FDA@vangelderen.org> <20010719234413.A64433@heechee.tobez.org> <20010720001429.A65236@heechee.tobez.org> Date: Fri, 20 Jul 2001 14:51:38 -0400 To: freebsd-audit@freebsd.org From: Garance A Drosihn Subject: Better error-processing in lpd's dofork() rtn Cc: freebsd-print@bostonradio.org, Anton Berezin Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG From the "Re: initgroups unsolicited warning?" thread... On 7/19/01, Garance A Drosihn wrote to -stable: > >At 12:14 AM +0200, Anton Berezin wrote: >> Here OK means that the caller checks initgroups() return code >> and acts appropriately. NOK means that initgroups() is called >> without return code checking. > [...] >> usr.sbin/lpr/lpd/printjob.c NOK > >Somehow I "just knew" that something in lpr would end up on a >list of things with not-OK code... :-) > >I'll try to look at that (just the call in lpd) if you wish. Here is a patch which adds error-checking for initgroups, and some other system-calls in the area. When testing this error- recovery, I found out that some of the error-checking already in dofork() was dangerously wrong. So, by the time I was done here, I had basically rewritten dofork() -- not that there is all that much there to rewrite... This all works in my testing, but please eyeball it and let me know if I've missed anything. I hope to install this in -current soon, so it can sit there for a week and still get MFC'ed into stable well before any code freeze for 4.4-release. note: you may get errors trying to apply this patch, because my email client sometimes puts an extra blank as the first character of some lines... Index: lpd/printjob.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/lpr/lpd/printjob.c,v retrieving revision 1.40 diff -u -r1.40 printjob.c --- lpd/printjob.c 2001/07/15 00:09:46 1.40 +++ lpd/printjob.c 2001/07/20 18:35:56 @@ -77,8 +77,8 @@ #include "pathnames.h" #include "extern.h" -#define DORETURN 0 /* absorb fork error */ -#define DOABORT 1 /* abort if dofork fails */ +#define DORETURN 0 /* dofork should return "can't fork" error */ +#define DOABORT 1 /* dofork should just die if fork() fails */ /* * Error tokens @@ -106,6 +106,10 @@ static char title[80]; /* ``pr'' title */ static char locale[80]; /* ``pr'' locale */ +/* these two are set from pp->daemon_user, but only if they are needed */ +static char *daemon_uname; /* set from pwd->pw_name */ +static int daemon_defgid; + static char class[32]; /* classification field */ static char origin_host[MAXHOSTNAMELEN]; /* user's host machine */ /* indentation size in static characters */ @@ -1408,11 +1412,24 @@ static int dofork(const struct printer *pp, int action) { - register int i, forkpid; + int i, fail, forkpid; struct passwd *pwd; + forkpid = -1; + if (daemon_uname == NULL) { + pwd = getpwuid(pp->daemon_user); + if (pwd == NULL) { + syslog(LOG_ERR, "%s: Can't lookup default daemon uid (%ld) in password file", + pp->printer, pp->daemon_user); + goto error_ret; + } + daemon_uname = strdup(pwd->pw_name); + daemon_defgid = pwd->pw_gid; + } + for (i = 0; i < 20; i++) { - if ((forkpid = fork()) < 0) { + forkpid = fork(); + if (forkpid < 0) { sleep((unsigned)(i*i)); continue; } @@ -1420,25 +1437,49 @@ * Child should run as daemon instead of root */ if (forkpid == 0) { - if ((pwd = getpwuid(pp->daemon_user)) == NULL) { - syslog(LOG_ERR, "Can't lookup default daemon uid (%ld) in password file", - pp->daemon_user); + errno = 0; + fail = initgroups(daemon_uname, daemon_defgid); + if (fail) { + syslog(LOG_ERR, "%s: initgroups(%s,%u): %m", + pp->printer, daemon_uname, daemon_defgid); break; } - initgroups(pwd->pw_name, pwd->pw_gid); - setgid(pwd->pw_gid); - setuid(pp->daemon_user); + fail = setgid(daemon_defgid); + if (fail) { + syslog(LOG_ERR, "%s: setgid(%u): %m", + pp->printer, daemon_defgid); + break; + } + fail = setuid(pp->daemon_user); + if (fail) { + syslog(LOG_ERR, "%s: setuid(%ld): %m", + pp->printer, pp->daemon_user); + break; + } } - return(forkpid); + return forkpid; + } + + /* + * An error occurred. If the error is in the child process, then + * this routine must ALWAYS exit(). DORETURN only effects how + * errors should be handled in the parent process. + */ +error_ret: + if (forkpid == 0) { + syslog(LOG_ERR, "%s: dofork(): aborting child process...", + pp->printer); + exit(1); } - syslog(LOG_ERR, "can't fork"); + syslog(LOG_ERR, "%s: dofork(): failure in fork", pp->printer); + sleep(1); /* throttle errors, as a safety measure */ switch (action) { case DORETURN: - return (-1); + return -1; default: syslog(LOG_ERR, "bad action (%d) to dofork", action); - /*FALL THRU*/ + /* FALLTHROUGH */ case DOABORT: exit(1); } -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 16: 4:24 2001 Delivered-To: freebsd-audit@freebsd.org Received: from Veronica.wmol.com (veronica.wmol.com [208.242.83.241]) by hub.freebsd.org (Postfix) with ESMTP id CA02D37B401 for ; Fri, 20 Jul 2001 16:04:22 -0700 (PDT) (envelope-from david@phobia.ms) Received: from rain.hill.hom (081bc122.chartermi.net [24.247.81.122]) by Veronica.wmol.com (Vircom SMTPRS 4.6.189) with ESMTP id for ; Fri, 20 Jul 2001 19:02:29 -0400 Date: Fri, 20 Jul 2001 19:04:12 -0400 From: David Hill To: audit@freebsd.org Subject: STD*_FILENO changes Message-Id: <20010720190412.5b2a8317.david@phobia.ms> X-Mailer: Sylpheed version 0.5.1 (GTK+ 1.2.10; i386-unknown-freebsd5.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello - Well, I said I would be happy to do it. Let me just say I'm happy it's done. The diff's can be found at this url: http://www.phobia.ms/patches/diffs.tar.gz - David Hill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jul 20 17:58:40 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 1AC1F37B405 for ; Fri, 20 Jul 2001 17:58:38 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f6L0wY458532; Fri, 20 Jul 2001 20:58:34 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20010720190412.5b2a8317.david@phobia.ms> References: <20010720190412.5b2a8317.david@phobia.ms> Date: Fri, 20 Jul 2001 20:58:32 -0400 To: David Hill , audit@FreeBSD.ORG From: Garance A Drosihn Subject: Re: STD*_FILENO changes Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 7:04 PM -0400 7/20/01, David Hill wrote: >Hello - > Well, I said I would be happy to do it. Let me just say >I'm happy it's done. > > The diff's can be found at this url: > http://www.phobia.ms/patches/diffs.tar.gz Speaking only for the two lpr pieces, these look fine. I could apply the patches to lpd.c.diff and recvjob.c.diff if you want, or should we have a single committer come along and do all of them in a single commit? (seems to me it'd be better to do them separately) [I only looked at the lpr ones, I haven't tried to apply and compile them yet] -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jul 21 2:26:12 2001 Delivered-To: freebsd-audit@freebsd.org Received: from axl.seasidesoftware.co.za (axl.seasidesoftware.co.za [196.31.7.201]) by hub.freebsd.org (Postfix) with ESMTP id E18D637B406 for ; Sat, 21 Jul 2001 02:26:06 -0700 (PDT) (envelope-from sheldonh@starjuice.net) Received: from sheldonh (helo=axl.seasidesoftware.co.za) by axl.seasidesoftware.co.za with local-esmtp (Exim 3.31 #1) id 15Nt23-0009Yb-00; Sat, 21 Jul 2001 11:26:43 +0200 From: Sheldon Hearn To: David Hill Cc: audit@freebsd.org Subject: Re: STD*_FILENO changes In-reply-to: Your message of "Fri, 20 Jul 2001 19:04:12 -0400." <20010720190412.5b2a8317.david@phobia.ms> Date: Sat, 21 Jul 2001 11:26:43 +0200 Message-ID: <36740.995707603@axl.seasidesoftware.co.za> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 20 Jul 2001 19:04:12 -0400, David Hill wrote: > The diff's can be found at this url: > http://www.phobia.ms/patches/diffs.tar.gz Um, did you actually test your diffs? It looks like the following files don't include the required : /usr/src/usr.bin/tip/libacu/courier.c /usr/src/usr.sbin/pcvt/vttest/esc.c /usr/src/usr.bin/talk/io.c /usr/src/usr.sbin/pcvt/keycap/keycap.c /usr/src/usr.bin/make/compat.c /usr/src/usr.bin/make/hash.c /usr/src/usr.bin/make/job.c /usr/src/usr.bin/tip/libacu/multitech.c /usr/src/usr.sbin/pcvt/vttest/main.c /usr/src/usr.bin/tip/tip/remcap.c /usr/src/usr.bin/tip/libacu/t3000.c /usr/src/usr.bin/tip/tip/tipout.c /usr/src/usr.bin/window/ttoutput.c /usr/src/usr.bin/tip/libacu/unidialer.c /usr/src/usr.bin/vgrind/vgrindefs.c /usr/src/usr.bin/window/wwrint.c Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jul 21 9:12:26 2001 Delivered-To: freebsd-audit@freebsd.org Received: from assaris.sics.se (h122n4fls32o892.telia.com [213.64.47.122]) by hub.freebsd.org (Postfix) with ESMTP id 4D94437B403; Sat, 21 Jul 2001 09:12:22 -0700 (PDT) (envelope-from assar@assaris.sics.se) Received: (from assar@localhost) by assaris.sics.se (8.9.3/8.9.3) id SAA25213; Sat, 21 Jul 2001 18:12:35 +0200 (CEST) (envelope-from assar) To: grog@freebsd.org, audit@freebsd.org Subject: removing extra prototypes from vinum? From: Assar Westerlund Date: 21 Jul 2001 18:12:34 +0200 Message-ID: <5llmli6z2l.fsf@assaris.sics.se> Lines: 37 User-Agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) Emacs/20.6 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Any comments/thoughts/objections on these patches to vinum? /assar Index: vinumext.h =================================================================== RCS file: /home/ncvs/src/sys/dev/vinum/vinumext.h,v retrieving revision 1.29 diff -u -w -r1.29 vinumext.h --- vinumext.h 2001/05/23 05:26:40 1.29 +++ vinumext.h 2001/07/21 16:11:11 @@ -159,10 +159,7 @@ int vinum_rqinfo(caddr_t data); void LongJmp(jmp_buf, int); char *basename(char *); -#else -void longjmp(jmp_buf, int); /* the kernel doesn't define this */ #endif -int setjmp(jmp_buf); void expand_table(void **, int, int); Index: vinummemory.c =================================================================== RCS file: /home/ncvs/src/sys/dev/vinum/vinummemory.c,v retrieving revision 1.27 diff -u -w -r1.27 vinummemory.c --- vinummemory.c 2001/05/23 23:24:04 1.27 +++ vinummemory.c 2001/07/21 16:11:11 @@ -41,7 +41,6 @@ #ifdef VINUMDEBUG #undef longjmp /* this was defined as LongJmp */ -void longjmp(jmp_buf, int); /* the kernel doesn't define this */ #include extern struct rqinfo rqinfo[]; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jul 21 11:14:19 2001 Delivered-To: freebsd-audit@freebsd.org Received: from femail13.sdc1.sfba.home.com (femail13.sdc1.sfba.home.com [24.0.95.140]) by hub.freebsd.org (Postfix) with ESMTP id 167EA37B403 for ; Sat, 21 Jul 2001 11:14:17 -0700 (PDT) (envelope-from btdang@home.com) Received: from home.com ([24.248.85.196]) by femail13.sdc1.sfba.home.com (InterMail vM.4.01.03.20 201-229-121-120-20010223) with ESMTP id <20010721181416.GNOJ4169.femail13.sdc1.sfba.home.com@home.com> for ; Sat, 21 Jul 2001 11:14:16 -0700 Message-ID: <3B59C7D7.83957F27@home.com> Date: Sat, 21 Jul 2001 11:20:07 -0700 From: Bruce Dang Organization: Boys & Girls Clubs X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: audit@freebsd.org Subject: PF_INET or AF_INET Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG this is just a question, but how come some of the socket(2) calls use AF_INET as its first arg. like sd = socket(AF_INET, SOCK_STREAM, 0);. according to the man page, we should use PF_INET. But either way, they are basically the same macro and results to 2. Should change the socket(2) man page or change all AF_INET in socket calls to PF_INET... Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jul 21 13:52:43 2001 Delivered-To: freebsd-audit@freebsd.org Received: from assaris.sics.se (dhcp113.iss.kth.se [130.237.7.113]) by hub.freebsd.org (Postfix) with ESMTP id B677D37B405; Sat, 21 Jul 2001 13:52:40 -0700 (PDT) (envelope-from assar@assaris.sics.se) Received: (from assar@localhost) by assaris.sics.se (8.9.3/8.9.3) id WAA26211; Sat, 21 Jul 2001 22:52:58 +0200 (CEST) (envelope-from assar) To: des@freebsd.org, audit@freebsd.org Subject: subf_printf warnings in linprocfs.c:linprocfs_donetdev From: Assar Westerlund Date: 21 Jul 2001 22:52:58 +0200 Message-ID: <5lofqeknrp.fsf@assaris.sics.se> Lines: 22 User-Agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) Emacs/20.6 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This gets rid of warnings from gcc's printf. Comments? /assar Index: linprocfs.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linprocfs/linprocfs.c,v retrieving revision 1.33 diff -u -w -u -w -r1.33 linprocfs.c --- linprocfs.c 2001/07/05 17:10:41 1.33 +++ linprocfs.c 2001/07/21 20:51:38 @@ -663,8 +663,8 @@ sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0); + 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, + 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL); } return (0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message