Date: Mon, 6 Jan 2003 00:35:09 -0800 (PST) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 23264 for review Message-ID: <200301060835.h068Z9hX041591@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=23264 Change 23264 by peter@peter_overcee on 2003/01/06 00:34:13 IFC @23263 Affected files ... .. //depot/projects/ia64/contrib/lukemftpd/libnetbsd/strsuftoll.c#1 branch .. //depot/projects/ia64/lib/libc/stdio/printf.3#17 integrate .. //depot/projects/ia64/lib/libc/stdio/scanf.3#10 integrate .. //depot/projects/ia64/lib/libc/stdlib/strfmon.3#5 integrate .. //depot/projects/ia64/libexec/lukemftpd/Makefile#9 integrate .. //depot/projects/ia64/libexec/lukemftpd/nbsd2fbsd.h#1 branch .. //depot/projects/ia64/libexec/lukemftpd/util.h#1 branch .. //depot/projects/ia64/sbin/devd/devd.cc#3 integrate .. //depot/projects/ia64/sbin/devd/devd.conf.5#5 integrate .. //depot/projects/ia64/share/man/man4/Makefile#31 integrate .. //depot/projects/ia64/share/man/man4/ida.4#1 branch .. //depot/projects/ia64/share/man/man4/iir.4#1 branch .. //depot/projects/ia64/share/man/man5/Makefile#8 integrate .. //depot/projects/ia64/sys/cam/scsi/scsi_da.c#26 integrate .. //depot/projects/ia64/sys/conf/ldscript.i386#3 integrate .. //depot/projects/ia64/sys/dev/firewire/firewire.c#8 integrate .. //depot/projects/ia64/sys/dev/firewire/fwdev.c#3 integrate .. //depot/projects/ia64/sys/kern/subr_prof.c#6 integrate .. //depot/projects/ia64/sys/netinet6/ip6_fw.c#7 integrate .. //depot/projects/ia64/sys/powerpc/powerpc/atomic.S#1 branch .. //depot/projects/ia64/sys/powerpc/powerpc/locore.S#1 branch .. //depot/projects/ia64/sys/powerpc/powerpc/ofwmagic.S#1 branch .. //depot/projects/ia64/sys/powerpc/powerpc/swtch.S#1 branch .. //depot/projects/ia64/sys/sys/syslimits.h#5 integrate .. //depot/projects/ia64/usr.sbin/kernbb/Makefile#2 integrate .. //depot/projects/ia64/usr.sbin/kernbb/kernbb.8#4 integrate .. //depot/projects/ia64/usr.sbin/kernbb/kernbb.c#3 integrate .. //depot/projects/ia64/usr.sbin/pkg_install/add/extract.c#5 integrate .. //depot/projects/ia64/usr.sbin/pkg_install/lib/file.c#9 integrate .. //depot/projects/ia64/usr.sbin/pkg_install/lib/lib.h#7 integrate .. //depot/projects/ia64/usr.sbin/pkg_install/lib/plist.c#9 integrate Differences ... ==== //depot/projects/ia64/lib/libc/stdio/printf.3#17 (text+ko) ==== @@ -34,9 +34,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.54 2002/12/20 08:28:10 tjr Exp $ +.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.55 2003/01/06 06:19:19 tjr Exp $ .\" -.Dd December 20, 2002 +.Dd January 4, 2003 .Dt PRINTF 3 .Os .Sh NAME @@ -872,3 +872,9 @@ argument to .Vt double , providing no additional precision. +.Pp +The +.Nm +family of functions do not correctly handle multibyte characters in the +.Fa format +argument. ==== //depot/projects/ia64/lib/libc/stdio/scanf.3#10 (text+ko) ==== @@ -34,9 +34,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)scanf.3 8.2 (Berkeley) 12/11/93 -.\" $FreeBSD: src/lib/libc/stdio/scanf.3,v 1.22 2002/12/20 07:46:01 tjr Exp $ +.\" $FreeBSD: src/lib/libc/stdio/scanf.3,v 1.23 2003/01/06 06:19:19 tjr Exp $ .\" -.Dd December 20, 2002 +.Dd January 4, 2003 .Dt SCANF 3 .Os .Sh NAME @@ -530,3 +530,9 @@ and .Cm \&%A floating-point formats are not implemented. +.Pp +The +.Nm +family of functions do not correctly handle multibyte characters in the +.Fa format +argument. ==== //depot/projects/ia64/lib/libc/stdlib/strfmon.3#5 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/stdlib/strfmon.3,v 1.6 2002/11/29 15:57:49 ru Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/strfmon.3,v 1.7 2003/01/06 06:21:25 tjr Exp $ .\" .Dd October 12, 2002 .Dt STRFMON 3 @@ -159,3 +159,9 @@ This manual page was written by .An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org based on the standards' text. +.Sh BUGS +The +.Fn strfmon +function does not correctly handle multibyte characters in the +.Fa format +argument. ==== //depot/projects/ia64/libexec/lukemftpd/Makefile#9 (text+ko) ==== @@ -1,18 +1,21 @@ # @(#)Makefile 8.2 (Berkeley) 4/4/94 -# $FreeBSD: src/libexec/lukemftpd/Makefile,v 1.8 2002/11/12 07:41:59 obrien Exp $ +# $FreeBSD: src/libexec/lukemftpd/Makefile,v 1.9 2003/01/06 03:03:53 obrien Exp $ MAINTAINER= obrien LUKEMFTPD= ${.CURDIR}/../../contrib/lukemftpd -.PATH: ${LUKEMFTPD}/src +.PATH: ${LUKEMFTPD}/src ${LUKEMFTPD}/libnetbsd PROG= lukemftpd MAN= lukemftpd.8 ftpd.conf.5 ftpusers.5 MLINKS= ftpusers.5 ftpchroot.5 SRCS= cmds.c conf.c ftpd.c ftpcmd.y popen.c +SRCS+= strsuftoll.c WFORMAT= 0 +CFLAGS+= -include nbsd2fbsd.h CFLAGS+= -I${.CURDIR} -I${LUKEMFTPD} -I${LUKEMFTPD}/src +CFLAGS+= -I${.CURDIR}/../..//lib/libc/stdtime YFLAGS= LDADD= -lcrypt -lutil ==== //depot/projects/ia64/sbin/devd/devd.cc#3 (text+ko) ==== @@ -29,18 +29,13 @@ */ // TODO list: -// o rewrite the main loop: -// - find best match -// - execute it. -// o need to insert the event_proc structures in order of priority. -// bigger numbers mean higher priority. // o devd.conf and devd man pages need a lot of help: // - devd.conf needs to lose the warning about zone files. // - devd.conf needs more details on the supported statements. // - devd.conf needs an example or two. #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sbin/devd/devd.cc,v 1.2 2002/12/18 07:08:01 imp Exp $"); +__FBSDID("$FreeBSD: src/sbin/devd/devd.cc,v 1.3 2003/01/06 08:09:41 imp Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -56,6 +51,7 @@ #include <string.h> #include <unistd.h> +#include <algorithm> #include <map> #include <string> #include <vector> @@ -69,15 +65,28 @@ extern FILE *yyin; extern int lineno; +static const char nomatch = '?'; +static const char attach = '+'; +static const char detach = '-'; + int dflag; int romeo_must_die = 0; static void event_loop(void); static void usage(void); +template <class T> void +delete_and_clear(vector<T *> &v) +{ + typename vector<T *>::const_iterator i; + + for (i = v.begin(); i != v.end(); i++) + delete *i; + v.clear(); +} + class config; - class var_list { public: @@ -130,7 +139,7 @@ public: event_proc(); virtual ~event_proc(); - int get_priority() { return (_prio); } + int get_priority() const { return (_prio); } void set_priority(int prio) { _prio = prio; } void add(eps *); bool matches(config &); @@ -158,10 +167,15 @@ void set_variable(const char *var, const char *val); const string &get_variable(const string &var); const string expand_string(const string &var); + char *set_vars(char *); + void find_and_execute(char); protected: + void sort_vector(vector<event_proc *> &); void parse_one_file(const char *fn); void parse_files_in_dir(const char *dirname); void expand_one(const char *&src, char *&dst, char *eod); + bool is_id_char(char); + bool chop_var(char *&buffer, char *&lhs, char *&rhs); private: vector<string> _dir_list; string _pidfile; @@ -229,18 +243,21 @@ bool action::do_action(config &c) { - // xxx - ::system(c.expand_string(_cmd).c_str()); + string s = c.expand_string(_cmd); + if (dflag) + fprintf(stderr, "Executing '%s'\n", s.c_str()); + ::system(s.c_str()); return (true); } match::match(config &c, const char *var, const char *re) - : _var(var), _re(re) + : _var(var) { - string pattern = "^"; - pattern.append(c.expand_string(_re)); - pattern.append("$"); - regcomp(&_regex, pattern.c_str(), REG_EXTENDED | REG_NOSUB); + string pattern = re; + _re = "^"; + _re.append(c.expand_string(string(re))); + _re.append("$"); + regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB); } match::~match() @@ -254,6 +271,10 @@ string value = c.get_variable(_var); bool retval; + if (dflag) + fprintf(stderr, "Testing %s=%s against %s\n", _var.c_str(), + value.c_str(), _re.c_str()); + retval = (regexec(&_regex, value.c_str(), 0, NULL, 0) == 0); return retval; } @@ -268,7 +289,7 @@ i = _vars.find(var); if (i == _vars.end()) - return var_list::bogus; + return (var_list::bogus); return (i->second); } @@ -281,6 +302,8 @@ void var_list::set_variable(const string &var, const string &val) { + if (dflag) + fprintf(stderr, "%s=%s\n", var.c_str(), val.c_str()); _vars[var] = val; } @@ -288,8 +311,10 @@ config::reset(void) { _dir_list.clear(); - _var_list_table.clear(); - // XXX need to cleanup _{attach,detach,nomatch}_list + delete_and_clear(_var_list_table); + delete_and_clear(_attach_list); + delete_and_clear(_detach_list); + delete_and_clear(_nomatch_list); } void @@ -328,6 +353,20 @@ } } +class epv_greater { +public: + int operator()(event_proc *const&l1, event_proc *const&l2) + { + return (l1->get_priority() > l2->get_priority()); + } +}; + +void +config::sort_vector(vector<event_proc *> &v) +{ + sort(v.begin(), v.end(), epv_greater()); +} + void config::parse(void) { @@ -336,6 +375,9 @@ parse_one_file(CF); for (i = _dir_list.begin(); i != _dir_list.end(); i++) parse_files_in_dir((*i).c_str()); + sort_vector(_attach_list); + sort_vector(_detach_list); + sort_vector(_nomatch_list); } void @@ -392,6 +434,8 @@ vl = new var_list(); _var_list_table.push_back(vl); + if (dflag) + fprintf(stderr, "Pushing table\n"); } void @@ -399,6 +443,8 @@ { delete _var_list_table.back(); _var_list_table.pop_back(); + if (dflag) + fprintf(stderr, "Popping table\n"); } void @@ -414,14 +460,20 @@ for (i = _var_list_table.rbegin(); i != _var_list_table.rend(); i++) { if ((*i)->is_set(var)) - return (var); + return ((*i)->get_variable(var)); } return (var_list::nothing); } -// Hey script |<idz, here's a routine chock-full-o-buffer-overflows. +bool +config::is_id_char(char ch) +{ + return (ch != '\0' && (isalpha(ch) || isdigit(ch) || ch == '_' || + ch == '-')); +} + // XXX -// imp should learn how to make effective use of the string class for the shit. +// imp should learn how to make effective use of the string class. void config::expand_one(const char *&src, char *&dst, char *) { @@ -430,6 +482,7 @@ char buffer[1024]; string varstr; + src++; // $$ -> $ if (*src == '$') { *dst++ = *src++; @@ -437,7 +490,8 @@ } // $(foo) -> $(foo) - // Not sure if I want to support this or not, so for now we just pass it through. + // Not sure if I want to support this or not, so for now we just pass + // it through. if (*src == '(') { *dst++ = '$'; count = 1; @@ -460,7 +514,7 @@ // $var -> replace with value var = src++; - while (*src && isalpha(*src) || isdigit(*src) || *src == '_' || *src == '-') + while (is_id_char(*src)) src++; memcpy(buffer, var, src - var); buffer[src - var] = '\0'; @@ -480,7 +534,7 @@ dst = buffer; while (*src) { if (*src == '$') - expand_one(++src, dst, buffer + sizeof(buffer)); + expand_one(src, dst, buffer + sizeof(buffer)); else *dst++ = *src++; } @@ -489,31 +543,117 @@ return (buffer); } +bool +config::chop_var(char *&buffer, char *&lhs, char *&rhs) +{ + char *walker; + + if (*buffer == '\0') + return (false); + walker = lhs = buffer; + while (is_id_char(*walker)) + walker++; + if (*walker != '=') + return (false); + walker++; // skip = + if (*walker == '"') { + walker++; // skip " + rhs = walker; + while (*walker && *walker != '"') + walker++; + if (*walker != '"') + return (false); + rhs[-2] = '\0'; + *walker++ = '\0'; + } else { + rhs = walker; + while (*walker && !isspace(*walker)) + walker++; + if (*walker != '\0') + *walker++ = '\0'; + rhs[-1] = '\0'; + } + buffer = walker; + return (true); +} + + +char * +config::set_vars(char *buffer) +{ + char *lhs; + char *rhs; + + while (1) { + if (!chop_var(buffer, lhs, rhs)) + break; + set_variable(lhs, rhs); + } + return (buffer); +} + +void +config::find_and_execute(char type) +{ + vector<event_proc *> *l; + vector<event_proc *>::const_iterator i; + char *s; + + switch (type) { + default: + return; + case nomatch: + l = &_nomatch_list; + s = "nomatch"; + break; + case attach: + l = &_attach_list; + s = "attach"; + break; + case detach: + l = &_detach_list; + s = "detach"; + break; + } + if (dflag) + fprintf(stderr, "Processing %s event\n", s); + for (i = l->begin(); i != l->end(); i++) { + if ((*i)->matches(*this)) { + (*i)->run(*this); + break; + } + } + +} + static void -process_event(const char *buffer) +process_event(char *buffer) { char type; - char cmd[1024]; char *sp; - // XXX should involve config - // XXX and set some variables - // XXX run the list and so forth - - // Ignore unknown devices for now. - if (*buffer == '?') - return; + sp = buffer + 1; + if (dflag) + fprintf(stderr, "Processing event '%s'\n", buffer); type = *buffer++; - sp = strchr(buffer, ' '); - if (sp == NULL) - return; /* Can't happen? */ - *sp = '\0'; - snprintf(cmd, sizeof(cmd), "/etc/devd-generic %s %s", buffer, - type == '+' ? "start" : "stop"); - if (dflag) - printf("Trying '%s'\n", cmd); - system(cmd); + cfg.push_var_table(); + // No match doesn't have a device, and the format is a little + // different, so handle it separately. + if (type != nomatch) { + sp = strchr(sp, ' '); + if (sp == NULL) + return; /* Can't happen? */ + *sp++ = '\0'; + cfg.set_variable("device-name", buffer); + } + if (strncmp(sp, "at ", 3) == 0) + sp += 3; + sp = cfg.set_vars(sp); + if (strncmp(sp, "on ", 3) == 0) + cfg.set_variable("bus", sp + 3); + cfg.find_and_execute(type); + cfg.pop_var_table(); } static void ==== //depot/projects/ia64/sbin/devd/devd.conf.5#5 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/sbin/devd/devd.conf.5,v 1.5 2002/12/27 12:15:32 schweikh Exp $ +.\" $FreeBSD: src/sbin/devd/devd.conf.5,v 1.6 2003/01/06 08:03:00 imp Exp $ .\" .\" The section on comments was taken from named.conf.5, which has the .\" following copyright: @@ -46,7 +46,7 @@ .Sh NAME .Nm devd.conf .Nd configuration file for -.Xr devdd 8 +.Xr devd 8 .Sh OVERVIEW .Ss General Syntax A ==== //depot/projects/ia64/share/man/man4/Makefile#31 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 -# $FreeBSD: src/share/man/man4/Makefile,v 1.183 2003/01/05 04:47:46 obrien Exp $ +# $FreeBSD: src/share/man/man4/Makefile,v 1.184 2003/01/06 04:51:20 trhodes Exp $ MAN= aac.4 \ acpi.4 \ @@ -64,12 +64,14 @@ ichsmb.4 \ icmp.4 \ icmp6.4 \ + ida.4 \ ieee80211.4 \ ifmib.4 \ iic.4 \ iicbb.4 \ iicbus.4 \ iicsmb.4 \ + iir.4 \ inet.4 \ inet6.4 \ intpm.4 \ ==== //depot/projects/ia64/share/man/man5/Makefile#8 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/5/93 -# $FreeBSD: src/share/man/man5/Makefile,v 1.44 2002/12/29 21:31:45 trhodes Exp $ +# $FreeBSD: src/share/man/man5/Makefile,v 1.45 2003/01/06 05:18:42 trhodes Exp $ #MISSING: dump.5 plot.5 MAN= a.out.5 acct.5 core.5 devfs.5 device.hints.5 \ @@ -15,7 +15,8 @@ rc.conf.5 remote.5 resolver.5 \ services.5 shells.5 stab.5 sysctl.conf.5 utmp.5 -MLINKS= dir.5 dirent.5 +MLINKS= a.out.5 aout.5 +MLINKS=+dir.5 dirent.5 MLINKS+=fs.5 inode.5 MLINKS+=hosts.equiv.5 rhosts.5 MLINKS+=msdosfs.5 msdos.5 ==== //depot/projects/ia64/sys/cam/scsi/scsi_da.c#26 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.118 2002/12/18 21:47:52 njl Exp $ + * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.119 2003/01/06 08:28:15 peter Exp $ */ #ifdef _KERNEL ==== //depot/projects/ia64/sys/conf/ldscript.i386#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/conf/ldscript.i386,v 1.6 2002/10/11 19:38:04 obrien Exp $ */ +/* $FreeBSD: src/sys/conf/ldscript.i386,v 1.7 2003/01/06 07:37:15 phk Exp $ */ OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd") OUTPUT_ARCH(i386) ENTRY(btext) @@ -65,10 +65,14 @@ CONSTRUCTORS } .data1 : { *(.data1) } + _start_ctors = .; + PROVIDE (start_ctors = .); .ctors : { *(.ctors) } + _stop_ctors = .; + PROVIDE (stop_ctors = .); .dtors : { *(.dtors) ==== //depot/projects/ia64/sys/dev/firewire/firewire.c#8 (text+ko) ==== @@ -30,7 +30,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.15 2003/01/05 14:58:45 simokawa Exp $ + * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.16 2003/01/06 05:57:48 simokawa Exp $ * */ @@ -1696,7 +1696,7 @@ printf("\n"); } } - err = device_get_children(fc->dev, &devlistp, &devcnt); + err = device_get_children(fc->bdev, &devlistp, &devcnt); if( err != 0 ) return; for( i = 0 ; i < devcnt ; i++){ ==== //depot/projects/ia64/sys/dev/firewire/fwdev.c#3 (text+ko) ==== @@ -30,7 +30,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/firewire/fwdev.c,v 1.3 2003/01/04 16:03:50 simokawa Exp $ + * $FreeBSD: src/sys/dev/firewire/fwdev.c,v 1.4 2003/01/06 08:07:20 simokawa Exp $ * */ @@ -728,8 +728,8 @@ case FWASREQEUI: fwdev = fw_noderesolve(sc->fc, asyreq->req.dst.eui); if (fwdev == NULL) { - printf("%s:cannot find node\n", - device_get_nameunit(sc->fc->dev)); + device_printf(sc->fc->bdev, + "cannot find node\n"); err = EINVAL; goto error; } ==== //depot/projects/ia64/sys/kern/subr_prof.c#6 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 - * $FreeBSD: src/sys/kern/subr_prof.c,v 1.55 2002/10/01 13:15:11 phk Exp $ + * $FreeBSD: src/sys/kern/subr_prof.c,v 1.56 2003/01/06 07:40:49 phk Exp $ */ #include <sys/param.h> @@ -157,6 +157,7 @@ uintfptr_t tmp_addr; #endif + tcov_init(); /* * Round lowpc and highpc to multiples of the density we're using * so the rest of the scaling (here and in gprof) stays in ints. @@ -531,3 +532,49 @@ } stopprofclock(p); } + +#if defined(__i386__) && __GNUC__ >= 2 +/* + * Support for "--test-coverage --profile-arcs" in GCC. + * + * We need to call all the functions in the .ctor section, in order + * to get all the counter-arrays strung into a list. + * + * XXX: the .ctors call __bb_init_func which is located in over in + * XXX: i386/i386/support.s for historical reasons. There is probably + * XXX: no reason for that to be assembler anymore, but doing it right + * XXX: in MI C code requires one to reverse-engineer the type-selection + * XXX: inside GCC. Have fun. + * + * XXX: Worrisome perspective: Calling the .ctors may make C++ in the + * XXX: kernel feasible. Don't. + */ +typedef void (*ctor_t)(void); +extern ctor_t _start_ctors, _stop_ctors; + +static void +tcov_init(void *foo __unused) +{ + ctor_t *p, q; + + for (p = &_start_ctors; p < &_stop_ctors; p++) { + q = *p; + q(); + } +} + +SYSINIT(kmem, SI_SUB_KPROF, SI_ORDER_SECOND, tcov_init, NULL) + +/* + * GCC contains magic to recognize calls to for instance execve() and + * puts in calls to this function to preserve the profile counters. + * XXX: Put zinging punchline here. + */ +void __bb_fork_func(void); +void +__bb_fork_func(void) +{ +} + +#endif + ==== //depot/projects/ia64/sys/netinet6/ip6_fw.c#7 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/netinet6/ip6_fw.c,v 1.20 2002/12/19 22:58:26 bmilekic Exp $ */ +/* $FreeBSD: src/sys/netinet6/ip6_fw.c,v 1.21 2003/01/06 04:33:46 mike Exp $ */ /* $KAME: ip6_fw.c,v 1.21 2001/01/24 01:25:32 itojun Exp $ */ /* @@ -976,7 +976,7 @@ /* Check length */ if (m->m_len != sizeof(struct ip6_fw)) { dprintf(("%s len=%d, want %d\n", err_prefix, m->m_len, - sizeof(struct ip6_fw))); + (int)sizeof(struct ip6_fw))); return (NULL); } return(check_ip6fw_struct(mtod(m, struct ip6_fw *))); @@ -1193,7 +1193,7 @@ if (stage == IPV6_FW_DEL) { if (m->m_len != sizeof(struct ip6_fw)) { dprintf(("%s len=%d, want %d\n", err_prefix, m->m_len, - sizeof(struct ip6_fw))); + (int)sizeof(struct ip6_fw))); error = EINVAL; } else if (mtod(m, struct ip6_fw *)->fw_number == (u_short)-1) { dprintf(("%s can't delete rule 65535\n", err_prefix)); ==== //depot/projects/ia64/sys/sys/syslimits.h#5 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/sys/sys/syslimits.h,v 1.14 2002/11/29 23:49:27 mike Exp $ + * $FreeBSD: src/sys/sys/syslimits.h,v 1.15 2003/01/06 04:33:47 obrien Exp $ */ #ifndef _SYS_SYSLIMITS_H_ @@ -52,6 +52,7 @@ #define CHILD_MAX 40 /* max simultaneous processes */ #endif #define LINK_MAX 32767 /* max file link count */ +#define LOGIN_NAME_MAX 17 /* max login name length (incl. NUL) */ #define MAX_CANON 255 /* max bytes in term canon input line */ #define MAX_INPUT 255 /* max bytes in terminal input */ #define NAME_MAX 255 /* max bytes in a file name */ @@ -68,7 +69,6 @@ * assume conservative values or call sysconf() to get the current value. * * HOST_NAME_MAX - * LOGIN_NAME_MAX * * (We should do this for most of the values currently defined here, * but many programs are not prepared to deal with this yet.) ==== //depot/projects/ia64/usr.sbin/kernbb/Makefile#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/usr.sbin/kernbb/Makefile,v 1.8 2001/07/20 06:19:54 obrien Exp $ +# $FreeBSD: src/usr.sbin/kernbb/Makefile,v 1.9 2003/01/06 07:46:26 phk Exp $ PROG= kernbb MAN= kernbb.8 @@ -6,5 +6,6 @@ DPADD= ${LIBKVM} LDADD= -lkvm +WARNS?= 3 .include <bsd.prog.mk> ==== //depot/projects/ia64/usr.sbin/kernbb/kernbb.8#4 (text+ko) ==== @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/usr.sbin/kernbb/kernbb.8,v 1.16 2002/07/14 14:43:42 charnier Exp $ +.\" $FreeBSD: src/usr.sbin/kernbb/kernbb.8,v 1.17 2003/01/06 07:46:26 phk Exp $ .\" .Dd May 22, 1995 .Dt KERNBB 8 @@ -42,20 +42,28 @@ .Sh DESCRIPTION The .Nm -utility is used to dump the basic-block profiling buffers of the running -kernel. +utility is used to extract the basic-block profiling buffers of the running +kernel into the files needed for the +.Xr gcov 1 +tool. .Pp At least one source file in the running kernel must have been compiled with the -.Fl a -option. +.Fl --test-coverage +and +.Fl --profile-arcs +options. +.Pp +The output is stored in the filenames compiled into the kernel by +.Xr gcc 1 . +If the absolute pathname cannot be written to, the directory part +of the filename is discarded and the file stored in the current +directory under its basename. .Pp -The output format is -.Tn ASCII , -consisting of one line per record with the -following fields: filename, linenumber, procedure, address, count -of executions, length of the basic-block in bytes and the product of -the previous two fields. +The output files are named *.da, and the +.Xr gcov 1 +program will extract the counts and merge them with the source +file to show actual execution counts. .Sh FILES .Bl -tag -width /boot/kernel/kernel -compact .It Pa /boot/kernel/kernel @@ -65,9 +73,12 @@ .El .Sh SEE ALSO .Xr cc 1 +.Xr gcov 1 .Sh AUTHORS The .Nm utility was written by .An Poul-Henning Kamp , along with the kernel-support. +.Sh BUGS +There are far too much magic and internal knowledge from GCC in this. ==== //depot/projects/ia64/usr.sbin/kernbb/kernbb.c#3 (text+ko) ==== @@ -10,7 +10,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/usr.sbin/kernbb/kernbb.c,v 1.13 2002/08/18 17:57:08 bde Exp $"; + "$FreeBSD: src/usr.sbin/kernbb/kernbb.c,v 1.14 2003/01/06 07:46:26 phk Exp $"; #endif /* not lint */ #include <err.h> @@ -22,8 +22,6 @@ #include <string.h> #include <unistd.h> -#define MAXBB 32768 - struct bb { u_long zero_one; u_long filename; @@ -38,27 +36,20 @@ }; struct nlist namelist[] = { - { "bbhead" }, - { NULL } + { "bbhead", 0, 0, 0, 0 }, + { NULL, 0, 0, 0, 0 } }; -u_long lineno[MAXBB]; -u_long counts[MAXBB]; -u_long addr[MAXBB]; -u_long func[MAXBB]; -u_long file[MAXBB]; -char *fn[MAXBB]; -char *pn[MAXBB]; - kvm_t *kv; int -main() +main(int argc __unused, char **argv __unused) { - int i,j; + int i; u_long l1,l2,l4; struct bb bb; - char buf[128]; + char buf[BUFSIZ], *p; + FILE *f; kv = kvm_open(NULL,NULL,NULL,O_RDWR,"dnc"); if (!kv) @@ -73,68 +64,30 @@ l1 += sizeof l1; kvm_read(kv,l2,&bb,sizeof bb); l2 = bb.next; - if (!bb.ncounts) - continue; - if (bb.ncounts > MAXBB) - errx(1, "found %lu counts above limit of %u", - bb.ncounts, MAXBB); - kvm_read(kv,bb.lineno,lineno, bb.ncounts * sizeof lineno[0]); - kvm_read(kv,bb.counts,counts, bb.ncounts * sizeof counts[0]); - kvm_read(kv,bb.addr, addr, bb.ncounts * sizeof addr[0]); - kvm_read(kv,bb.file, file, bb.ncounts * sizeof file[0]); - kvm_read(kv,bb.func, func, bb.ncounts * sizeof func[0]); + kvm_read(kv, bb.filename, buf, sizeof(buf)); + p = buf; + f = fopen(p, "w"); + if (f != NULL) { + printf("Writing \"%s\"\n", p); + } else { + p = strrchr(buf, '/'); + if (p == NULL) + p = buf; + else + p++; + printf("Writing \"%s\" (spec \"%s\")\n", p, buf); + f = fopen(p, "w"); + } + if (f == NULL) + err(1,"%s", p); + fwrite(&bb.ncounts, 4, 1, f); l4 = 0; - for (i=0; i < bb.ncounts; i++) { - if (counts[i]) - l4++; - if (!func[i] && i+1 < bb.ncounts) - func[i] = func[i+1]; - } - if (!l4) - continue; - for (i=0; i < bb.ncounts; i++) { - - if (0 && !counts[i]) - continue; - - if (!pn[i] && func[i]) { - kvm_read(kv,func[i], buf, sizeof buf); - buf[sizeof buf -1] = 0; - pn[i] = strdup(buf); - for(j=i+1;j<bb.ncounts;j++) - if (func[j] == func[i]) { - pn[j] = pn[i]; - func[j] = 0; - } >>> TRUNCATED FOR MAIL (1000 lines) <<< To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301060835.h068Z9hX041591>