Re: svn commit: r217718 - in head/sys: conf dev/usb
On Saturday 22 January 2011 16:09:18 Gary Jennejohn wrote: On Sat, 22 Jan 2011 13:52:23 + (UTC) Hans Petter Selasky hsela...@freebsd.org wrote: Author: hselasky Date: Sat Jan 22 13:52:23 2011 New Revision: 217718 URL: http://svn.freebsd.org/changeset/base/217718 Log: Allow USB_HOST_ALIGN to be configured at compile time. This patch is necessary for MIPS based RouterStation Pro board and maybe other MIPS based boards as well. Submitted by: Milan Obuch Approved by: thompsa (mentor) Modified: head/sys/conf/options head/sys/dev/usb/usb_freebsd.h Modified: head/sys/conf/options = = --- head/sys/conf/options Sat Jan 22 13:18:28 2011 (r217717) +++ head/sys/conf/options Sat Jan 22 13:52:23 2011(r217718) @@ -642,6 +642,7 @@ BUS_DEBUG opt_bus.h # options for USB support USB_DEBUG opt_usb.h +USB_HOST_ALIGN opt_usb.h Sorry I didn't see this option sneaking in during r217631 :-) Anyway, two times is better than one time :-) USB_REQ_DEBUG opt_usb.h USB_VERBOSEopt_usb.h USB_EHCI_BIG_ENDIAN_DESC opt_usb.h Modified: head/sys/dev/usb/usb_freebsd.h = = --- head/sys/dev/usb/usb_freebsd.hSat Jan 22 13:18:28 2011(r217717) +++ head/sys/dev/usb/usb_freebsd.hSat Jan 22 13:52:23 2011(r217718) @@ -46,7 +46,12 @@ #defineUSB_TD_GET_PROC(td) (td)-td_proc #defineUSB_PROC_GET_GID(td) (td)-p_pgid +#if defined(USB_HOST_ALIGN) (USB_HOST_ALIGN != 0) +/* USB_HOST_ALIGN is already defined and valid */ Not necessarily valid. What if the user sets it to -24? The compiler will happily accept that with the above #if-statement. IMO you should test for USB_HOST_ALIGN 0, which should always work. Defensive programming is always a good idea. I agree. Does this look OK: #if defined(USB_HOST_ALIGN) (USB_HOST_ALIGN != 0) #if (-USB_HOST_ALIGN USB_HOST_ALIGN) == USB_HOST_ALIGN #error USB_HOST_ALIGN is not power of two. #endif #if (USB_HOST_ALIGN = 0) #error USB_HOST_ALIGN is less than or equal to zero. #endif ... +#else +#undef USB_HOST_ALIGN #defineUSB_HOST_ALIGN8 /* bytes, must be power of two */ +#endif #defineUSB_FS_ISOC_UFRAME_MAX 4/* exclusive unit */ #defineUSB_BUS_MAX 256 /* units */ #defineUSB_MAX_DEVICES 128 /* units */ --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217718 - in head/sys: conf dev/usb
On Sunday 23 January 2011 10:19:02 Hans Petter Selasky wrote: #if defined(USB_HOST_ALIGN) (USB_HOST_ALIGN != 0) #if (-USB_HOST_ALIGN USB_HOST_ALIGN) == USB_HOST_ALIGN should be != in this check. #error USB_HOST_ALIGN is not power of two. --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217743 - head/sys/compat/linux
Author: dchagin Date: Sun Jan 23 09:50:39 2011 New Revision: 217743 URL: http://svn.freebsd.org/changeset/base/217743 Log: Style(9) fix. Approved by: kib(mentor) MFC after:1 month Modified: head/sys/compat/linux/linux_signal.c Modified: head/sys/compat/linux/linux_signal.c == --- head/sys/compat/linux/linux_signal.cSun Jan 23 07:27:35 2011 (r217742) +++ head/sys/compat/linux/linux_signal.cSun Jan 23 09:50:39 2011 (r217743) @@ -526,7 +526,7 @@ linux_kill(struct thread *td, struct lin * Allow signal 0 as a means to check for privileges */ if (!LINUX_SIG_VALID(args-signum) args-signum != 0) - return EINVAL; + return (EINVAL); if (args-signum 0 args-signum = LINUX_SIGTBLSZ) tmp.signum = linux_to_bsd_signal[_SIG_IDX(args-signum)]; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217738 - head/tools/tools/ath/athstats
On Sat Jan 22 11, Adrian Chadd wrote: Author: adrian Date: Sat Jan 22 23:37:42 2011 New Revision: 217738 URL: http://svn.freebsd.org/changeset/base/217738 Log: Patch the athstats code/Makefile to cross-compile correctly. Modified: head/tools/tools/ath/athstats/Makefile head/tools/tools/ath/athstats/athstats.c Modified: head/tools/tools/ath/athstats/Makefile == --- head/tools/tools/ath/athstats/MakefileSat Jan 22 23:30:01 2011 (r217737) +++ head/tools/tools/ath/athstats/MakefileSat Jan 22 23:37:42 2011 (r217738) @@ -1,28 +1,26 @@ # $FreeBSD$ -PROG=athstats +.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal -SRCS=main.c statfoo.c athstats.c +PROG=athstats -.include bsd.prog.mk +SRCS=main.c statfoo.c athstats.c opt_ah.h ah_osdep.h -SRCDIR= ${.CURDIR}/../../../.. +CLEANFILES+= opt_ah.h -CLEANFILES+= opt_ah.h ah_osdep.h +.include ../Makefile.inc CFLAGS+=-DATH_SUPPORT_ANI CFLAGS+=-DATH_SUPPORT_TDMA -CFLAGS+=-I${.CURDIR} -CFLAGS+=-I${SRCDIR}/sys/net80211 - -.include ../Makefile.inc - -athstats.o: opt_ah.h ah_osdep.h - opt_ah.h: - touch opt_ah.h + echo #define AH_DEBUG 1 opt_ah.h + echo #define AH_DEBUG_COUNTRY 1 opt_ah.h + echo #define AH_SUPPORT_AR5416 1 opt_ah.h + ah_osdep.h: echo 'typedef void *HAL_SOFTC;' ah_osdep.h echo 'typedef int HAL_BUS_TAG;' ah_osdep.h echo 'typedef void *HAL_BUS_HANDLE;' ah_osdep.h + +.include bsd.prog.mk Modified: head/tools/tools/ath/athstats/athstats.c == --- head/tools/tools/ath/athstats/athstats.c Sat Jan 22 23:30:01 2011 (r217737) +++ head/tools/tools/ath/athstats/athstats.c Sat Jan 22 23:37:42 2011 (r217738) @@ -29,6 +29,8 @@ * $FreeBSD$ */ +#include opt_ah.h + /* * ath statistics class. */ -- a13x diff --git a/tools/tools/ath/athstats/main.c b/tools/tools/ath/athstats/main.c index 489c0bd..82dc561 100644 --- a/tools/tools/ath/athstats/main.c +++ b/tools/tools/ath/athstats/main.c @@ -114,7 +114,7 @@ main(int argc, char *argv[]) wf-zerostats(wf); break; default: - errx(-1, usage: %s [-a] [-i ifname] [-l] [-o fmt] [-z] [interval]\n, argv[0]); + errx(-1, usage: %s [-b] [-i ifname] [-l] [-o fmt] [-z] [interval]\n, argv[0]); /*NOTREACHED*/ } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217733 - in head: . share/man/man7
On Sat, 22 Jan 2011, Garrett Cooper wrote: On Sat, Jan 22, 2011 at 2:57 PM, Bjoern A. Zeeb b...@freebsd.org wrote: Author: bz Date: Sat Jan 22 22:57:28 2011 New Revision: 217733 URL: http://svn.freebsd.org/changeset/base/217733 Log: Properly document what the top-level `make tinderbox` does. Reviewed by: jmallett MFC After: 3 days X-MFC: build.7 only As much as I like make universe and tinderbox, for the purpose of development testing would it make sense if there was a tinderbox target that actually died on its first failure? tinderbox and universe I think not really; if you want to catch errors, you want all of them and not just the first broken kernel if there are 12. seems to be useful when dealing with known breakage or when executing periodic builds, but I don't know think it's as effective with development testing, as for some of the stuff I just want to build on something other than my host arch and another arch that isn't x86 (say arm, mips, powerpc) just to make sure that I didn't break anything endian wise (if the code is that nasty). make universe TARGETS=arm or make universe TARGETS=i386 amd64 sparc64 ia64 works perfectly well (again). Even make universe TARGETS=mips TARGET_ARCH=mips64eb KERNCONFS=XLR64 should be perfectly fine. /bz -- Bjoern A. Zeeb You have to have visions! ks Going to jail sucks -- bz All my daemons like it! http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217744 - head/lib/libkvm
Author: uqs Date: Sun Jan 23 11:08:28 2011 New Revision: 217744 URL: http://svn.freebsd.org/changeset/base/217744 Log: libkvm code janitoring - make WARNS=6 clean for archs w/o strict alignment requirments - add const, ANSIfy, remove unused vars, cast types for comparison - thanks to differing definitions of VM_MIN_ADDRESS across our archs, we need to trick the compiler to not complain about signedness. We could either fix VM_MIN_ADDRESS to always be a simple integer or make the check conditional on $ARCH. Closes PRs: kern/42386, kern/83364 Reviewed by: bde Modified: head/lib/libkvm/kvm.c head/lib/libkvm/kvm.h head/lib/libkvm/kvm_amd64.c head/lib/libkvm/kvm_arm.c head/lib/libkvm/kvm_cptime.c head/lib/libkvm/kvm_file.c head/lib/libkvm/kvm_getloadavg.c head/lib/libkvm/kvm_getswapinfo.c head/lib/libkvm/kvm_i386.c head/lib/libkvm/kvm_ia64.c head/lib/libkvm/kvm_minidump_amd64.c head/lib/libkvm/kvm_minidump_arm.c head/lib/libkvm/kvm_minidump_i386.c head/lib/libkvm/kvm_minidump_mips.c head/lib/libkvm/kvm_mips.c head/lib/libkvm/kvm_pcpu.c head/lib/libkvm/kvm_powerpc.c head/lib/libkvm/kvm_proc.c head/lib/libkvm/kvm_sparc64.c head/lib/libkvm/kvm_vnet.c Modified: head/lib/libkvm/kvm.c == --- head/lib/libkvm/kvm.c Sun Jan 23 09:50:39 2011(r217743) +++ head/lib/libkvm/kvm.c Sun Jan 23 11:08:28 2011(r217744) @@ -77,8 +77,7 @@ static char sccsid[] = @(#)kvm.c 8.2 (B int __fdnlist(int, struct nlist *); char * -kvm_geterr(kd) - kvm_t *kd; +kvm_geterr(kvm_t *kd) { return (kd-errbuf); } @@ -103,7 +102,7 @@ _kvm_err(kvm_t *kd, const char *program, (void)fputc('\n', stderr); } else (void)vsnprintf(kd-errbuf, - sizeof(kd-errbuf), (char *)fmt, ap); + sizeof(kd-errbuf), fmt, ap); va_end(ap); } @@ -122,7 +121,7 @@ _kvm_syserr(kvm_t *kd, const char *progr } else { char *cp = kd-errbuf; - (void)vsnprintf(cp, sizeof(kd-errbuf), (char *)fmt, ap); + (void)vsnprintf(cp, sizeof(kd-errbuf), fmt, ap); n = strlen(cp); (void)snprintf(cp[n], sizeof(kd-errbuf) - n, : %s, strerror(errno)); @@ -131,25 +130,18 @@ _kvm_syserr(kvm_t *kd, const char *progr } void * -_kvm_malloc(kd, n) - kvm_t *kd; - size_t n; +_kvm_malloc(kvm_t *kd, size_t n) { void *p; if ((p = calloc(n, sizeof(char))) == NULL) - _kvm_err(kd, kd-program, can't allocate %u bytes: %s, + _kvm_err(kd, kd-program, can't allocate %zu bytes: %s, n, strerror(errno)); return (p); } static kvm_t * -_kvm_open(kd, uf, mf, flag, errout) - kvm_t *kd; - const char *uf; - const char *mf; - int flag; - char *errout; +_kvm_open(kvm_t *kd, const char *uf, const char *mf, int flag, char *errout) { struct stat st; @@ -242,12 +234,8 @@ failed: } kvm_t * -kvm_openfiles(uf, mf, sf, flag, errout) - const char *uf; - const char *mf; - const char *sf __unused; - int flag; - char *errout; +kvm_openfiles(const char *uf, const char *mf, const char *sf __unused, int flag, +char *errout) { kvm_t *kd; @@ -260,12 +248,8 @@ kvm_openfiles(uf, mf, sf, flag, errout) } kvm_t * -kvm_open(uf, mf, sf, flag, errstr) - const char *uf; - const char *mf; - const char *sf __unused; - int flag; - const char *errstr; +kvm_open(const char *uf, const char *mf, const char *sf __unused, int flag, +const char *errstr) { kvm_t *kd; @@ -280,8 +264,7 @@ kvm_open(uf, mf, sf, flag, errstr) } int -kvm_close(kd) - kvm_t *kd; +kvm_close(kvm_t *kd) { int error = 0; @@ -316,8 +299,9 @@ kvm_fdnlist_prefix(kvm_t *kd, struct nli { struct nlist *n, *np, *p; char *cp, *ce; + const char *ccp; size_t len; - int unresolved; + int slen, unresolved; /* * Calculate the space we need to malloc for nlist and names. @@ -355,13 +339,13 @@ kvm_fdnlist_prefix(kvm_t *kd, struct nli continue; bcopy(p, np, sizeof(struct nlist)); /* Save the new\0orig. name so we can later match it again. */ - len = snprintf(cp, ce - cp, %s%s%c%s, prefix, + slen = snprintf(cp, ce - cp, %s%s%c%s, prefix, (prefix[0] != '\0' p-n_name[0] == '_') ? (p-n_name + 1) : p-n_name, '\0', p-n_name); - if (len = ce - cp) + if (slen 0 || slen = ce - cp) continue; np-n_name = cp; - cp += len + 1; + cp += slen + 1; np++; unresolved++;
svn commit: r217746 - head/usr.bin/top
Author: keramida (doc committer) Date: Sun Jan 23 11:08:39 2011 New Revision: 217746 URL: http://svn.freebsd.org/changeset/base/217746 Log: Touch up the sample memory usage numbers a bit, to avoid wrapping on terminal boundary. While here add definition for 'G' and fix the indentation of 'K' units. Submitted by: plunket PR: docs/153614 MFC after:3 days Modified: head/usr.bin/top/top.local.1 Modified: head/usr.bin/top/top.local.1 == --- head/usr.bin/top/top.local.1Sun Jan 23 11:08:36 2011 (r217745) +++ head/usr.bin/top/top.local.1Sun Jan 23 11:08:39 2011 (r217746) @@ -5,16 +5,19 @@ The '-H' option will toggle the display of kernel visible thread contexts. At runtime the 'H' key will toggle this mode. The default is OFF. -.SH DESCRIPTION OF MEMORY -Mem: 9220K Active, 1032K Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free +.SH DESCRIPTION OF MEMORY +Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out - +.TP .B K: Kilobyte .TP .B M: Megabyte .TP +.B G: +Gigabyte +.TP .B %: 1/100 .TP ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217745 - head/lib/libkvm
Author: uqs Date: Sun Jan 23 11:08:36 2011 New Revision: 217745 URL: http://svn.freebsd.org/changeset/base/217745 Log: libkvm: fix process runtime calculation on crashdumps Fix a long standing bug, where the procs ticks where assumed to be in us. Instead, read cpu_tick_frequency from the kernel and use the same logic to convert runtime. This is still too optimistic in that it assumes cpu_tick_frequency is available and fixed. Since this function is only called on crashdumps, I think we can live with that. Testing has shown the values to be correct for different kern.hz inside Virtualbox. Bump WARNS. Alignment issues on some archs mean this is still at 3. Reviewed by: bde Modified: head/lib/libkvm/Makefile head/lib/libkvm/kvm_proc.c Modified: head/lib/libkvm/Makefile == --- head/lib/libkvm/MakefileSun Jan 23 11:08:28 2011(r217744) +++ head/lib/libkvm/MakefileSun Jan 23 11:08:36 2011(r217745) @@ -15,7 +15,7 @@ KVM_ARCH=${MACHINE_ARCH} KVM_ARCH=${MACHINE_CPUARCH} .endif -WARNS?=0 +WARNS?=3 SRCS= kvm.c kvm_${KVM_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \ kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c Modified: head/lib/libkvm/kvm_proc.c == --- head/lib/libkvm/kvm_proc.c Sun Jan 23 11:08:28 2011(r217744) +++ head/lib/libkvm/kvm_proc.c Sun Jan 23 11:08:36 2011(r217745) @@ -88,6 +88,25 @@ __FBSDID($FreeBSD$); static int ticks; static int hz; +static uint64_t cpu_tick_frequency; + +/* + * From sys/kern/kern_tc.c. Depends on cpu_tick_frequency, which is + * read/initialized before this function is ever called. + */ +static uint64_t +cputick2usec(uint64_t tick) +{ + + if (cpu_tick_frequency == 0) + return (0); + if (tick 18446744073709551) /* floor(2^64 / 1000) */ + return (tick / (cpu_tick_frequency / 100)); + else if (tick 18446744073709) /* floor(2^64 / 100) */ + return ((tick * 1000) / (cpu_tick_frequency / 1000)); + else + return ((tick * 100) / cpu_tick_frequency); +} /* * Read proc's from memory file into buffer bp, which has space to hold @@ -113,7 +132,6 @@ kvm_proclist(kvm_t *kd, int what, int ar struct thread mtd; struct proc proc; struct proc pproc; - struct timeval tv; struct sysentvec sysent; char svname[KI_EMULNAMELEN]; @@ -367,15 +385,7 @@ nopgrp: kp-ki_lockname, LOCKNAMELEN); kp-ki_lockname[LOCKNAMELEN] = 0; } - /* -* XXX: This is plain wrong, rux_runtime has nothing -* to do with struct bintime, rux_runtime is just a 64-bit -* integer counter of cputicks. What we need here is a way -* to convert cputicks to usecs. The kernel does it in -* kern/kern_tc.c, but the function can't be just copied. -*/ - bintime2timeval(proc.p_rux.rux_runtime, tv); - kp-ki_runtime = (u_int64_t)tv.tv_sec * 100 + tv.tv_usec; + kp-ki_runtime = cputick2usec(proc.p_rux.rux_runtime); kp-ki_pid = proc.p_pid; kp-ki_siglist = proc.p_siglist; SIGSETOR(kp-ki_siglist, mtd.td_siglist); @@ -542,14 +552,15 @@ kvm_getprocs(kvm_t *kd, int op, int arg, liveout: nprocs = size == 0 ? 0 : size / kd-procbase-ki_structsize; } else { - struct nlist nl[6], *p; + struct nlist nl[7], *p; nl[0].n_name = _nprocs; nl[1].n_name = _allproc; nl[2].n_name = _zombproc; nl[3].n_name = _ticks; nl[4].n_name = _hz; - nl[5].n_name = 0; + nl[5].n_name = _cpu_tick_frequency; + nl[6].n_name = 0; if (kvm_nlist(kd, nl) != 0) { for (p = nl; p-n_type != 0; ++p) @@ -570,6 +581,11 @@ liveout: _kvm_err(kd, kd-program, can't read hz); return (0); } + if (KREAD(kd, nl[5].n_value, cpu_tick_frequency)) { + _kvm_err(kd, kd-program, + can't read cpu_tick_frequency); + return (0); + } size = nprocs * sizeof(struct kinfo_proc); kd-procbase = (struct kinfo_proc *)_kvm_malloc(kd, size); if (kd-procbase == 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217718 - in head/sys: conf dev/usb
On Sun, 23 Jan 2011 10:19:02 +0100 Hans Petter Selasky hsela...@freebsd.org wrote: On Saturday 22 January 2011 16:09:18 Gary Jennejohn wrote: On Sat, 22 Jan 2011 13:52:23 + (UTC) Hans Petter Selasky hsela...@freebsd.org wrote: Author: hselasky Date: Sat Jan 22 13:52:23 2011 New Revision: 217718 URL: http://svn.freebsd.org/changeset/base/217718 Log: Allow USB_HOST_ALIGN to be configured at compile time. This patch is necessary for MIPS based RouterStation Pro board and maybe other MIPS based boards as well. Submitted by: Milan Obuch Approved by:thompsa (mentor) Modified: head/sys/conf/options head/sys/dev/usb/usb_freebsd.h Modified: head/sys/conf/options = = --- head/sys/conf/options Sat Jan 22 13:18:28 2011 (r217717) +++ head/sys/conf/options Sat Jan 22 13:52:23 2011(r217718) @@ -642,6 +642,7 @@ BUS_DEBUG opt_bus.h # options for USB support USB_DEBUGopt_usb.h +USB_HOST_ALIGN opt_usb.h Sorry I didn't see this option sneaking in during r217631 :-) Anyway, two times is better than one time :-) USB_REQ_DEBUGopt_usb.h USB_VERBOSE opt_usb.h USB_EHCI_BIG_ENDIAN_DESC opt_usb.h Modified: head/sys/dev/usb/usb_freebsd.h = = --- head/sys/dev/usb/usb_freebsd.h Sat Jan 22 13:18:28 2011 (r217717) +++ head/sys/dev/usb/usb_freebsd.hSat Jan 22 13:52:23 2011 (r217718) @@ -46,7 +46,12 @@ #define USB_TD_GET_PROC(td) (td)-td_proc #define USB_PROC_GET_GID(td) (td)-p_pgid +#if defined(USB_HOST_ALIGN) (USB_HOST_ALIGN != 0) +/* USB_HOST_ALIGN is already defined and valid */ Not necessarily valid. What if the user sets it to -24? The compiler will happily accept that with the above #if-statement. IMO you should test for USB_HOST_ALIGN 0, which should always work. Defensive programming is always a good idea. I agree. Does this look OK: #if defined(USB_HOST_ALIGN) (USB_HOST_ALIGN != 0) #if (-USB_HOST_ALIGN USB_HOST_ALIGN) == USB_HOST_ALIGN #error USB_HOST_ALIGN is not power of two. #endif #if (USB_HOST_ALIGN = 0) #error USB_HOST_ALIGN is less than or equal to zero. #endif ... Looks OK to me. Rather convoluted, but the #else down below makes that necessary, I guess. +#else +#undef USB_HOST_ALIGN #define USB_HOST_ALIGN8 /* bytes, must be power of two */ +#endif #define USB_FS_ISOC_UFRAME_MAX 4/* exclusive unit */ #define USB_BUS_MAX 256 /* units */ #define USB_MAX_DEVICES 128 /* units */ -- Gary Jennejohn ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217747 - head/sys/sys
Author: kib Date: Sun Jan 23 12:44:17 2011 New Revision: 217747 URL: http://svn.freebsd.org/changeset/base/217747 Log: Fix typo. MFC after:3 days Modified: head/sys/sys/pioctl.h Modified: head/sys/sys/pioctl.h == --- head/sys/sys/pioctl.h Sun Jan 23 11:08:39 2011(r217746) +++ head/sys/sys/pioctl.h Sun Jan 23 12:44:17 2011(r217747) @@ -69,7 +69,7 @@ struct procfs_status { /* * If PF_LINGER is set in procp-p_pfsflags, then the last close - * of a /proc/pid/mem file will nto clear out the stops and continue + * of a /proc/pid/mem file will not clear out the stops and continue * the process. */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217748 - head/sys/netinet/cc
Author: lstewart Date: Sun Jan 23 13:00:25 2011 New Revision: 217748 URL: http://svn.freebsd.org/changeset/base/217748 Log: An sbuf configured with SBUF_AUTOEXTEND will call malloc with M_WAITOK when a write to the buffer causes it to overflow. We therefore can't hold the CC list rwlock over a call to sbuf_printf() for an sbuf configured with SBUF_AUTOEXTEND. Switch to a fixed length sbuf which should be of sufficient size except in the very unlikely event that the sysctl is being processed as one or more new algorithms are loaded. If that happens, we accept the race and may fail the sysctl gracefully if there is insufficient room to print the names of all the algorithms. This should address a WITNESS warning and the potential panic that would occur if the sbuf call to malloc did sleep whilst holding the CC list rwlock. Sponsored by: FreeBSD Foundation Reported by: Nick Hibma Reviewed by: bz MFC after:3 weeks X-MFC with: r215166 Modified: head/sys/netinet/cc/cc.c Modified: head/sys/netinet/cc/cc.c == --- head/sys/netinet/cc/cc.cSun Jan 23 12:44:17 2011(r217747) +++ head/sys/netinet/cc/cc.cSun Jan 23 13:00:25 2011(r217748) @@ -128,20 +128,37 @@ cc_list_available(SYSCTL_HANDLER_ARGS) { struct cc_algo *algo; struct sbuf *s; - int err, first; + int err, first, nalgos; - err = 0; + err = nalgos = 0; first = 1; - s = sbuf_new(NULL, NULL, TCP_CA_NAME_MAX, SBUF_AUTOEXTEND); + + CC_LIST_RLOCK(); + STAILQ_FOREACH(algo, cc_list, entries) { + nalgos++; + } + CC_LIST_RUNLOCK(); + + s = sbuf_new(NULL, NULL, nalgos * TCP_CA_NAME_MAX, SBUF_FIXEDLEN); if (s == NULL) return (ENOMEM); + /* +* It is theoretically possible for the CC list to have grown in size +* since the call to sbuf_new() and therefore for the sbuf to be too +* small. If this were to happen (incredibly unlikely), the sbuf will +* reach an overflow condition, sbuf_printf() will return an error and +* the sysctl will fail gracefully. +*/ CC_LIST_RLOCK(); STAILQ_FOREACH(algo, cc_list, entries) { err = sbuf_printf(s, first ? %s : , %s, algo-name); - if (err) + if (err) { + /* Sbuf overflow condition. */ + err = EOVERFLOW; break; + } first = 0; } CC_LIST_RUNLOCK(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217749 - head/gnu/usr.bin/gdb/kgdb
Author: emaste Date: Sun Jan 23 14:08:59 2011 New Revision: 217749 URL: http://svn.freebsd.org/changeset/base/217749 Log: Use string literal format strings to quiet clang warnings. Modified: head/gnu/usr.bin/gdb/kgdb/main.c Modified: head/gnu/usr.bin/gdb/kgdb/main.c == --- head/gnu/usr.bin/gdb/kgdb/main.cSun Jan 23 13:00:25 2011 (r217748) +++ head/gnu/usr.bin/gdb/kgdb/main.cSun Jan 23 14:08:59 2011 (r217749) @@ -129,7 +129,7 @@ kernel_from_dumpnr(int nr) snprintf(path, sizeof(path), %s/info.%d, crashdir, nr); info = fopen(path, r); if (info == NULL) { - warn(path); + warn(%s, path); return; } while (fgets(path, sizeof(path), info) != NULL) { @@ -408,7 +408,7 @@ main(int argc, char *argv[]) if (dumpnr = 0) { snprintf(path, sizeof(path), %s/vmcore.%d, crashdir, dumpnr); if (stat(path, st) == -1) - err(1, path); + err(1, %s, path); if (!S_ISREG(st.st_mode)) errx(1, %s: not a regular file, path); vmcore = strdup(path); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217750 - head/sbin/init
Author: jilles Date: Sun Jan 23 14:22:26 2011 New Revision: 217750 URL: http://svn.freebsd.org/changeset/base/217750 Log: init: Only run /etc/rc.shutdown if /etc/rc was run. It does not make sense to shut down daemons that were not started. In particular, this fixes loss of mixer settings when shutting down using shutdown(8), init(8) or ctrl+alt+del from single-user mode. If /etc/rc reboots, /etc/rc.shutdown is not run. Also fix segfaults and other erratic behaviour if init receives SIGHUP or SIGTSTP while in single-user mode. This commit does not attempt to fix any badness with signal handlers (assumption that pointers can be read and written atomically, EINTR race condition). I believe it does not make this badness any worse. Silence on: -arch@ Modified: head/sbin/init/init.c Modified: head/sbin/init/init.c == --- head/sbin/init/init.c Sun Jan 23 14:08:59 2011(r217749) +++ head/sbin/init/init.c Sun Jan 23 14:22:26 2011(r217750) @@ -122,6 +122,7 @@ static state_func_t multi_user(void); static state_func_t clean_ttys(void); static state_func_t catatonia(void); static state_func_t death(void); +static state_func_t death_single(void); static state_func_t run_script(const char *); @@ -136,6 +137,7 @@ int devfs; static void transition(state_t); static state_t requested_transition; +static state_t current_state = death_single; static void setctty(const char *); static const char *get_shell(void); @@ -559,8 +561,9 @@ static void transition(state_t s) { + current_state = s; for (;;) - s = (state_t) (*s)(); + current_state = (state_t) (*current_state)(); } /* @@ -796,7 +799,7 @@ runcom(void) * Returns 0 on success, otherwise the next transition to enter: * - single_user if fork/execv/waitpid failed, or if the script *terminated with a signal or exit code != 0. - * - death if a SIGTERM was delivered to init(8). + * - death_single if a SIGTERM was delivered to init(8). */ static state_func_t run_script(const char *script) @@ -852,8 +855,8 @@ run_script(const char *script) if ((wpid = waitpid(-1, status, WUNTRACED)) != -1) collect_child(wpid); if (wpid == -1) { - if (requested_transition == death) - return (state_func_t) death; + if (requested_transition == death_single) + return (state_func_t) death_single; if (errno == EINTR) continue; warning(wait for %s on %s failed: %m; going to @@ -1306,7 +1309,9 @@ transition_handler(int sig) switch (sig) { case SIGHUP: - requested_transition = clean_ttys; + if (current_state == read_ttys || current_state == multi_user || + current_state == clean_ttys || current_state == catatonia) + requested_transition = clean_ttys; break; case SIGUSR2: howto = RB_POWEROFF; @@ -1315,10 +1320,17 @@ transition_handler(int sig) case SIGINT: Reboot = TRUE; case SIGTERM: - requested_transition = death; + if (current_state == read_ttys || current_state == multi_user || + current_state == clean_ttys || current_state == catatonia) + requested_transition = death; + else + requested_transition = death_single; break; case SIGTSTP: - requested_transition = catatonia; + if (current_state == runcom || current_state == read_ttys || + current_state == clean_ttys || + current_state == multi_user || current_state == catatonia) + requested_transition = catatonia; break; default: requested_transition = 0; @@ -1494,9 +1506,6 @@ death(void) { struct utmpx utx; session_t *sp; - int i; - pid_t pid; - static const int death_sigs[2] = { SIGTERM, SIGKILL }; /* NB: should send a message to the session logger to avoid blocking. */ utx.ut_type = SHUTDOWN_TIME; @@ -1518,6 +1527,22 @@ death(void) /* Try to run the rc.shutdown script within a period of time */ runshutdown(); + return (state_func_t) death_single; +} + +/* + * Do what is necessary to reinitialize single user mode or reboot + * from an incomplete state. + */ +static state_func_t +death_single(void) +{ + int i; + pid_t pid; + static const int death_sigs[2] = { SIGTERM, SIGKILL }; + + revoke(_PATH_CONSOLE); + for (i = 0; i 2; ++i) { if (kill(-1, death_sigs[i]) == -1
svn commit: r217751 - head/sys/dev/ath/ath_hal/ar9002
Author: adrian Date: Sun Jan 23 14:30:35 2011 New Revision: 217751 URL: http://svn.freebsd.org/changeset/base/217751 Log: Update the AR9280v2 inivals to match what is in Linux ath9k. This repairs the behaviour of my AR9280 - both radio chains now seem to correctly be receiving. Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280v2.ini Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280v2.ini == --- head/sys/dev/ath/ath_hal/ar9002/ar9280v2.iniSun Jan 23 14:22:26 2011(r217750) +++ head/sys/dev/ath/ath_hal/ar9002/ar9280v2.iniSun Jan 23 14:30:35 2011(r217751) @@ -1,6 +1,5 @@ /* - * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting - * Copyright (c) 2002-2008 Atheros Communications, Inc. + * Copyright (c) 2010 Atheros Communications Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,7 +15,6 @@ * * $FreeBSD$ */ -/* Auto Generated PCI Register Writes. Created: 10/15/08 */ static const uint32_t ar9280Modes_v2[][6] = { /* Address 5G-HT20 5G-HT40 2G-HT40 2G-HT20 Turbo */ @@ -26,51 +24,50 @@ static const uint32_t ar9280Modes_v2[][6 { 0x10f0, 0x, 0x, 0x, 0x, 0x0008 }, { 0x8014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00, 0x06e006e0 }, { 0x801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b, 0x0988004f }, +{ 0x8120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810, 0x08f04810 }, +{ 0x81d0, 0x3210, 0x3210, 0x320a, 0x320a, 0x320a }, { 0x8318, 0x3e80, 0x7d00, 0x6880, 0x3440, 0x6880 }, { 0x9804, 0x0300, 0x03c4, 0x03c4, 0x0300, 0x0303 }, { 0x9820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, 0x02020200 }, -{ 0x9824, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e }, +{ 0x9824, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e }, { 0x9828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001 }, { 0x9834, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e }, { 0x9838, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007 }, { 0x9840, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e, 0x206a012e }, { 0x9844, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0, 0x037216a0 }, -{ 0x9850, 0x6c4000e2, 0x6c4000e2, 0x6d4000e2, 0x6c4000e2, 0x6c4000e2 }, +{ 0x9850, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2, 0x6c4000e2 }, { 0x9858, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e }, -{ 0x985c, 0x31395d5e, 0x31395d5e, 0x3139605e, 0x31395d5e, 0x31395d5e }, +{ 0x985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e, 0x31395d5e }, { 0x9860, 0x00048d18, 0x00048d18, 0x00048d20, 0x00048d20, 0x00048d18 }, { 0x9864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 }, { 0x9868, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0 }, { 0x986c, 0x06903081, 0x06903081, 0x06903881, 0x06903881, 0x06903881 }, { 0x9914, 0x07d0, 0x0fa0, 0x1130, 0x0898, 0x07d0 }, -{ 0x9918, 0x000a, 0x0014, 0x0016, 0x000b, 0x0016 }, +{ 0x9918, 0x000a, 0x0014, 0x0268, 0x000b, 0x0016 }, { 0x9924, 0xd00a8a0b, 0xd00a8a0b, 0xd00a8a0d, 0xd00a8a0d, 0xd00a8a0d }, { 0x9944, 0xffbc1010, 0xffbc1010, 0xffbc1010, 0xffbc1010, 0xffbc1010 }, { 0x9960, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010 }, { 0xa960, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010 }, { 0x9964, 0x0210, 0x0210, 0x0210, 0x0210, 0x0210 }, +{ 0xc968, 0x03b5, 0x03b5, 0x03ce, 0x03ce, 0x03ce }, { 0x99b8, 0x001c, 0x001c, 0x001c, 0x001c, 0x001c }, { 0x99bc, 0x0a00, 0x0a00, 0x0c00, 0x0c00, 0x0c00 }, { 0x99c0, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4 }, -{ 0x99c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77 }, -{ 0x99c8, 0x60f65329, 0x60f65329, 0x60f65329, 0x60f65329, 0x60f65329 }, -{ 0x99cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8 }, -{ 0x99d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384, 0x00046384 }, -{ 0x99d4, 0x, 0x, 0x, 0x, 0x }, -{ 0x99d8, 0x, 0x, 0x, 0x, 0x }, { 0xa204, 0x0444, 0x0444, 0x0444, 0x0444, 0x0444 }, { 0xa20c, 0x0014, 0x0014, 0x0001f019, 0x0001f019, 0x0001f019 }, { 0xb20c, 0x0014, 0x0014, 0x0001f019, 0x0001f019, 0x0001f019 }, { 0xa21c, 0x1883800a,
svn commit: r217752 - head/sys/dev/ath/ath_hal/ar5416
Author: adrian Date: Sun Jan 23 14:49:50 2011 New Revision: 217752 URL: http://svn.freebsd.org/changeset/base/217752 Log: Enable the 11n PHY by default whether or not 11n is configured. The linux ath9k driver and (from what I've been told) the atheros reference driver does this; it then leaves discarding 11n frames to the 802.11 layer. Whilst I'm here, merge in a fix from ath9k which maintains a turbo register setting when enabling the 11n register; and remove an un-needed (duplicate) flag setting. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c == --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun Jan 23 14:30:35 2011(r217751) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun Jan 23 14:49:50 2011(r217752) @@ -2138,22 +2138,28 @@ interpolate(uint16_t target, uint16_t sr return rv; } +/* + * The linux ath9k driver and (from what I've been told) the reference + * Atheros driver enables the 11n PHY by default whether or not it's + * configured. + */ static void ar5416Set11nRegs(struct ath_hal *ah, const struct ieee80211_channel *chan) { uint32_t phymode; + uint32_t enableDacFifo = 0; HAL_HT_MACMODE macmode; /* MAC - 20/40 mode */ - if (!IEEE80211_IS_CHAN_HT(chan)) - return; + if (AR_SREV_KITE_10_OR_LATER(ah)) + enableDacFifo = (OS_REG_READ(ah, AR_PHY_TURBO) AR_PHY_FC_ENABLE_DAC_FIFO); /* Enable 11n HT, 20 MHz */ phymode = AR_PHY_FC_HT_EN | AR_PHY_FC_SHORT_GI_40 - | AR_PHY_FC_SINGLE_HT_LTF1 | AR_PHY_FC_WALSH; + | AR_PHY_FC_SINGLE_HT_LTF1 | AR_PHY_FC_WALSH | enableDacFifo; /* Configure baseband for dynamic 20/40 operation */ if (IEEE80211_IS_CHAN_HT40(chan)) { - phymode |= AR_PHY_FC_DYN2040_EN | AR_PHY_FC_SHORT_GI_40; + phymode |= AR_PHY_FC_DYN2040_EN; /* Configure control (primary) channel at +-10MHz */ if (IEEE80211_IS_CHAN_HT40U(chan)) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217753 - head/sbin/init
Author: jilles Date: Sun Jan 23 14:54:45 2011 New Revision: 217753 URL: http://svn.freebsd.org/changeset/base/217753 Log: init(8): Document that login(1) is now responsible for recording logouts. init(8) only uses utmpx for recording reboots and shutdowns. Modified: head/sbin/init/init.8 Modified: head/sbin/init/init.8 == --- head/sbin/init/init.8 Sun Jan 23 14:49:50 2011(r217752) +++ head/sbin/init/init.8 Sun Jan 23 14:54:45 2011(r217753) @@ -31,7 +31,7 @@ .\ @(#)init.8 8.3 (Berkeley) 4/18/94 .\ $FreeBSD$ .\ -.Dd September 15, 2005 +.Dd January 23, 2011 .Dt INIT 8 .Os .Sh NAME @@ -146,11 +146,11 @@ executes a shell for that user. When this shell dies, either because the user logged out or an abnormal termination occurred (a signal), -the -.Nm -utility wakes up and records the logout in the the user accounting +.Nm login +records the logout in the the user accounting database (see -.Xr getutxent 3 ). +.Xr getutxent 3) +and terminates. The cycle is then restarted by .Nm ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217748 - head/sys/netinet/cc
For sbuf use for a sysctl you can use sbuf_init_for_sysctl() which will, instead of growing, push the current data out using SYSCTL_OUT to a wired user buffer. There's a few examples in the vm/ code. This can sometimes significantly simplify the code since there's no need to worry about held mutex/rwlock anymore. Thanks, matthew On Sun, Jan 23, 2011 at 5:00 AM, Lawrence Stewart lstew...@freebsd.org wrote: Author: lstewart Date: Sun Jan 23 13:00:25 2011 New Revision: 217748 URL: http://svn.freebsd.org/changeset/base/217748 Log: An sbuf configured with SBUF_AUTOEXTEND will call malloc with M_WAITOK when a write to the buffer causes it to overflow. We therefore can't hold the CC list rwlock over a call to sbuf_printf() for an sbuf configured with SBUF_AUTOEXTEND. Switch to a fixed length sbuf which should be of sufficient size except in the very unlikely event that the sysctl is being processed as one or more new algorithms are loaded. If that happens, we accept the race and may fail the sysctl gracefully if there is insufficient room to print the names of all the algorithms. This should address a WITNESS warning and the potential panic that would occur if the sbuf call to malloc did sleep whilst holding the CC list rwlock. Sponsored by: FreeBSD Foundation Reported by: Nick Hibma Reviewed by: bz MFC after: 3 weeks X-MFC with: r215166 Modified: head/sys/netinet/cc/cc.c Modified: head/sys/netinet/cc/cc.c == --- head/sys/netinet/cc/cc.c Sun Jan 23 12:44:17 2011 (r217747) +++ head/sys/netinet/cc/cc.c Sun Jan 23 13:00:25 2011 (r217748) @@ -128,20 +128,37 @@ cc_list_available(SYSCTL_HANDLER_ARGS) { struct cc_algo *algo; struct sbuf *s; - int err, first; + int err, first, nalgos; - err = 0; + err = nalgos = 0; first = 1; - s = sbuf_new(NULL, NULL, TCP_CA_NAME_MAX, SBUF_AUTOEXTEND); + + CC_LIST_RLOCK(); + STAILQ_FOREACH(algo, cc_list, entries) { + nalgos++; + } + CC_LIST_RUNLOCK(); + + s = sbuf_new(NULL, NULL, nalgos * TCP_CA_NAME_MAX, SBUF_FIXEDLEN); if (s == NULL) return (ENOMEM); + /* + * It is theoretically possible for the CC list to have grown in size + * since the call to sbuf_new() and therefore for the sbuf to be too + * small. If this were to happen (incredibly unlikely), the sbuf will + * reach an overflow condition, sbuf_printf() will return an error and + * the sysctl will fail gracefully. + */ CC_LIST_RLOCK(); STAILQ_FOREACH(algo, cc_list, entries) { err = sbuf_printf(s, first ? %s : , %s, algo-name); - if (err) + if (err) { + /* Sbuf overflow condition. */ + err = EOVERFLOW; break; + } first = 0; } CC_LIST_RUNLOCK(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217754 - head
Author: bz Date: Sun Jan 23 16:28:44 2011 New Revision: 217754 URL: http://svn.freebsd.org/changeset/base/217754 Log: For `make tinderbox` there is no need to print the extra commands. MFC after:5 days Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Sun Jan 23 14:54:45 2011(r217753) +++ head/Makefile Sun Jan 23 16:28:44 2011(r217754) @@ -275,7 +275,7 @@ make: .PHONY ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= tinderbox: - cd ${.CURDIR} \ + @cd ${.CURDIR} \ DOING_TINDERBOX=YES ${MAKE} JFLAG=${JFLAG} universe # @@ -317,7 +317,7 @@ universe_prologue: @echo make universe started on ${STARTTIME} @echo -- .if defined(DOING_TINDERBOX) - rm -f ${FAILFILE} + @rm -f ${FAILFILE} .endif .for target in ${TARGETS} universe: universe_${target} ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217755 - head/etc/periodic/daily
Author: jpaetzel Date: Sun Jan 23 17:13:29 2011 New Revision: 217755 URL: http://svn.freebsd.org/changeset/base/217755 Log: This script parses output of userland tools. In the case of a faulted zpool the output causes the script to bail out with syntax errors. Since a scrub of a faulted zpool is pointless, just skip over any pools marked as such. PR: conf/150228 Submitted by: jpaetzel Approved by: kib (mentor) MFC after:3 days MFC note: only for RELENG_8 Modified: head/etc/periodic/daily/800.scrub-zfs Modified: head/etc/periodic/daily/800.scrub-zfs == --- head/etc/periodic/daily/800.scrub-zfs Sun Jan 23 16:28:44 2011 (r217754) +++ head/etc/periodic/daily/800.scrub-zfs Sun Jan 23 17:13:29 2011 (r217755) @@ -24,13 +24,17 @@ case $daily_scrub_zfs_enable in for pool in ${daily_scrub_zfs_pools}; do # sanity check - zpool list ${pool} /dev/null 21 + _status=$(zpool list ${pool} | sed -n -e '$p') if [ $? -ne 0 ]; then echoWARNING: pool '${pool}' specified in echo '/etc/periodic.conf:daily_scrub_zfs_pools' echo does not exist continue fi + if echo ${_status} | grep -q FAULTED; then + echo Skipping faulted pool: ${pool} + continue + fi # successful only if there is at least one pool to scrub rc=0 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217756 - head/sys/powerpc/powermac
Author: nwhitehorn Date: Sun Jan 23 17:20:11 2011 New Revision: 217756 URL: http://svn.freebsd.org/changeset/base/217756 Log: Disable ATAPI DMA unconditionally on Apple Kauai ATA controllers, like it is on the MacIO ones. It appears to be unreliable on all DBDMA-based controllers for unknown reasons, which should be figured out eventually. Tested by:Torfinn Ingolfsen MFC after:1 week Modified: head/sys/powerpc/powermac/ata_kauai.c Modified: head/sys/powerpc/powermac/ata_kauai.c == --- head/sys/powerpc/powermac/ata_kauai.c Sun Jan 23 17:13:29 2011 (r217755) +++ head/sys/powerpc/powermac/ata_kauai.c Sun Jan 23 17:20:11 2011 (r217756) @@ -217,10 +217,8 @@ ata_kauai_probe(device_t dev) ch = sc-sc_ch.sc_ch; compatstring = ofw_bus_get_compat(dev); - if (compatstring != NULL strcmp(compatstring,shasta-ata) == 0) { - ch-flags |= ATA_NO_ATAPI_DMA; + if (compatstring != NULL strcmp(compatstring,shasta-ata) == 0) sc-shasta = 1; - } /* Pre-K2 controllers apparently need this hack */ if (!sc-shasta @@ -246,8 +244,11 @@ ata_kauai_probe(device_t dev) ch-r_io[ATA_CONTROL].offset = ATA_KAUAI_ALTOFFSET; ata_default_registers(dev); -ch-unit = 0; -ch-flags |= ATA_USE_16BIT; + ch-unit = 0; + ch-flags |= ATA_USE_16BIT; + + /* XXX: ATAPI DMA is unreliable. We should find out why. */ + ch-flags |= ATA_NO_ATAPI_DMA; ata_generic_hw(dev); return (ata_probe(dev)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217755 - head/etc/periodic/daily
On Sun, Jan 23, 2011 at 05:13:29PM +, Josh Paetzel wrote: Author: jpaetzel Date: Sun Jan 23 17:13:29 2011 New Revision: 217755 URL: http://svn.freebsd.org/changeset/base/217755 Log: This script parses output of userland tools. In the case of a faulted zpool the output causes the script to bail out with syntax errors. Since a scrub of a faulted zpool is pointless, just skip over any pools marked as such. PR: conf/150228 Submitted by: jpaetzel Approved by:kib (mentor) MFC after: 3 days MFC note: only for RELENG_8 Modified: head/etc/periodic/daily/800.scrub-zfs Modified: head/etc/periodic/daily/800.scrub-zfs == --- head/etc/periodic/daily/800.scrub-zfs Sun Jan 23 16:28:44 2011 (r217754) +++ head/etc/periodic/daily/800.scrub-zfs Sun Jan 23 17:13:29 2011 (r217755) @@ -24,13 +24,17 @@ case $daily_scrub_zfs_enable in for pool in ${daily_scrub_zfs_pools}; do # sanity check - zpool list ${pool} /dev/null 21 + _status=$(zpool list ${pool} | sed -n -e '$p') if [ $? -ne 0 ]; then echoWARNING: pool '${pool}' specified in echo '/etc/periodic.conf:daily_scrub_zfs_pools' echo does not exist continue fi The above 'if' block never executes anymore now, since $? is sed's exit status which is always 0. Consider _status=$(zpool list ${pool}) if [ $? -ne 0 ]; then ... fi _status=${_status##*$newline} With somewhere at the top of the script newline=' ' # one newline and no other whitespace Note that this changed code will give the last non-empty line, while your sed code gives the last line even if it is empty. I think it does not make a difference. + if echo ${_status} | grep -q FAULTED; then + echo Skipping faulted pool: ${pool} + continue + fi Faster and more resilient to special characters: case ${_status} in *FAULTED*) echo Skipping faulted pool: ${pool} continue ;; esac # successful only if there is at least one pool to scrub rc=0 -- Jilles Tjoelker ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217760 - in head/sys: conf netinet
Author: tuexen Date: Sun Jan 23 19:36:28 2011 New Revision: 217760 URL: http://svn.freebsd.org/changeset/base/217760 Log: Add stream scheduling support. This work is based on a patch received from Robin Seggelmann. MFC after: 3 months. Added: head/sys/netinet/sctp_ss_functions.c (contents, props changed) Modified: head/sys/conf/files head/sys/netinet/sctp.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/conf/files == --- head/sys/conf/files Sun Jan 23 18:43:16 2011(r217759) +++ head/sys/conf/files Sun Jan 23 19:36:28 2011(r217760) @@ -2638,6 +2638,7 @@ netinet/sctp_input.c optional inet sctp netinet/sctp_output.c optional inet sctp netinet/sctp_pcb.c optional inet sctp netinet/sctp_peeloff.c optional inet sctp +netinet/sctp_ss_functions.coptional inet sctp netinet/sctp_sysctl.c optional inet sctp netinet/sctp_timer.c optional inet sctp netinet/sctp_usrreq.c optional inet sctp Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Sun Jan 23 18:43:16 2011(r217759) +++ head/sys/netinet/sctp.h Sun Jan 23 19:36:28 2011(r217760) @@ -158,6 +158,9 @@ struct sctp_paramhdr { #define SCTP_CMT_USE_DAC0x1201 /* JRS - Pluggable Congestion Control Socket option */ #define SCTP_PLUGGABLE_CC 0x1202 +/* RS - Pluggable Stream Scheduling Socket option */ +#define SCTP_PLUGGABLE_SS 0x1203 +#define SCTP_SS_VALUE 0x1204 /* read only */ #define SCTP_GET_SNDBUF_USE0x1101 @@ -253,6 +256,22 @@ struct sctp_paramhdr { /* HTCP Congestion Control */ #define SCTP_CC_HTCP 0x0002 +/* RS - Supported stream scheduling modules for pluggable + * stream scheduling + */ +/* Default simple round-robin */ +#define SCTP_SS_DEFAULT0x +/* Real round-robin */ +#define SCTP_SS_ROUND_ROBIN0x0001 +/* Real round-robin per packet */ +#define SCTP_SS_ROUND_ROBIN_PACKET 0x0002 +/* Priority */ +#define SCTP_SS_PRIORITY 0x0003 +/* Fair Bandwidth */ +#define SCTP_SS_FAIR_BANDWITH 0x0004 +/* First-come, first-serve */ +#define SCTP_SS_FIRST_COME 0x0005 + /* fragment interleave constants * setting must be one of these or Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Jan 23 18:43:16 2011 (r217759) +++ head/sys/netinet/sctp_input.c Sun Jan 23 19:36:28 2011 (r217760) @@ -193,8 +193,8 @@ int sctp_is_there_unsent_data(struct sctp_tcb *stcb) { int unsent_data = 0; - struct sctp_stream_queue_pending *sp, *nsp; - struct sctp_stream_out *strq; + unsigned int i; + struct sctp_stream_queue_pending *sp; struct sctp_association *asoc; /* @@ -205,9 +205,14 @@ sctp_is_there_unsent_data(struct sctp_tc */ asoc = stcb-asoc; SCTP_TCB_SEND_LOCK(stcb); - TAILQ_FOREACH(strq, asoc-out_wheel, next_spoke) { - /* sa_ignore FREED_MEMORY */ - TAILQ_FOREACH_SAFE(sp, strq-outqueue, next, nsp) { + if (!stcb-asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) { + /* Check to see if some data queued */ + for (i = 0; i stcb-asoc.streamoutcnt; i++) { + /* sa_ignore FREED_MEMORY */ + sp = TAILQ_FIRST(stcb-asoc.strmout[i].outqueue); + if (sp == NULL) { + continue; + } if ((sp-msg_is_complete) (sp-length == 0) (sp-sender_all_done)) { @@ -224,8 +229,8 @@ sctp_is_there_unsent_data(struct sctp_tc sp-msg_is_complete, sp-put_last_out); } - atomic_subtract_int(asoc-stream_queue_cnt, 1); - TAILQ_REMOVE(strq-outqueue, sp, next); + atomic_subtract_int(stcb-asoc.stream_queue_cnt, 1); + TAILQ_REMOVE(stcb-asoc.strmout[i].outqueue, sp, next); if (sp-net) {
svn commit: r217766 - head/sys/dev/re
Author: yongari Date: Mon Jan 24 00:01:06 2011 New Revision: 217766 URL: http://svn.freebsd.org/changeset/base/217766 Log: Apply TX interrupt moderation to all RTL810xE PCIe Fast Ethernet controllers. Experimentation with RTL8102E, RTL8103E and RTL8105E showed dramatic decrement of TX completion interrupts under high TX load(e.g. from 147k interrupts/second to 10k interrupts/second) With this change, TX interrupt moderation is applied to all controllers except RTL8139C+. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Sun Jan 23 23:17:37 2011(r217765) +++ head/sys/dev/re/if_re.c Mon Jan 24 00:01:06 2011(r217766) @@ -2943,20 +2943,8 @@ re_init_locked(struct rl_softc *sc) /* Configure interrupt moderation. */ if (sc-rl_type == RL_8169) { - switch (sc-rl_hwrev-rl_rev) { - case RL_HWREV_8100E: - case RL_HWREV_8101E: - case RL_HWREV_8102E: - case RL_HWREV_8102EL: - case RL_HWREV_8102EL_SPIN1: - case RL_HWREV_8103E: - CSR_WRITE_2(sc, RL_INTRMOD, 0); - break; - default: - /* Magic from vendor. */ - CSR_WRITE_2(sc, RL_INTRMOD, 0x5100); - break; - } + /* Magic from vendor. */ + CSR_WRITE_2(sc, RL_INTRMOD, 0x5100); } #ifdef DEVICE_POLLING ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217746 - head/usr.bin/top
On 23 January 2011 14:08, Giorgos Keramidas keram...@freebsd.org wrote: Author: keramida (doc committer) Date: Sun Jan 23 11:08:39 2011 New Revision: 217746 URL: http://svn.freebsd.org/changeset/base/217746 Log: Touch up the sample memory usage numbers a bit, to avoid wrapping on terminal boundary. While here add definition for 'G' and fix the indentation of 'K' units. Thanks! (d'oh, I completely forgot about it) -- wbr, pluknet ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217746 - head/usr.bin/top
On Sun, Jan 23, 2011 at 6:44 PM, Sergey Kandaurov pluk...@freebsd.org wrote: On 23 January 2011 14:08, Giorgos Keramidas keram...@freebsd.org wrote: Author: keramida (doc committer) Date: Sun Jan 23 11:08:39 2011 New Revision: 217746 URL: http://svn.freebsd.org/changeset/base/217746 Log: Touch up the sample memory usage numbers a bit, to avoid wrapping on terminal boundary. While here add definition for 'G' and fix the indentation of 'K' units. Thanks! (d'oh, I completely forgot about it) *sigh*.. K is not a unit modifier, it's a temperature unit, i.e. K - Kelvin, not K - kilo- :(... This needs to be fixed upstream too to be SI compliant. Thanks, -Garrett ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217767 - head/usr.sbin/freebsd-update
Author: gordon Date: Mon Jan 24 04:32:59 2011 New Revision: 217767 URL: http://svn.freebsd.org/changeset/base/217767 Log: Honor $PAGER instead of always calling more. Approved by: colin@ MFC after:1 week Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh == --- head/usr.sbin/freebsd-update/freebsd-update.sh Mon Jan 24 00:01:06 2011(r217766) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Mon Jan 24 04:32:59 2011(r217767) @@ -1875,7 +1875,7 @@ fetch_create_manifest () { echo -n been downloaded because the files have been echo modified locally: cat modifiedfiles - fi | more + fi | $PAGER rm modifiedfiles # If no files will be updated, tell the user and exit @@ -1905,7 +1905,7 @@ fetch_create_manifest () { echo -n The following files will be removed echo as part of updating to ${RELNUM}-p${RELPATCHNUM}: cat files.removed - fi | more + fi | $PAGER rm files.removed # Report added files, if any @@ -1914,7 +1914,7 @@ fetch_create_manifest () { echo -n The following files will be added echo as part of updating to ${RELNUM}-p${RELPATCHNUM}: cat files.added - fi | more + fi | $PAGER rm files.added # Report updated files, if any @@ -1924,7 +1924,7 @@ fetch_create_manifest () { echo as part of updating to ${RELNUM}-p${RELPATCHNUM}: cat files.updated - fi | more + fi | $PAGER rm files.updated # Create a directory for the install manifest. @@ -3202,6 +3202,11 @@ cmd_IDS () { # Make sure we find utilities from the base system export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${PATH} +# Set a pager if the user doesn't +if [ -z $PAGER ]; then + PAGER=/usr/bin/more +fi + # Set LC_ALL in order to avoid problems with character ranges like [A-Z]. export LC_ALL=C ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217769 - in head: sbin/dump sbin/fsck_ffs sbin/fsdb sbin/fsirand sbin/newfs usr.sbin/makefs usr.sbin/quot
Author: mckusick Date: Mon Jan 24 06:17:05 2011 New Revision: 217769 URL: http://svn.freebsd.org/changeset/base/217769 Log: The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilities include sys/time.h instead of time.h. This include is incorrect as per the manpages for the APIs and the POSIX definitions. This commit replaces sys/time.h where necessary with time.h. The commit also includes some minor style(9) header fixup in newfs. This commit is part of a larger effort by Garrett Cooper started in //depot/user/gcooper/posix-conformance-work/ -- to make FreeBSD more POSIX compliant. Submitted by: Garrett Cooper yanegomi at gmail dot com Modified: head/sbin/dump/itime.c head/sbin/dump/main.c head/sbin/dump/optr.c head/sbin/dump/tape.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/suj.c head/sbin/fsdb/fsdb.c head/sbin/fsirand/fsirand.c head/sbin/newfs/mkfs.c head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/makefs.c head/usr.sbin/quot/quot.c Modified: head/sbin/dump/itime.c == --- head/sbin/dump/itime.c Mon Jan 24 06:03:58 2011(r217768) +++ head/sbin/dump/itime.c Mon Jan 24 06:17:05 2011(r217769) @@ -37,7 +37,6 @@ static const char rcsid[] = #include sys/param.h #include sys/queue.h -#include sys/time.h #include ufs/ufs/dinode.h @@ -49,6 +48,7 @@ static const char rcsid[] = #include stdio.h #include stdlib.h #include string.h +#include time.h #include timeconv.h #include dump.h Modified: head/sbin/dump/main.c == --- head/sbin/dump/main.c Mon Jan 24 06:03:58 2011(r217768) +++ head/sbin/dump/main.c Mon Jan 24 06:17:05 2011(r217769) @@ -43,7 +43,6 @@ static const char rcsid[] = #include sys/param.h #include sys/stat.h -#include sys/time.h #include sys/mount.h #include sys/disklabel.h @@ -64,6 +63,7 @@ static const char rcsid[] = #include stdio.h #include stdlib.h #include string.h +#include time.h #include timeconv.h #include unistd.h Modified: head/sbin/dump/optr.c == --- head/sbin/dump/optr.c Mon Jan 24 06:03:58 2011(r217768) +++ head/sbin/dump/optr.c Mon Jan 24 06:17:05 2011(r217769) @@ -38,7 +38,6 @@ static const char rcsid[] = #include sys/param.h #include sys/queue.h #include sys/wait.h -#include sys/time.h #include ufs/ufs/dinode.h @@ -51,6 +50,7 @@ static const char rcsid[] = #include string.h #include stdarg.h #include signal.h +#include time.h #include unistd.h #include dump.h Modified: head/sbin/dump/tape.c == --- head/sbin/dump/tape.c Mon Jan 24 06:03:58 2011(r217768) +++ head/sbin/dump/tape.c Mon Jan 24 06:17:05 2011(r217769) @@ -37,7 +37,6 @@ static const char rcsid[] = #include sys/param.h #include sys/socket.h -#include sys/time.h #include sys/wait.h #include sys/stat.h @@ -54,6 +53,7 @@ static const char rcsid[] = #include stdio.h #include stdlib.h #include string.h +#include time.h #include unistd.h #include dump.h Modified: head/sbin/fsck_ffs/inode.c == --- head/sbin/fsck_ffs/inode.c Mon Jan 24 06:03:58 2011(r217768) +++ head/sbin/fsck_ffs/inode.c Mon Jan 24 06:17:05 2011(r217769) @@ -37,7 +37,6 @@ __FBSDID($FreeBSD$); #include sys/param.h #include sys/stdint.h -#include sys/time.h #include sys/sysctl.h #include ufs/ufs/dinode.h @@ -47,6 +46,7 @@ __FBSDID($FreeBSD$); #include err.h #include pwd.h #include string.h +#include time.h #include fsck.h Modified: head/sbin/fsck_ffs/main.c == --- head/sbin/fsck_ffs/main.c Mon Jan 24 06:03:58 2011(r217768) +++ head/sbin/fsck_ffs/main.c Mon Jan 24 06:17:05 2011(r217769) @@ -42,11 +42,10 @@ static char sccsid[] = @(#)main.c 8.6 ( __FBSDID($FreeBSD$); #include sys/param.h -#include sys/stat.h #include sys/file.h -#include sys/time.h #include sys/mount.h #include sys/resource.h +#include sys/stat.h #include sys/sysctl.h #include sys/uio.h #include sys/disklabel.h @@ -62,6 +61,7 @@ __FBSDID($FreeBSD$); #include paths.h #include stdint.h #include string.h +#include time.h #include fsck.h Modified: head/sbin/fsck_ffs/suj.c == --- head/sbin/fsck_ffs/suj.cMon Jan 24 06:03:58 2011(r217768) +++ head/sbin/fsck_ffs/suj.cMon Jan 24 06:17:05 2011(r217769) @@ -37,6 +37,8 @@ __FBSDID($FreeBSD$); #include ufs/ufs/dir.h #include ufs/ffs/fs.h +#include assert.h +#include err.h
Re: svn commit: r217734 - head
On 01/22/2011 16:10, Bjoern A. Zeeb wrote: Author: bz Date: Sat Jan 22 23:10:58 2011 New Revision: 217734 URL: http://svn.freebsd.org/changeset/base/217734 Log: In `make targets` print the make variable TARGETS as we expect it rather than the grammatically better sounding variant without the 'S'. This allows copy and paste and is less confusing. Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Sat Jan 22 22:57:28 2011(r217733) +++ head/Makefile Sat Jan 22 23:10:58 2011(r217734) @@ -297,7 +297,7 @@ TARGET_ARCHES_${target}?= ${target} .endfor targets: - @echo Supported TARGET/TARGET_ARCH pairs + @echo Supported TARGETS/TARGET_ARCH pairs .for target in ${TARGETS} .for target_arch in ${TARGET_ARCHES_${target}} @echo ${target}/${target_arch} this change is wrong. You set TARGET, not TARGETS. Please revert it. Warner ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r217714 - head/sbin/fdisk
Maxim, In case it wasn't clear from Bruce's long explaination, parts of this are technically wrong and need to be reverted or fixed. Warner On 01/22/2011 00:47, Bruce Evans wrote: On Sat, 22 Jan 2011, Maxim Sobolev wrote: Log: Warn user when value entered is greated than the amount supported by the MBR for the given parameter and set that parameter to the maximum value instead of just truncating the most significant part silently. Could happen for example if the capacity of the device is more than 2TB, so that the number of sectors is greater than 2Mib. MFC after:1 month This improves some things, but has a high density of style bugs (many lines expanded beyond 80 columns...), and 2 errors in the limits. What's this 2Mib limit? ibits are strange units for sector counts. The limit should be 4G, but there is probably lots of brokenness starting at 2G. fdisk is quite broken at 2G, since it uses ints too much. Modified: head/sbin/fdisk/fdisk.c == --- head/sbin/fdisk/fdisk.cSat Jan 22 01:48:12 2011(r217713) +++ head/sbin/fdisk/fdisk.cSat Jan 22 05:21:20 2011(r217714) @@ -586,9 +586,9 @@ change_part(int i) tcyl = DPCYL(partp-dp_scyl,partp-dp_ssect); thd = partp-dp_shd; tsec = DPSECT(partp-dp_ssect); -Decimal(beginning cylinder, tcyl, tmp); -Decimal(beginning head, thd, tmp); -Decimal(beginning sector, tsec, tmp); +Decimal(beginning cylinder, tcyl, tmp, sizeof(partp-dp_scyl)); Cylinder numbers are 10 bits in the MBR. They don't fit in the starting and ending cylinder fields, so 2 bits of them are put in the corresponding sector fields. The sizeof here is always 1, giving only 8 bits and thus a wrong limit of 256. +Decimal(beginning head, thd, tmp, sizeof(partp-dp_shd)); +Decimal(beginning sector, tsec, tmp, sizeof(partp-dp_ssect)); Sector numbers are only 6 bits in the MBR. The sizeof here is always 1, giving 8 bits and thus a wrong limit of 256. partp-dp_scyl = DOSCYL(tcyl); partp-dp_ssect = DOSSECT(tsec,tcyl); partp-dp_shd = thd; The DOSSECT() macro handles the details of merging cylinder bits into sector field.s Since these are the values to be written directly into the MBR, it is correct to limit them and not blindly truncate them. Non-blindly changing them is little better. They should just be rejected. There is also a lower limit on sector numbers. Sector 0 is invalid. Similarly for ending C/H/S numbers, except the breakage is larger in practice. Starting cylinder numbers are usually 0, but ending cylinder numbers are usually 1023 and now you can't edit them to anything above 255, including null changes from 1023 and changes from invalid values to the least invalid value of 1023. Older disks/devices/software may actually have between 256 and 1023 cylinders and need an MBR which matches. @@ -647,7 +647,7 @@ change_active(int which) setactive: do { new = active; -Decimal(active partition, new, tmp); +Decimal(active partition, new, tmp, 0); if (new 1 || new 4) { printf(Active partition number must be in range 1-4. Try again.\n); This has a lower limit too, and does the necessary and correct range checking for itself. It now has to pass a bogus upper limit of 0 to Decimal() to stop checking there. Decimal() should probably handle both limits like this does. @@ -677,9 +677,9 @@ get_params_to_use() { do { -Decimal(BIOS's idea of #cylinders, dos_cyls, tmp); -Decimal(BIOS's idea of #heads, dos_heads, tmp); -Decimal(BIOS's idea of #sectors, dos_sectors, tmp); +Decimal(BIOS's idea of #cylinders, dos_cyls, tmp, 0); +Decimal(BIOS's idea of #heads, dos_heads, tmp, 0); +Decimal(BIOS's idea of #sectors, dos_sectors, tmp, 0); dos_cylsecs = dos_heads * dos_sectors; print_params(); } I originally thought that the user values had to be accepted fairly blindly since they are multiplied out in places like here. Now I see that nothing has changed for these, but it probably should be changed to at least warn about them. There seems to be mo multiplication out involving dos_cyls. There are warnings about it being out of range all over the place. The size of the disk in sectors is mostly given not by these dos variables, but by the undosed variables cyls, heads and sectors. get_params() initializes all the dos variables badly by setting them to the same as to undosed variables in all cases. This is guranteed to give dos_cyls 1023 on any hard disk less than about 12 years old. Note that the limits for the above are 1 more than the limits for starting and ending C/H/S, except for dos_sectors, since these values are counts
svn commit: r217770 - in head/tools/tools/ath: . ath_ee_v4k_print
Author: adrian Date: Mon Jan 24 06:46:03 2011 New Revision: 217770 URL: http://svn.freebsd.org/changeset/base/217770 Log: Add a simple tool to print the contents of a v4k EEPROM dump. Added: head/tools/tools/ath/ath_ee_v4k_print/ head/tools/tools/ath/ath_ee_v4k_print/Makefile (contents, props changed) head/tools/tools/ath/ath_ee_v4k_print/eeprom.c (contents, props changed) head/tools/tools/ath/ath_ee_v4k_print/eeprom.h (contents, props changed) head/tools/tools/ath/ath_ee_v4k_print/main.c (contents, props changed) head/tools/tools/ath/ath_ee_v4k_print/v4k.c (contents, props changed) head/tools/tools/ath/ath_ee_v4k_print/v4k.h (contents, props changed) Modified: head/tools/tools/ath/Makefile Modified: head/tools/tools/ath/Makefile == --- head/tools/tools/ath/Makefile Mon Jan 24 06:17:05 2011 (r217769) +++ head/tools/tools/ath/Makefile Mon Jan 24 06:46:03 2011 (r217770) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR=athdebug athdecode athkey athpoke athprom athrd athregs athstats ath_ee_v14_print ath_prom_read +SUBDIR=athdebug athdecode athkey athpoke athprom athrd athregs athstats ath_ee_v14_print ath_prom_read ath_ee_v4k_print .include bsd.subdir.mk Added: head/tools/tools/ath/ath_ee_v4k_print/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/ath_ee_v4k_print/Makefile Mon Jan 24 06:46:03 2011(r217770) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal + +PROG= ath_ee_v4k_print +SRCS= main.c eeprom.c v4k.c +NOMAN= yes +NO_MAN=yes + +.include ../Makefile.inc + +.include bsd.prog.mk Added: head/tools/tools/ath/ath_ee_v4k_print/eeprom.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/ath_ee_v4k_print/eeprom.c Mon Jan 24 06:46:03 2011(r217770) @@ -0,0 +1,72 @@ + +/* + * Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include stdio.h +#include stdlib.h +#include unistd.h +#include string.h +#include sys/types.h +#include err.h + +#include eeprom.h + +void +load_eeprom_dump(const char *file, uint16_t *buf) +{ + unsigned int r[8]; + FILE *fp; + char b[1024]; + int i; + + fp = fopen(file, r); + if (!fp) + err(1, fopen); + + while (!feof(fp)) { + if (fgets(b, 1024, fp) == NULL) + break; + if (feof(fp)) + break; + if (strlen(b) 0) + b[strlen(b)-1] = '\0'; + if (strlen(b) == 0) + break; + sscanf(b, %x: %x %x %x %x %x %x %x %x\n, + i, r[0], r[1], r[2], r[3], r[4], + r[5], r[6], r[7]); + buf[i++] = r[0]; + buf[i++] = r[1]; + buf[i++] = r[2]; + buf[i++] = r[3]; + buf[i++] = r[4]; + buf[i++] = r[5]; + buf[i++] = r[6]; + buf[i++] = r[7]; + } + fclose(fp); +} Added: head/tools/tools/ath/ath_ee_v4k_print/eeprom.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/ath_ee_v4k_print/eeprom.h Mon Jan 24 06:46:03 2011(r217770) @@ -0,0
svn commit: r217771 - head/sbin/fdisk
Author: sobomax Date: Mon Jan 24 07:16:20 2011 New Revision: 217771 URL: http://svn.freebsd.org/changeset/base/217771 Log: o Cylinder numbers are 10 bits in the MBR; o Sector numbers are only 6 bits in the MBR; o bde'cize name of the local variable. Submitted by: bde Modified: head/sbin/fdisk/fdisk.c Modified: head/sbin/fdisk/fdisk.c == --- head/sbin/fdisk/fdisk.c Mon Jan 24 06:46:03 2011(r217770) +++ head/sbin/fdisk/fdisk.c Mon Jan 24 07:16:20 2011(r217771) @@ -62,7 +62,7 @@ static char lbuf[LBUF]; * Created. */ -#define Decimal(str, ans, tmp, size) if (decimal(str, tmp, ans, size)) ans = tmp +#define Decimal(str, ans, tmp, nbits) if (decimal(str, tmp, ans, nbits)) ans = tmp #define RoundCyl(x) x) + cylsecs - 1) / cylsecs) * cylsecs) @@ -247,7 +247,7 @@ static int get_params(void); static int read_s0(void); static int write_s0(void); static int ok(const char *str); -static int decimal(const char *str, int *num, int deflt, int size); +static int decimal(const char *str, int *num, int deflt, int nbits); static int read_config(char *config_file); static void reset_boot(void); static int sanitize_partition(struct dos_partition *); @@ -572,9 +572,9 @@ change_part(int i) } do { - Decimal(sysid (165=FreeBSD), partp-dp_typ, tmp, sizeof(partp-dp_typ)); - Decimal(start, partp-dp_start, tmp, sizeof(partp-dp_start)); - Decimal(size, partp-dp_size, tmp, sizeof(partp-dp_size)); + Decimal(sysid (165=FreeBSD), partp-dp_typ, tmp, sizeof(partp-dp_typ) * 8); + Decimal(start, partp-dp_start, tmp, sizeof(partp-dp_start) * 8); + Decimal(size, partp-dp_size, tmp, sizeof(partp-dp_size) * 8); if (!sanitize_partition(partp)) { warnx(ERROR: failed to adjust; setting sysid to 0); partp-dp_typ = 0; @@ -586,9 +586,9 @@ change_part(int i) tcyl = DPCYL(partp-dp_scyl,partp-dp_ssect); thd = partp-dp_shd; tsec = DPSECT(partp-dp_ssect); - Decimal(beginning cylinder, tcyl, tmp, sizeof(partp-dp_scyl)); - Decimal(beginning head, thd, tmp, sizeof(partp-dp_shd)); - Decimal(beginning sector, tsec, tmp, sizeof(partp-dp_ssect)); + Decimal(beginning cylinder, tcyl, tmp, 10); + Decimal(beginning head, thd, tmp, sizeof(partp-dp_shd) * 8); + Decimal(beginning sector, tsec, tmp, 6); partp-dp_scyl = DOSCYL(tcyl); partp-dp_ssect = DOSSECT(tsec,tcyl); partp-dp_shd = thd; @@ -596,9 +596,9 @@ change_part(int i) tcyl = DPCYL(partp-dp_ecyl,partp-dp_esect); thd = partp-dp_ehd; tsec = DPSECT(partp-dp_esect); - Decimal(ending cylinder, tcyl, tmp, sizeof(partp-dp_ecyl)); - Decimal(ending head, thd, tmp, sizeof(partp-dp_ehd)); - Decimal(ending sector, tsec, tmp, sizeof(partp-dp_esect)); + Decimal(ending cylinder, tcyl, tmp, 10); + Decimal(ending head, thd, tmp, sizeof(partp-dp_ehd) * 8); + Decimal(ending sector, tsec, tmp, 6); partp-dp_ecyl = DOSCYL(tcyl); partp-dp_esect = DOSSECT(tsec,tcyl); partp-dp_ehd = thd; @@ -915,16 +915,16 @@ ok(const char *str) } static int -decimal(const char *str, int *num, int deflt, int size) +decimal(const char *str, int *num, int deflt, int nbits) { - long long acc = 0, maxval; + long long acc = 0, limit; int c; char *cp; - if (size == 0) { - size = sizeof(*num); + if (nbits == 0) { + nbits = sizeof(*num) * 8; } - maxval = (long long)1 (size * 8); + limit = (long long)1 nbits; while (1) { printf(Supply a decimal value for \%s\ [%d] , str, deflt); fflush(stdout); @@ -941,7 +941,7 @@ decimal(const char *str, int *num, int d return 0; while ((c = *cp++)) { if (c = '9' c = '0') { - if (acc maxval) + if (acc limit) acc = acc * 10 + c - '0'; } else break; @@ -949,8 +949,8 @@ decimal(const char *str, int *num, int d if (c == ' ' || c == '\t') while ((c = *cp) (c == ' ' || c == '\t')) cp++; if (!c) { - if (acc = maxval) { -
Re: svn commit: r217748 - head/sys/netinet/cc
Hi Matthew, On 01/24/11 02:39, m...@freebsd.org wrote: For sbuf use for a sysctl you can use sbuf_init_for_sysctl() which I assume you mean sbuf_new_for_sysctl() that's in kern/kern_sysctl.c? It would be useful to document this function in sbuf(9) - I wasn't aware of it and didn't find it when I went looking how to do what my patch somewhat hackishly achieves. will, instead of growing, push the current data out using SYSCTL_OUT to a wired user buffer. There's a few examples in the vm/ code. This can sometimes significantly simplify the code since there's no need to worry about held mutex/rwlock anymore. I need to MFC the work my patch is against at some point... if/when you MFC the sbuf_set_drain() and sbuf_new_for_sysctl() patches, I'll be happy to switch to using sbuf_new_for_sysctl(). I'll wait until the MFC is done though before switching. Cheers, Lawrence ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217772 - head/sys/conf
Author: adrian Date: Mon Jan 24 07:45:14 2011 New Revision: 217772 URL: http://svn.freebsd.org/changeset/base/217772 Log: Undo a local option which mistakenly crept into a commit. Modified: head/sys/conf/options Modified: head/sys/conf/options == --- head/sys/conf/options Mon Jan 24 07:16:20 2011(r217771) +++ head/sys/conf/options Mon Jan 24 07:45:14 2011(r217772) @@ -650,7 +650,6 @@ UKBD_DFLT_KEYMAPopt_ukbd.h UPLCOM_INTR_INTERVAL opt_uplcom.h UVSCOM_DEFAULT_OPKTSIZEopt_uvscom.h UVSCOM_INTR_INTERVAL opt_uvscom.h -USB_HOST_ALIGN opt_usb.h # Embedded system options INIT_PATH ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r217773 - in head/sys/modules: . khelp
Author: lstewart Date: Mon Jan 24 07:50:29 2011 New Revision: 217773 URL: http://svn.freebsd.org/changeset/base/217773 Log: Add build infrastructure for Khelp modules. Sponsored by: FreeBSD Foundation Reviewed by: bz MFC after:3 months Added: head/sys/modules/khelp/ head/sys/modules/khelp/Makefile (contents, props changed) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Mon Jan 24 07:45:14 2011(r217772) +++ head/sys/modules/Makefile Mon Jan 24 07:50:29 2011(r217773) @@ -151,6 +151,7 @@ SUBDIR= ${_3dfx} \ jme \ joy \ kbdmux \ + khelp \ krpc \ ksyms \ le \ Added: head/sys/modules/khelp/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/khelp/Makefile Mon Jan 24 07:50:29 2011 (r217773) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= + +.include bsd.subdir.mk ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org