From owner-svn-src-stable@FreeBSD.ORG Sun Oct 2 09:44:28 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B721E106564A; Sun, 2 Oct 2011 09:44:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A59888FC08; Sun, 2 Oct 2011 09:44:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p929iSfw056837; Sun, 2 Oct 2011 09:44:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p929iS6W056835; Sun, 2 Oct 2011 09:44:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201110020944.p929iS6W056835@svn.freebsd.org> From: Xin LI Date: Sun, 2 Oct 2011 09:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225916 - stable/8/sys/dev/coretemp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 09:44:28 -0000 Author: delphij Date: Sun Oct 2 09:44:28 2011 New Revision: 225916 URL: http://svn.freebsd.org/changeset/base/225916 Log: MFC r225339: Expose more variables from coretemp(4) via sysctl: - tjmax - Tj(max) value from the CPU - delta - current delta reading - resolution - sensor resolution in Celsius - throttle_log - whether a #PROCHOT was asserted since last reset Submitted by: Mark Johnston (mostly) Modified: stable/8/sys/dev/coretemp/coretemp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/coretemp/coretemp.c ============================================================================== --- stable/8/sys/dev/coretemp/coretemp.c Sun Oct 2 08:48:47 2011 (r225915) +++ stable/8/sys/dev/coretemp/coretemp.c Sun Oct 2 09:44:28 2011 (r225916) @@ -48,12 +48,21 @@ __FBSDID("$FreeBSD$"); #include #include -#define TZ_ZEROC 2732 +#define TZ_ZEROC 2732 + +#define THERM_STATUS_LOG 0x02 +#define THERM_STATUS 0x01 +#define THERM_STATUS_TEMP_SHIFT 16 +#define THERM_STATUS_TEMP_MASK 0x7f +#define THERM_STATUS_RES_SHIFT 27 +#define THERM_STATUS_RES_MASK 0x0f +#define THERM_STATUS_VALID_SHIFT 31 +#define THERM_STATUS_VALID_MASK 0x01 struct coretemp_softc { device_t sc_dev; int sc_tjmax; - struct sysctl_oid *sc_oid; + unsigned int sc_throttle_log; }; /* @@ -64,8 +73,10 @@ static int coretemp_probe(device_t dev); static int coretemp_attach(device_t dev); static int coretemp_detach(device_t dev); -static int coretemp_get_temp(device_t dev); -static int coretemp_get_temp_sysctl(SYSCTL_HANDLER_ARGS); +static uint64_t coretemp_get_thermal_msr(int cpu); +static void coretemp_clear_thermal_msr(int cpu); +static int coretemp_get_val_sysctl(SYSCTL_HANDLER_ARGS); +static int coretemp_throttle_log_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t coretemp_methods[] = { /* Device interface */ @@ -83,8 +94,16 @@ static driver_t coretemp_driver = { sizeof(struct coretemp_softc), }; +enum therm_info { + CORETEMP_TEMP, + CORETEMP_DELTA, + CORETEMP_RESOLUTION, + CORETEMP_TJMAX, +}; + static devclass_t coretemp_devclass; -DRIVER_MODULE(coretemp, cpu, coretemp_driver, coretemp_devclass, NULL, NULL); +DRIVER_MODULE(coretemp, cpu, coretemp_driver, coretemp_devclass, NULL, + NULL); static void coretemp_identify(driver_t *driver, device_t parent) @@ -135,6 +154,8 @@ coretemp_attach(device_t dev) uint64_t msr; int cpu_model, cpu_stepping; int ret, tjtarget; + struct sysctl_oid *oid; + struct sysctl_ctx_list *ctx; sc->sc_dev = dev; pdev = device_get_parent(dev); @@ -149,7 +170,7 @@ coretemp_attach(device_t dev) */ if (cpu_model < 0xe) return (ENXIO); - + #if 0 /* * XXXrpaulo: I have this CPU model and when it returns from C3 * coretemp continues to function properly. @@ -216,7 +237,7 @@ coretemp_attach(device_t dev) ret = rdmsr_safe(MSR_IA32_TEMPERATURE_TARGET, &msr); if (ret == 0) { tjtarget = (msr >> 16) & 0xff; - + /* * On earlier generation of processors, the value * obtained from IA32_TEMPERATURE_TARGET register is @@ -243,15 +264,35 @@ coretemp_attach(device_t dev) if (bootverbose) device_printf(dev, "Setting TjMax=%d\n", sc->sc_tjmax); + ctx = device_get_sysctl_ctx(dev); + + oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), OID_AUTO, + "coretemp", CTLFLAG_RD, NULL, "Per-CPU thermal information"); + /* - * Add the "temperature" MIB to dev.cpu.N. + * Add the MIBs to dev.cpu.N and dev.cpu.N.coretemp. */ - sc->sc_oid = SYSCTL_ADD_PROC(device_get_sysctl_ctx(pdev), - SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), - OID_AUTO, "temperature", - CTLTYPE_INT | CTLFLAG_RD, - dev, 0, coretemp_get_temp_sysctl, "IK", + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), + OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, dev, + CORETEMP_TEMP, coretemp_get_val_sysctl, "IK", "Current temperature"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "delta", + CTLTYPE_INT | CTLFLAG_RD, dev, CORETEMP_DELTA, + coretemp_get_val_sysctl, "I", + "Delta between TCC activation and current temperature"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "resolution", + CTLTYPE_INT | CTLFLAG_RD, dev, CORETEMP_RESOLUTION, + coretemp_get_val_sysctl, "I", + "Resolution of CPU thermal sensor"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "tjmax", + CTLTYPE_INT | CTLFLAG_RD, dev, CORETEMP_TJMAX, + coretemp_get_val_sysctl, "IK", + "TCC activation temperature"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "throttle_log", CTLTYPE_INT | CTLFLAG_RW, dev, 0, + coretemp_throttle_log_sysctl, "I", + "Set to 1 if the thermal sensor has tripped"); return (0); } @@ -259,22 +300,13 @@ coretemp_attach(device_t dev) static int coretemp_detach(device_t dev) { - struct coretemp_softc *sc = device_get_softc(dev); - - sysctl_remove_oid(sc->sc_oid, 1, 0); - return (0); } - -static int -coretemp_get_temp(device_t dev) +static uint64_t +coretemp_get_thermal_msr(int cpu) { uint64_t msr; - int temp; - int cpu = device_get_unit(dev); - struct coretemp_softc *sc = device_get_softc(dev); - char stemp[16]; thread_lock(curthread); sched_bind(curthread, cpu); @@ -296,51 +328,116 @@ coretemp_get_temp(device_t dev) sched_unbind(curthread); thread_unlock(curthread); - /* - * Check for Thermal Status and Thermal Status Log. - */ - if ((msr & 0x3) == 0x3) - device_printf(dev, "PROCHOT asserted\n"); + return (msr); +} + +static void +coretemp_clear_thermal_msr(int cpu) +{ + thread_lock(curthread); + sched_bind(curthread, cpu); + thread_unlock(curthread); + + wrmsr(MSR_THERM_STATUS, 0); + + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); +} + +static int +coretemp_get_val_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev; + uint64_t msr; + int val, tmp; + struct coretemp_softc *sc; + enum therm_info type; + char stemp[16]; + + dev = (device_t) arg1; + msr = coretemp_get_thermal_msr(device_get_unit(dev)); + sc = device_get_softc(dev); + type = arg2; + + if (((msr >> THERM_STATUS_VALID_SHIFT) & THERM_STATUS_VALID_MASK) != 1) { + val = -1; + } else { + switch (type) { + case CORETEMP_TEMP: + tmp = (msr >> THERM_STATUS_TEMP_SHIFT) & + THERM_STATUS_TEMP_MASK; + val = (sc->sc_tjmax - tmp) * 10 + TZ_ZEROC; + break; + case CORETEMP_DELTA: + val = (msr >> THERM_STATUS_TEMP_SHIFT) & + THERM_STATUS_TEMP_MASK; + break; + case CORETEMP_RESOLUTION: + val = (msr >> THERM_STATUS_RES_SHIFT) & + THERM_STATUS_RES_MASK; + break; + case CORETEMP_TJMAX: + val = sc->sc_tjmax * 10 + TZ_ZEROC; + break; + } + } + + if (msr & THERM_STATUS_LOG) { + sc->sc_throttle_log = 1; - /* - * Bit 31 contains "Reading valid" - */ - if (((msr >> 31) & 0x1) == 1) { /* - * Starting on bit 16 and ending on bit 22. + * Check for Critical Temperature Status and Critical + * Temperature Log. It doesn't really matter if the + * current temperature is invalid because the "Critical + * Temperature Log" bit will tell us if the Critical + * Temperature has * been reached in past. It's not + * directly related to the current temperature. + * + * If we reach a critical level, allow devctl(4) + * to catch this and shutdown the system. */ - temp = sc->sc_tjmax - ((msr >> 16) & 0x7f); - } else - temp = -1; - - /* - * Check for Critical Temperature Status and Critical - * Temperature Log. - * It doesn't really matter if the current temperature is - * invalid because the "Critical Temperature Log" bit will - * tell us if the Critical Temperature has been reached in - * past. It's not directly related to the current temperature. - * - * If we reach a critical level, allow devctl(4) to catch this - * and shutdown the system. - */ - if (((msr >> 4) & 0x3) == 0x3) { - device_printf(dev, "critical temperature detected, " - "suggest system shutdown\n"); - snprintf(stemp, sizeof(stemp), "%d", temp); - devctl_notify("coretemp", "Thermal", stemp, "notify=0xcc"); + if (msr & THERM_STATUS) { + tmp = (msr >> THERM_STATUS_TEMP_SHIFT) & + THERM_STATUS_TEMP_MASK; + tmp = (sc->sc_tjmax - tmp) * 10 + TZ_ZEROC; + device_printf(dev, "critical temperature detected, " + "suggest system shutdown\n"); + snprintf(stemp, sizeof(stemp), "%d", tmp); + devctl_notify("coretemp", "Thermal", stemp, + "notify=0xcc"); + } } - return (temp); + return (sysctl_handle_int(oidp, &val, 0, req)); } static int -coretemp_get_temp_sysctl(SYSCTL_HANDLER_ARGS) +coretemp_throttle_log_sysctl(SYSCTL_HANDLER_ARGS) { - device_t dev = (device_t) arg1; - int temp; + device_t dev; + uint64_t msr; + int error, val; + struct coretemp_softc *sc; + + dev = (device_t) arg1; + msr = coretemp_get_thermal_msr(device_get_unit(dev)); + sc = device_get_softc(dev); + + if (msr & THERM_STATUS_LOG) + sc->sc_throttle_log = 1; + + val = sc->sc_throttle_log; - temp = coretemp_get_temp(dev) * 10 + TZ_ZEROC; + error = sysctl_handle_int(oidp, &val, 0, req); - return (sysctl_handle_int(oidp, &temp, 0, req)); + if (error || !req->newptr) + return (error); + else if (val != 0) + return (EINVAL); + + coretemp_clear_thermal_msr(device_get_unit(dev)); + sc->sc_throttle_log = 0; + + return (0); } From owner-svn-src-stable@FreeBSD.ORG Sun Oct 2 11:13:28 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6E75106566B; Sun, 2 Oct 2011 11:13:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCE5F8FC08; Sun, 2 Oct 2011 11:13:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92BDSQA061329; Sun, 2 Oct 2011 11:13:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92BDS7C061327; Sun, 2 Oct 2011 11:13:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110021113.p92BDS7C061327@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 Oct 2011 11:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225917 - stable/9/sys/powerpc/powerpc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 11:13:29 -0000 Author: mav Date: Sun Oct 2 11:13:28 2011 New Revision: 225917 URL: http://svn.freebsd.org/changeset/base/225917 Log: MFC r225875, r225877: Handle the race in cpu_idle() when due to the critical section CPU could get into sleep after receiving interrupt, delaying interrupt thread execution indefinitely until the next interrupt arrive. Reviewed by: nwhitehorn Approved by: re (kib) Modified: stable/9/sys/powerpc/powerpc/cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/9/sys/powerpc/powerpc/cpu.c Sun Oct 2 09:44:28 2011 (r225916) +++ stable/9/sys/powerpc/powerpc/cpu.c Sun Oct 2 11:13:28 2011 (r225917) @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -553,6 +554,11 @@ cpu_idle_60x(void) vers = mfpvr() >> 16; #ifdef AIM + mtmsr(msr & ~PSL_EE); + if (sched_runnable()) { + mtmsr(msr); + return; + } switch (vers) { case IBM970: case IBM970FX: @@ -583,6 +589,11 @@ cpu_idle_e500(void) msr = mfmsr(); #ifdef E500 + mtmsr(msr & ~PSL_EE); + if (sched_runnable()) { + mtmsr(msr); + return; + } /* Freescale E500 core RM section 6.4.1. */ __asm __volatile("msync; mtmsr %0; isync" :: "r" (msr | PSL_WE)); From owner-svn-src-stable@FreeBSD.ORG Sun Oct 2 12:15:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 726641065672; Sun, 2 Oct 2011 12:15:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612978FC18; Sun, 2 Oct 2011 12:15:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92CFF39063147; Sun, 2 Oct 2011 12:15:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92CFFw4063144; Sun, 2 Oct 2011 12:15:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110021215.p92CFFw4063144@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 Oct 2011 12:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225918 - stable/9/sys/dev/mfi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 12:15:15 -0000 Author: mav Date: Sun Oct 2 12:15:15 2011 New Revision: 225918 URL: http://svn.freebsd.org/changeset/base/225918 Log: MFC r225869: - Add special support for the MFI_CMD ioctl with MFI_CMD_STP command, used by present MegaCLI version. It has some special meaning for the first s/g list entry, while the main s/g list begins from the the second entry, and those lists should remain separate after loading to the busdma map. - Fix bug in 32bit ioctl compatibility shims when s/g list consists of more then on element. Approved by: re (kib) Modified: stable/9/sys/dev/mfi/mfi.c stable/9/sys/dev/mfi/mfivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Sun Oct 2 11:13:28 2011 (r225917) +++ stable/9/sys/dev/mfi/mfi.c Sun Oct 2 12:15:15 2011 (r225918) @@ -1488,7 +1488,7 @@ mfi_data_cb(void *arg, bus_dma_segment_t struct mfi_command *cm; union mfi_sgl *sgl; struct mfi_softc *sc; - int i, dir; + int i, j, first, dir; cm = (struct mfi_command *)arg; sc = cm->cm_sc; @@ -1502,19 +1502,33 @@ mfi_data_cb(void *arg, bus_dma_segment_t return; } + j = 0; + if (cm->cm_frame->header.cmd == MFI_CMD_STP) { + first = cm->cm_stp_len; + if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { + sgl->sg32[j].addr = segs[0].ds_addr; + sgl->sg32[j++].len = first; + } else { + sgl->sg64[j].addr = segs[0].ds_addr; + sgl->sg64[j++].len = first; + } + } else + first = 0; if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { for (i = 0; i < nsegs; i++) { - sgl->sg32[i].addr = segs[i].ds_addr; - sgl->sg32[i].len = segs[i].ds_len; + sgl->sg32[j].addr = segs[i].ds_addr + first; + sgl->sg32[j++].len = segs[i].ds_len - first; + first = 0; } } else { for (i = 0; i < nsegs; i++) { - sgl->sg64[i].addr = segs[i].ds_addr; - sgl->sg64[i].len = segs[i].ds_len; + sgl->sg64[j].addr = segs[i].ds_addr + first; + sgl->sg64[j++].len = segs[i].ds_len - first; + first = 0; } hdr->flags |= MFI_FRAME_SGL64; } - hdr->sg_count = nsegs; + hdr->sg_count = j; dir = 0; if (cm->cm_flags & MFI_CMD_DATAIN) { @@ -1525,6 +1539,8 @@ mfi_data_cb(void *arg, bus_dma_segment_t dir |= BUS_DMASYNC_PREWRITE; hdr->flags |= MFI_FRAME_DIR_WRITE; } + if (cm->cm_frame->header.cmd == MFI_CMD_STP) + dir |= BUS_DMASYNC_PREWRITE; bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap, dir); cm->cm_flags |= MFI_CMD_MAPPED; @@ -1602,7 +1618,8 @@ mfi_complete(struct mfi_softc *sc, struc if ((cm->cm_flags & MFI_CMD_MAPPED) != 0) { dir = 0; - if (cm->cm_flags & MFI_CMD_DATAIN) + if ((cm->cm_flags & MFI_CMD_DATAIN) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) dir |= BUS_DMASYNC_POSTREAD; if (cm->cm_flags & MFI_CMD_DATAOUT) dir |= BUS_DMASYNC_POSTWRITE; @@ -1927,7 +1944,8 @@ mfi_ioctl(struct cdev *dev, u_long cmd, struct mfi_command *cm = NULL; uint32_t context; union mfi_sense_ptr sense_ptr; - uint8_t *data = NULL, *temp; + uint8_t *data = NULL, *temp, *addr; + size_t len; int i; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; #ifdef __amd64__ @@ -2024,6 +2042,21 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_flags == 0) cm->cm_flags |= MFI_CMD_DATAIN | MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; + if (cm->cm_frame->header.cmd == MFI_CMD_STP) { +#ifdef __amd64__ + if (cmd == MFI_CMD) { +#endif + /* Native */ + cm->cm_stp_len = ioc->mfi_sgl[0].iov_len; +#ifdef __amd64__ + } else { + /* 32bit on 64bit */ + ioc32 = (struct mfi_ioc_packet32 *)ioc; + cm->cm_stp_len = ioc32->mfi_sgl[0].iov_len; + } +#endif + cm->cm_len += cm->cm_stp_len; + } if (cm->cm_len && (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, @@ -2040,35 +2073,30 @@ mfi_ioctl(struct cdev *dev, u_long cmd, cm->cm_frame->header.context = context; temp = data; - if (cm->cm_flags & MFI_CMD_DATAOUT) { + if ((cm->cm_flags & MFI_CMD_DATAOUT) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { #ifdef __amd64__ if (cmd == MFI_CMD) { +#endif /* Native */ - error = copyin(ioc->mfi_sgl[i].iov_base, - temp, - ioc->mfi_sgl[i].iov_len); + addr = ioc->mfi_sgl[i].iov_base; + len = ioc->mfi_sgl[i].iov_len; +#ifdef __amd64__ } else { - void *temp_convert; - /* 32bit */ + /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; - temp_convert = - PTRIN(ioc32->mfi_sgl[i].iov_base); - error = copyin(temp_convert, - temp, - ioc32->mfi_sgl[i].iov_len); + addr = PTRIN(ioc32->mfi_sgl[i].iov_base); + len = ioc32->mfi_sgl[i].iov_len; } -#else - error = copyin(ioc->mfi_sgl[i].iov_base, - temp, - ioc->mfi_sgl[i].iov_len); #endif + error = copyin(addr, temp, len); if (error != 0) { device_printf(sc->mfi_dev, "Copy in failed\n"); goto out; } - temp = &temp[ioc->mfi_sgl[i].iov_len]; + temp = &temp[len]; } } @@ -2098,35 +2126,30 @@ mfi_ioctl(struct cdev *dev, u_long cmd, mtx_unlock(&sc->mfi_io_lock); temp = data; - if (cm->cm_flags & MFI_CMD_DATAIN) { + if ((cm->cm_flags & MFI_CMD_DATAIN) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { #ifdef __amd64__ if (cmd == MFI_CMD) { +#endif /* Native */ - error = copyout(temp, - ioc->mfi_sgl[i].iov_base, - ioc->mfi_sgl[i].iov_len); + addr = ioc->mfi_sgl[i].iov_base; + len = ioc->mfi_sgl[i].iov_len; +#ifdef __amd64__ } else { - void *temp_convert; - /* 32bit */ + /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; - temp_convert = - PTRIN(ioc32->mfi_sgl[i].iov_base); - error = copyout(temp, - temp_convert, - ioc32->mfi_sgl[i].iov_len); + addr = PTRIN(ioc32->mfi_sgl[i].iov_base); + len = ioc32->mfi_sgl[i].iov_len; } -#else - error = copyout(temp, - ioc->mfi_sgl[i].iov_base, - ioc->mfi_sgl[i].iov_len); #endif + error = copyout(temp, addr, len); if (error != 0) { device_printf(sc->mfi_dev, "Copy out failed\n"); goto out; } - temp = &temp[ioc->mfi_sgl[i].iov_len]; + temp = &temp[len]; } } Modified: stable/9/sys/dev/mfi/mfivar.h ============================================================================== --- stable/9/sys/dev/mfi/mfivar.h Sun Oct 2 11:13:28 2011 (r225917) +++ stable/9/sys/dev/mfi/mfivar.h Sun Oct 2 12:15:15 2011 (r225918) @@ -87,6 +87,7 @@ struct mfi_command { union mfi_sgl *cm_sg; void *cm_data; int cm_len; + int cm_stp_len; int cm_total_frame_size; int cm_extra_frames; int cm_flags; From owner-svn-src-stable@FreeBSD.ORG Sun Oct 2 12:18:06 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71A131065673; Sun, 2 Oct 2011 12:18:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 608EC8FC08; Sun, 2 Oct 2011 12:18:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92CI6Ne063293; Sun, 2 Oct 2011 12:18:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92CI6vk063290; Sun, 2 Oct 2011 12:18:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110021218.p92CI6vk063290@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 Oct 2011 12:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225919 - stable/8/sys/dev/mfi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 12:18:06 -0000 Author: mav Date: Sun Oct 2 12:18:06 2011 New Revision: 225919 URL: http://svn.freebsd.org/changeset/base/225919 Log: MFC r225869: - Add special support for the MFI_CMD ioctl with MFI_CMD_STP command, used by present MegaCLI version. It has some special meaning for the first s/g list entry, while the main s/g list begins from the the second entry, and those lists should remain separate after loading to the busdma map. - Fix bug in 32bit ioctl compatibility shims when s/g list consists of more then on element. Modified: stable/8/sys/dev/mfi/mfi.c stable/8/sys/dev/mfi/mfivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Sun Oct 2 12:15:15 2011 (r225918) +++ stable/8/sys/dev/mfi/mfi.c Sun Oct 2 12:18:06 2011 (r225919) @@ -1488,7 +1488,7 @@ mfi_data_cb(void *arg, bus_dma_segment_t struct mfi_command *cm; union mfi_sgl *sgl; struct mfi_softc *sc; - int i, dir; + int i, j, first, dir; cm = (struct mfi_command *)arg; sc = cm->cm_sc; @@ -1502,19 +1502,33 @@ mfi_data_cb(void *arg, bus_dma_segment_t return; } + j = 0; + if (cm->cm_frame->header.cmd == MFI_CMD_STP) { + first = cm->cm_stp_len; + if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { + sgl->sg32[j].addr = segs[0].ds_addr; + sgl->sg32[j++].len = first; + } else { + sgl->sg64[j].addr = segs[0].ds_addr; + sgl->sg64[j++].len = first; + } + } else + first = 0; if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { for (i = 0; i < nsegs; i++) { - sgl->sg32[i].addr = segs[i].ds_addr; - sgl->sg32[i].len = segs[i].ds_len; + sgl->sg32[j].addr = segs[i].ds_addr + first; + sgl->sg32[j++].len = segs[i].ds_len - first; + first = 0; } } else { for (i = 0; i < nsegs; i++) { - sgl->sg64[i].addr = segs[i].ds_addr; - sgl->sg64[i].len = segs[i].ds_len; + sgl->sg64[j].addr = segs[i].ds_addr + first; + sgl->sg64[j++].len = segs[i].ds_len - first; + first = 0; } hdr->flags |= MFI_FRAME_SGL64; } - hdr->sg_count = nsegs; + hdr->sg_count = j; dir = 0; if (cm->cm_flags & MFI_CMD_DATAIN) { @@ -1525,6 +1539,8 @@ mfi_data_cb(void *arg, bus_dma_segment_t dir |= BUS_DMASYNC_PREWRITE; hdr->flags |= MFI_FRAME_DIR_WRITE; } + if (cm->cm_frame->header.cmd == MFI_CMD_STP) + dir |= BUS_DMASYNC_PREWRITE; bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap, dir); cm->cm_flags |= MFI_CMD_MAPPED; @@ -1602,7 +1618,8 @@ mfi_complete(struct mfi_softc *sc, struc if ((cm->cm_flags & MFI_CMD_MAPPED) != 0) { dir = 0; - if (cm->cm_flags & MFI_CMD_DATAIN) + if ((cm->cm_flags & MFI_CMD_DATAIN) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) dir |= BUS_DMASYNC_POSTREAD; if (cm->cm_flags & MFI_CMD_DATAOUT) dir |= BUS_DMASYNC_POSTWRITE; @@ -1927,7 +1944,8 @@ mfi_ioctl(struct cdev *dev, u_long cmd, struct mfi_command *cm = NULL; uint32_t context; union mfi_sense_ptr sense_ptr; - uint8_t *data = NULL, *temp; + uint8_t *data = NULL, *temp, *addr; + size_t len; int i; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; #ifdef __amd64__ @@ -2024,6 +2042,21 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_flags == 0) cm->cm_flags |= MFI_CMD_DATAIN | MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; + if (cm->cm_frame->header.cmd == MFI_CMD_STP) { +#ifdef __amd64__ + if (cmd == MFI_CMD) { +#endif + /* Native */ + cm->cm_stp_len = ioc->mfi_sgl[0].iov_len; +#ifdef __amd64__ + } else { + /* 32bit on 64bit */ + ioc32 = (struct mfi_ioc_packet32 *)ioc; + cm->cm_stp_len = ioc32->mfi_sgl[0].iov_len; + } +#endif + cm->cm_len += cm->cm_stp_len; + } if (cm->cm_len && (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, @@ -2040,35 +2073,30 @@ mfi_ioctl(struct cdev *dev, u_long cmd, cm->cm_frame->header.context = context; temp = data; - if (cm->cm_flags & MFI_CMD_DATAOUT) { + if ((cm->cm_flags & MFI_CMD_DATAOUT) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { #ifdef __amd64__ if (cmd == MFI_CMD) { +#endif /* Native */ - error = copyin(ioc->mfi_sgl[i].iov_base, - temp, - ioc->mfi_sgl[i].iov_len); + addr = ioc->mfi_sgl[i].iov_base; + len = ioc->mfi_sgl[i].iov_len; +#ifdef __amd64__ } else { - void *temp_convert; - /* 32bit */ + /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; - temp_convert = - PTRIN(ioc32->mfi_sgl[i].iov_base); - error = copyin(temp_convert, - temp, - ioc32->mfi_sgl[i].iov_len); + addr = PTRIN(ioc32->mfi_sgl[i].iov_base); + len = ioc32->mfi_sgl[i].iov_len; } -#else - error = copyin(ioc->mfi_sgl[i].iov_base, - temp, - ioc->mfi_sgl[i].iov_len); #endif + error = copyin(addr, temp, len); if (error != 0) { device_printf(sc->mfi_dev, "Copy in failed\n"); goto out; } - temp = &temp[ioc->mfi_sgl[i].iov_len]; + temp = &temp[len]; } } @@ -2098,35 +2126,30 @@ mfi_ioctl(struct cdev *dev, u_long cmd, mtx_unlock(&sc->mfi_io_lock); temp = data; - if (cm->cm_flags & MFI_CMD_DATAIN) { + if ((cm->cm_flags & MFI_CMD_DATAIN) || + (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { #ifdef __amd64__ if (cmd == MFI_CMD) { +#endif /* Native */ - error = copyout(temp, - ioc->mfi_sgl[i].iov_base, - ioc->mfi_sgl[i].iov_len); + addr = ioc->mfi_sgl[i].iov_base; + len = ioc->mfi_sgl[i].iov_len; +#ifdef __amd64__ } else { - void *temp_convert; - /* 32bit */ + /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; - temp_convert = - PTRIN(ioc32->mfi_sgl[i].iov_base); - error = copyout(temp, - temp_convert, - ioc32->mfi_sgl[i].iov_len); + addr = PTRIN(ioc32->mfi_sgl[i].iov_base); + len = ioc32->mfi_sgl[i].iov_len; } -#else - error = copyout(temp, - ioc->mfi_sgl[i].iov_base, - ioc->mfi_sgl[i].iov_len); #endif + error = copyout(temp, addr, len); if (error != 0) { device_printf(sc->mfi_dev, "Copy out failed\n"); goto out; } - temp = &temp[ioc->mfi_sgl[i].iov_len]; + temp = &temp[len]; } } Modified: stable/8/sys/dev/mfi/mfivar.h ============================================================================== --- stable/8/sys/dev/mfi/mfivar.h Sun Oct 2 12:15:15 2011 (r225918) +++ stable/8/sys/dev/mfi/mfivar.h Sun Oct 2 12:18:06 2011 (r225919) @@ -87,6 +87,7 @@ struct mfi_command { union mfi_sgl *cm_sg; void *cm_data; int cm_len; + int cm_stp_len; int cm_total_frame_size; int cm_extra_frames; int cm_flags; From owner-svn-src-stable@FreeBSD.ORG Sun Oct 2 13:48:16 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FD011065676; Sun, 2 Oct 2011 13:48:16 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E2318FC16; Sun, 2 Oct 2011 13:48:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92DmFS2066063; Sun, 2 Oct 2011 13:48:15 GMT (envelope-from mr@svn.freebsd.org) Received: (from mr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92DmF7K066061; Sun, 2 Oct 2011 13:48:15 GMT (envelope-from mr@svn.freebsd.org) Message-Id: <201110021348.p92DmF7K066061@svn.freebsd.org> From: Michael Reifenberger Date: Sun, 2 Oct 2011 13:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225923 - stable/8/tools/tools/nanobsd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 13:48:16 -0000 Author: mr Date: Sun Oct 2 13:48:15 2011 New Revision: 225923 URL: http://svn.freebsd.org/changeset/base/225923 Log: Bring nanobsd.sh up to date. MFC: r212938: Support new variable NANO_LABEL. r212990: Make the labels match the device name that's mounted, not just the slice they are on. r214955: - Set -x flag when executing customisation scripts to aid in debugging them. - Use KERNCONFDIR with KERNCONF instead of copying the kernel config into the source tree so included kernel configs work. - Put more stuff in the _.bk/_.ik log file, not just make statements. - Add the kernel config name to the pprint during kernel installation. - Add NANO_MODULES providing a list of modules to build and install. r215069: Document NANO_CFGDIR and NANO_DATADIR r215070: Build make.conf when the world is not selected to build, but the kernel is. r215081: Insulate the nanobsd build from the current system by opting out of the SRCCONF processing. r216144: _WITHOUT_SRCCONF has too much baggage. Instead, use the simpler SRCCONF=/dev/null. r216145: - Mount the device async when we're doing the copy. - Create a sparse file instead of a fully zerod one. This trades the possibiltiy of running out of space during the build for the speed gain not having do write all those zeros... r216928: Put in the other half of the SRCCONF patch. r216929: Bump the media size from approx 600MB to approx 750MB. The great hob-nailed tennis shoe of progress demands it! r220091: Use ${NANO_WORLDDIR}/var/empty as copy source since it has no schg flag set. r221850: Copy symbolic links as files rather than recreating the links. r221851: Implement -f to inhibit copying s1 partition out for speed. r221852: Add ${} around variable dereference... r221856: If there's no package directory, don't try to install packages from it. Instead, report that 0 packages are reported. r221877: Restore BOOT2CFG, accidentally removed in r212938. r222535: Don't need (and can't use) -L to copy links here. Parts of the MFC's requested by: jpaetzel@ Modified: stable/8/tools/tools/nanobsd/nanobsd.sh Directory Properties: stable/8/tools/tools/nanobsd/ (props changed) Modified: stable/8/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- stable/8/tools/tools/nanobsd/nanobsd.sh Sun Oct 2 13:47:03 2011 (r225922) +++ stable/8/tools/tools/nanobsd/nanobsd.sh Sun Oct 2 13:48:15 2011 (r225923) @@ -75,6 +75,9 @@ CONF_WORLD=' ' # Kernel config file to use NANO_KERNEL=GENERIC +# Kernel modules to build; default is none +NANO_MODULES= + # Customize commands. NANO_CUSTOMIZE="" @@ -88,7 +91,7 @@ NANO_NEWFS="-b 4096 -f 512 -i 8192 -O1 - NANO_DRIVE=ad0 # Target media size in 512 bytes sectors -NANO_MEDIASIZE=1200000 +NANO_MEDIASIZE=1500000 # Number of code images on media (1 or 2) NANO_IMAGES=2 @@ -135,14 +138,27 @@ NANO_MD_BACKING="file" # Progress Print level PPLEVEL=3 +# Set NANO_LABEL to non-blank to form the basis for using /dev/ufs/label +# in preference to /dev/${NANO_DRIVE} +# Root partition will be ${NANO_LABEL}s{1,2} +# /cfg partition will be ${NANO_LABEL}s3 +# /data partition will be ${NANO_LABEL}s4 +NANO_LABEL="" + ####################################################################### # Architecture to build. Corresponds to TARGET_ARCH in a buildworld. -# Unfortunately, there's no way to set TARGET at this time, and it +# Unfortunately, there's no way to set TARGET at this time, and it # conflates the two, so architectures where TARGET != TARGET_ARCH do # not work. This defaults to the arch of the current machine. NANO_ARCH=`uname -p` +# Directory to populate /cfg from +NANO_CFGDIR="" + +# Directory to populate /data from +NANO_DATADIR="" + ####################################################################### # # The functions which do the real work. @@ -166,6 +182,7 @@ make_conf_build ( ) ( echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_BUILD} echo "${CONF_BUILD}" >> ${NANO_MAKE_CONF_BUILD} + echo "SRCCONF=/dev/null" >> ${NANO_MAKE_CONF_BUILD} ) build_world ( ) ( @@ -182,19 +199,26 @@ build_kernel ( ) ( pprint 2 "build kernel ($NANO_KERNEL)" pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.bk" + ( if [ -f ${NANO_KERNEL} ] ; then - cp ${NANO_KERNEL} ${NANO_SRC}/sys/${NANO_ARCH}/conf + kernconfdir=$(realpath $(dirname ${NANO_KERNEL})) + kernconf=$(basename ${NANO_KERNEL}) + else + kernconf=${NANO_KERNEL} fi - (cd ${NANO_SRC}; + cd ${NANO_SRC}; # unset these just in case to avoid compiler complaints # when cross-building unset TARGET_CPUTYPE unset TARGET_BIG_ENDIAN + # Note: We intentionally build all modules, not only the ones in + # NANO_MODULES so the built world can be reused by multiple images. env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} buildkernel \ - __MAKE_CONF=${NANO_MAKE_CONF_BUILD} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 - ) + __MAKE_CONF=${NANO_MAKE_CONF_BUILD} \ + ${kernconfdir:+"KERNCONFDIR="}${kernconfdir} \ + KERNCONF=${kernconf} + ) > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 ) clean_world ( ) ( @@ -221,6 +245,7 @@ make_conf_install ( ) ( echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_INSTALL} echo "${CONF_INSTALL}" >> ${NANO_MAKE_CONF_INSTALL} + echo "SRCCONF=/dev/null" >> ${NANO_MAKE_CONF_INSTALL} ) install_world ( ) ( @@ -251,14 +276,25 @@ install_etc ( ) ( ) install_kernel ( ) ( - pprint 2 "install kernel" + pprint 2 "install kernel ($NANO_KERNEL)" pprint 3 "log: ${NANO_OBJ}/_.ik" + ( + if [ -f ${NANO_KERNEL} ] ; then + kernconfdir=$(realpath $(dirname ${NANO_KERNEL})) + kernconf=$(basename ${NANO_KERNEL}) + else + kernconf=${NANO_KERNEL} + fi + cd ${NANO_SRC} env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ DESTDIR=${NANO_WORLDDIR} \ - __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${NANO_OBJ}/_.ik 2>&1 + __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} \ + ${kernconfdir:+"KERNCONFDIR="}${kernconfdir} \ + KERNCONF=${kernconf} \ + MODULES_OVERRIDE="${NANO_MODULES}" + ) > ${NANO_OBJ}/_.ik 2>&1 ) run_customize() ( @@ -269,7 +305,7 @@ run_customize() ( pprint 2 "customize \"$c\"" pprint 3 "log: ${NANO_OBJ}/_.cust.$c" pprint 4 "`type $c`" - ( $c ) > ${NANO_OBJ}/_.cust.$c 2>&1 + ( set -x ; $c ) > ${NANO_OBJ}/_.cust.$c 2>&1 done ) @@ -281,7 +317,7 @@ run_late_customize() ( pprint 2 "late customize \"$c\"" pprint 3 "log: ${NANO_OBJ}/_.late_cust.$c" pprint 4 "`type $c`" - ( $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1 + ( set -x ; $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1 done ) @@ -361,16 +397,26 @@ prune_usr() ( done ) +newfs_part ( ) ( + local dev mnt lbl + dev=$1 + mnt=$2 + lbl=$3 + echo newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev} + newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev} + mount -o async ${dev} ${mnt} +) + populate_slice ( ) ( - local dev dir mnt + local dev dir mnt lbl dev=$1 dir=$2 mnt=$3 - test -z $2 && dir=/var/empty - test -d $d || dir=/var/empty + lbl=$4 + test -z $2 && dir=${NANO_WORLDDIR}/var/empty + test -d $dir || dir=${NANO_WORLDDIR}/var/empty echo "Creating ${dev} with ${dir} (mounting on ${mnt})" - newfs ${NANO_NEWFS} ${dev} - mount ${dev} ${mnt} + newfs_part $dev $mnt $lbl cd ${dir} find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} df -i ${mnt} @@ -378,11 +424,11 @@ populate_slice ( ) ( ) populate_cfg_slice ( ) ( - populate_slice "$1" "$2" "$3" + populate_slice "$1" "$2" "$3" "$4" ) populate_data_slice ( ) ( - populate_slice "$1" "$2" "$3" + populate_slice "$1" "$2" "$3" "$4" ) create_i386_diskimage ( ) ( @@ -467,8 +513,8 @@ create_i386_diskimage ( ) ( -y ${NANO_HEADS}` else echo "Creating md backing file..." - dd if=/dev/zero of=${IMG} bs=${NANO_SECTS}b \ - count=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` + rm -f ${IMG} + dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ -y ${NANO_HEADS}` fi @@ -484,13 +530,8 @@ create_i386_diskimage ( ) ( bsdlabel ${MD}s1 # Create first image - # XXX: should use populate_slice for easier override - newfs ${NANO_NEWFS} /dev/${MD}s1a + populate_slice /dev/${MD}s1a ${NANO_WORLDDIR} ${MNT} "s1a" mount /dev/${MD}s1a ${MNT} - df -i ${MNT} - echo "Copying worlddir..." - ( cd ${NANO_WORLDDIR} && find . -print | cpio -dump ${MNT} ) - df -i ${MNT} echo "Generating mtree..." ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree ( cd ${MNT} && du -k ) > ${NANO_OBJ}/_.du @@ -506,14 +547,19 @@ create_i386_diskimage ( ) ( sed -i "" "s=${NANO_DRIVE}s1=${NANO_DRIVE}s2=g" $f done umount ${MNT} + # Override the label from the first partition so we + # don't confuse glabel with duplicates. + if [ ! -z ${NANO_LABEL} ]; then + tunefs -L ${NANO_LABEL}"s2a" /dev/${MD}s2a + fi fi # Create Config slice - populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} + populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} "s3" # Create Data slice, if any. if [ $NANO_DATASIZE -ne 0 ] ; then - populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} + populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} "s4" fi if [ "${NANO_MD_BACKING}" = "swap" ] ; then @@ -521,8 +567,10 @@ create_i386_diskimage ( ) ( dd if=/dev/${MD} of=${IMG} bs=64k fi - echo "Writing out _.disk.image..." - dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + if ${do_copyout_partition} ; then + echo "Writing out _.disk.image..." + dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + fi mdconfig -d -u $MD trap - 1 2 15 EXIT @@ -628,7 +676,7 @@ cust_allow_ssh_root () ( cust_install_files () ( cd ${NANO_TOOLS}/Files - find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${NANO_WORLDDIR} ) ####################################################################### @@ -636,12 +684,18 @@ cust_install_files () ( cust_pkg () ( + # If the package directory doesn't exist, we're done. + if [ ! -d ${NANO_PACKAGE_DIR} ]; then + echo "DONE 0 packages" + return 0 + fi + # Copy packages into chroot mkdir -p ${NANO_WORLDDIR}/Pkg ( cd ${NANO_PACKAGE_DIR} find ${NANO_PACKAGE_LIST} -print | - cpio -dumpv ${NANO_WORLDDIR}/Pkg + cpio -Ldumpv ${NANO_WORLDDIR}/Pkg ) # Count & report how many we have to install @@ -712,8 +766,9 @@ pprint() { usage () { ( - echo "Usage: $0 [-biknqvw] [-c config_file]" + echo "Usage: $0 [-bfiknqvw] [-c config_file]" echo " -b suppress builds (both kernel and world)" + echo " -f suppress code slice extraction" echo " -i suppress disk image build" echo " -k suppress buildkernel" echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" @@ -732,9 +787,10 @@ do_clean=true do_kernel=true do_world=true do_image=true +do_copyout_partition=true set +e -args=`getopt bc:hiknqvw $*` +args=`getopt bc:fhiknqvw $*` if [ $? -ne 0 ] ; then usage exit 2 @@ -760,6 +816,10 @@ do shift shift ;; + -f) + do_copyout_partition=false + shift + ;; -h) usage ;; @@ -820,6 +880,11 @@ else NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN" fi +# Override user's NANO_DRIVE if they specified a NANO_LABEL +if [ ! -z "${NANO_LABEL}" ]; then + NANO_DRIVE=ufs/${NANO_LABEL} +fi + export MAKEOBJDIRPREFIX export NANO_ARCH @@ -844,6 +909,7 @@ export NANO_TOOLS export NANO_WORLDDIR export NANO_BOOT0CFG export NANO_BOOTLOADER +export NANO_LABEL ####################################################################### # And then it is as simple as that... @@ -867,6 +933,9 @@ else fi if $do_kernel ; then + if ! $do_world ; then + make_conf_build + fi build_kernel else pprint 2 "Skipping buildkernel (as instructed)" From owner-svn-src-stable@FreeBSD.ORG Mon Oct 3 10:23:29 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FB70106566B; Mon, 3 Oct 2011 10:23:29 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F32DF8FC12; Mon, 3 Oct 2011 10:23:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p93ANSZx004028; Mon, 3 Oct 2011 10:23:28 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p93ANS5r004026; Mon, 3 Oct 2011 10:23:28 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201110031023.p93ANS5r004026@svn.freebsd.org> From: Attilio Rao Date: Mon, 3 Oct 2011 10:23:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225933 - stable/8/sys/dev/coretemp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2011 10:23:29 -0000 Author: attilio Date: Mon Oct 3 10:23:28 2011 New Revision: 225933 URL: http://svn.freebsd.org/changeset/base/225933 Log: MFC r225662: Cleanup #PROCHOT sticky assertion. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/coretemp/coretemp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/coretemp/coretemp.c ============================================================================== --- stable/8/sys/dev/coretemp/coretemp.c Sun Oct 2 23:31:14 2011 (r225932) +++ stable/8/sys/dev/coretemp/coretemp.c Mon Oct 3 10:23:28 2011 (r225933) @@ -384,6 +384,7 @@ coretemp_get_val_sysctl(SYSCTL_HANDLER_A } if (msr & THERM_STATUS_LOG) { + coretemp_clear_thermal_msr(device_get_unit(dev)); sc->sc_throttle_log = 1; /* @@ -424,8 +425,10 @@ coretemp_throttle_log_sysctl(SYSCTL_HAND msr = coretemp_get_thermal_msr(device_get_unit(dev)); sc = device_get_softc(dev); - if (msr & THERM_STATUS_LOG) + if (msr & THERM_STATUS_LOG) { + coretemp_clear_thermal_msr(device_get_unit(dev)); sc->sc_throttle_log = 1; + } val = sc->sc_throttle_log; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 3 20:05:21 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A12861065673; Mon, 3 Oct 2011 20:05:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9070E8FC0A; Mon, 3 Oct 2011 20:05:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p93K5LCN025757; Mon, 3 Oct 2011 20:05:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p93K5LWi025755; Mon, 3 Oct 2011 20:05:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201110032005.p93K5LWi025755@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Oct 2011 20:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225948 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2011 20:05:21 -0000 Author: kib Date: Mon Oct 3 20:05:21 2011 New Revision: 225948 URL: http://svn.freebsd.org/changeset/base/225948 Log: Restore the td_syscalls counter, that was erronously removed in the r225855. Note that this is a direct commit to stable/8, td_syscalls was removed in head by r210138. Submitted by: jhb Modified: stable/8/sys/kern/subr_syscall.c Modified: stable/8/sys/kern/subr_syscall.c ============================================================================== --- stable/8/sys/kern/subr_syscall.c Mon Oct 3 19:51:18 2011 (r225947) +++ stable/8/sys/kern/subr_syscall.c Mon Oct 3 20:05:21 2011 (r225948) @@ -58,6 +58,7 @@ syscallenter(struct thread *td, struct s PCPU_INC(cnt.v_syscall); p = td->td_proc; + td->td_syscalls++; td->td_pticks = 0; if (td->td_ucred != p->p_ucred) From owner-svn-src-stable@FreeBSD.ORG Mon Oct 3 20:27:52 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63DD4106566B; Mon, 3 Oct 2011 20:27:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FF568FC12; Mon, 3 Oct 2011 20:27:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p93KRqfs026472; Mon, 3 Oct 2011 20:27:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p93KRqf7026466; Mon, 3 Oct 2011 20:27:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201110032027.p93KRqf7026466@svn.freebsd.org> From: Dimitry Andric Date: Mon, 3 Oct 2011 20:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225949 - in stable/9: contrib/llvm contrib/llvm/lib/Support contrib/llvm/tools/clang etc/mtree share/doc share/doc/llvm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2011 20:27:52 -0000 Author: dim Date: Mon Oct 3 20:27:51 2011 New Revision: 225949 URL: http://svn.freebsd.org/changeset/base/225949 Log: MFC r225880: Revive the LLVM and Clang license files, which were removed in my too-thorough cleanup of unused files, in r213695. Also make sure these get installed under /usr/share/doc. Submitted by: rwatson, brooks Pointy hat to: dim Approved by: re (kib) Added: stable/9/contrib/llvm/LICENSE.TXT - copied unchanged from r225880, head/contrib/llvm/LICENSE.TXT stable/9/contrib/llvm/lib/Support/COPYRIGHT.regex - copied unchanged from r225880, head/contrib/llvm/lib/Support/COPYRIGHT.regex stable/9/contrib/llvm/tools/clang/LICENSE.TXT - copied unchanged from r225880, head/contrib/llvm/tools/clang/LICENSE.TXT stable/9/share/doc/llvm/ - copied from r225880, head/share/doc/llvm/ Modified: stable/9/etc/mtree/BSD.usr.dist stable/9/share/doc/Makefile Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) stable/9/etc/ (props changed) stable/9/share/doc/ (props changed) Copied: stable/9/contrib/llvm/LICENSE.TXT (from r225880, head/contrib/llvm/LICENSE.TXT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/LICENSE.TXT Mon Oct 3 20:27:51 2011 (r225949, copy of r225880, head/contrib/llvm/LICENSE.TXT) @@ -0,0 +1,69 @@ +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign. +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- +Autoconf llvm/autoconf + llvm/projects/ModuleMaker/autoconf + llvm/projects/sample/autoconf +CellSPU backend llvm/lib/Target/CellSPU/README.txt +Google Test llvm/utils/unittest/googletest +OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} Copied: stable/9/contrib/llvm/lib/Support/COPYRIGHT.regex (from r225880, head/contrib/llvm/lib/Support/COPYRIGHT.regex) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/lib/Support/COPYRIGHT.regex Mon Oct 3 20:27:51 2011 (r225949, copy of r225880, head/contrib/llvm/lib/Support/COPYRIGHT.regex) @@ -0,0 +1,54 @@ +$OpenBSD: COPYRIGHT,v 1.3 2003/06/02 20:18:36 millert Exp $ + +Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +/*- + * Copyright (c) 1994 + * The Regents of the University of California. All rights reserved. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94 + */ Copied: stable/9/contrib/llvm/tools/clang/LICENSE.TXT (from r225880, head/contrib/llvm/tools/clang/LICENSE.TXT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/tools/clang/LICENSE.TXT Mon Oct 3 20:27:51 2011 (r225949, copy of r225880, head/contrib/llvm/tools/clang/LICENSE.TXT) @@ -0,0 +1,63 @@ +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright (c) 2007-2011 University of Illinois at Urbana-Champaign. +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- + + Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Mon Oct 3 20:05:21 2011 (r225948) +++ stable/9/etc/mtree/BSD.usr.dist Mon Oct 3 20:27:51 2011 (r225949) @@ -93,6 +93,10 @@ intel_wpi .. .. + llvm + clang + .. + .. ncurses .. ntp Modified: stable/9/share/doc/Makefile ============================================================================== --- stable/9/share/doc/Makefile Mon Oct 3 20:05:21 2011 (r225948) +++ stable/9/share/doc/Makefile Mon Oct 3 20:27:51 2011 (r225949) @@ -3,12 +3,16 @@ .include -SUBDIR= ${_bind9} IPv6 legal ${_roffdocs} +SUBDIR= ${_bind9} IPv6 legal ${_llvm} ${_roffdocs} .if ${MK_BIND} != "no" _bind9= bind9 .endif +.if ${MK_CLANG} != "no" +_llvm= llvm +.endif + # FIXME this is not a real solution ... .if ${MK_GROFF} != "no" _roffdocs= papers psd smm usd From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 00:29:10 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8ABCB106564A; Tue, 4 Oct 2011 00:29:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 713218FC16; Tue, 4 Oct 2011 00:29:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p940TAmK034311; Tue, 4 Oct 2011 00:29:10 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p940TAE2034309; Tue, 4 Oct 2011 00:29:10 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201110040029.p940TAE2034309@svn.freebsd.org> From: Ed Maste Date: Tue, 4 Oct 2011 00:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225956 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 00:29:10 -0000 Author: emaste Date: Tue Oct 4 00:29:10 2011 New Revision: 225956 URL: http://svn.freebsd.org/changeset/base/225956 Log: MFC r225798: Improve battery capacity reporting When a status pointer is passed in mfi_dcmd_command does not return an errno (if the ioctl is successful), so move the test for NO_HW_PRESENT outside of the error case. This should fix incorrect reporting for systems with a dead or no battery. Additionally, handle error codes other than NO_HW_PRESENT by omitting the battery capacity display. LSI's supercap-based parts (CV series) report their data using the same interface as battery-based parts, except that they do not include the capacity stats (state of charge, cumulative charge cycles, etc.) PR: bin/160581 Modified: stable/8/usr.sbin/mfiutil/mfi_show.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_show.c Tue Oct 4 00:15:40 2011 (r225955) +++ stable/8/usr.sbin/mfiutil/mfi_show.c Tue Oct 4 00:29:10 2011 (r225956) @@ -141,7 +141,7 @@ show_battery(int ac, char **av) struct mfi_bbu_design_info design; struct mfi_bbu_status stat; uint8_t status; - int comma, error, fd; + int comma, error, fd, show_capacity; if (ac != 1) { warnx("show battery: extra arguments"); @@ -157,16 +157,17 @@ show_battery(int ac, char **av) if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_CAPACITY_INFO, &cap, sizeof(cap), NULL, 0, &status) < 0) { - if (status == MFI_STAT_NO_HW_PRESENT) { - printf("mfi%d: No battery present\n", mfi_unit); - close(fd); - return (0); - } error = errno; warn("Failed to get capacity info"); close(fd); return (error); } + if (status == MFI_STAT_NO_HW_PRESENT) { + printf("mfi%d: No battery present\n", mfi_unit); + close(fd); + return (0); + } + show_capacity = (status == MFI_STAT_OK); if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_DESIGN_INFO, &design, sizeof(design), NULL, 0, NULL) < 0) { @@ -192,10 +193,14 @@ show_battery(int ac, char **av) printf(" Model: %s\n", design.device_name); printf(" Chemistry: %s\n", design.device_chemistry); printf(" Design Capacity: %d mAh\n", design.design_capacity); - printf(" Full Charge Capacity: %d mAh\n", cap.full_charge_capacity); - printf(" Current Capacity: %d mAh\n", cap.remaining_capacity); - printf(" Charge Cycles: %d\n", cap.cycle_count); - printf(" Current Charge: %d%%\n", cap.relative_charge); + if (show_capacity) { + printf(" Full Charge Capacity: %d mAh\n", + cap.full_charge_capacity); + printf(" Current Capacity: %d mAh\n", + cap.remaining_capacity); + printf(" Charge Cycles: %d\n", cap.cycle_count); + printf(" Current Charge: %d%%\n", cap.relative_charge); + } printf(" Design Voltage: %d mV\n", design.design_voltage); printf(" Current Voltage: %d mV\n", stat.voltage); printf(" Temperature: %d C\n", stat.temperature); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 09:55:16 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D26C1065673; Tue, 4 Oct 2011 09:55:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C93E8FC1B; Tue, 4 Oct 2011 09:55:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p949tG9P052022; Tue, 4 Oct 2011 09:55:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p949tGO2052020; Tue, 4 Oct 2011 09:55:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201110040955.p949tGO2052020@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Oct 2011 09:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225961 - stable/8/libexec/rtld-elf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 09:55:16 -0000 Author: kib Date: Tue Oct 4 09:55:15 2011 New Revision: 225961 URL: http://svn.freebsd.org/changeset/base/225961 Log: MFC r225699: Restore the writing of the .bss sections of the dsos. Revert the optimization of using mprotect(2) to establish .bss, overlap the section with mmap(2). Modified: stable/8/libexec/rtld-elf/map_object.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/map_object.c ============================================================================== --- stable/8/libexec/rtld-elf/map_object.c Tue Oct 4 06:46:12 2011 (r225960) +++ stable/8/libexec/rtld-elf/map_object.c Tue Oct 4 09:55:15 2011 (r225961) @@ -209,8 +209,9 @@ map_object(int fd, const char *path, con bss_vlimit = round_page(segs[i]->p_vaddr + segs[i]->p_memsz); bss_addr = mapbase + (bss_vaddr - base_vaddr); if (bss_vlimit > bss_vaddr) { /* There is something to do */ - if (mprotect(bss_addr, bss_vlimit - bss_vaddr, data_prot) == -1) { - _rtld_error("%s: mprotect of bss failed: %s", path, + if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, + data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { + _rtld_error("%s: mmap of bss failed: %s", path, strerror(errno)); return NULL; } From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 10:00:29 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7319A1065675; Tue, 4 Oct 2011 10:00:29 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D39C8FC20; Tue, 4 Oct 2011 10:00:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94A0TSn052272; Tue, 4 Oct 2011 10:00:29 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94A0T75052269; Tue, 4 Oct 2011 10:00:29 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201110041000.p94A0T75052269@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 4 Oct 2011 10:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225962 - stable/9/usr.bin/script X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 10:00:29 -0000 Author: trociny Date: Tue Oct 4 10:00:28 2011 New Revision: 225962 URL: http://svn.freebsd.org/changeset/base/225962 Log: MFC r225809: When script(1) reads EOF from input it starts spinning on zero-byte reads eating 100% CPU. Fix this by skipping select on STDIN after reading EOF -- permanently if STDIN is not terminal and for one second if it is. Also after reading EOF from STDIN we have to pass it to the program being scripted. The previous approach was to write zero bytes into the pseudo-terminal. This does not work because zero-byte write does not have any effect on read. Fix this by sending VEOF instead. Submitted by: Ronald Klop Discussed with: kib, Chris Torek Approved by: re (kib) Modified: stable/9/usr.bin/script/script.1 stable/9/usr.bin/script/script.c Directory Properties: stable/9/usr.bin/script/ (props changed) Modified: stable/9/usr.bin/script/script.1 ============================================================================== --- stable/9/usr.bin/script/script.1 Tue Oct 4 09:55:15 2011 (r225961) +++ stable/9/usr.bin/script/script.1 Tue Oct 4 10:00:28 2011 (r225962) @@ -166,3 +166,12 @@ The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. +.Pp +If the +.Nm +reads zero bytes from the terminal it switches to a mode when it probes read +only once a second until it gets some data. +This prevents the +.Nm +spinning on zero-byte reads, but might cause a 1-second delay in +processing of the user input. Modified: stable/9/usr.bin/script/script.c ============================================================================== --- stable/9/usr.bin/script/script.c Tue Oct 4 09:55:15 2011 (r225961) +++ stable/9/usr.bin/script/script.c Tue Oct 4 10:00:28 2011 (r225962) @@ -86,6 +86,7 @@ main(int argc, char *argv[]) char ibuf[BUFSIZ]; fd_set rfd; int flushtime = 30; + int readstdin; aflg = kflg = 0; while ((ch = getopt(argc, argv, "aqkt:")) != -1) @@ -155,19 +156,21 @@ main(int argc, char *argv[]) doshell(argv); close(slave); - if (flushtime > 0) - tvp = &tv; - else - tvp = NULL; - - start = time(0); - FD_ZERO(&rfd); + start = tvec = time(0); + readstdin = 1; for (;;) { + FD_ZERO(&rfd); FD_SET(master, &rfd); - FD_SET(STDIN_FILENO, &rfd); - if (flushtime > 0) { - tv.tv_sec = flushtime; + if (readstdin) + FD_SET(STDIN_FILENO, &rfd); + if ((!readstdin && ttyflg) || flushtime > 0) { + tv.tv_sec = !readstdin && ttyflg ? 1 : + flushtime - (tvec - start); tv.tv_usec = 0; + tvp = &tv; + readstdin = 1; + } else { + tvp = NULL; } n = select(master + 1, &rfd, 0, 0, tvp); if (n < 0 && errno != EINTR) @@ -176,8 +179,13 @@ main(int argc, char *argv[]) cc = read(STDIN_FILENO, ibuf, BUFSIZ); if (cc < 0) break; - if (cc == 0) - (void)write(master, ibuf, 0); + if (cc == 0) { + if (tcgetattr(master, &stt) == 0 && + (stt.c_lflag & ICANON) != 0) { + (void)write(master, &stt.c_cc[VEOF], 1); + } + readstdin = 0; + } if (cc > 0) { (void)write(master, ibuf, cc); if (kflg && tcgetattr(master, &stt) >= 0 && From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 10:02:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89223106566C; Tue, 4 Oct 2011 10:02:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60A608FC1F; Tue, 4 Oct 2011 10:02:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94A2Ela052386; Tue, 4 Oct 2011 10:02:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94A2Elo052384; Tue, 4 Oct 2011 10:02:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201110041002.p94A2Elo052384@svn.freebsd.org> From: Alexander Motin Date: Tue, 4 Oct 2011 10:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225963 - stable/9/sys/powerpc/powerpc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 10:02:14 -0000 Author: mav Date: Tue Oct 4 10:02:14 2011 New Revision: 225963 URL: http://svn.freebsd.org/changeset/base/225963 Log: MFC 225953: Revert r225875, r225877: It is reported that on some chips (e.g. the 970MP) behavior of POW bit set simultaneously with modifying other bits is undefined and may cause hangs. The race should be handled in some other way, but for now just get back. Reported by: nwitehorn Approved by: re (kib) Modified: stable/9/sys/powerpc/powerpc/cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/9/sys/powerpc/powerpc/cpu.c Tue Oct 4 10:00:28 2011 (r225962) +++ stable/9/sys/powerpc/powerpc/cpu.c Tue Oct 4 10:02:14 2011 (r225963) @@ -65,7 +65,6 @@ #include #include #include -#include #include #include @@ -554,11 +553,6 @@ cpu_idle_60x(void) vers = mfpvr() >> 16; #ifdef AIM - mtmsr(msr & ~PSL_EE); - if (sched_runnable()) { - mtmsr(msr); - return; - } switch (vers) { case IBM970: case IBM970FX: @@ -589,11 +583,6 @@ cpu_idle_e500(void) msr = mfmsr(); #ifdef E500 - mtmsr(msr & ~PSL_EE); - if (sched_runnable()) { - mtmsr(msr); - return; - } /* Freescale E500 core RM section 6.4.1. */ __asm __volatile("msync; mtmsr %0; isync" :: "r" (msr | PSL_WE)); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 10:08:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6432A106564A; Tue, 4 Oct 2011 10:08:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 540258FC13; Tue, 4 Oct 2011 10:08:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94A82Jd052715; Tue, 4 Oct 2011 10:08:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94A82av052712; Tue, 4 Oct 2011 10:08:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201110041008.p94A82av052712@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Oct 2011 10:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225964 - in stable/8: etc/mtree include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 10:08:02 -0000 Author: kib Date: Tue Oct 4 10:08:02 2011 New Revision: 225964 URL: http://svn.freebsd.org/changeset/base/225964 Log: MFC r225790: Install ciss(4) ioctl header. PR: kern/109813 Modified: stable/8/etc/mtree/BSD.include.dist stable/8/include/Makefile Directory Properties: stable/8/etc/ (props changed) stable/8/include/ (props changed) Modified: stable/8/etc/mtree/BSD.include.dist ============================================================================== --- stable/8/etc/mtree/BSD.include.dist Tue Oct 4 10:02:14 2011 (r225963) +++ stable/8/etc/mtree/BSD.include.dist Tue Oct 4 10:08:02 2011 (r225964) @@ -92,6 +92,8 @@ .. bktr .. + ciss + .. firewire .. hwpmc Modified: stable/8/include/Makefile ============================================================================== --- stable/8/include/Makefile Tue Oct 4 10:02:14 2011 (r225963) +++ stable/8/include/Makefile Tue Oct 4 10:08:02 2011 (r225964) @@ -39,7 +39,7 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ + dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:02:49 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57F80106566C; Tue, 4 Oct 2011 11:02:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E8798FC08; Tue, 4 Oct 2011 11:02:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94B2nRw054516; Tue, 4 Oct 2011 11:02:49 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94B2neP054513; Tue, 4 Oct 2011 11:02:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041102.p94B2neP054513@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 11:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225965 - in stable/9/sys: modules/ipfw netinet/ipfw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:02:49 -0000 Author: bz Date: Tue Oct 4 11:02:48 2011 New Revision: 225965 URL: http://svn.freebsd.org/changeset/base/225965 Log: MFC r225793: Unbreak no-ip and no-inet6 module builds with ipfw. For now continue to build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under the assumption that the private L2 hook (which hopefully eventually will be a pfil hook as well) can still be useful. Allow building the module without inet as well. Approved by: re (kib) Modified: stable/9/sys/modules/ipfw/Makefile stable/9/sys/netinet/ipfw/ip_fw_pfil.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/modules/ipfw/Makefile ============================================================================== --- stable/9/sys/modules/ipfw/Makefile Tue Oct 4 10:08:02 2011 (r225964) +++ stable/9/sys/modules/ipfw/Makefile Tue Oct 4 11:02:48 2011 (r225965) @@ -8,7 +8,7 @@ KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c SRCS+= ip_fw_dynamic.c ip_fw_log.c SRCS+= ip_fw_sockopt.c ip_fw_table.c -SRCS+= opt_inet6.h opt_ipfw.h opt_ipsec.h +SRCS+= opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h CFLAGS+= -DIPFIREWALL CFLAGS+= -I${.CURDIR}/../../contrib/pf @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf # .if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + echo "#define INET 1" > ${.TARGET} +.endif .if ${MK_INET6_SUPPORT} != "no" opt_inet6.h: echo "#define INET6 1" > ${.TARGET} Modified: stable/9/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_pfil.c Tue Oct 4 10:08:02 2011 (r225964) +++ stable/9/sys/netinet/ipfw/ip_fw_pfil.c Tue Oct 4 11:02:48 2011 (r225965) @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$"); #if !defined(KLD_MODULE) #include "opt_ipdn.h" #include "opt_inet.h" +#include "opt_inet6.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ #endif /* KLD_MODULE */ -#include "opt_inet6.h" #include #include @@ -154,7 +154,7 @@ again: /* next_hop may be set by ipfw_chk */ if (args.next_hop == NULL && args.next_hop6 == NULL) break; /* pass */ -#ifndef IPFIREWALL_FORWARD +#if !defined(IPFIREWALL_FORWARD) || (!defined(INET6) && !defined(INET)) ret = EACCES; #else { @@ -205,7 +205,7 @@ again: #endif m_tag_prepend(*m0, fwd_tag); } -#endif +#endif /* IPFIREWALL_FORWARD */ break; case IP_FW_DENY: From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:08:32 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D1D5106566B; Tue, 4 Oct 2011 11:08:32 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22DE38FC15; Tue, 4 Oct 2011 11:08:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94B8WLR054738; Tue, 4 Oct 2011 11:08:32 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94B8Wuu054735; Tue, 4 Oct 2011 11:08:32 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201110041108.p94B8Wuu054735@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 4 Oct 2011 11:08:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225966 - stable/8/usr.bin/script X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:08:32 -0000 Author: trociny Date: Tue Oct 4 11:08:31 2011 New Revision: 225966 URL: http://svn.freebsd.org/changeset/base/225966 Log: MFC r225809: When script(1) reads EOF from input it starts spinning on zero-byte reads eating 100% CPU. Fix this by skipping select on STDIN after reading EOF -- permanently if STDIN is not terminal and for one second if it is. Also after reading EOF from STDIN we have to pass it to the program being scripted. The previous approach was to write zero bytes into the pseudo-terminal. This does not work because zero-byte write does not have any effect on read. Fix this by sending VEOF instead. Submitted by: Ronald Klop Discussed with: kib, Chris Torek Modified: stable/8/usr.bin/script/script.1 stable/8/usr.bin/script/script.c Directory Properties: stable/8/usr.bin/script/ (props changed) Modified: stable/8/usr.bin/script/script.1 ============================================================================== --- stable/8/usr.bin/script/script.1 Tue Oct 4 11:02:48 2011 (r225965) +++ stable/8/usr.bin/script/script.1 Tue Oct 4 11:08:31 2011 (r225966) @@ -170,3 +170,12 @@ The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. +.Pp +If the +.Nm +reads zero bytes from the terminal it switches to a mode when it probes read +only once a second until it gets some data. +This prevents the +.Nm +spinning on zero-byte reads, but might cause a 1-second delay in +processing of the user input. Modified: stable/8/usr.bin/script/script.c ============================================================================== --- stable/8/usr.bin/script/script.c Tue Oct 4 11:02:48 2011 (r225965) +++ stable/8/usr.bin/script/script.c Tue Oct 4 11:08:31 2011 (r225966) @@ -91,6 +91,7 @@ main(int argc, char *argv[]) char ibuf[BUFSIZ]; fd_set rfd; int flushtime = 30; + int readstdin; aflg = kflg = 0; while ((ch = getopt(argc, argv, "aqkt:")) != -1) @@ -160,19 +161,21 @@ main(int argc, char *argv[]) doshell(argv); close(slave); - if (flushtime > 0) - tvp = &tv; - else - tvp = NULL; - - start = time(0); - FD_ZERO(&rfd); + start = tvec = time(0); + readstdin = 1; for (;;) { + FD_ZERO(&rfd); FD_SET(master, &rfd); - FD_SET(STDIN_FILENO, &rfd); - if (flushtime > 0) { - tv.tv_sec = flushtime; + if (readstdin) + FD_SET(STDIN_FILENO, &rfd); + if ((!readstdin && ttyflg) || flushtime > 0) { + tv.tv_sec = !readstdin && ttyflg ? 1 : + flushtime - (tvec - start); tv.tv_usec = 0; + tvp = &tv; + readstdin = 1; + } else { + tvp = NULL; } n = select(master + 1, &rfd, 0, 0, tvp); if (n < 0 && errno != EINTR) @@ -181,8 +184,13 @@ main(int argc, char *argv[]) cc = read(STDIN_FILENO, ibuf, BUFSIZ); if (cc < 0) break; - if (cc == 0) - (void)write(master, ibuf, 0); + if (cc == 0) { + if (tcgetattr(master, &stt) == 0 && + (stt.c_lflag & ICANON) != 0) { + (void)write(master, &stt.c_cc[VEOF], 1); + } + readstdin = 0; + } if (cc > 0) { (void)write(master, ibuf, cc); if (kflg && tcgetattr(master, &stt) >= 0 && From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:08:45 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29A2E106578A; Tue, 4 Oct 2011 11:08:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 190738FC12; Tue, 4 Oct 2011 11:08:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94B8iIP054781; Tue, 4 Oct 2011 11:08:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94B8iuH054778; Tue, 4 Oct 2011 11:08:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201110041108.p94B8iuH054778@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Oct 2011 11:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225967 - in stable/9: etc/mtree include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:08:45 -0000 Author: kib Date: Tue Oct 4 11:08:44 2011 New Revision: 225967 URL: http://svn.freebsd.org/changeset/base/225967 Log: MFC r225790: Install ciss(4) ioctl header. PR: kern/109813 Approved by: re (bz) Modified: stable/9/etc/mtree/BSD.include.dist stable/9/include/Makefile Directory Properties: stable/9/etc/ (props changed) stable/9/include/ (props changed) Modified: stable/9/etc/mtree/BSD.include.dist ============================================================================== --- stable/9/etc/mtree/BSD.include.dist Tue Oct 4 11:08:31 2011 (r225966) +++ stable/9/etc/mtree/BSD.include.dist Tue Oct 4 11:08:44 2011 (r225967) @@ -96,6 +96,8 @@ .. bktr .. + ciss + .. firewire .. hwpmc Modified: stable/9/include/Makefile ============================================================================== --- stable/9/include/Makefile Tue Oct 4 11:08:31 2011 (r225966) +++ stable/9/include/Makefile Tue Oct 4 11:08:44 2011 (r225967) @@ -39,7 +39,7 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ + dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:10:12 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 554DE106566B; Tue, 4 Oct 2011 11:10:12 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B33A8FC0A; Tue, 4 Oct 2011 11:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94BACgh054871; Tue, 4 Oct 2011 11:10:12 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94BACvW054868; Tue, 4 Oct 2011 11:10:12 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201110041110.p94BACvW054868@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 4 Oct 2011 11:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225968 - stable/7/usr.bin/script X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:10:12 -0000 Author: trociny Date: Tue Oct 4 11:10:11 2011 New Revision: 225968 URL: http://svn.freebsd.org/changeset/base/225968 Log: MFC r225809: When script(1) reads EOF from input it starts spinning on zero-byte reads eating 100% CPU. Fix this by skipping select on STDIN after reading EOF -- permanently if STDIN is not terminal and for one second if it is. Also after reading EOF from STDIN we have to pass it to the program being scripted. The previous approach was to write zero bytes into the pseudo-terminal. This does not work because zero-byte write does not have any effect on read. Fix this by sending VEOF instead. Reported by: Ronald Klop Discussed with: kib, Chris Torek Modified: stable/7/usr.bin/script/script.1 stable/7/usr.bin/script/script.c Directory Properties: stable/7/usr.bin/script/ (props changed) Modified: stable/7/usr.bin/script/script.1 ============================================================================== --- stable/7/usr.bin/script/script.1 Tue Oct 4 11:08:44 2011 (r225967) +++ stable/7/usr.bin/script/script.1 Tue Oct 4 11:10:11 2011 (r225968) @@ -170,3 +170,12 @@ The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. +.Pp +If the +.Nm +reads zero bytes from the terminal it switches to a mode when it probes read +only once a second until it gets some data. +This prevents the +.Nm +spinning on zero-byte reads, but might cause a 1-second delay in +processing of the user input. Modified: stable/7/usr.bin/script/script.c ============================================================================== --- stable/7/usr.bin/script/script.c Tue Oct 4 11:08:44 2011 (r225967) +++ stable/7/usr.bin/script/script.c Tue Oct 4 11:10:11 2011 (r225968) @@ -91,6 +91,7 @@ main(int argc, char *argv[]) char ibuf[BUFSIZ]; fd_set rfd; int flushtime = 30; + int readstdin; aflg = kflg = 0; while ((ch = getopt(argc, argv, "aqkt:")) != -1) @@ -159,19 +160,21 @@ main(int argc, char *argv[]) if (child == 0) doshell(argv); - if (flushtime > 0) - tvp = &tv; - else - tvp = NULL; - - start = time(0); - FD_ZERO(&rfd); + start = tvec = time(0); + readstdin = 1; for (;;) { + FD_ZERO(&rfd); FD_SET(master, &rfd); - FD_SET(STDIN_FILENO, &rfd); - if (flushtime > 0) { - tv.tv_sec = flushtime; + if (readstdin) + FD_SET(STDIN_FILENO, &rfd); + if ((!readstdin && ttyflg) || flushtime > 0) { + tv.tv_sec = !readstdin && ttyflg ? 1 : + flushtime - (tvec - start); tv.tv_usec = 0; + tvp = &tv; + readstdin = 1; + } else { + tvp = NULL; } n = select(master + 1, &rfd, 0, 0, tvp); if (n < 0 && errno != EINTR) @@ -180,8 +183,13 @@ main(int argc, char *argv[]) cc = read(STDIN_FILENO, ibuf, BUFSIZ); if (cc < 0) break; - if (cc == 0) - (void)write(master, ibuf, 0); + if (cc == 0) { + if (tcgetattr(master, &stt) == 0 && + (stt.c_lflag & ICANON) != 0) { + (void)write(master, &stt.c_cc[VEOF], 1); + } + readstdin = 0; + } if (cc > 0) { (void)write(master, ibuf, cc); if (kflg && tcgetattr(master, &stt) >= 0 && From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:23:04 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41174106566B; Tue, 4 Oct 2011 11:23:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3030E8FC14; Tue, 4 Oct 2011 11:23:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94BN4lB055349; Tue, 4 Oct 2011 11:23:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94BN4Pp055347; Tue, 4 Oct 2011 11:23:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201110041123.p94BN4Pp055347@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Oct 2011 11:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225969 - stable/8/lib/libc/stdtime X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:23:04 -0000 Author: kib Date: Tue Oct 4 11:23:03 2011 New Revision: 225969 URL: http://svn.freebsd.org/changeset/base/225969 Log: MFC r225677: Do not overallocate on the stack. Threaded code might use custom stack size. Modified: stable/8/lib/libc/stdtime/localtime.c Directory Properties: stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/stdtime/localtime.c ============================================================================== --- stable/8/lib/libc/stdtime/localtime.c Tue Oct 4 11:10:11 2011 (r225968) +++ stable/8/lib/libc/stdtime/localtime.c Tue Oct 4 11:23:03 2011 (r225969) @@ -388,12 +388,16 @@ register const int doextend; int fid; int stored; int nread; + int res; union { struct tzhead tzhead; char buf[2 * sizeof(struct tzhead) + 2 * sizeof *sp + 4 * TZ_MAX_TIMES]; - } u; + } *u; + + u = NULL; + res = -1; /* XXX The following is from OpenBSD, and I'm not sure it is correct */ if (name != NULL && issetugid() != 0) @@ -412,16 +416,24 @@ register const int doextend; ** to hold the longest file name string that the implementation ** guarantees can be opened." */ - char fullname[FILENAME_MAX + 1]; + char *fullname; + + fullname = malloc(FILENAME_MAX + 1); + if (fullname == NULL) + goto out; if (name[0] == ':') ++name; doaccess = name[0] == '/'; if (!doaccess) { - if ((p = TZDIR) == NULL) + if ((p = TZDIR) == NULL) { + free(fullname); return -1; - if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname) + } + if (strlen(p) + 1 + strlen(name) >= FILENAME_MAX) { + free(fullname); return -1; + } (void) strcpy(fullname, p); (void) strcat(fullname, "/"); (void) strcat(fullname, name); @@ -432,37 +444,45 @@ register const int doextend; doaccess = TRUE; name = fullname; } - if (doaccess && access(name, R_OK) != 0) + if (doaccess && access(name, R_OK) != 0) { + free(fullname); return -1; - if ((fid = _open(name, OPEN_MODE)) == -1) + } + if ((fid = _open(name, OPEN_MODE)) == -1) { + free(fullname); return -1; + } if ((_fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) { + free(fullname); _close(fid); return -1; } } - nread = _read(fid, u.buf, sizeof u.buf); + u = malloc(sizeof(*u)); + if (u == NULL) + goto out; + nread = _read(fid, u->buf, sizeof u->buf); if (_close(fid) < 0 || nread <= 0) - return -1; + goto out; for (stored = 4; stored <= 8; stored *= 2) { int ttisstdcnt; int ttisgmtcnt; - ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt); - ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt); - sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt); - sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt); - sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt); - sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt); - p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt; + ttisstdcnt = (int) detzcode(u->tzhead.tzh_ttisstdcnt); + ttisgmtcnt = (int) detzcode(u->tzhead.tzh_ttisgmtcnt); + sp->leapcnt = (int) detzcode(u->tzhead.tzh_leapcnt); + sp->timecnt = (int) detzcode(u->tzhead.tzh_timecnt); + sp->typecnt = (int) detzcode(u->tzhead.tzh_typecnt); + sp->charcnt = (int) detzcode(u->tzhead.tzh_charcnt); + p = u->tzhead.tzh_charcnt + sizeof u->tzhead.tzh_charcnt; if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS || sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES || sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES || sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS || (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) || (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0)) - return -1; - if (nread - (p - u.buf) < + goto out; + if (nread - (p - u->buf) < sp->timecnt * stored + /* ats */ sp->timecnt + /* types */ sp->typecnt * 6 + /* ttinfos */ @@ -470,7 +490,7 @@ register const int doextend; sp->leapcnt * (stored + 4) + /* lsinfos */ ttisstdcnt + /* ttisstds */ ttisgmtcnt) /* ttisgmts */ - return -1; + goto out; for (i = 0; i < sp->timecnt; ++i) { sp->ats[i] = (stored == 4) ? detzcode(p) : detzcode64(p); @@ -479,7 +499,7 @@ register const int doextend; for (i = 0; i < sp->timecnt; ++i) { sp->types[i] = (unsigned char) *p++; if (sp->types[i] >= sp->typecnt) - return -1; + goto out; } for (i = 0; i < sp->typecnt; ++i) { struct ttinfo * ttisp; @@ -489,11 +509,11 @@ register const int doextend; p += 4; ttisp->tt_isdst = (unsigned char) *p++; if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1) - return -1; + goto out; ttisp->tt_abbrind = (unsigned char) *p++; if (ttisp->tt_abbrind < 0 || ttisp->tt_abbrind > sp->charcnt) - return -1; + goto out; } for (i = 0; i < sp->charcnt; ++i) sp->chars[i] = *p++; @@ -518,7 +538,7 @@ register const int doextend; ttisp->tt_ttisstd = *p++; if (ttisp->tt_ttisstd != TRUE && ttisp->tt_ttisstd != FALSE) - return -1; + goto out; } } for (i = 0; i < sp->typecnt; ++i) { @@ -531,7 +551,7 @@ register const int doextend; ttisp->tt_ttisgmt = *p++; if (ttisp->tt_ttisgmt != TRUE && ttisp->tt_ttisgmt != FALSE) - return -1; + goto out; } } /* @@ -564,11 +584,11 @@ register const int doextend; /* ** If this is an old file, we're done. */ - if (u.tzhead.tzh_version[0] == '\0') + if (u->tzhead.tzh_version[0] == '\0') break; - nread -= p - u.buf; + nread -= p - u->buf; for (i = 0; i < nread; ++i) - u.buf[i] = p[i]; + u->buf[i] = p[i]; /* ** If this is a narrow integer time_t system, we're done. */ @@ -576,39 +596,43 @@ register const int doextend; break; } if (doextend && nread > 2 && - u.buf[0] == '\n' && u.buf[nread - 1] == '\n' && + u->buf[0] == '\n' && u->buf[nread - 1] == '\n' && sp->typecnt + 2 <= TZ_MAX_TYPES) { - struct state ts; + struct state *ts; register int result; - u.buf[nread - 1] = '\0'; - result = tzparse(&u.buf[1], &ts, FALSE); - if (result == 0 && ts.typecnt == 2 && - sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) { + ts = malloc(sizeof(*ts)); + if (ts == NULL) + goto out; + u->buf[nread - 1] = '\0'; + result = tzparse(&u->buf[1], ts, FALSE); + if (result == 0 && ts->typecnt == 2 && + sp->charcnt + ts->charcnt <= TZ_MAX_CHARS) { for (i = 0; i < 2; ++i) - ts.ttis[i].tt_abbrind += + ts->ttis[i].tt_abbrind += sp->charcnt; - for (i = 0; i < ts.charcnt; ++i) + for (i = 0; i < ts->charcnt; ++i) sp->chars[sp->charcnt++] = - ts.chars[i]; + ts->chars[i]; i = 0; - while (i < ts.timecnt && - ts.ats[i] <= + while (i < ts->timecnt && + ts->ats[i] <= sp->ats[sp->timecnt - 1]) ++i; - while (i < ts.timecnt && + while (i < ts->timecnt && sp->timecnt < TZ_MAX_TIMES) { sp->ats[sp->timecnt] = - ts.ats[i]; + ts->ats[i]; sp->types[sp->timecnt] = sp->typecnt + - ts.types[i]; + ts->types[i]; ++sp->timecnt; ++i; } - sp->ttis[sp->typecnt++] = ts.ttis[0]; - sp->ttis[sp->typecnt++] = ts.ttis[1]; + sp->ttis[sp->typecnt++] = ts->ttis[0]; + sp->ttis[sp->typecnt++] = ts->ttis[1]; } + free(ts); } sp->goback = sp->goahead = FALSE; if (sp->timecnt > 1) { @@ -627,7 +651,10 @@ register const int doextend; break; } } - return 0; + res = 0; +out: + free(u); + return (res); } static int From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:35:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8716106566B; Tue, 4 Oct 2011 11:35:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6F638FC08; Tue, 4 Oct 2011 11:35:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94BZICF055777; Tue, 4 Oct 2011 11:35:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94BZIBO055771; Tue, 4 Oct 2011 11:35:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041135.p94BZIBO055771@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 11:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225970 - stable/9/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:35:19 -0000 Author: bz Date: Tue Oct 4 11:35:18 2011 New Revision: 225970 URL: http://svn.freebsd.org/changeset/base/225970 Log: MFC r225837: Pass the fibnum where we need filtering of the message on the rtsock allowing routing daemons to filter routing updates on an rtsock per FIB. Adjust raw_input() and split it into wrapper and a new function taking an optional callback argument even though we only have one consumer [1] to keep the hackish flags local to rtsock.c. Submitted by: multiple (see PR) Suggested by: rwatson [1] Reviewed by: rwatson PR: kern/134931 Approved by: re (kib) Modified: stable/9/sys/net/raw_cb.h stable/9/sys/net/raw_usrreq.c stable/9/sys/net/route.c stable/9/sys/net/route.h stable/9/sys/net/rtsock.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/net/raw_cb.h ============================================================================== --- stable/9/sys/net/raw_cb.h Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/raw_cb.h Tue Oct 4 11:35:18 2011 (r225970) @@ -70,9 +70,14 @@ pr_init_t raw_init; * Library routines for raw socket usrreq functions; will always be wrapped * so that protocol-specific functions can be handled. */ +typedef int (*raw_input_cb_fn)(struct mbuf *, struct sockproto *, + struct sockaddr *, struct rawcb *); + int raw_attach(struct socket *, int); void raw_detach(struct rawcb *); void raw_input(struct mbuf *, struct sockproto *, struct sockaddr *); +void raw_input_ext(struct mbuf *, struct sockproto *, struct sockaddr *, + raw_input_cb_fn); /* * Generic pr_usrreqs entries for raw socket protocols, usually wrapped so Modified: stable/9/sys/net/raw_usrreq.c ============================================================================== --- stable/9/sys/net/raw_usrreq.c Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/raw_usrreq.c Tue Oct 4 11:35:18 2011 (r225970) @@ -71,6 +71,14 @@ raw_init(void) void raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src) { + + return (raw_input_ext(m0, proto, src, NULL)); +} + +void +raw_input_ext(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, + raw_input_cb_fn cb) +{ struct rawcb *rp; struct mbuf *m = m0; struct socket *last; @@ -83,6 +91,8 @@ raw_input(struct mbuf *m0, struct sockpr if (rp->rcb_proto.sp_protocol && rp->rcb_proto.sp_protocol != proto->sp_protocol) continue; + if (cb != NULL && (*cb)(m, proto, src, rp) != 0) + continue; if (last) { struct mbuf *n; n = m_copy(m, 0, (int)M_COPYALL); Modified: stable/9/sys/net/route.c ============================================================================== --- stable/9/sys/net/route.c Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/route.c Tue Oct 4 11:35:18 2011 (r225970) @@ -384,7 +384,7 @@ miss: */ bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); + rt_missmsg_fib(msgtype, &info, 0, err, fibnum); } done: if (newrt) @@ -609,7 +609,7 @@ out: info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_NETMASK] = netmask; info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, error); + rt_missmsg_fib(RTM_REDIRECT, &info, flags, error, fibnum); if (ifa != NULL) ifa_free(ifa); } @@ -1522,7 +1522,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int } RT_ADDREF(rt); RT_UNLOCK(rt); - rt_newaddrmsg(cmd, ifa, error, rt); + rt_newaddrmsg_fib(cmd, ifa, error, rt, fibnum); RT_LOCK(rt); RT_REMREF(rt); if (cmd == RTM_DELETE) { Modified: stable/9/sys/net/route.h ============================================================================== --- stable/9/sys/net/route.h Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/route.h Tue Oct 4 11:35:18 2011 (r225970) @@ -369,7 +369,9 @@ void rt_ieee80211msg(struct ifnet *, in void rt_ifannouncemsg(struct ifnet *, int); void rt_ifmsg(struct ifnet *); void rt_missmsg(int, struct rt_addrinfo *, int, int); +void rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int); void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); +void rt_newaddrmsg_fib(int, struct ifaddr *, int, struct rtentry *, int); void rt_newmaddrmsg(int, struct ifmultiaddr *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); Modified: stable/9/sys/net/rtsock.c ============================================================================== --- stable/9/sys/net/rtsock.c Tue Oct 4 11:23:03 2011 (r225969) +++ stable/9/sys/net/rtsock.c Tue Oct 4 11:35:18 2011 (r225970) @@ -122,6 +122,13 @@ MALLOC_DEFINE(M_RTABLE, "routetbl", "rou static struct sockaddr route_src = { 2, PF_ROUTE, }; static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, }; +/* + * Used by rtsock/raw_input callback code to decide whether to filter the update + * notification to a socket bound to a particular FIB. + */ +#define RTS_FILTER_FIB M_PROTO8 +#define RTS_ALLFIBS -1 + static struct { int ip_count; /* attached w/ AF_INET */ int ip6_count; /* attached w/ AF_INET6 */ @@ -196,6 +203,31 @@ rts_init(void) } SYSINIT(rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rts_init, 0); +static int +raw_input_rts_cb(struct mbuf *m, struct sockproto *proto, struct sockaddr *src, + struct rawcb *rp) +{ + int fibnum; + + KASSERT(m != NULL, ("%s: m is NULL", __func__)); + KASSERT(proto != NULL, ("%s: proto is NULL", __func__)); + KASSERT(rp != NULL, ("%s: rp is NULL", __func__)); + + /* No filtering requested. */ + if ((m->m_flags & RTS_FILTER_FIB) == 0) + return (0); + + /* Check if it is a rts and the fib matches the one of the socket. */ + fibnum = M_GETFIB(m); + if (proto->sp_family != PF_ROUTE || + rp->rcb_socket == NULL || + rp->rcb_socket->so_fibnum == fibnum) + return (0); + + /* Filtering requested and no match, the socket shall be skipped. */ + return (1); +} + static void rts_input(struct mbuf *m) { @@ -212,7 +244,7 @@ rts_input(struct mbuf *m) } else route_proto.sp_protocol = 0; - raw_input(m, &route_proto, &route_src); + raw_input_ext(m, &route_proto, &route_src, raw_input_rts_cb); } /* @@ -885,6 +917,8 @@ flush: m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len); } if (m) { + M_SETFIB(m, so->so_fibnum); + m->m_flags |= RTS_FILTER_FIB; if (rp) { /* * XXX insure we don't get a copy by @@ -1127,7 +1161,8 @@ again: * destination. */ void -rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +rt_missmsg_fib(int type, struct rt_addrinfo *rtinfo, int flags, int error, + int fibnum) { struct rt_msghdr *rtm; struct mbuf *m; @@ -1138,6 +1173,14 @@ rt_missmsg(int type, struct rt_addrinfo m = rt_msg1(type, rtinfo); if (m == NULL) return; + + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: fibnum out " + "of range 0 <= %d < %d", __func__, fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } + rtm = mtod(m, struct rt_msghdr *); rtm->rtm_flags = RTF_DONE | flags; rtm->rtm_errno = error; @@ -1145,6 +1188,13 @@ rt_missmsg(int type, struct rt_addrinfo rt_dispatch(m, sa); } +void +rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +{ + + rt_missmsg_fib(type, rtinfo, flags, error, RTS_ALLFIBS); +} + /* * This routine is called to generate a message from the routing * socket indicating that the status of a network interface has changed. @@ -1179,7 +1229,8 @@ rt_ifmsg(struct ifnet *ifp) * copies of it. */ void -rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +rt_newaddrmsg_fib(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt, + int fibnum) { struct rt_addrinfo info; struct sockaddr *sa = NULL; @@ -1237,10 +1288,24 @@ rt_newaddrmsg(int cmd, struct ifaddr *if rtm->rtm_errno = error; rtm->rtm_addrs = info.rti_addrs; } + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: " + "fibnum out of range 0 <= %d < %d", __func__, + fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } rt_dispatch(m, sa); } } +void +rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +{ + + rt_newaddrmsg_fib(cmd, ifa, error, rt, RTS_ALLFIBS); +} + /* * This is the analogue to the rt_newaddrmsg which performs the same * function but for multicast group memberhips. This is easier since From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 11:54:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 754AA106566B; Tue, 4 Oct 2011 11:54:57 +0000 (UTC) (envelope-from melifaro@yandex-team.ru) Received: from forward6.mail.yandex.net (forward6.mail.yandex.net [IPv6:2a02:6b8:0:202::1]) by mx1.freebsd.org (Postfix) with ESMTP id D1E978FC0C; Tue, 4 Oct 2011 11:54:53 +0000 (UTC) Received: from smtpcorp2.mail.yandex.net (smtpcorp2.mail.yandex.net [77.88.61.36]) by forward6.mail.yandex.net (Yandex) with ESMTP id F2A3CF82AF7; Tue, 4 Oct 2011 15:54:51 +0400 (MSD) Received: from smtpcorp2.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp2.mail.yandex.net (Yandex) with ESMTP id DF1BD740110; Tue, 4 Oct 2011 15:54:51 +0400 (MSD) Received: from dhcp170-36-red.yandex.net (dhcp170-36-red.yandex.net [95.108.170.36]) by smtpcorp2.mail.yandex.net (nwsmtp/Yandex) with ESMTP id spLCWQo9; Tue, 4 Oct 2011 15:54:51 +0400 Message-ID: <4E8AF3AC.8050001@yandex-team.ru> Date: Tue, 04 Oct 2011 15:53:16 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.16) Gecko/20110120 Thunderbird/3.0.11 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201110041135.p94BZIBO055771@svn.freebsd.org> In-Reply-To: <201110041135.p94BZIBO055771@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 04 Oct 2011 12:24:36 +0000 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r225970 - stable/9/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 11:54:57 -0000 On 04.10.2011 15:35, Bjoern A. Zeeb wrote: > Author: bz > Date: Tue Oct 4 11:35:18 2011 > New Revision: 225970 > URL: http://svn.freebsd.org/changeset/base/225970 > > Log: > MFC r225837: Thanks for merging this very very long-awaited fix! From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 12:45:24 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E402E106566C; Tue, 4 Oct 2011 12:45:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D337F8FC1A; Tue, 4 Oct 2011 12:45:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94CjOdR057980; Tue, 4 Oct 2011 12:45:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94CjOZM057978; Tue, 4 Oct 2011 12:45:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041245.p94CjOZM057978@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 12:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225971 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 12:45:25 -0000 Author: bz Date: Tue Oct 4 12:45:24 2011 New Revision: 225971 URL: http://svn.freebsd.org/changeset/base/225971 Log: MFC r225885: Fix an obvious bug from r186196 shadowing a variable, not correctly appending the new mbuf to the chain reference but possibly causing an mbuf nextpkt loop leading to a memory used after handoff (or having been freed) and leaking an mbuf here. Reviewed by: rwatson, brooks Approved by: re (kib) Modified: stable/9/sys/netinet6/nd6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet6/nd6.c ============================================================================== --- stable/9/sys/netinet6/nd6.c Tue Oct 4 11:35:18 2011 (r225970) +++ stable/9/sys/netinet6/nd6.c Tue Oct 4 12:45:24 2011 (r225971) @@ -2042,14 +2042,15 @@ nd6_output_lle(struct ifnet *ifp, struct if (*chain == NULL) *chain = m; else { - struct mbuf *m = *chain; + struct mbuf *mb; /* * append mbuf to end of deferred chain */ - while (m->m_nextpkt != NULL) - m = m->m_nextpkt; - m->m_nextpkt = m; + mb = *chain; + while (mb->m_nextpkt != NULL) + mb = mb->m_nextpkt; + mb->m_nextpkt = m; } return (error); } From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 13:18:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE8781065673; Tue, 4 Oct 2011 13:18:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D442D8FC08; Tue, 4 Oct 2011 13:18:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94DIEwD059220; Tue, 4 Oct 2011 13:18:14 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94DIE3o059214; Tue, 4 Oct 2011 13:18:14 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041318.p94DIE3o059214@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 13:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225975 - stable/8/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 13:18:15 -0000 Author: bz Date: Tue Oct 4 13:18:14 2011 New Revision: 225975 URL: http://svn.freebsd.org/changeset/base/225975 Log: MFC r225837: Pass the fibnum where we need filtering of the message on the rtsock allowing routing daemons to filter routing updates on an rtsock per FIB. Adjust raw_input() and split it into wrapper and a new function taking an optional callback argument even though we only have one consumer [1] to keep the hackish flags local to rtsock.c. PR: kern/134931 Submitted by: multiple (see PR) Suggested by: rwatson [1] Reviewed by: rwatson Modified: stable/8/sys/net/raw_cb.h stable/8/sys/net/raw_usrreq.c stable/8/sys/net/route.c stable/8/sys/net/route.h stable/8/sys/net/rtsock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/net/raw_cb.h ============================================================================== --- stable/8/sys/net/raw_cb.h Tue Oct 4 13:15:12 2011 (r225974) +++ stable/8/sys/net/raw_cb.h Tue Oct 4 13:18:14 2011 (r225975) @@ -70,9 +70,14 @@ pr_init_t raw_init; * Library routines for raw socket usrreq functions; will always be wrapped * so that protocol-specific functions can be handled. */ +typedef int (*raw_input_cb_fn)(struct mbuf *, struct sockproto *, + struct sockaddr *, struct rawcb *); + int raw_attach(struct socket *, int); void raw_detach(struct rawcb *); void raw_input(struct mbuf *, struct sockproto *, struct sockaddr *); +void raw_input_ext(struct mbuf *, struct sockproto *, struct sockaddr *, + raw_input_cb_fn); /* * Generic pr_usrreqs entries for raw socket protocols, usually wrapped so Modified: stable/8/sys/net/raw_usrreq.c ============================================================================== --- stable/8/sys/net/raw_usrreq.c Tue Oct 4 13:15:12 2011 (r225974) +++ stable/8/sys/net/raw_usrreq.c Tue Oct 4 13:18:14 2011 (r225975) @@ -71,6 +71,14 @@ raw_init(void) void raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src) { + + return (raw_input_ext(m0, proto, src, NULL)); +} + +void +raw_input_ext(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, + raw_input_cb_fn cb) +{ struct rawcb *rp; struct mbuf *m = m0; struct socket *last; @@ -83,6 +91,8 @@ raw_input(struct mbuf *m0, struct sockpr if (rp->rcb_proto.sp_protocol && rp->rcb_proto.sp_protocol != proto->sp_protocol) continue; + if (cb != NULL && (*cb)(m, proto, src, rp) != 0) + continue; if (last) { struct mbuf *n; n = m_copy(m, 0, (int)M_COPYALL); Modified: stable/8/sys/net/route.c ============================================================================== --- stable/8/sys/net/route.c Tue Oct 4 13:15:12 2011 (r225974) +++ stable/8/sys/net/route.c Tue Oct 4 13:18:14 2011 (r225975) @@ -390,7 +390,7 @@ miss: */ bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); + rt_missmsg_fib(msgtype, &info, 0, err, fibnum); } done: if (newrt) @@ -615,7 +615,7 @@ out: info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_NETMASK] = netmask; info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, error); + rt_missmsg_fib(RTM_REDIRECT, &info, flags, error, fibnum); if (ifa != NULL) ifa_free(ifa); } @@ -1527,7 +1527,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int } RT_ADDREF(rt); RT_UNLOCK(rt); - rt_newaddrmsg(cmd, ifa, error, rt); + rt_newaddrmsg_fib(cmd, ifa, error, rt, fibnum); RT_LOCK(rt); RT_REMREF(rt); if (cmd == RTM_DELETE) { Modified: stable/8/sys/net/route.h ============================================================================== --- stable/8/sys/net/route.h Tue Oct 4 13:15:12 2011 (r225974) +++ stable/8/sys/net/route.h Tue Oct 4 13:18:14 2011 (r225975) @@ -367,7 +367,9 @@ void rt_ieee80211msg(struct ifnet *, in void rt_ifannouncemsg(struct ifnet *, int); void rt_ifmsg(struct ifnet *); void rt_missmsg(int, struct rt_addrinfo *, int, int); +void rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int); void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); +void rt_newaddrmsg_fib(int, struct ifaddr *, int, struct rtentry *, int); void rt_newmaddrmsg(int, struct ifmultiaddr *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); Modified: stable/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Tue Oct 4 13:15:12 2011 (r225974) +++ stable/8/sys/net/rtsock.c Tue Oct 4 13:18:14 2011 (r225975) @@ -122,6 +122,13 @@ MALLOC_DEFINE(M_RTABLE, "routetbl", "rou static struct sockaddr route_src = { 2, PF_ROUTE, }; static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, }; +/* + * Used by rtsock/raw_input callback code to decide whether to filter the update + * notification to a socket bound to a particular FIB. + */ +#define RTS_FILTER_FIB M_PROTO8 +#define RTS_ALLFIBS -1 + static struct { int ip_count; /* attached w/ AF_INET */ int ip6_count; /* attached w/ AF_INET6 */ @@ -196,6 +203,31 @@ rts_init(void) } SYSINIT(rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rts_init, 0); +static int +raw_input_rts_cb(struct mbuf *m, struct sockproto *proto, struct sockaddr *src, + struct rawcb *rp) +{ + int fibnum; + + KASSERT(m != NULL, ("%s: m is NULL", __func__)); + KASSERT(proto != NULL, ("%s: proto is NULL", __func__)); + KASSERT(rp != NULL, ("%s: rp is NULL", __func__)); + + /* No filtering requested. */ + if ((m->m_flags & RTS_FILTER_FIB) == 0) + return (0); + + /* Check if it is a rts and the fib matches the one of the socket. */ + fibnum = M_GETFIB(m); + if (proto->sp_family != PF_ROUTE || + rp->rcb_socket == NULL || + rp->rcb_socket->so_fibnum == fibnum) + return (0); + + /* Filtering requested and no match, the socket shall be skipped. */ + return (1); +} + static void rts_input(struct mbuf *m) { @@ -212,7 +244,7 @@ rts_input(struct mbuf *m) } else route_proto.sp_protocol = 0; - raw_input(m, &route_proto, &route_src); + raw_input_ext(m, &route_proto, &route_src, raw_input_rts_cb); } /* @@ -886,6 +918,8 @@ flush: Free(rtm); } if (m) { + M_SETFIB(m, so->so_fibnum); + m->m_flags |= RTS_FILTER_FIB; if (rp) { /* * XXX insure we don't get a copy by @@ -1125,7 +1159,8 @@ again: * destination. */ void -rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +rt_missmsg_fib(int type, struct rt_addrinfo *rtinfo, int flags, int error, + int fibnum) { struct rt_msghdr *rtm; struct mbuf *m; @@ -1136,6 +1171,14 @@ rt_missmsg(int type, struct rt_addrinfo m = rt_msg1(type, rtinfo); if (m == NULL) return; + + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: fibnum out " + "of range 0 <= %d < %d", __func__, fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } + rtm = mtod(m, struct rt_msghdr *); rtm->rtm_flags = RTF_DONE | flags; rtm->rtm_errno = error; @@ -1143,6 +1186,13 @@ rt_missmsg(int type, struct rt_addrinfo rt_dispatch(m, sa); } +void +rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +{ + + rt_missmsg_fib(type, rtinfo, flags, error, RTS_ALLFIBS); +} + /* * This routine is called to generate a message from the routing * socket indicating that the status of a network interface has changed. @@ -1177,7 +1227,8 @@ rt_ifmsg(struct ifnet *ifp) * copies of it. */ void -rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +rt_newaddrmsg_fib(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt, + int fibnum) { struct rt_addrinfo info; struct sockaddr *sa = NULL; @@ -1235,10 +1286,24 @@ rt_newaddrmsg(int cmd, struct ifaddr *if rtm->rtm_errno = error; rtm->rtm_addrs = info.rti_addrs; } + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: " + "fibnum out of range 0 <= %d < %d", __func__, + fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } rt_dispatch(m, sa); } } +void +rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +{ + + rt_newaddrmsg_fib(cmd, ifa, error, rt, RTS_ALLFIBS); +} + /* * This is the analogue to the rt_newaddrmsg which performs the same * function but for multicast group memberhips. This is easier since From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 13:19:22 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B15106564A; Tue, 4 Oct 2011 13:19:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F96B8FC12; Tue, 4 Oct 2011 13:19:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94DJMGM059294; Tue, 4 Oct 2011 13:19:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94DJMt3059288; Tue, 4 Oct 2011 13:19:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041319.p94DJMt3059288@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 13:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225976 - stable/7/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 13:19:22 -0000 Author: bz Date: Tue Oct 4 13:19:21 2011 New Revision: 225976 URL: http://svn.freebsd.org/changeset/base/225976 Log: MFC r225837: Pass the fibnum where we need filtering of the message on the rtsock allowing routing daemons to filter routing updates on an rtsock per FIB. Adjust raw_input() and split it into wrapper and a new function taking an optional callback argument even though we only have one consumer [1] to keep the hackish flags local to rtsock.c. PR: kern/134931 Submitted by: multiple (see PR) Suggested by: rwatson [1] Reviewed by: rwatson Modified: stable/7/sys/net/raw_cb.h stable/7/sys/net/raw_usrreq.c stable/7/sys/net/route.c stable/7/sys/net/route.h stable/7/sys/net/rtsock.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/net/raw_cb.h ============================================================================== --- stable/7/sys/net/raw_cb.h Tue Oct 4 13:18:14 2011 (r225975) +++ stable/7/sys/net/raw_cb.h Tue Oct 4 13:19:21 2011 (r225976) @@ -68,9 +68,14 @@ pr_init_t raw_init; * Library routines for raw socket usrreq functions; will always be wrapped * so that protocol-specific functions can be handled. */ +typedef int (*raw_input_cb_fn)(struct mbuf *, struct sockproto *, + struct sockaddr *, struct rawcb *); + int raw_attach(struct socket *, int); void raw_detach(struct rawcb *); void raw_input(struct mbuf *, struct sockproto *, struct sockaddr *); +void raw_input_ext(struct mbuf *, struct sockproto *, struct sockaddr *, + raw_input_cb_fn); /* * Generic pr_usrreqs entries for raw socket protocols, usually wrapped so Modified: stable/7/sys/net/raw_usrreq.c ============================================================================== --- stable/7/sys/net/raw_usrreq.c Tue Oct 4 13:18:14 2011 (r225975) +++ stable/7/sys/net/raw_usrreq.c Tue Oct 4 13:19:21 2011 (r225976) @@ -69,6 +69,14 @@ raw_init(void) void raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src) { + + return (raw_input_ext(m0, proto, src, NULL)); +} + +void +raw_input_ext(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, + raw_input_cb_fn cb) +{ struct rawcb *rp; struct mbuf *m = m0; struct socket *last; @@ -81,6 +89,8 @@ raw_input(struct mbuf *m0, struct sockpr if (rp->rcb_proto.sp_protocol && rp->rcb_proto.sp_protocol != proto->sp_protocol) continue; + if (cb != NULL && (*cb)(m, proto, src, rp) != 0) + continue; if (last) { struct mbuf *n; n = m_copy(m, 0, (int)M_COPYALL); Modified: stable/7/sys/net/route.c ============================================================================== --- stable/7/sys/net/route.c Tue Oct 4 13:18:14 2011 (r225975) +++ stable/7/sys/net/route.c Tue Oct 4 13:19:21 2011 (r225976) @@ -344,7 +344,8 @@ rtalloc1_fib(struct sockaddr *dst, int r newrt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = newrt->rt_ifa->ifa_addr; } - rt_missmsg(RTM_ADD, &info, newrt->rt_flags, 0); + rt_missmsg_fib(RTM_ADD, &info, newrt->rt_flags, 0, + fibnum); } else { KASSERT(rt == newrt, ("locking wrong route")); RT_LOCK(newrt); @@ -370,7 +371,7 @@ rtalloc1_fib(struct sockaddr *dst, int r */ bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); + rt_missmsg_fib(msgtype, &info, 0, err, fibnum); } } if (newrt) @@ -591,7 +592,7 @@ out: info.rti_info[RTAX_GATEWAY] = gateway; info.rti_info[RTAX_NETMASK] = netmask; info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, error); + rt_missmsg_fib(RTM_REDIRECT, &info, flags, error, fibnum); } int @@ -1482,7 +1483,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int * notify any listening routing agents of the change */ RT_LOCK(rt); - rt_newaddrmsg(cmd, ifa, error, rt); + rt_newaddrmsg_fib(cmd, ifa, error, rt, fibnum); if (cmd == RTM_DELETE) { /* * If we are deleting, and we found an entry, then Modified: stable/7/sys/net/route.h ============================================================================== --- stable/7/sys/net/route.h Tue Oct 4 13:18:14 2011 (r225975) +++ stable/7/sys/net/route.h Tue Oct 4 13:19:21 2011 (r225976) @@ -351,7 +351,9 @@ void rt_ieee80211msg(struct ifnet *, in void rt_ifannouncemsg(struct ifnet *, int); void rt_ifmsg(struct ifnet *); void rt_missmsg(int, struct rt_addrinfo *, int, int); +void rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int); void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); +void rt_newaddrmsg_fib(int, struct ifaddr *, int, struct rtentry *, int); void rt_newmaddrmsg(int, struct ifmultiaddr *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); Modified: stable/7/sys/net/rtsock.c ============================================================================== --- stable/7/sys/net/rtsock.c Tue Oct 4 13:18:14 2011 (r225975) +++ stable/7/sys/net/rtsock.c Tue Oct 4 13:19:21 2011 (r225976) @@ -68,6 +68,13 @@ MALLOC_DEFINE(M_RTABLE, "routetbl", "rou static struct sockaddr route_src = { 2, PF_ROUTE, }; static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, }; +/* + * Used by rtsock/raw_input callback code to decide whether to filter the update + * notification to a socket bound to a particular FIB. + */ +#define RTS_FILTER_FIB M_PROTO8 +#define RTS_ALLFIBS -1 + static struct { int ip_count; /* attached w/ AF_INET */ int ip6_count; /* attached w/ AF_INET6 */ @@ -124,6 +131,31 @@ rts_init(void) } SYSINIT(rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rts_init, 0); +static int +raw_input_rts_cb(struct mbuf *m, struct sockproto *proto, struct sockaddr *src, + struct rawcb *rp) +{ + int fibnum; + + KASSERT(m != NULL, ("%s: m is NULL", __func__)); + KASSERT(proto != NULL, ("%s: proto is NULL", __func__)); + KASSERT(rp != NULL, ("%s: rp is NULL", __func__)); + + /* No filtering requested. */ + if ((m->m_flags & RTS_FILTER_FIB) == 0) + return (0); + + /* Check if it is a rts and the fib matches the one of the socket. */ + fibnum = M_GETFIB(m); + if (proto->sp_family != PF_ROUTE || + rp->rcb_socket == NULL || + rp->rcb_socket->so_fibnum == fibnum) + return (0); + + /* Filtering requested and no match, the socket shall be skipped. */ + return (1); +} + static void rts_input(struct mbuf *m) { @@ -140,7 +172,7 @@ rts_input(struct mbuf *m) } else route_proto.sp_protocol = 0; - raw_input(m, &route_proto, &route_src); + raw_input_ext(m, &route_proto, &route_src, raw_input_rts_cb); } /* @@ -727,6 +759,8 @@ flush: Free(rtm); } if (m) { + M_SETFIB(m, so->so_fibnum); + m->m_flags |= RTS_FILTER_FIB; if (rp) { /* * XXX insure we don't get a copy by @@ -958,7 +992,8 @@ again: * destination. */ void -rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +rt_missmsg_fib(int type, struct rt_addrinfo *rtinfo, int flags, int error, + int fibnum) { struct rt_msghdr *rtm; struct mbuf *m; @@ -969,6 +1004,14 @@ rt_missmsg(int type, struct rt_addrinfo m = rt_msg1(type, rtinfo); if (m == NULL) return; + + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: fibnum out " + "of range 0 <= %d < %d", __func__, fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } + rtm = mtod(m, struct rt_msghdr *); rtm->rtm_flags = RTF_DONE | flags; rtm->rtm_errno = error; @@ -976,6 +1019,13 @@ rt_missmsg(int type, struct rt_addrinfo rt_dispatch(m, sa); } +void +rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, int error) +{ + + rt_missmsg_fib(type, rtinfo, flags, error, RTS_ALLFIBS); +} + /* * This routine is called to generate a message from the routing * socket indicating that the status of a network interface has changed. @@ -1010,7 +1060,8 @@ rt_ifmsg(struct ifnet *ifp) * copies of it. */ void -rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +rt_newaddrmsg_fib(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt, + int fibnum) { struct rt_addrinfo info; struct sockaddr *sa = NULL; @@ -1066,10 +1117,24 @@ rt_newaddrmsg(int cmd, struct ifaddr *if rtm->rtm_errno = error; rtm->rtm_addrs = info.rti_addrs; } + if (fibnum != RTS_ALLFIBS) { + KASSERT(fibnum >= 0 && fibnum < rt_numfibs, ("%s: " + "fibnum out of range 0 <= %d < %d", __func__, + fibnum, rt_numfibs)); + M_SETFIB(m, fibnum); + m->m_flags |= RTS_FILTER_FIB; + } rt_dispatch(m, sa); } } +void +rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) +{ + + rt_newaddrmsg_fib(cmd, ifa, error, rt, RTS_ALLFIBS); +} + /* * This is the analogue to the rt_newaddrmsg which performs the same * function but for multicast group memberhips. This is easier since From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 13:31:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A94E21065674; Tue, 4 Oct 2011 13:31:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 987AE8FC12; Tue, 4 Oct 2011 13:31:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94DVvdG059767; Tue, 4 Oct 2011 13:31:57 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94DVv9F059765; Tue, 4 Oct 2011 13:31:57 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201110041331.p94DVv9F059765@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 4 Oct 2011 13:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225978 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 13:31:57 -0000 Author: bz Date: Tue Oct 4 13:31:57 2011 New Revision: 225978 URL: http://svn.freebsd.org/changeset/base/225978 Log: MFC r225885: Fix an obvious bug from r186196 shadowing a variable, not correctly appending the new mbuf to the chain reference but possibly causing an mbuf nextpkt loop leading to a memory used after handoff (or having been freed) and leaking an mbuf here. Reviewed by: rwatson, brooks Modified: stable/8/sys/netinet6/nd6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/nd6.c ============================================================================== --- stable/8/sys/netinet6/nd6.c Tue Oct 4 13:24:22 2011 (r225977) +++ stable/8/sys/netinet6/nd6.c Tue Oct 4 13:31:57 2011 (r225978) @@ -1917,14 +1917,15 @@ nd6_output_lle(struct ifnet *ifp, struct if (*chain == NULL) *chain = m; else { - struct mbuf *m = *chain; + struct mbuf *mb; /* * append mbuf to end of deferred chain */ - while (m->m_nextpkt != NULL) - m = m->m_nextpkt; - m->m_nextpkt = m; + mb = *chain; + while (mb->m_nextpkt != NULL) + mb = mb->m_nextpkt; + mb->m_nextpkt = m; } return (error); } From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 15:06:12 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00C92106566B; Tue, 4 Oct 2011 15:06:12 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA7088FC12; Tue, 4 Oct 2011 15:06:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94F6BOg063041; Tue, 4 Oct 2011 15:06:11 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94F6BOd063039; Tue, 4 Oct 2011 15:06:11 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201110041506.p94F6BOd063039@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 4 Oct 2011 15:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225983 - stable/9/crypto/openssh X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 15:06:12 -0000 Author: des Date: Tue Oct 4 15:06:11 2011 New Revision: 225983 URL: http://svn.freebsd.org/changeset/base/225983 Log: MFH r225852: regenerate after hpn patch Approved by: re (kib) Modified: stable/9/crypto/openssh/ssh_namespace.h Directory Properties: stable/9/crypto/openssh/ (props changed) Modified: stable/9/crypto/openssh/ssh_namespace.h ============================================================================== --- stable/9/crypto/openssh/ssh_namespace.h Tue Oct 4 15:00:54 2011 (r225982) +++ stable/9/crypto/openssh/ssh_namespace.h Tue Oct 4 15:06:11 2011 (r225983) @@ -7,7 +7,7 @@ * * A list of symbols which need munging is obtained as follows: * - * nm libssh.a | awk '/[0-9a-z] [A-Z] / && $3 !~ /^ssh_/ { print "#define" $3 "\t\tssh_" $3 }' + * nm libssh.a | awk '/[0-9a-z] [A-Z] / && $3 !~ /^ssh_/ { print "#define " $3 "\t\tssh_" $3 }' * * $FreeBSD$ */ @@ -58,6 +58,7 @@ #define buffer_get_int64 ssh_buffer_get_int64 #define buffer_get_int64_ret ssh_buffer_get_int64_ret #define buffer_get_int_ret ssh_buffer_get_int_ret +#define buffer_get_max_len ssh_buffer_get_max_len #define buffer_get_ret ssh_buffer_get_ret #define buffer_get_short ssh_buffer_get_short #define buffer_get_short_ret ssh_buffer_get_short_ret @@ -139,6 +140,7 @@ #define channel_send_window_changes ssh_channel_send_window_changes #define channel_set_af ssh_channel_set_af #define channel_set_fds ssh_channel_set_fds +#define channel_set_hpn ssh_channel_set_hpn #define channel_setup_local_fwd_listener ssh_channel_setup_local_fwd_listener #define channel_setup_remote_fwd_listener ssh_channel_setup_remote_fwd_listener #define channel_still_open ssh_channel_still_open @@ -438,6 +440,7 @@ #define set_nonblock ssh_set_nonblock #define shadow_pw ssh_shadow_pw #define sigdie ssh_sigdie +#define sock_get_rcvbuf ssh_sock_get_rcvbuf #define sock_set_v6only ssh_sock_set_v6only #define ssh1_3des_iv ssh_ssh1_3des_iv #define start_progress_meter ssh_start_progress_meter From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 17:26:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 691811065673; Tue, 4 Oct 2011 17:26:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7398FC0C; Tue, 4 Oct 2011 17:26:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94HQfc4071880; Tue, 4 Oct 2011 17:26:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94HQflE071877; Tue, 4 Oct 2011 17:26:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201110041726.p94HQflE071877@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 4 Oct 2011 17:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226015 - stable/9/lib/libfetch X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 17:26:41 -0000 Author: des Date: Tue Oct 4 17:26:40 2011 New Revision: 226015 URL: http://svn.freebsd.org/changeset/base/226015 Log: MFH r225810 r225812: make passive mode the default. Approved by: re (kib) Modified: stable/9/lib/libfetch/fetch.3 stable/9/lib/libfetch/ftp.c Directory Properties: stable/9/lib/libfetch/ (props changed) Modified: stable/9/lib/libfetch/fetch.3 ============================================================================== --- stable/9/lib/libfetch/fetch.3 Tue Oct 4 17:14:59 2011 (r226014) +++ stable/9/lib/libfetch/fetch.3 Tue Oct 4 17:26:40 2011 (r226015) @@ -318,9 +318,19 @@ and implement the FTP protocol as described in RFC959. .Pp If the +.Ql P +(not passive) flag is specified, an active (rather than passive) +connection will be attempted. +.Pp +The .Ql p -(passive) flag is specified, a passive (rather than active) connection -will be attempted. +flag is supported for compatibility with earlier versions where active +connections were the default. +It has precedence over the +.Ql P +flag, so if both are specified, +.Nm +will use a passive connection. .Pp If the .Ql l @@ -475,9 +485,11 @@ connections will be bound. .It Ev FTP_LOGIN Default FTP login if none was provided in the URL. .It Ev FTP_PASSIVE_MODE -If set to anything but +If set to .Ql no , -forces the FTP code to use passive mode. +forces the FTP code to use active mode. +If set to any other value, forces passive mode even if the application +requested active mode. .It Ev FTP_PASSWORD Default FTP password if the remote server requests one and none was provided in the URL. Modified: stable/9/lib/libfetch/ftp.c ============================================================================== --- stable/9/lib/libfetch/ftp.c Tue Oct 4 17:14:59 2011 (r226014) +++ stable/9/lib/libfetch/ftp.c Tue Oct 4 17:26:40 2011 (r226015) @@ -633,13 +633,12 @@ ftp_transfer(conn_t *conn, const char *o /* check flags */ low = CHECK_FLAG('l'); - pasv = CHECK_FLAG('p'); + pasv = CHECK_FLAG('p') || !CHECK_FLAG('P'); verbose = CHECK_FLAG('v'); /* passive mode */ - if (!pasv) - pasv = ((s = getenv("FTP_PASSIVE_MODE")) != NULL && - strncasecmp(s, "no", 2) != 0); + if ((s = getenv("FTP_PASSIVE_MODE")) != NULL) + pasv = (strncasecmp(s, "no", 2) != 0); /* isolate filename */ filename = ftp_filename(file, &filenamelen, &type); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 17:27:11 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 055E1106564A; Tue, 4 Oct 2011 17:27:11 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEE708FC18; Tue, 4 Oct 2011 17:27:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94HRAm4071935; Tue, 4 Oct 2011 17:27:10 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94HRAZO071932; Tue, 4 Oct 2011 17:27:10 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201110041727.p94HRAZO071932@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 4 Oct 2011 17:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226016 - stable/9/usr.bin/fetch X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 17:27:11 -0000 Author: des Date: Tue Oct 4 17:27:10 2011 New Revision: 226016 URL: http://svn.freebsd.org/changeset/base/226016 Log: MFH r225815: document that passive mode is the default MFH r225982: convert to UTF-8 Approved by: re (kib) Modified: stable/9/usr.bin/fetch/fetch.1 stable/9/usr.bin/fetch/fetch.c Directory Properties: stable/9/usr.bin/fetch/ (props changed) Modified: stable/9/usr.bin/fetch/fetch.1 ============================================================================== --- stable/9/usr.bin/fetch/fetch.1 Tue Oct 4 17:26:40 2011 (r226015) +++ stable/9/usr.bin/fetch/fetch.1 Tue Oct 4 17:27:10 2011 (r226016) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav +.\" Copyright (c) 2000-2011 Dag-Erling Smørgrav .\" All rights reserved. .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used .\" by permission. @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2008 +.Dd September 27, 2011 .Dt FETCH 1 .Os .Sh NAME @@ -165,11 +165,13 @@ directory, with name(s) selected as in t .It Fl P .It Fl p Use passive FTP. -This is useful if you are behind a firewall which blocks incoming -connections. -Try this flag if -.Nm -seems to hang when retrieving FTP URLs. +These flags have no effect, since passive FTP is the default, but are +provided for compatibility with earlier versions where active FTP was +the default. +To force active mode, set the +.Ev FTP_PASSIVE_MODE +environment variable to +.Ql NO . .It Fl q Quiet mode. .It Fl R Modified: stable/9/usr.bin/fetch/fetch.c ============================================================================== --- stable/9/usr.bin/fetch/fetch.c Tue Oct 4 17:26:40 2011 (r226015) +++ stable/9/usr.bin/fetch/fetch.c Tue Oct 4 17:27:10 2011 (r226016) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 19:07:39 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78B361065679; Tue, 4 Oct 2011 19:07:39 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B70C8FC0C; Tue, 4 Oct 2011 19:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94J7dgm075276; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94J7d0x075274; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201110041907.p94J7d0x075274@svn.freebsd.org> From: Colin Percival Date: Tue, 4 Oct 2011 19:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226023 - head/sys/compat/linux releng/7.3 releng/7.3/sys/compat/linux releng/7.3/sys/conf releng/7.4 releng/7.4/sys/compat/linux releng/7.4/sys/conf releng/8.1 releng/8.1/sys/compat/li... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 19:07:39 -0000 Author: cperciva Date: Tue Oct 4 19:07:38 2011 New Revision: 226023 URL: http://svn.freebsd.org/changeset/base/226023 Log: Fix a bug in UNIX socket handling in the linux emulator which was exposed by the security fix in FreeBSD-SA-11:05.unix. Approved by: so (cperciva) Approved by: re (kib) Security: Related to FreeBSD-SA-11:05.unix, but not actually a security fix. Modified: stable/7/sys/compat/linux/linux_socket.c Changes in other areas also in this revision: Modified: head/sys/compat/linux/linux_socket.c releng/7.3/UPDATING releng/7.3/sys/compat/linux/linux_socket.c releng/7.3/sys/conf/newvers.sh releng/7.4/UPDATING releng/7.4/sys/compat/linux/linux_socket.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/sys/compat/linux/linux_socket.c releng/8.1/sys/conf/newvers.sh releng/8.2/UPDATING releng/8.2/sys/compat/linux/linux_socket.c releng/8.2/sys/conf/newvers.sh stable/8/sys/compat/linux/linux_socket.c stable/9/sys/compat/linux/linux_socket.c Modified: stable/7/sys/compat/linux/linux_socket.c ============================================================================== --- stable/7/sys/compat/linux/linux_socket.c Tue Oct 4 18:45:29 2011 (r226022) +++ stable/7/sys/compat/linux/linux_socket.c Tue Oct 4 19:07:38 2011 (r226023) @@ -101,6 +101,7 @@ do_sa_get(struct sockaddr **sap, const s int oldv6size; struct sockaddr_in6 *sin6; #endif + int namelen; if (*osalen < 2 || *osalen > UCHAR_MAX || !osa) return (EINVAL); @@ -163,6 +164,20 @@ do_sa_get(struct sockaddr **sap, const s } } + if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) { + for (namelen = 0; + namelen < *osalen - offsetof(struct sockaddr_un, sun_path); + namelen++) + if (!((struct sockaddr_un *)kosa)->sun_path[namelen]) + break; + if (namelen + offsetof(struct sockaddr_un, sun_path) > + sizeof(struct sockaddr_un)) { + error = EINVAL; + goto out; + } + alloclen = sizeof(struct sockaddr_un); + } + sa = (struct sockaddr *) kosa; sa->sa_family = bdom; sa->sa_len = alloclen; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 19:07:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B011106568D; Tue, 4 Oct 2011 19:07:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1F9F8FC14; Tue, 4 Oct 2011 19:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94J7d8V075305; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94J7dHA075303; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201110041907.p94J7dHA075303@svn.freebsd.org> From: Colin Percival Date: Tue, 4 Oct 2011 19:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226023 - head/sys/compat/linux releng/7.3 releng/7.3/sys/compat/linux releng/7.3/sys/conf releng/7.4 releng/7.4/sys/compat/linux releng/7.4/sys/conf releng/8.1 releng/8.1/sys/compat/li... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 19:07:40 -0000 Author: cperciva Date: Tue Oct 4 19:07:38 2011 New Revision: 226023 URL: http://svn.freebsd.org/changeset/base/226023 Log: Fix a bug in UNIX socket handling in the linux emulator which was exposed by the security fix in FreeBSD-SA-11:05.unix. Approved by: so (cperciva) Approved by: re (kib) Security: Related to FreeBSD-SA-11:05.unix, but not actually a security fix. Modified: stable/9/sys/compat/linux/linux_socket.c Changes in other areas also in this revision: Modified: head/sys/compat/linux/linux_socket.c releng/7.3/UPDATING releng/7.3/sys/compat/linux/linux_socket.c releng/7.3/sys/conf/newvers.sh releng/7.4/UPDATING releng/7.4/sys/compat/linux/linux_socket.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/sys/compat/linux/linux_socket.c releng/8.1/sys/conf/newvers.sh releng/8.2/UPDATING releng/8.2/sys/compat/linux/linux_socket.c releng/8.2/sys/conf/newvers.sh stable/7/sys/compat/linux/linux_socket.c stable/8/sys/compat/linux/linux_socket.c Modified: stable/9/sys/compat/linux/linux_socket.c ============================================================================== --- stable/9/sys/compat/linux/linux_socket.c Tue Oct 4 18:45:29 2011 (r226022) +++ stable/9/sys/compat/linux/linux_socket.c Tue Oct 4 19:07:38 2011 (r226023) @@ -104,6 +104,7 @@ do_sa_get(struct sockaddr **sap, const s int oldv6size; struct sockaddr_in6 *sin6; #endif + int namelen; if (*osalen < 2 || *osalen > UCHAR_MAX || !osa) return (EINVAL); @@ -166,6 +167,20 @@ do_sa_get(struct sockaddr **sap, const s } } + if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) { + for (namelen = 0; + namelen < *osalen - offsetof(struct sockaddr_un, sun_path); + namelen++) + if (!((struct sockaddr_un *)kosa)->sun_path[namelen]) + break; + if (namelen + offsetof(struct sockaddr_un, sun_path) > + sizeof(struct sockaddr_un)) { + error = EINVAL; + goto out; + } + alloclen = sizeof(struct sockaddr_un); + } + sa = (struct sockaddr *) kosa; sa->sa_family = bdom; sa->sa_len = alloclen; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 4 19:07:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BD20106568E; Tue, 4 Oct 2011 19:07:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2A568FC15; Tue, 4 Oct 2011 19:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p94J7dUh075311; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94J7dSw075309; Tue, 4 Oct 2011 19:07:39 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201110041907.p94J7dSw075309@svn.freebsd.org> From: Colin Percival Date: Tue, 4 Oct 2011 19:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226023 - head/sys/compat/linux releng/7.3 releng/7.3/sys/compat/linux releng/7.3/sys/conf releng/7.4 releng/7.4/sys/compat/linux releng/7.4/sys/conf releng/8.1 releng/8.1/sys/compat/li... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2011 19:07:40 -0000 Author: cperciva Date: Tue Oct 4 19:07:38 2011 New Revision: 226023 URL: http://svn.freebsd.org/changeset/base/226023 Log: Fix a bug in UNIX socket handling in the linux emulator which was exposed by the security fix in FreeBSD-SA-11:05.unix. Approved by: so (cperciva) Approved by: re (kib) Security: Related to FreeBSD-SA-11:05.unix, but not actually a security fix. Modified: stable/8/sys/compat/linux/linux_socket.c Changes in other areas also in this revision: Modified: head/sys/compat/linux/linux_socket.c releng/7.3/UPDATING releng/7.3/sys/compat/linux/linux_socket.c releng/7.3/sys/conf/newvers.sh releng/7.4/UPDATING releng/7.4/sys/compat/linux/linux_socket.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/sys/compat/linux/linux_socket.c releng/8.1/sys/conf/newvers.sh releng/8.2/UPDATING releng/8.2/sys/compat/linux/linux_socket.c releng/8.2/sys/conf/newvers.sh stable/7/sys/compat/linux/linux_socket.c stable/9/sys/compat/linux/linux_socket.c Modified: stable/8/sys/compat/linux/linux_socket.c ============================================================================== --- stable/8/sys/compat/linux/linux_socket.c Tue Oct 4 18:45:29 2011 (r226022) +++ stable/8/sys/compat/linux/linux_socket.c Tue Oct 4 19:07:38 2011 (r226023) @@ -103,6 +103,7 @@ do_sa_get(struct sockaddr **sap, const s int oldv6size; struct sockaddr_in6 *sin6; #endif + int namelen; if (*osalen < 2 || *osalen > UCHAR_MAX || !osa) return (EINVAL); @@ -165,6 +166,20 @@ do_sa_get(struct sockaddr **sap, const s } } + if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) { + for (namelen = 0; + namelen < *osalen - offsetof(struct sockaddr_un, sun_path); + namelen++) + if (!((struct sockaddr_un *)kosa)->sun_path[namelen]) + break; + if (namelen + offsetof(struct sockaddr_un, sun_path) > + sizeof(struct sockaddr_un)) { + error = EINVAL; + goto out; + } + alloclen = sizeof(struct sockaddr_un); + } + sa = (struct sockaddr *) kosa; sa->sa_family = bdom; sa->sa_len = alloclen; From owner-svn-src-stable@FreeBSD.ORG Wed Oct 5 15:50:05 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC70E106566B; Wed, 5 Oct 2011 15:50:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B71BA8FC08; Wed, 5 Oct 2011 15:50:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95Fo5ol018419; Wed, 5 Oct 2011 15:50:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95Fo5N1018417; Wed, 5 Oct 2011 15:50:05 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201110051550.p95Fo5N1018417@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Oct 2011 15:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226036 - stable/9/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 15:50:06 -0000 Author: jkim Date: Wed Oct 5 15:50:05 2011 New Revision: 226036 URL: http://svn.freebsd.org/changeset/base/226036 Log: MFC: r226035 Avoid accidental conflicts with C++ operator keywords. Approved by: re (kib) Modified: stable/9/include/iso646.h Directory Properties: stable/9/include/ (props changed) Modified: stable/9/include/iso646.h ============================================================================== --- stable/9/include/iso646.h Wed Oct 5 09:56:43 2011 (r226035) +++ stable/9/include/iso646.h Wed Oct 5 15:50:05 2011 (r226036) @@ -29,6 +29,8 @@ #ifndef _ISO646_H_ #define _ISO646_H_ +#ifndef __cplusplus + #define and && #define and_eq &= #define bitand & @@ -41,4 +43,6 @@ #define xor ^ #define xor_eq ^= +#endif /* !__cplusplus */ + #endif /* !_ISO646_H_ */ From owner-svn-src-stable@FreeBSD.ORG Wed Oct 5 15:52:04 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E755106564A; Wed, 5 Oct 2011 15:52:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D9848FC13; Wed, 5 Oct 2011 15:52:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95Fq4ZQ018516; Wed, 5 Oct 2011 15:52:04 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95Fq4bN018514; Wed, 5 Oct 2011 15:52:04 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201110051552.p95Fq4bN018514@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Oct 2011 15:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226037 - stable/8/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 15:52:04 -0000 Author: jkim Date: Wed Oct 5 15:52:04 2011 New Revision: 226037 URL: http://svn.freebsd.org/changeset/base/226037 Log: MFC: r225801 Avoid accidental conflicts with C++ operator keywords. Modified: stable/8/include/iso646.h Directory Properties: stable/8/include/ (props changed) Modified: stable/8/include/iso646.h ============================================================================== --- stable/8/include/iso646.h Wed Oct 5 15:50:05 2011 (r226036) +++ stable/8/include/iso646.h Wed Oct 5 15:52:04 2011 (r226037) @@ -29,6 +29,8 @@ #ifndef _ISO646_H_ #define _ISO646_H_ +#ifndef __cplusplus + #define and && #define and_eq &= #define bitand & @@ -41,4 +43,6 @@ #define xor ^ #define xor_eq ^= +#endif /* !__cplusplus */ + #endif /* !_ISO646_H_ */ From owner-svn-src-stable@FreeBSD.ORG Wed Oct 5 15:52:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7214A106566B; Wed, 5 Oct 2011 15:52:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 614BE8FC17; Wed, 5 Oct 2011 15:52:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95FqepI018568; Wed, 5 Oct 2011 15:52:40 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95FqebU018566; Wed, 5 Oct 2011 15:52:40 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201110051552.p95FqebU018566@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Oct 2011 15:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226038 - stable/7/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 15:52:40 -0000 Author: jkim Date: Wed Oct 5 15:52:40 2011 New Revision: 226038 URL: http://svn.freebsd.org/changeset/base/226038 Log: MFC: r225801 Avoid accidental conflicts with C++ operator keywords. Modified: stable/7/include/iso646.h Directory Properties: stable/7/include/ (props changed) Modified: stable/7/include/iso646.h ============================================================================== --- stable/7/include/iso646.h Wed Oct 5 15:52:04 2011 (r226037) +++ stable/7/include/iso646.h Wed Oct 5 15:52:40 2011 (r226038) @@ -29,6 +29,8 @@ #ifndef _ISO646_H_ #define _ISO646_H_ +#ifndef __cplusplus + #define and && #define and_eq &= #define bitand & @@ -41,4 +43,6 @@ #define xor ^ #define xor_eq ^= +#endif /* !__cplusplus */ + #endif /* !_ISO646_H_ */ From owner-svn-src-stable@FreeBSD.ORG Wed Oct 5 15:54:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 86EF7106564A; Wed, 5 Oct 2011 15:54:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: src-committers@FreeBSD.org Date: Wed, 5 Oct 2011 11:54:26 -0400 User-Agent: KMail/1.6.2 References: <201110051550.p95Fo5N1018417@svn.freebsd.org> In-Reply-To: <201110051550.p95Fo5N1018417@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110051154.28931.jkim@FreeBSD.org> Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r226036 - stable/9/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 15:54:40 -0000 On Wednesday 05 October 2011 11:50 am, Jung-uk Kim wrote: > Author: jkim > Date: Wed Oct 5 15:50:05 2011 > New Revision: 226036 > URL: http://svn.freebsd.org/changeset/base/226036 > > Log: > MFC: r226035 ^^^^^^^ r225801 > > Avoid accidental conflicts with C++ operator keywords. > > Approved by: re (kib) Sorry for the copy-and-pasto. Jung-uk Kim From owner-svn-src-stable@FreeBSD.ORG Wed Oct 5 19:58:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AD8B1065670; Wed, 5 Oct 2011 19:58:00 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39BF18FC12; Wed, 5 Oct 2011 19:58:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95Jw0DN026506; Wed, 5 Oct 2011 19:58:00 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95Jw0lb026504; Wed, 5 Oct 2011 19:58:00 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201110051958.p95Jw0lb026504@svn.freebsd.org> From: Martin Matuska Date: Wed, 5 Oct 2011 19:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226044 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 19:58:00 -0000 Author: mm Date: Wed Oct 5 19:57:59 2011 New Revision: 226044 URL: http://svn.freebsd.org/changeset/base/226044 Log: MFC r225828: Remove assertion that prevents zfs rename of datasets with mountpoint=none or mountpoint=legacy that have children datasets. This also fixes dataset rename when receiving incremental snapshots as reported on freebsd-fs@ This assertion was made triggerable by opensolaris change #10196. PR: bin/160400 Reviewed by: pjd Approved by: re (kib) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 5 17:29:49 2011 (r226043) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 5 19:57:59 2011 (r226044) @@ -467,7 +467,6 @@ change_one(zfs_handle_t *zhp, void *data * This is necessary when the original mountpoint * is legacy or none. */ - ASSERT(!clp->cl_alldependents); verify(uu_list_insert_before(clp->cl_list, uu_list_first(clp->cl_list), cn) == 0); } From owner-svn-src-stable@FreeBSD.ORG Wed Oct 5 20:00:50 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93EBE106566B; Wed, 5 Oct 2011 20:00:50 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82EAF8FC15; Wed, 5 Oct 2011 20:00:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p95K0oOv026669; Wed, 5 Oct 2011 20:00:50 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p95K0o1c026667; Wed, 5 Oct 2011 20:00:50 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201110052000.p95K0o1c026667@svn.freebsd.org> From: Martin Matuska Date: Wed, 5 Oct 2011 20:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226045 - stable/8/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2011 20:00:50 -0000 Author: mm Date: Wed Oct 5 20:00:50 2011 New Revision: 226045 URL: http://svn.freebsd.org/changeset/base/226045 Log: MFC r225828: Remove assertion that prevents zfs rename of datasets with mountpoint=none or mountpoint=legacy that have children datasets. This also fixes dataset rename when receiving incremental snapshots as reported on freebsd-fs@ This assertion was made triggerable by opensolaris change #10196. PR: bin/160400 Reviewed by: pjd Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 5 19:57:59 2011 (r226044) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 5 20:00:50 2011 (r226045) @@ -467,7 +467,6 @@ change_one(zfs_handle_t *zhp, void *data * This is necessary when the original mountpoint * is legacy or none. */ - ASSERT(!clp->cl_alldependents); verify(uu_list_insert_before(clp->cl_list, uu_list_first(clp->cl_list), cn) == 0); } From owner-svn-src-stable@FreeBSD.ORG Thu Oct 6 14:33:33 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51A541065679; Thu, 6 Oct 2011 14:33:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 413398FC0C; Thu, 6 Oct 2011 14:33:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96EXX51064731; Thu, 6 Oct 2011 14:33:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96EXXgc064729; Thu, 6 Oct 2011 14:33:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201110061433.p96EXXgc064729@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 6 Oct 2011 14:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226061 - stable/9/sys/dev/puc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 14:33:33 -0000 Author: ae Date: Thu Oct 6 14:33:32 2011 New Revision: 226061 URL: http://svn.freebsd.org/changeset/base/226061 Log: MFC r225878: Add Oxford Semiconductor OXPCIe952 (0x1c38) 1 port serial card. PR: kern/160895 Submitted by: Konstantin V. Krotov Approved by: re (kib) Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Thu Oct 6 14:29:38 2011 (r226060) +++ stable/9/sys/dev/puc/pucdata.c Thu Oct 6 14:33:32 2011 (r226061) @@ -733,6 +733,13 @@ const struct puc_cfg puc_pci_devices[] = * */ + { 0x1415, 0xc138, 0xffff, 0, + "Oxford Semiconductor OXPCIe952 UARTs", + DEFAULT_RCLK * 0x22, + PUC_PORT_NONSTANDARD, 0x10, 0, -1, + .config_function = puc_config_oxford_pcie + }, + { 0x1415, 0xc158, 0xffff, 0, "Oxford Semiconductor OXPCIe952 UARTs", DEFAULT_RCLK * 0x22, From owner-svn-src-stable@FreeBSD.ORG Thu Oct 6 14:35:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD1B2106566B; Thu, 6 Oct 2011 14:35:09 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C83F8FC12; Thu, 6 Oct 2011 14:35:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96EZ9hQ064822; Thu, 6 Oct 2011 14:35:09 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96EZ9Lm064820; Thu, 6 Oct 2011 14:35:09 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201110061435.p96EZ9Lm064820@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 6 Oct 2011 14:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226062 - stable/8/sys/dev/puc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 14:35:09 -0000 Author: ae Date: Thu Oct 6 14:35:09 2011 New Revision: 226062 URL: http://svn.freebsd.org/changeset/base/226062 Log: MFC r225878: Add Oxford Semiconductor OXPCIe952 (0xc138) 1 port serial card. PR: kern/160895 Submitted by: Konstantin V. Krotov Modified: stable/8/sys/dev/puc/pucdata.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Thu Oct 6 14:33:32 2011 (r226061) +++ stable/8/sys/dev/puc/pucdata.c Thu Oct 6 14:35:09 2011 (r226062) @@ -733,6 +733,13 @@ const struct puc_cfg puc_pci_devices[] = * */ + { 0x1415, 0xc138, 0xffff, 0, + "Oxford Semiconductor OXPCIe952 UARTs", + DEFAULT_RCLK * 0x22, + PUC_PORT_NONSTANDARD, 0x10, 0, -1, + .config_function = puc_config_oxford_pcie + }, + { 0x1415, 0xc158, 0xffff, 0, "Oxford Semiconductor OXPCIe952 UARTs", DEFAULT_RCLK * 0x22, From owner-svn-src-stable@FreeBSD.ORG Thu Oct 6 19:15:51 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9603106566C; Thu, 6 Oct 2011 19:15:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D49EB8FC12; Thu, 6 Oct 2011 19:15:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96JFpAX074081; Thu, 6 Oct 2011 19:15:51 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96JFpBW074072; Thu, 6 Oct 2011 19:15:51 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201110061915.p96JFpBW074072@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 6 Oct 2011 19:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226067 - in stable/9: sbin/camcontrol share/examples/scsi_target share/misc sys/cam sys/cam/scsi sys/dev/ciss sys/dev/firewire sys/dev/iir sys/dev/iscsi/initiator sys/dev/isp sys/dev/m... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 19:15:52 -0000 Author: ken Date: Thu Oct 6 19:15:51 2011 New Revision: 226067 URL: http://svn.freebsd.org/changeset/base/226067 Log: MFC r225950: Add descriptor sense support to CAM, and honor sense residuals properly in CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c: Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a length (which should be the sense length - residual) and can indicate which fields are present and valid in the sense data. Add a couple of new scsi_get_*() routines to get the sense key, asc, and ascq only. mly.c: Rename struct scsi_sense_data to struct scsi_sense_data_fixed. sbp_targ.c: Use the new sense fetching routines to get sense data instead of accessing it directly. sbp.c: Change the firewire/SCSI sense data transformation code to use struct scsi_sense_data_fixed instead of struct scsi_sense_data. This should be changed later to use scsi_set_sense_data(). ciss.c: Calculate the sense residual properly. Use scsi_get_sense_key() to fetch the sense key. mps_sas.c, mpt_cam.c: Set the sense residual properly. iir.c: Use scsi_set_sense_data() instead of building sense data by hand. iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data directly. umass.c: Use scsi_set_sense_data() to build sense data. Grab the sense key using scsi_get_sense_key(). Calculate the sense residual properly. isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key values. Calculate and set the sense residual. Approved by: re (kib) Sponsored by: Spectra Logic Corporation Modified: stable/9/sbin/camcontrol/camcontrol.c stable/9/share/examples/scsi_target/scsi_cmds.c stable/9/share/examples/scsi_target/scsi_target.c stable/9/share/misc/scsi_modes stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/cam_periph.c stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_low.c stable/9/sys/cam/scsi/scsi_sa.c stable/9/sys/cam/scsi/scsi_targ_bh.c stable/9/sys/dev/ciss/ciss.c stable/9/sys/dev/firewire/sbp.c stable/9/sys/dev/firewire/sbp_targ.c stable/9/sys/dev/iir/iir.c stable/9/sys/dev/iscsi/initiator/iscsi_subr.c stable/9/sys/dev/isp/isp_freebsd.h stable/9/sys/dev/mly/mly.c stable/9/sys/dev/mps/mps_sas.c stable/9/sys/dev/mpt/mpt_cam.c stable/9/sys/dev/usb/storage/umass.c stable/9/sys/powerpc/ps3/ps3cdrom.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) stable/9/share/examples/ (props changed) stable/9/share/misc/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sbin/camcontrol/camcontrol.c Thu Oct 6 19:15:51 2011 (r226067) @@ -1907,7 +1907,9 @@ readdefects(struct cam_device *device, i int error_code, sense_key, asc, ascq; sense = &ccb->csio.sense_data; - scsi_extract_sense(sense, &error_code, &sense_key, &asc, &ascq); + scsi_extract_sense_len(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, &error_code, &sense_key, &asc, + &ascq, /*show_errors*/ 1); /* * According to the SCSI spec, if the disk doesn't support @@ -3798,8 +3800,9 @@ doreport: int error_code, sense_key, asc, ascq; sense = &ccb->csio.sense_data; - scsi_extract_sense(sense, &error_code, &sense_key, - &asc, &ascq); + scsi_extract_sense_len(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, &error_code, &sense_key, + &asc, &ascq, /*show_errors*/ 1); /* * According to the SCSI-2 and SCSI-3 specs, a @@ -3810,15 +3813,15 @@ doreport: */ if ((sense_key == SSD_KEY_NOT_READY) && (asc == 0x04) && (ascq == 0x04)) { - if ((sense->extra_len >= 10) - && ((sense->sense_key_spec[0] & - SSD_SCS_VALID) != 0) + uint8_t sks[3]; + + if ((scsi_get_sks(sense, ccb->csio.sense_len - + ccb->csio.sense_resid, sks) == 0) && (quiet == 0)) { int val; u_int64_t percentage; - val = scsi_2btoul( - &sense->sense_key_spec[1]); + val = scsi_2btoul(&sks[1]); percentage = 10000 * val; fprintf(stdout, Modified: stable/9/share/examples/scsi_target/scsi_cmds.c ============================================================================== --- stable/9/share/examples/scsi_target/scsi_cmds.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/share/examples/scsi_target/scsi_cmds.c Thu Oct 6 19:15:51 2011 (r226067) @@ -242,22 +242,22 @@ tcmd_sense(u_int init_id, struct ccb_scs u_int8_t asc, u_int8_t ascq) { struct initiator_state *istate; - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; /* Set our initiator's istate */ istate = tcmd_get_istate(init_id); if (istate == NULL) return; istate->pending_ca |= CA_CMD_SENSE; /* XXX set instead of or? */ - sense = &istate->sense_data; + sense = (struct scsi_sense_data_fixed *)&istate->sense_data; bzero(sense, sizeof(*sense)); sense->error_code = SSD_CURRENT_ERROR; sense->flags = flags; sense->add_sense_code = asc; sense->add_sense_code_qual = ascq; sense->extra_len = - offsetof(struct scsi_sense_data, sense_key_spec[2]) - - offsetof(struct scsi_sense_data, extra_len); + offsetof(struct scsi_sense_data_fixed, sense_key_spec[2]) - + offsetof(struct scsi_sense_data_fixed, extra_len); /* Fill out the supplied CTIO */ if (ctio != NULL) { @@ -298,7 +298,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio struct scsi_inquiry *inq; struct atio_descr *a_descr; struct initiator_state *istate; - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; a_descr = (struct atio_descr *)atio->ccb_h.targ_descr; inq = (struct scsi_inquiry *)a_descr->cdb; @@ -310,7 +310,7 @@ tcmd_inquiry(struct ccb_accept_tio *atio * complain if EVPD or CMDDT is set. */ istate = tcmd_get_istate(ctio->init_id); - sense = &istate->sense_data; + sense = (struct scsi_sense_data_fixed *)&istate->sense_data; if ((inq->byte2 & SI_EVPD) != 0) { tcmd_illegal_req(atio, ctio); sense->sense_key_spec[0] = SSD_SCS_VALID | SSD_FIELDPTR_CMD | @@ -376,7 +376,7 @@ static int tcmd_req_sense(struct ccb_accept_tio *atio, struct ccb_scsiio *ctio) { struct scsi_request_sense *rsense; - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; struct initiator_state *istate; size_t dlen; struct atio_descr *a_descr; @@ -385,7 +385,7 @@ tcmd_req_sense(struct ccb_accept_tio *at rsense = (struct scsi_request_sense *)a_descr->cdb; istate = tcmd_get_istate(ctio->init_id); - sense = &istate->sense_data; + sense = (struct scsi_sense_data_fixed *)&istate->sense_data; if (debug) { cdb_debug(a_descr->cdb, "REQ SENSE from %u: ", atio->init_id); @@ -400,7 +400,7 @@ tcmd_req_sense(struct ccb_accept_tio *at } bcopy(sense, ctio->data_ptr, sizeof(struct scsi_sense_data)); - dlen = offsetof(struct scsi_sense_data, extra_len) + + dlen = offsetof(struct scsi_sense_data_fixed, extra_len) + sense->extra_len + 1; ctio->dxfer_len = min(dlen, SCSI_CDB6_LEN(rsense->length)); ctio->ccb_h.flags |= CAM_DIR_IN | CAM_SEND_STATUS; @@ -482,7 +482,7 @@ tcmd_rdwr(struct ccb_accept_tio *atio, s c_descr = (struct ctio_descr *)ctio->ccb_h.targ_descr; /* Command needs to be decoded */ - if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_RESV) { + if ((a_descr->flags & CAM_DIR_MASK) == CAM_DIR_BOTH) { if (debug) warnx("Calling rdwr_decode"); ret = tcmd_rdwr_decode(atio, ctio); Modified: stable/9/share/examples/scsi_target/scsi_target.c ============================================================================== --- stable/9/share/examples/scsi_target/scsi_target.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/share/examples/scsi_target/scsi_target.c Thu Oct 6 19:15:51 2011 (r226067) @@ -651,7 +651,7 @@ work_atio(struct ccb_accept_tio *atio) * receiving this ATIO. */ if (atio->sense_len != 0) { - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; if (debug) { warnx("ATIO with %u bytes sense received", @@ -825,9 +825,9 @@ work_inot(struct ccb_immed_notify *inot) /* If there is sense data, use it */ if (sense != 0) { - struct scsi_sense_data *sense; + struct scsi_sense_data_fixed *sense; - sense = &inot->sense_data; + sense = (struct scsi_sense_data_fixed *)&inot->sense_data; tcmd_sense(inot->initiator_id, NULL, sense->flags, sense->add_sense_code, sense->add_sense_code_qual); if (debug) Modified: stable/9/share/misc/scsi_modes ============================================================================== --- stable/9/share/misc/scsi_modes Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/share/misc/scsi_modes Thu Oct 6 19:15:51 2011 (r226067) @@ -50,19 +50,32 @@ # ALL DEVICE TYPES 0x0a "Control Mode Page" { - {Reserved} *t7 + {TST} t3 + {TMF_ONLY} t1 + {DPICZ} t1 + {D_SENSE} t1 + {GLTSD} t1 {RLEC} t1 {Queue Algorithm Modifier} t4 - {Reserved} *t2 - {QErr} t1 + {NUAR} t1 + {QErr} t2 {DQue} t1 {EECA} t1 - {Reserved} *t4 + {RAC} t1 + {UA_INTLCK_CTRL} t2 + {SWP} t1 {RAENP} t1 {UAAENP} t1 {EAENP} t1 - {Reserved} *i1 + {ATO} t1 + {TAS} t1 + {ATMPE} t1 + {RWWP} t1 + {Reserved} *t1 + {Autoload Mode} t3 {Ready AEN Holdoff Period} i2 + {Busy Timeout Period} i2 + {Extended Self-Test Completion Time} i2 } 0x02 "Disconnect-Reconnect Page" { Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sys/cam/cam_ccb.h Thu Oct 6 19:15:51 2011 (r226067) @@ -539,7 +539,7 @@ struct ccb_dev_match { /* * Definitions for the path inquiry CCB fields. */ -#define CAM_VERSION 0x15 /* Hex value for current version */ +#define CAM_VERSION 0x16 /* Hex value for current version */ typedef enum { PI_MDP_ABLE = 0x80, /* Supports MDP message */ Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sys/cam/cam_periph.c Thu Oct 6 19:15:51 2011 (r226067) @@ -1085,7 +1085,6 @@ camperiphsensedone(struct cam_periph *pe union ccb *saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; cam_status status; int frozen = 0; - u_int sense_key; int depth = done_ccb->ccb_h.recovery_depth; status = done_ccb->ccb_h.status; @@ -1101,22 +1100,25 @@ camperiphsensedone(struct cam_periph *pe switch (status) { case CAM_REQ_CMP: { + int error_code, sense_key, asc, ascq; + + scsi_extract_sense_len(&saved_ccb->csio.sense_data, + saved_ccb->csio.sense_len - + saved_ccb->csio.sense_resid, + &error_code, &sense_key, &asc, &ascq, + /*show_errors*/ 1); /* * If we manually retrieved sense into a CCB and got * something other than "NO SENSE" send the updated CCB * back to the client via xpt_done() to be processed via * the error recovery code again. */ - sense_key = saved_ccb->csio.sense_data.flags; - sense_key &= SSD_KEY; - if (sense_key != SSD_KEY_NO_SENSE) { - saved_ccb->ccb_h.status |= - CAM_AUTOSNS_VALID; + if ((sense_key != -1) + && (sense_key != SSD_KEY_NO_SENSE)) { + saved_ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } else { - saved_ccb->ccb_h.status &= - ~CAM_STATUS_MASK; - saved_ccb->ccb_h.status |= - CAM_AUTOSENSE_FAIL; + saved_ccb->ccb_h.status &= ~CAM_STATUS_MASK; + saved_ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; } saved_ccb->csio.sense_resid = done_ccb->csio.resid; bcopy(saved_ccb, done_ccb, sizeof(union ccb)); @@ -1198,12 +1200,15 @@ camperiphdone(struct cam_periph *periph, if (status & CAM_AUTOSNS_VALID) { struct ccb_getdev cgd; struct scsi_sense_data *sense; - int error_code, sense_key, asc, ascq; + int error_code, sense_key, asc, ascq, sense_len; scsi_sense_action err_action; sense = &done_ccb->csio.sense_data; - scsi_extract_sense(sense, &error_code, - &sense_key, &asc, &ascq); + sense_len = done_ccb->csio.sense_len - + done_ccb->csio.sense_resid; + scsi_extract_sense_len(sense, sense_len, &error_code, + &sense_key, &asc, &ascq, + /*show_errors*/ 1); /* * Grab the inquiry data for this device. */ Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Thu Oct 6 17:35:38 2011 (r226066) +++ stable/9/sys/cam/scsi/scsi_all.c Thu Oct 6 19:15:51 2011 (r226067) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #ifdef _KERNEL #include @@ -54,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #ifndef _KERNEL #include +#include #ifndef FALSE #define FALSE 0 @@ -608,14 +611,24 @@ scsi_op_desc(u_int16_t opcode, struct sc struct op_table_entry *table[2]; int num_tables; - pd_type = SID_TYPE(inq_data); + /* + * If we've got inquiry data, use it to determine what type of + * device we're dealing with here. Otherwise, assume direct + * access. + */ + if (inq_data == NULL) { + pd_type = T_DIRECT; + match = NULL; + } else { + pd_type = SID_TYPE(inq_data); - match = cam_quirkmatch((caddr_t)inq_data, - (caddr_t)scsi_op_quirk_table, - sizeof(scsi_op_quirk_table)/ - sizeof(*scsi_op_quirk_table), - sizeof(*scsi_op_quirk_table), - scsi_inquiry_match); + match = cam_quirkmatch((caddr_t)inq_data, + (caddr_t)scsi_op_quirk_table, + sizeof(scsi_op_quirk_table)/ + sizeof(*scsi_op_quirk_table), + sizeof(*scsi_op_quirk_table), + scsi_inquiry_match); + } if (match != NULL) { table[0] = ((struct scsi_op_quirk_entry *)match)->op_table; @@ -699,7 +712,7 @@ const struct sense_key_table_entry sense { SSD_KEY_EQUAL, SS_NOP, "EQUAL" }, { SSD_KEY_VOLUME_OVERFLOW, SS_FATAL|EIO, "VOLUME OVERFLOW" }, { SSD_KEY_MISCOMPARE, SS_NOP, "MISCOMPARE" }, - { SSD_KEY_RESERVED, SS_FATAL|EIO, "RESERVED" } + { SSD_KEY_COMPLETED, SS_NOP, "COMPLETED" } }; const int sense_key_table_size = @@ -1062,25 +1075,25 @@ static struct asc_table_entry asc_table[ { SST(0x10, 0x03, SS_RDEF, /* XXX TBD */ "Logical block reference tag check failed") }, /* DT WRO BK */ - { SST(0x11, 0x00, SS_RDEF, + { SST(0x11, 0x00, SS_FATAL|EIO, "Unrecovered read error") }, /* DT WRO BK */ - { SST(0x11, 0x01, SS_RDEF, + { SST(0x11, 0x01, SS_FATAL|EIO, "Read retries exhausted") }, /* DT WRO BK */ - { SST(0x11, 0x02, SS_RDEF, + { SST(0x11, 0x02, SS_FATAL|EIO, "Error too long to correct") }, /* DT W O BK */ - { SST(0x11, 0x03, SS_RDEF, + { SST(0x11, 0x03, SS_FATAL|EIO, "Multiple read errors") }, /* D W O BK */ - { SST(0x11, 0x04, SS_RDEF, + { SST(0x11, 0x04, SS_FATAL|EIO, "Unrecovered read error - auto reallocate failed") }, /* WRO B */ - { SST(0x11, 0x05, SS_RDEF, + { SST(0x11, 0x05, SS_FATAL|EIO, "L-EC uncorrectable error") }, /* WRO B */ - { SST(0x11, 0x06, SS_RDEF, + { SST(0x11, 0x06, SS_FATAL|EIO, "CIRC unrecovered error") }, /* W O B */ { SST(0x11, 0x07, SS_RDEF, @@ -1095,10 +1108,10 @@ static struct asc_table_entry asc_table[ { SST(0x11, 0x0A, SS_RDEF, "Miscorrected error") }, /* D W O BK */ - { SST(0x11, 0x0B, SS_RDEF, + { SST(0x11, 0x0B, SS_FATAL|EIO, "Unrecovered read error - recommend reassignment") }, /* D W O BK */ - { SST(0x11, 0x0C, SS_RDEF, + { SST(0x11, 0x0C, SS_FATAL|EIO, "Unrecovered read error - recommend rewrite the data") }, /* DT WRO B */ { SST(0x11, 0x0D, SS_RDEF, @@ -2790,7 +2803,10 @@ scsi_sense_desc(int sense_key, int asc, &sense_entry, &asc_entry); - *sense_key_desc = sense_entry->desc; + if (sense_entry != NULL) + *sense_key_desc = sense_entry->desc; + else + *sense_key_desc = "Invalid Sense Key"; if (asc_entry != NULL) *asc_desc = asc_entry->desc; @@ -2816,10 +2832,12 @@ scsi_error_action(struct ccb_scsiio *csi int error_code, sense_key, asc, ascq; scsi_sense_action action; - scsi_extract_sense(&csio->sense_data, &error_code, - &sense_key, &asc, &ascq); + scsi_extract_sense_len(&csio->sense_data, csio->sense_len - + csio->sense_resid, &error_code, + &sense_key, &asc, &ascq, /*show_errors*/ 1); - if (error_code == SSD_DEFERRED_ERROR) { + if ((error_code == SSD_DEFERRED_ERROR) + || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* * XXX dufault@FreeBSD.org * This error doesn't relate to the command associated @@ -2857,8 +2875,10 @@ scsi_error_action(struct ccb_scsiio *csi if (asc_entry != NULL && (asc != 0 || ascq != 0)) action = asc_entry->action; - else + else if (sense_entry != NULL) action = sense_entry->action; + else + action = SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE; if (sense_key == SSD_KEY_RECOVERED_ERROR) { /* @@ -3040,308 +3060,1530 @@ scsi_command_string(struct cam_device *d return(0); } - /* - * scsi_sense_sbuf() returns 0 for success and -1 for failure. + * Iterate over sense descriptors. Each descriptor is passed into iter_func(). + * If iter_func() returns 0, list traversal continues. If iter_func() + * returns non-zero, list traversal is stopped. */ -#ifdef _KERNEL -int -scsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb, - scsi_sense_string_flags flags) -#else /* !_KERNEL */ -int -scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, - struct sbuf *sb, scsi_sense_string_flags flags) -#endif /* _KERNEL/!_KERNEL */ +void +scsi_desc_iterate(struct scsi_sense_data_desc *sense, u_int sense_len, + int (*iter_func)(struct scsi_sense_data_desc *sense, + u_int, struct scsi_sense_desc_header *, + void *), void *arg) { - struct scsi_sense_data *sense; - struct scsi_inquiry_data *inq_data; -#ifdef _KERNEL - struct ccb_getdev *cgd; -#endif /* _KERNEL */ - u_int32_t info; - int error_code; - int sense_key; - int asc, ascq; - char path_str[64]; - -#ifndef _KERNEL - if (device == NULL) - return(-1); -#endif /* !_KERNEL */ - if ((csio == NULL) || (sb == NULL)) - return(-1); + int cur_pos; + int desc_len; /* - * If the CDB is a physical address, we can't deal with it.. + * First make sure the extra length field is present. */ - if ((csio->ccb_h.flags & CAM_CDB_PHYS) != 0) - flags &= ~SSS_FLAG_PRINT_COMMAND; + if (SSD_DESC_IS_PRESENT(sense, sense_len, extra_len) == 0) + return; -#ifdef _KERNEL - xpt_path_string(csio->ccb_h.path, path_str, sizeof(path_str)); -#else /* !_KERNEL */ - cam_path_string(device, path_str, sizeof(path_str)); -#endif /* _KERNEL/!_KERNEL */ + /* + * The length of data actually returned may be different than the + * extra_len recorded in the sturcture. + */ + desc_len = sense_len -offsetof(struct scsi_sense_data_desc, sense_desc); -#ifdef _KERNEL - if ((cgd = (struct ccb_getdev*)xpt_alloc_ccb_nowait()) == NULL) - return(-1); /* - * Get the device information. + * Limit this further by the extra length reported, and the maximum + * allowed extra length. */ - xpt_setup_ccb(&cgd->ccb_h, - csio->ccb_h.path, - CAM_PRIORITY_NORMAL); - cgd->ccb_h.func_code = XPT_GDEV_TYPE; - xpt_action((union ccb *)cgd); + desc_len = MIN(desc_len, MIN(sense->extra_len, SSD_EXTRA_MAX)); /* - * If the device is unconfigured, just pretend that it is a hard - * drive. scsi_op_desc() needs this. + * Subtract the size of the header from the descriptor length. + * This is to ensure that we have at least the header left, so we + * don't have to check that inside the loop. This can wind up + * being a negative value. */ - if (cgd->ccb_h.status == CAM_DEV_NOT_THERE) - cgd->inq_data.device = T_DIRECT; + desc_len -= sizeof(struct scsi_sense_desc_header); - inq_data = &cgd->inq_data; + for (cur_pos = 0; cur_pos < desc_len;) { + struct scsi_sense_desc_header *header; -#else /* !_KERNEL */ + header = (struct scsi_sense_desc_header *) + &sense->sense_desc[cur_pos]; - inq_data = &device->inq_data; + /* + * Check to make sure we have the entire descriptor. We + * don't call iter_func() unless we do. + * + * Note that although cur_pos is at the beginning of the + * descriptor, desc_len already has the header length + * subtracted. So the comparison of the length in the + * header (which does not include the header itself) to + * desc_len - cur_pos is correct. + */ + if (header->length > (desc_len - cur_pos)) + break; -#endif /* _KERNEL/!_KERNEL */ + if (iter_func(sense, sense_len, header, arg) != 0) + break; - sense = NULL; + cur_pos += sizeof(*header) + header->length; + } +} - if (flags & SSS_FLAG_PRINT_COMMAND) { +struct scsi_find_desc_info { + uint8_t desc_type; + struct scsi_sense_desc_header *header; +}; - sbuf_cat(sb, path_str); +static int +scsi_find_desc_func(struct scsi_sense_data_desc *sense, u_int sense_len, + struct scsi_sense_desc_header *header, void *arg) +{ + struct scsi_find_desc_info *desc_info; -#ifdef _KERNEL - scsi_command_string(csio, sb); -#else /* !_KERNEL */ - scsi_command_string(device, csio, sb); -#endif /* _KERNEL/!_KERNEL */ - sbuf_printf(sb, "\n"); - } + desc_info = (struct scsi_find_desc_info *)arg; + + if (header->desc_type == desc_info->desc_type) { + desc_info->header = header; + + /* We found the descriptor, tell the iterator to stop. */ + return (1); + } else + return (0); +} + +/* + * Given a descriptor type, return a pointer to it if it is in the sense + * data and not truncated. Avoiding truncating sense data will simplify + * things significantly for the caller. + */ +uint8_t * +scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len, + uint8_t desc_type) +{ + struct scsi_find_desc_info desc_info; + + desc_info.desc_type = desc_type; + desc_info.header = NULL; + + scsi_desc_iterate(sense, sense_len, scsi_find_desc_func, &desc_info); + + return ((uint8_t *)desc_info.header); +} + +/* + * Fill in SCSI sense data with the specified parameters. This routine can + * fill in either fixed or descriptor type sense data. + */ +void +scsi_set_sense_data_va(struct scsi_sense_data *sense_data, + scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) +{ + int descriptor_sense; + scsi_sense_elem_type elem_type; /* - * If the sense data is a physical pointer, forget it. + * Determine whether to return fixed or descriptor format sense + * data. If the user specifies SSD_TYPE_NONE for some reason, + * they'll just get fixed sense data. */ - if (csio->ccb_h.flags & CAM_SENSE_PTR) { - if (csio->ccb_h.flags & CAM_SENSE_PHYS) { -#ifdef _KERNEL - xpt_free_ccb((union ccb*)cgd); -#endif /* _KERNEL/!_KERNEL */ - return(-1); - } else { - /* - * bcopy the pointer to avoid unaligned access - * errors on finicky architectures. We don't - * ensure that the sense data is pointer aligned. - */ - bcopy(&csio->sense_data, &sense, - sizeof(struct scsi_sense_data *)); - } - } else { + if (sense_format == SSD_TYPE_DESC) + descriptor_sense = 1; + else + descriptor_sense = 0; + + /* + * Zero the sense data, so that we don't pass back any garbage data + * to the user. + */ + memset(sense_data, 0, sizeof(*sense_data)); + + if (descriptor_sense != 0) { + struct scsi_sense_data_desc *sense; + + sense = (struct scsi_sense_data_desc *)sense_data; /* - * If the physical sense flag is set, but the sense pointer - * is not also set, we assume that the user is an idiot and - * return. (Well, okay, it could be that somehow, the - * entire csio is physical, but we would have probably core - * dumped on one of the bogus pointer deferences above - * already.) + * The descriptor sense format eliminates the use of the + * valid bit. */ - if (csio->ccb_h.flags & CAM_SENSE_PHYS) { -#ifdef _KERNEL - xpt_free_ccb((union ccb*)cgd); -#endif /* _KERNEL/!_KERNEL */ - return(-1); - } else - sense = &csio->sense_data; - } - + if (current_error != 0) + sense->error_code = SSD_DESC_CURRENT_ERROR; + else + sense->error_code = SSD_DESC_DEFERRED_ERROR; + sense->sense_key = sense_key; + sense->add_sense_code = asc; + sense->add_sense_code_qual = ascq; + /* + * Start off with no extra length, since the above data + * fits in the standard descriptor sense information. + */ + sense->extra_len = 0; + while ((elem_type = (scsi_sense_elem_type)va_arg(ap, + scsi_sense_elem_type)) != SSD_ELEM_NONE) { + int sense_len, len_to_copy; + uint8_t *data; + + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); + break; + } - sbuf_cat(sb, path_str); + sense_len = (int)va_arg(ap, int); + len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - + sense->extra_len); + data = (uint8_t *)va_arg(ap, uint8_t *); - error_code = sense->error_code & SSD_ERRCODE; - sense_key = sense->flags & SSD_KEY; + /* + * We've already consumed the arguments for this one. + */ + if (elem_type == SSD_ELEM_SKIP) + continue; - sbuf_printf(sb, "SCSI sense: "); - switch (error_code) { - case SSD_DEFERRED_ERROR: - sbuf_printf(sb, "Deferred error: "); + switch (elem_type) { + case SSD_ELEM_DESC: { - /* FALLTHROUGH */ - case SSD_CURRENT_ERROR: - { - const char *sense_key_desc; - const char *asc_desc; + /* + * This is a straight descriptor. All we + * need to do is copy the data in. + */ + bcopy(data, &sense->sense_desc[ + sense->extra_len], len_to_copy); + sense->extra_len += len_to_copy; + break; + } + case SSD_ELEM_SKS: { + struct scsi_sense_sks sks; - asc = (sense->extra_len >= 5) ? sense->add_sense_code : 0; - ascq = (sense->extra_len >= 6) ? sense->add_sense_code_qual : 0; - scsi_sense_desc(sense_key, asc, ascq, inq_data, - &sense_key_desc, &asc_desc); - sbuf_cat(sb, sense_key_desc); + bzero(&sks, sizeof(sks)); - info = scsi_4btoul(sense->info); - - if (sense->error_code & SSD_ERRCODE_VALID) { + /* + * This is already-formatted sense key + * specific data. We just need to fill out + * the header and copy everything in. + */ + bcopy(data, &sks.sense_key_spec, + MIN(len_to_copy, + sizeof(sks.sense_key_spec))); + + sks.desc_type = SSD_DESC_SKS; + sks.length = sizeof(sks) - + offsetof(struct scsi_sense_sks, reserved1); + bcopy(&sks,&sense->sense_desc[sense->extra_len], + sizeof(sks)); + sense->extra_len += sizeof(sks); + break; + } + case SSD_ELEM_INFO: + case SSD_ELEM_COMMAND: { + struct scsi_sense_command cmd; + struct scsi_sense_info info; + uint8_t *data_dest; + uint8_t *descriptor; + int descriptor_size, i, copy_len; + + bzero(&cmd, sizeof(cmd)); + bzero(&info, sizeof(info)); + + /* + * Command or information data. The + * operate in pretty much the same way. + */ + if (elem_type == SSD_ELEM_COMMAND) { + len_to_copy = MIN(len_to_copy, + sizeof(cmd.command_info)); + descriptor = (uint8_t *)&cmd; + descriptor_size = sizeof(cmd); + data_dest =(uint8_t *)&cmd.command_info; + cmd.desc_type = SSD_DESC_COMMAND; + cmd.length = sizeof(cmd) - + offsetof(struct scsi_sense_command, + reserved); + } else { + len_to_copy = MIN(len_to_copy, + sizeof(info.info)); + descriptor = (uint8_t *)&info; + descriptor_size = sizeof(cmd); + data_dest = (uint8_t *)&info.info; + info.desc_type = SSD_DESC_INFO; + info.byte2 = SSD_INFO_VALID; + info.length = sizeof(info) - + offsetof(struct scsi_sense_info, + byte2); + } - switch (sense_key) { - case SSD_KEY_NOT_READY: - case SSD_KEY_ILLEGAL_REQUEST: - case SSD_KEY_UNIT_ATTENTION: - case SSD_KEY_DATA_PROTECT: + /* + * Copy this in reverse because the spec + * (SPC-4) says that when 4 byte quantities + * are stored in this 8 byte field, the + * first four bytes shall be 0. + * + * So we fill the bytes in from the end, and + * if we have less than 8 bytes to copy, + * the initial, most significant bytes will + * be 0. + */ + for (i = sense_len - 1; i >= 0 && + len_to_copy > 0; i--, len_to_copy--) + data_dest[len_to_copy - 1] = data[i]; + + /* + * This calculation looks much like the + * initial len_to_copy calculation, but + * we have to do it again here, because + * we're looking at a larger amount that + * may or may not fit. It's not only the + * data the user passed in, but also the + * rest of the descriptor. + */ + copy_len = MIN(descriptor_size, + SSD_EXTRA_MAX - sense->extra_len); + bcopy(descriptor, &sense->sense_desc[ + sense->extra_len], copy_len); + sense->extra_len += copy_len; + break; + } + case SSD_ELEM_FRU: { + struct scsi_sense_fru fru; + int copy_len; + + bzero(&fru, sizeof(fru)); + + fru.desc_type = SSD_DESC_FRU; + fru.length = sizeof(fru) - + offsetof(struct scsi_sense_fru, reserved); + fru.fru = *data; + + copy_len = MIN(sizeof(fru), SSD_EXTRA_MAX - + sense->extra_len); + bcopy(&fru, &sense->sense_desc[ + sense->extra_len], copy_len); + sense->extra_len += copy_len; break; - case SSD_KEY_BLANK_CHECK: - sbuf_printf(sb, " req sz: %d (decimal)", info); + } + case SSD_ELEM_STREAM: { + struct scsi_sense_stream stream_sense; + int copy_len; + + bzero(&stream_sense, sizeof(stream_sense)); + stream_sense.desc_type = SSD_DESC_STREAM; + stream_sense.length = sizeof(stream_sense) - + offsetof(struct scsi_sense_stream, reserved); + stream_sense.byte3 = *data; + + copy_len = MIN(sizeof(stream_sense), + SSD_EXTRA_MAX - sense->extra_len); + bcopy(&stream_sense, &sense->sense_desc[ + sense->extra_len], copy_len); + sense->extra_len += copy_len; break; + } default: - if (info) { - if (sense->flags & SSD_ILI) { - sbuf_printf(sb, " ILI (length " - "mismatch): %d", info); - - } else { - sbuf_printf(sb, " info:%x", - info); - } - } + /* + * We shouldn't get here, but if we do, do + * nothing. We've already consumed the + * arguments above. + */ + break; } - } else if (info) { - sbuf_printf(sb, " info?:%x", info); } + } else { + struct scsi_sense_data_fixed *sense; - if (sense->extra_len >= 4) { - if (bcmp(sense->cmd_spec_info, "\0\0\0\0", 4)) { - sbuf_printf(sb, " csi:%x,%x,%x,%x", - sense->cmd_spec_info[0], - sense->cmd_spec_info[1], - sense->cmd_spec_info[2], - sense->cmd_spec_info[3]); - } - } + sense = (struct scsi_sense_data_fixed *)sense_data; - sbuf_printf(sb, " asc:%x,%x (%s)", asc, ascq, asc_desc); + if (current_error != 0) + sense->error_code = SSD_CURRENT_ERROR; + else + sense->error_code = SSD_DEFERRED_ERROR; - if (sense->extra_len >= 7 && sense->fru) { - sbuf_printf(sb, " field replaceable unit: %x", - sense->fru); - } + sense->flags = sense_key; + sense->add_sense_code = asc; + sense->add_sense_code_qual = ascq; + /* + * We've set the ASC and ASCQ, so we have 6 more bytes of + * valid data. If we wind up setting any of the other + * fields, we'll bump this to 10 extra bytes. + */ + sense->extra_len = 6; - if ((sense->extra_len >= 10) - && (sense->sense_key_spec[0] & SSD_SCS_VALID) != 0) { - switch(sense_key) { - case SSD_KEY_ILLEGAL_REQUEST: { - int bad_command; - char tmpstr2[40]; - - if (sense->sense_key_spec[0] & 0x40) - bad_command = 1; - else - bad_command = 0; - - tmpstr2[0] = '\0'; - - /* Bit pointer is valid */ - if (sense->sense_key_spec[0] & 0x08) - snprintf(tmpstr2, sizeof(tmpstr2), - "bit %d ", - sense->sense_key_spec[0] & 0x7); - sbuf_printf(sb, ": %s byte %d %sis invalid", - bad_command ? "Command" : "Data", - scsi_2btoul( - &sense->sense_key_spec[1]), - tmpstr2); + while ((elem_type = (scsi_sense_elem_type)va_arg(ap, + scsi_sense_elem_type)) != SSD_ELEM_NONE) { + int sense_len, len_to_copy; + uint8_t *data; + + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); break; } - case SSD_KEY_RECOVERED_ERROR: - case SSD_KEY_HARDWARE_ERROR: - case SSD_KEY_MEDIUM_ERROR: - sbuf_printf(sb, " actual retry count: %d", - scsi_2btoul( - &sense->sense_key_spec[1])); + /* + * If we get in here, just bump the extra length to + * 10 bytes. That will encompass anything we're + * going to set here. + */ + sense->extra_len = 10; + sense_len = (int)va_arg(ap, int); + len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - + sense->extra_len); + data = (uint8_t *)va_arg(ap, uint8_t *); + + switch (elem_type) { + case SSD_ELEM_SKS: + /* + * The user passed in pre-formatted sense + * key specific data. + */ + bcopy(data, &sense->sense_key_spec[0], + MIN(sizeof(sense->sense_key_spec), + sense_len)); break; - default: - sbuf_printf(sb, " sks:%#x,%#x", - sense->sense_key_spec[0], - scsi_2btoul( - &sense->sense_key_spec[1])); + case SSD_ELEM_INFO: + case SSD_ELEM_COMMAND: { + uint8_t *data_dest; + int i; + + if (elem_type == SSD_ELEM_COMMAND) + data_dest = &sense->cmd_spec_info[0]; + else { + data_dest = &sense->info[0]; + /* + * We're setting the info field, so + * set the valid bit. + */ + sense->error_code |= SSD_ERRCODE_VALID; + } + + /* + * Copy this in reverse so that if we have + * less than 4 bytes to fill, the least + * significant bytes will be at the end. + * If we have more than 4 bytes, only the + * least significant bytes will be included. + */ + for (i = sense_len - 1; i >= 0 && + len_to_copy > 0; i--, len_to_copy--) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Oct 6 20:25:36 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 244621065673; Thu, 6 Oct 2011 20:25:36 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13CB88FC0C; Thu, 6 Oct 2011 20:25:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p96KPZuF076346; Thu, 6 Oct 2011 20:25:35 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p96KPZV3076344; Thu, 6 Oct 2011 20:25:35 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201110062025.p96KPZV3076344@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 6 Oct 2011 20:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226070 - stable/9/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 20:25:36 -0000 Author: pluknet Date: Thu Oct 6 20:25:35 2011 New Revision: 226070 URL: http://svn.freebsd.org/changeset/base/226070 Log: MFC r225776: Fix typo in OSIOCGIFADDR. Approved by: re (kib) Modified: stable/9/share/man/man9/ifnet.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/ifnet.9 ============================================================================== --- stable/9/share/man/man9/ifnet.9 Thu Oct 6 20:20:30 2011 (r226069) +++ stable/9/share/man/man9/ifnet.9 Thu Oct 6 20:25:35 2011 (r226070) @@ -1252,7 +1252,7 @@ function is called to perform the operat The socket's protocol control routine is called to implement the requested action. .Pp -.It Dv OSIOGIFADDR +.It Dv OSIOCGIFADDR .It Dv OSIOCGIFDSTADDR .It Dv OSIOCGIFBRDADDR .It Dv OSIOCGIFNETMASK From owner-svn-src-stable@FreeBSD.ORG Fri Oct 7 06:46:46 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D91301065672; Fri, 7 Oct 2011 06:46:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C734C8FC15; Fri, 7 Oct 2011 06:46:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p976kkQW097321; Fri, 7 Oct 2011 06:46:46 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p976kkm4097316; Fri, 7 Oct 2011 06:46:46 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201110070646.p976kkm4097316@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 7 Oct 2011 06:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226092 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 06:46:47 -0000 Author: trasz Date: Fri Oct 7 06:46:46 2011 New Revision: 226092 URL: http://svn.freebsd.org/changeset/base/226092 Log: MFC r225938: Fix bug introduced in r225641, which would cause panic if racct_proc_fork() returned error -- the racct_destroy_locked() would get called twice. MFC r225940: Fix another bug introduced in r225641, which caused rctl to access certain fields in 'struct proc' before they got initialized in do_fork(). MFC r225944: Move some code inside the racct_proc_fork(); it spares a few lock operations and it's more logical this way. MFC r225981: Actually enforce limit for inheritable resources on fork. Approved by: re (kib) Modified: stable/9/sys/kern/kern_fork.c stable/9/sys/kern/kern_racct.c stable/9/sys/kern/kern_rctl.c stable/9/sys/sys/racct.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/kern_fork.c ============================================================================== --- stable/9/sys/kern/kern_fork.c Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/kern/kern_fork.c Fri Oct 7 06:46:46 2011 (r226092) @@ -879,17 +879,6 @@ fork1(struct thread *td, int flags, int goto fail1; } -#ifdef RACCT - PROC_LOCK(newproc); - error = racct_add(newproc, RACCT_NPROC, 1); - error += racct_add(newproc, RACCT_NTHR, 1); - PROC_UNLOCK(newproc); - if (error != 0) { - error = EAGAIN; - goto fail1; - } -#endif - #ifdef MAC mac_proc_init(newproc); #endif @@ -939,6 +928,7 @@ fork1(struct thread *td, int flags, int if (flags & RFPROCDESC) procdesc_finit(newproc->p_procdesc, fp_procdesc); #endif + racct_proc_fork_done(newproc); return (0); } Modified: stable/9/sys/kern/kern_racct.c ============================================================================== --- stable/9/sys/kern/kern_racct.c Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/kern/kern_racct.c Fri Oct 7 06:46:46 2011 (r226092) @@ -261,12 +261,8 @@ racct_alloc_resource(struct racct *racct } } -/* - * Increase allocation of 'resource' by 'amount' for process 'p'. - * Return 0 if it's below limits, or errno, if it's not. - */ -int -racct_add(struct proc *p, int resource, uint64_t amount) +static int +racct_add_locked(struct proc *p, int resource, uint64_t amount) { #ifdef RCTL int error; @@ -282,23 +278,35 @@ racct_add(struct proc *p, int resource, */ PROC_LOCK_ASSERT(p, MA_OWNED); - mtx_lock(&racct_lock); #ifdef RCTL error = rctl_enforce(p, resource, amount); if (error && RACCT_IS_DENIABLE(resource)) { SDT_PROBE(racct, kernel, rusage, add_failure, p, resource, amount, 0, 0); - mtx_unlock(&racct_lock); return (error); } #endif racct_alloc_resource(p->p_racct, resource, amount); racct_add_cred_locked(p->p_ucred, resource, amount); - mtx_unlock(&racct_lock); return (0); } +/* + * Increase allocation of 'resource' by 'amount' for process 'p'. + * Return 0 if it's below limits, or errno, if it's not. + */ +int +racct_add(struct proc *p, int resource, uint64_t amount) +{ + int error; + + mtx_lock(&racct_lock); + error = racct_add_locked(p, resource, amount); + mtx_unlock(&racct_lock); + return (error); +} + static void racct_add_cred_locked(struct ucred *cred, int resource, uint64_t amount) { @@ -559,6 +567,12 @@ racct_proc_fork(struct proc *parent, str PROC_LOCK(child); mtx_lock(&racct_lock); +#ifdef RCTL + error = rctl_proc_fork(parent, child); + if (error != 0) + goto out; +#endif + /* * Inherit resource usage. */ @@ -569,32 +583,14 @@ racct_proc_fork(struct proc *parent, str error = racct_set_locked(child, i, parent->p_racct->r_resources[i]); - if (error != 0) { - /* - * XXX: The only purpose of these two lines is - * to prevent from tripping checks in racct_destroy(). - */ - for (i = 0; i <= RACCT_MAX; i++) - racct_set_locked(child, i, 0); + if (error != 0) goto out; - } } -#ifdef RCTL - error = rctl_proc_fork(parent, child); - if (error != 0) { - /* - * XXX: The only purpose of these two lines is to prevent from - * tripping checks in racct_destroy(). - */ - for (i = 0; i <= RACCT_MAX; i++) - racct_set_locked(child, i, 0); - } -#endif + error = racct_add_locked(child, RACCT_NPROC, 1); + error += racct_add_locked(child, RACCT_NTHR, 1); out: - if (error != 0) - racct_destroy_locked(&child->p_racct); mtx_unlock(&racct_lock); PROC_UNLOCK(child); PROC_UNLOCK(parent); @@ -602,6 +598,24 @@ out: return (error); } +/* + * Called at the end of fork1(), to handle rules that require the process + * to be fully initialized. + */ +void +racct_proc_fork_done(struct proc *child) +{ + +#ifdef RCTL + PROC_LOCK(child); + mtx_lock(&racct_lock); + rctl_enforce(child, RACCT_NPROC, 0); + rctl_enforce(child, RACCT_NTHR, 0); + mtx_unlock(&racct_lock); + PROC_UNLOCK(child); +#endif +} + void racct_proc_exit(struct proc *p) { @@ -827,6 +841,11 @@ racct_proc_fork(struct proc *parent, str } void +racct_proc_fork_done(struct proc *child) +{ +} + +void racct_proc_exit(struct proc *p) { } Modified: stable/9/sys/kern/kern_rctl.c ============================================================================== --- stable/9/sys/kern/kern_rctl.c Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/kern/kern_rctl.c Fri Oct 7 06:46:46 2011 (r226092) @@ -312,6 +312,16 @@ rctl_enforce(struct proc *p, int resourc if (link->rrl_exceeded != 0) continue; + /* + * If the process state is not fully initialized yet, + * we can't access most of the required fields, e.g. + * p->p_comm. This happens when called from fork1(). + * Ignore this rule for now; it will be processed just + * after fork, when called from racct_proc_fork_done(). + */ + if (p->p_state != PRS_NORMAL) + continue; + if (!ppsratecheck(&lasttime, &curtime, 10)) continue; @@ -335,6 +345,9 @@ rctl_enforce(struct proc *p, int resourc if (link->rrl_exceeded != 0) continue; + if (p->p_state != PRS_NORMAL) + continue; + buf = malloc(RCTL_LOG_BUFSIZE, M_RCTL, M_NOWAIT); if (buf == NULL) { printf("rctl_enforce: out of memory\n"); @@ -357,23 +370,15 @@ rctl_enforce(struct proc *p, int resourc if (link->rrl_exceeded != 0) continue; + if (p->p_state != PRS_NORMAL) + continue; + KASSERT(rule->rr_action > 0 && rule->rr_action <= RCTL_ACTION_SIGNAL_MAX, ("rctl_enforce: unknown action %d", rule->rr_action)); /* - * We're supposed to send a signal, but the process - * is not fully initialized yet, probably because we - * got called from fork1(). For now just deny the - * allocation instead. - */ - if (p->p_state != PRS_NORMAL) { - should_deny = 1; - continue; - } - - /* * We're using the fact that RCTL_ACTION_SIG* values * are equal to their counterparts from sys/signal.h. */ Modified: stable/9/sys/sys/racct.h ============================================================================== --- stable/9/sys/sys/racct.h Fri Oct 7 06:13:38 2011 (r226091) +++ stable/9/sys/sys/racct.h Fri Oct 7 06:46:46 2011 (r226092) @@ -137,6 +137,7 @@ void racct_create(struct racct **racctp) void racct_destroy(struct racct **racctp); int racct_proc_fork(struct proc *parent, struct proc *child); +void racct_proc_fork_done(struct proc *child); void racct_proc_exit(struct proc *p); void racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred, From owner-svn-src-stable@FreeBSD.ORG Fri Oct 7 14:27:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F6D3106567F; Fri, 7 Oct 2011 14:27:20 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E44B8FC08; Fri, 7 Oct 2011 14:27:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p97ERKrF014742; Fri, 7 Oct 2011 14:27:20 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p97ERK5U014740; Fri, 7 Oct 2011 14:27:20 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201110071427.p97ERK5U014740@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 7 Oct 2011 14:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226106 - stable/7/usr.bin/rs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 14:27:20 -0000 Author: jh Date: Fri Oct 7 14:27:20 2011 New Revision: 226106 URL: http://svn.freebsd.org/changeset/base/226106 Log: MFC r218410: Handle EOF when skipping lines. Modified: stable/7/usr.bin/rs/rs.c Directory Properties: stable/7/usr.bin/rs/ (props changed) Modified: stable/7/usr.bin/rs/rs.c ============================================================================== --- stable/7/usr.bin/rs/rs.c Fri Oct 7 13:43:01 2011 (r226105) +++ stable/7/usr.bin/rs/rs.c Fri Oct 7 14:27:20 2011 (r226106) @@ -130,14 +130,17 @@ getfile(void) char *p; char *endp; char **ep; + int c; int multisep = (flags & ONEISEPONLY ? 0 : 1); int nullpad = flags & NULLPAD; char **padto; while (skip--) { - getline(); + c = getline(); if (flags & SKIPPRINT) puts(curline); + if (c == EOF) + return; } getline(); if (flags & NOARGS && curlen < owidth) From owner-svn-src-stable@FreeBSD.ORG Fri Oct 7 14:29:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DC5F1065676; Fri, 7 Oct 2011 14:29:15 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64EA88FC20; Fri, 7 Oct 2011 14:29:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p97ETFAU014845; Fri, 7 Oct 2011 14:29:15 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p97ETFaO014843; Fri, 7 Oct 2011 14:29:15 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201110071429.p97ETFaO014843@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 7 Oct 2011 14:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226107 - stable/7/usr.bin/rs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 14:29:15 -0000 Author: jh Date: Fri Oct 7 14:29:15 2011 New Revision: 226107 URL: http://svn.freebsd.org/changeset/base/226107 Log: MFC r218411: - Use LINE_MAX from limits.h as the maximum line length instead of BUFSIZ. Use LINE_MAX * 2 as the buffer size (BSIZE). - Error out if we encounter a line longer than LINE_MAX. The previous behavior was to silently split long lines and produce corrupted output. PR: bin/151384 Modified: stable/7/usr.bin/rs/rs.c Directory Properties: stable/7/usr.bin/rs/ (props changed) Modified: stable/7/usr.bin/rs/rs.c ============================================================================== --- stable/7/usr.bin/rs/rs.c Fri Oct 7 14:27:20 2011 (r226106) +++ stable/7/usr.bin/rs/rs.c Fri Oct 7 14:29:15 2011 (r226107) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -333,8 +334,8 @@ prepfile(void) warnx("%d is colwidths, nelem %d", colwidths[i], nelem);*/ } -#define BSIZE 2048 -char ibuf[BSIZE]; /* two screenfuls should do */ +#define BSIZE (LINE_MAX * 2) +char ibuf[BSIZE]; int getline(void) /* get line; maintain curline, curlen; manage storage */ @@ -355,7 +356,7 @@ getline(void) /* get line; maintain curl curline = ibuf; } } - if (!putlength && endblock - curline < BUFSIZ) { /* need storage */ + if (!putlength && endblock - curline < LINE_MAX + 1) { /* need storage */ /*ww = endblock-curline; tt += ww;*/ /*printf("#wasted %d total %d\n",ww,tt);*/ if (!(curline = (char *) malloc(BSIZE))) @@ -363,11 +364,16 @@ getline(void) /* get line; maintain curl endblock = curline + BSIZE; /*printf("#endb %d curline %d\n",endblock,curline);*/ } - for (p = curline, i = 1; i < BUFSIZ; *p++ = c, i++) - if ((c = getchar()) == EOF || c == '\n') + for (p = curline, i = 0;; *p++ = c, i++) { + if ((c = getchar()) == EOF) break; + if (i >= LINE_MAX) + errx(1, "maximum line length (%d) exceeded", LINE_MAX); + if (c == '\n') + break; + } *p = '\0'; - curlen = i - 1; + curlen = i; return(c); } From owner-svn-src-stable@FreeBSD.ORG Fri Oct 7 14:30:45 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4F26106568B; Fri, 7 Oct 2011 14:30:45 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C43288FC0C; Fri, 7 Oct 2011 14:30:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p97EUjqc014946; Fri, 7 Oct 2011 14:30:45 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p97EUj7l014944; Fri, 7 Oct 2011 14:30:45 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201110071430.p97EUj7l014944@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 7 Oct 2011 14:30:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226108 - stable/7/usr.bin/rs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 14:30:46 -0000 Author: jh Date: Fri Oct 7 14:30:45 2011 New Revision: 226108 URL: http://svn.freebsd.org/changeset/base/226108 Log: MFC r219038: Document the input line length limit. Modified: stable/7/usr.bin/rs/rs.1 Directory Properties: stable/7/usr.bin/rs/ (props changed) Modified: stable/7/usr.bin/rs/rs.1 ============================================================================== --- stable/7/usr.bin/rs/rs.1 Fri Oct 7 14:29:15 2011 (r226107) +++ stable/7/usr.bin/rs/rs.1 Fri Oct 7 14:30:45 2011 (r226108) @@ -32,7 +32,7 @@ .\" @(#)rs.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd July 30, 2004 +.Dd February 25, 2011 .Dt RS 1 .Os .Sh NAME @@ -241,4 +241,9 @@ Re-ordering of columns is not yet possib There are too many options. .It Multibyte characters are not recognized. +.It +Lines longer than +.Dv LINE_MAX +(2048) bytes are not processed and result in immediate termination of +.Nm . .El From owner-svn-src-stable@FreeBSD.ORG Fri Oct 7 20:40:45 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E80AD1065731; Fri, 7 Oct 2011 20:40:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D3E8FC0A; Fri, 7 Oct 2011 20:40:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p97Kejum026804; Fri, 7 Oct 2011 20:40:45 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p97KejXU026797; Fri, 7 Oct 2011 20:40:45 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201110072040.p97KejXU026797@svn.freebsd.org> From: Xin LI Date: Fri, 7 Oct 2011 20:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226115 - in stable/9: share/man/man4 sys/amd64/conf sys/conf sys/dev/tws sys/i386/conf sys/modules sys/modules/tws X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 20:40:46 -0000 Author: delphij Date: Fri Oct 7 20:40:45 2011 New Revision: 226115 URL: http://svn.freebsd.org/changeset/base/226115 Log: MFC r226026: Add the 9750 SATA+SAS 6Gb/s RAID controller card driver, tws(4). Many thanks for their contiued support to FreeBSD. This is version 10.80.00.003 from codeset 10.2.1 [1] Obtained from: LSI http://kb.lsi.com/Download16574.aspx [1] Approved by: re (kib) Added: stable/9/share/man/man4/tws.4 - copied unchanged from r226026, head/share/man/man4/tws.4 stable/9/sys/dev/tws/ - copied from r226026, head/sys/dev/tws/ stable/9/sys/modules/tws/ - copied from r226026, head/sys/modules/tws/ Modified: stable/9/share/man/man4/Makefile stable/9/sys/amd64/conf/GENERIC stable/9/sys/conf/files stable/9/sys/i386/conf/GENERIC stable/9/sys/modules/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/share/man/man4/Makefile Fri Oct 7 20:40:45 2011 (r226115) @@ -447,6 +447,7 @@ MAN= aac.4 \ tun.4 \ twa.4 \ twe.4 \ + tws.4 \ tx.4 \ txp.4 \ u3g.4 \ Copied: stable/9/share/man/man4/tws.4 (from r226026, head/share/man/man4/tws.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/tws.4 Fri Oct 7 20:40:45 2011 (r226115, copy of r226026, head/share/man/man4/tws.4) @@ -0,0 +1,118 @@ +.\" +.\"Copyright (c) 2010, 2011 iXsystems, Inc. +.\"All rights reserved. +.\" written by: Xin LI +.\" +.\"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$ +.\" +.Dd October 4, 2011 +.Dt TWS 4 +.Os +.Sh NAME +.Nm tws +.Nd 3ware 9750 SATA+SAS 6Gb/s RAID controller card driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device scbus" +.Cd "device tws" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +tws_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for LSI's 3ware 9750 SATA+SAS 6Gb/s RAID controller cards. +.Pp +These controllers feature the LSISAS2108 6Gb/s SAS RAID-on-Chip (ROC) +and are available in 4- and 8-port configurations, supports RAID levels +0, 1, 5, 6, 10, 50 and single disk, with 96 SATA and/or SAS hard drives and SSDs. +.Pp +For further hardware information, see +.Pa http://www.lsi.com/. +.Sh HARDWARE +The +.Nm +driver supports the following SATA/SAS RAID controller: +.Pp +.Bl -bullet -compact +.It +LSI's 3ware SAS 9750 series +.El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "hw.tws.use_32bit_sgls" +.It Va hw.tws.cam_depth +The maximium queued CAM SIM requests for one controller. +The default value is 256. +.It Va hw.tws.enable_msi +This tunable enables MSI support on the controller if set to a non-zero value. +The default value is 0. +.It Va hw.tws.queue_depth +The maximium queued requests for one controller. +.It Va hw.tws.use_32bit_sgls +Limit the driver to use only 32-bit SG elements regardless whether the operating +system is running in 64-bit mode. +The default value is 0. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/tws?" -compact +.It Pa /dev/da? +array/logical disk interface +.It Pa /dev/tws? +management interface +.El +.Sh DIAGNOSTICS +Whenever the driver encounters a command failure, it prints out an error code in +the format: +.Qq Li "ERROR: (: ):" , +followed by a text description of the error. +There are other error messages and warnings that the +driver prints out, depending on the kinds of errors that it encounters. +If the driver is compiled with +.Dv TWS_DEBUG +defined, it prints out a whole bunch of debug +messages. +.Sh SEE ALSO +.Xr da 4 , +.Xr scsi 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Manjunath Ranganathaiah +for LSI and this manual page was written by +.An Xin LI Aq delphij@FreeBSD.org +for iXsystems, Inc. Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/amd64/conf/GENERIC Fri Oct 7 20:40:45 2011 (r226115) @@ -151,6 +151,7 @@ device mlx # Mylex DAC960 family #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID +device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/conf/files Fri Oct 7 20:40:45 2011 (r226115) @@ -1833,6 +1833,11 @@ dev/twa/tw_osl_freebsd.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twe/twe.c optional twe dev/twe/twe_freebsd.c optional twe +dev/tws/tws.c optional tws +dev/tws/tws_cam.c optional tws +dev/tws/tws_hdm.c optional tws +dev/tws/tws_services.c optional tws +dev/tws/tws_user.c optional tws dev/tx/if_tx.c optional tx dev/txp/if_txp.c optional txp dev/uart/uart_bus_acpi.c optional uart acpi Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/i386/conf/GENERIC Fri Oct 7 20:40:45 2011 (r226115) @@ -147,6 +147,7 @@ device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID +device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller # RAID controllers device aac # Adaptec FSA RAID Modified: stable/9/sys/modules/Makefile ============================================================================== --- stable/9/sys/modules/Makefile Fri Oct 7 18:01:34 2011 (r226114) +++ stable/9/sys/modules/Makefile Fri Oct 7 20:40:45 2011 (r226115) @@ -302,6 +302,7 @@ SUBDIR= ${_3dfx} \ trm \ ${_twa} \ twe \ + tws \ tx \ txp \ uart \