From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 00:29:00 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CD77106564A; Sun, 10 Apr 2011 00:29:00 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BCF98FC08; Sun, 10 Apr 2011 00:29:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3A0T0ei029504; Sun, 10 Apr 2011 00:29:00 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3A0T037029501; Sun, 10 Apr 2011 00:29:00 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201104100029.p3A0T037029501@svn.freebsd.org> From: Glen Barber Date: Sun, 10 Apr 2011 00:29:00 +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: r220508 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 00:29:00 -0000 Author: gjb (doc committer) Date: Sun Apr 10 00:29:00 2011 New Revision: 220508 URL: http://svn.freebsd.org/changeset/base/220508 Log: MFC 220432: - u3g.4: - remove self-reference in SEE ALSO section (originally was to s/XR/Xr) - cxgbe.4: - remove blank line - add closing .El Modified: stable/8/share/man/man4/cxgbe.4 stable/8/share/man/man4/u3g.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/cxgbe.4 ============================================================================== --- stable/8/share/man/man4/cxgbe.4 Sat Apr 9 23:55:27 2011 (r220507) +++ stable/8/share/man/man4/cxgbe.4 Sun Apr 10 00:29:00 2011 (r220508) @@ -60,7 +60,6 @@ The driver supprts Jumbo Frames, Transmi TCP segmentation offload (TSO), Large Receive Offload (LRO), VLAN tag insertion/extraction, VLAN checksum offload, VLAN TSO, and Receive Side Steering (RSS). - For further hardware information and questions related to hardware requirements, see .Pa http://www.chelsio.com/ . @@ -139,6 +138,7 @@ The default value is 1024. The size, in number of entries, of the descriptor ring used for an rx queue. The default value is 1024. +.El .Sh SUPPORT For general information and support, go to the Chelsio support website at: Modified: stable/8/share/man/man4/u3g.4 ============================================================================== --- stable/8/share/man/man4/u3g.4 Sat Apr 9 23:55:27 2011 (r220507) +++ stable/8/share/man/man4/u3g.4 Sun Apr 10 00:29:00 2011 (r220508) @@ -94,7 +94,6 @@ and .Sh SEE ALSO .Xr tty 4 , .Xr ucom 4 , -.XR u3g 4 , .Xr usb 4 , .Xr usb_quirk 4 , .Xr usbconfig 5 From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 01:21:03 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9F70106566C; Sun, 10 Apr 2011 01:21:02 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF2E18FC0C; Sun, 10 Apr 2011 01:21:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3A1L2D7031075; Sun, 10 Apr 2011 01:21:02 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3A1L2r0031072; Sun, 10 Apr 2011 01:21:02 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201104100121.p3A1L2r0031072@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 10 Apr 2011 01:21: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: r220509 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 01:21:03 -0000 Author: np Date: Sun Apr 10 01:21:02 2011 New Revision: 220509 URL: http://svn.freebsd.org/changeset/base/220509 Log: MFC r220410 Modify read/write ioctls to work with 64 bit registers too. Modified: stable/8/sys/dev/cxgbe/t4_ioctl.h stable/8/sys/dev/cxgbe/t4_main.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/cxgbe/t4_ioctl.h ============================================================================== --- stable/8/sys/dev/cxgbe/t4_ioctl.h Sun Apr 10 00:29:00 2011 (r220508) +++ stable/8/sys/dev/cxgbe/t4_ioctl.h Sun Apr 10 01:21:02 2011 (r220509) @@ -35,24 +35,25 @@ * Ioctl commands specific to this driver. */ enum { - T4_GET32 = 0x40, /* read 32 bit register */ - T4_SET32, /* write 32 bit register */ + T4_GETREG = 0x40, /* read register */ + T4_SETREG, /* write register */ T4_REGDUMP, /* dump of all registers */ }; -struct t4_reg32 { +struct t4_reg { uint32_t addr; - uint32_t val; + uint32_t size; + uint64_t val; }; #define T4_REGDUMP_SIZE (160 * 1024) struct t4_regdump { - uint32_t version; - uint32_t len; /* bytes */ - uint8_t *data; + uint32_t version; + uint32_t len; /* bytes */ + uint32_t *data; }; -#define CHELSIO_T4_GETREG32 _IOWR('f', T4_GET32, struct t4_reg32) -#define CHELSIO_T4_SETREG32 _IOW('f', T4_SET32, struct t4_reg32) +#define CHELSIO_T4_GETREG _IOWR('f', T4_GETREG, struct t4_reg) +#define CHELSIO_T4_SETREG _IOW('f', T4_SETREG, struct t4_reg) #define CHELSIO_T4_REGDUMP _IOWR('f', T4_REGDUMP, struct t4_regdump) #endif Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Sun Apr 10 00:29:00 2011 (r220508) +++ stable/8/sys/dev/cxgbe/t4_main.c Sun Apr 10 01:21:02 2011 (r220509) @@ -2803,18 +2803,35 @@ t4_ioctl(struct cdev *dev, unsigned long return (rc); switch (cmd) { - case CHELSIO_T4_GETREG32: { - struct t4_reg32 *edata = (struct t4_reg32 *)data; + case CHELSIO_T4_GETREG: { + struct t4_reg *edata = (struct t4_reg *)data; + if ((edata->addr & 0x3) != 0 || edata->addr >= sc->mmio_len) return (EFAULT); - edata->val = t4_read_reg(sc, edata->addr); + + if (edata->size == 4) + edata->val = t4_read_reg(sc, edata->addr); + else if (edata->size == 8) + edata->val = t4_read_reg64(sc, edata->addr); + else + return (EINVAL); + break; } - case CHELSIO_T4_SETREG32: { - struct t4_reg32 *edata = (struct t4_reg32 *)data; + case CHELSIO_T4_SETREG: { + struct t4_reg *edata = (struct t4_reg *)data; + if ((edata->addr & 0x3) != 0 || edata->addr >= sc->mmio_len) return (EFAULT); - t4_write_reg(sc, edata->addr, edata->val); + + if (edata->size == 4) { + if (edata->val & 0xffffffff00000000) + return (EINVAL); + t4_write_reg(sc, edata->addr, (uint32_t) edata->val); + } else if (edata->size == 8) + t4_write_reg64(sc, edata->addr, edata->val); + else + return (EINVAL); break; } case CHELSIO_T4_REGDUMP: { From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 09:35:43 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28BF4106564A; Sun, 10 Apr 2011 09:35:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1929C8FC19; Sun, 10 Apr 2011 09:35:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3A9ZgDQ042123; Sun, 10 Apr 2011 09:35:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3A9ZgN3042121; Sun, 10 Apr 2011 09:35:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201104100935.p3A9ZgN3042121@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 Apr 2011 09:35:42 +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: r220513 - stable/8/sys/dev/dc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 09:35:43 -0000 Author: marius Date: Sun Apr 10 09:35:42 2011 New Revision: 220513 URL: http://svn.freebsd.org/changeset/base/220513 Log: MFC: r220046, r220106 Wait until the DMA engine is stopped before unmapping buffers and descriptors, which fixes DMA errors seen on sparc64. Modified: stable/8/sys/dev/dc/if_dc.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/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Sun Apr 10 03:53:06 2011 (r220512) +++ stable/8/sys/dev/dc/if_dc.c Sun Apr 10 09:35:42 2011 (r220513) @@ -279,6 +279,7 @@ static void dc_miibus_statchg(device_t); static void dc_miibus_mediainit(device_t); static void dc_setcfg(struct dc_softc *, int); +static void dc_netcfg_wait(struct dc_softc *); static uint32_t dc_mchash_le(struct dc_softc *, const uint8_t *); static uint32_t dc_mchash_be(const uint8_t *); static void dc_setfilt_21143(struct dc_softc *); @@ -1370,6 +1371,32 @@ dc_setfilt(struct dc_softc *sc) dc_setfilt_xircom(sc); } +static void +dc_netcfg_wait(struct dc_softc *sc) +{ + uint32_t isr; + int i; + + for (i = 0; i < DC_TIMEOUT; i++) { + isr = CSR_READ_4(sc, DC_ISR); + if (isr & DC_ISR_TX_IDLE && + ((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED || + (isr & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT)) + break; + DELAY(10); + } + if (i == DC_TIMEOUT) { + if (!(isr & DC_ISR_TX_IDLE) && !DC_IS_ASIX(sc)) + device_printf(sc->dc_dev, + "%s: failed to force tx to idle state\n", __func__); + if (!((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED || + (isr & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) && + !DC_HAS_BROKEN_RXSTATE(sc)) + device_printf(sc->dc_dev, + "%s: failed to force rx to idle state\n", __func__); + } +} + /* * In order to fiddle with the 'full-duplex' and '100Mbps' bits in * the netconfig register, we first have to put the transmit and/or @@ -1378,8 +1405,7 @@ dc_setfilt(struct dc_softc *sc) static void dc_setcfg(struct dc_softc *sc, int media) { - int i, restart = 0, watchdogreg; - uint32_t isr; + int restart = 0, watchdogreg; if (IFM_SUBTYPE(media) == IFM_NONE) return; @@ -1387,28 +1413,7 @@ dc_setcfg(struct dc_softc *sc, int media if (CSR_READ_4(sc, DC_NETCFG) & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) { restart = 1; DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); - - for (i = 0; i < DC_TIMEOUT; i++) { - isr = CSR_READ_4(sc, DC_ISR); - if (isr & DC_ISR_TX_IDLE && - ((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED || - (isr & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT)) - break; - DELAY(10); - } - - if (i == DC_TIMEOUT) { - if (!(isr & DC_ISR_TX_IDLE) && !DC_IS_ASIX(sc)) - device_printf(sc->dc_dev, - "%s: failed to force tx to idle state\n", - __func__); - if (!((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED || - (isr & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) && - !DC_HAS_BROKEN_RXSTATE(sc)) - device_printf(sc->dc_dev, - "%s: failed to force rx to idle state\n", - __func__); - } + dc_netcfg_wait(sc); } if (IFM_SUBTYPE(media) == IFM_100_TX) { @@ -3917,7 +3922,7 @@ dc_stop(struct dc_softc *sc) struct dc_list_data *ld; struct dc_chain_data *cd; int i; - uint32_t ctl; + uint32_t ctl, netcfg; DC_LOCK_ASSERT(sc); @@ -3928,14 +3933,21 @@ dc_stop(struct dc_softc *sc) callout_stop(&sc->dc_stat_ch); callout_stop(&sc->dc_wdog_ch); sc->dc_wdog_timer = 0; + sc->dc_link = 0; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_RX_ON | DC_NETCFG_TX_ON)); + netcfg = CSR_READ_4(sc, DC_NETCFG); + if (netcfg & (DC_NETCFG_RX_ON | DC_NETCFG_TX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, + netcfg & ~(DC_NETCFG_RX_ON | DC_NETCFG_TX_ON)); CSR_WRITE_4(sc, DC_IMR, 0x00000000); + /* Wait the completion of TX/RX SM. */ + if (netcfg & (DC_NETCFG_RX_ON | DC_NETCFG_TX_ON)) + dc_netcfg_wait(sc); + CSR_WRITE_4(sc, DC_TXADDR, 0x00000000); CSR_WRITE_4(sc, DC_RXADDR, 0x00000000); - sc->dc_link = 0; /* * Free data in the RX lists. From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 15:40:57 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB84A1065678; Sun, 10 Apr 2011 15:40:57 +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 9CC708FC0A; Sun, 10 Apr 2011 15:40:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3AFev5L052543; Sun, 10 Apr 2011 15:40:57 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3AFevAW052541; Sun, 10 Apr 2011 15:40:57 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201104101540.p3AFevAW052541@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 10 Apr 2011 15:40: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: r220524 - stable/8/sys/geom/gate X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 15:40:57 -0000 Author: trociny Date: Sun Apr 10 15:40:57 2011 New Revision: 220524 URL: http://svn.freebsd.org/changeset/base/220524 Log: MFC r220264: r220264 (pjd): GEOM has an internal mechanism to deal with ENOMEM errors returned via g_io_deliver(). In such case it increases 'pace' counter on each ENOMEM and reschedules the request. The 'pace' counter is decreased for each request going down, but until 'pace' is greater than zero, GEOM will handle at most 10 requests per second. For GEOM GATE users that are proxy to local GEOM providers (like ggatel(8) and HAST) we can end up with almost permanent slow down of GEOM down queue. This is because once we reach GEOM GATE queue limit, we return ENOMEM to the GEOM. This means that we have, eg. 1024 I/O requests in the GEOM GATE queue. To make room in the queue and stop returning ENOMEM we need to proceed the requests of course, but those requests are handled by userland daemons that handle them by reading/writing also from/to local GEOM providers. For example with HAST, a new requests comes to /dev/hast/data, which is GEOM GATE provider. GEOM GATE passes the request to hastd(8) and hastd(8) reads/writes from/to /dev/da0. Once we reach GEOM GATE queue limit, to free up a slot in GEOM GATE queue, hastd(8) has to read/write from/to /dev/da0, but this request will also be very slow, because GEOM now slows down all the requests. We end up with full queue that we can unload at the speed of 10 requests per second. This simply looks like a deadlock. Fix it by allowing userland daemons that work with both GEOM GATE and local GEOM providers to specify unlimited queue size, so GEOM GATE will never return ENOMEM to the GEOM. Approved by: pjd (mentor) Modified: stable/8/sys/geom/gate/g_gate.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/geom/gate/g_gate.c ============================================================================== --- stable/8/sys/geom/gate/g_gate.c Sun Apr 10 15:28:37 2011 (r220523) +++ stable/8/sys/geom/gate/g_gate.c Sun Apr 10 15:40:57 2011 (r220524) @@ -192,7 +192,7 @@ g_gate_start(struct bio *bp) } mtx_lock(&sc->sc_queue_mtx); - if (sc->sc_queue_count > sc->sc_queue_size) { + if (sc->sc_queue_size > 0 && sc->sc_queue_count > sc->sc_queue_size) { mtx_unlock(&sc->sc_queue_mtx); G_GATE_LOGREQ(1, bp, "Queue full, request canceled."); g_io_deliver(bp, ENOMEM); From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 15:48:16 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF7291065670; Sun, 10 Apr 2011 15:48:16 +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 9A8E98FC1C; Sun, 10 Apr 2011 15:48:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3AFmGPj052742; Sun, 10 Apr 2011 15:48:16 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3AFmGAq052736; Sun, 10 Apr 2011 15:48:16 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201104101548.p3AFmGAq052736@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 10 Apr 2011 15:48: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: r220525 - stable/8/sbin/hastd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 15:48:16 -0000 Author: trociny Date: Sun Apr 10 15:48:16 2011 New Revision: 220525 URL: http://svn.freebsd.org/changeset/base/220525 Log: MFC r220005, r220006, r220007, r220266, r220270, r220271, r220272, r220273, r220274: r220005 (pjd): Use role2str() when setting process title. r220006 (pjd): Use timeout from configuration file not only when sending and receiving, but also when establishing connection. r220007 (pjd): Add mapsize to the header just before sending the packet. Before it could change later and we were sending invalid mapsize. Some time ago I added optimization where when nodes are connected for the first time and there were no writes to them yet, there is no initial full synchronization. This bug prevented it from working. r220266 (pjd): Handle the problem described in r220264 by using GEOM GATE queue of unlimited length. This should fix deadlocks reported by HAST users. r220270 (pjd): Allow to disable sends or receives on a socket using shutdown(2) by interpreting NULL 'data' argument passed to proto_common_send() or proto_common_recv() as a will to do so. r220271 (pjd): Declare directions for sockets between primary and secondary. In HAST we use two sockets - one for only sending the data and one for only receiving the data. r220272 (pjd): When we are operating on blocking socket and get EAGAIN on send(2) or recv(2) this means that request timed out. Translate the meaningless EAGAIN to ETIMEDOUT to give administrator a hint that he might need to increase timeout in configuration file. r220273 (pjd): Handle ENOBUFS on send(2) by retrying for a while and logging the problem. r220274 (pjd): Increase default timeout from 5 seconds to 20 seconds. 5 seconds is definitely to short under heavy load and I was experiencing those timeouts in my recent tests. Approved by: pjd (mentor) Modified: stable/8/sbin/hastd/hast.conf.5 stable/8/sbin/hastd/hast.h stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/proto_common.c stable/8/sbin/hastd/secondary.c Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/hast.conf.5 ============================================================================== --- stable/8/sbin/hastd/hast.conf.5 Sun Apr 10 15:40:57 2011 (r220524) +++ stable/8/sbin/hastd/hast.conf.5 Sun Apr 10 15:48:16 2011 (r220525) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 20, 2011 +.Dd April 2, 2011 .Dt HAST.CONF 5 .Os .Sh NAME @@ -241,7 +241,7 @@ LZF is very fast, general purpose compre .Pp Connection timeout in seconds. The default value is -.Va 5 . +.Va 20 . .It Ic exec Aq path .Pp Execute the given program on various HAST events. Modified: stable/8/sbin/hastd/hast.h ============================================================================== --- stable/8/sbin/hastd/hast.h Sun Apr 10 15:40:57 2011 (r220524) +++ stable/8/sbin/hastd/hast.h Sun Apr 10 15:48:16 2011 (r220525) @@ -83,7 +83,7 @@ #define HIO_KEEPALIVE 5 #define HAST_USER "hast" -#define HAST_TIMEOUT 5 +#define HAST_TIMEOUT 20 #define HAST_CONFIG "/etc/hast.conf" #define HAST_CONTROL "/var/run/hastctl" #define HASTD_LISTEN "tcp4://0.0.0.0:8457" Modified: stable/8/sbin/hastd/primary.c ============================================================================== --- stable/8/sbin/hastd/primary.c Sun Apr 10 15:40:57 2011 (r220524) +++ stable/8/sbin/hastd/primary.c Sun Apr 10 15:48:16 2011 (r220525) @@ -509,7 +509,7 @@ primary_connect(struct hast_resource *re primary_exit(EX_TEMPFAIL, "Unable to receive connection from parent"); } - if (proto_connect_wait(conn, HAST_TIMEOUT) < 0) { + if (proto_connect_wait(conn, res->hr_timeout) < 0) { pjdlog_errno(LOG_WARNING, "Unable to connect to %s", res->hr_remoteaddr); proto_close(conn); @@ -701,6 +701,11 @@ init_remote(struct hast_resource *res, s (void)hast_activemap_flush(res); } nv_free(nvin); + /* Setup directions. */ + if (proto_send(out, NULL, 0) == -1) + pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); + if (proto_recv(in, NULL, 0) == -1) + pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); pjdlog_info("Connected to %s.", res->hr_remoteaddr); if (inp != NULL && outp != NULL) { *inp = in; @@ -761,7 +766,7 @@ init_ggate(struct hast_resource *res) ggiocreate.gctl_mediasize = res->hr_datasize; ggiocreate.gctl_sectorsize = res->hr_local_sectorsize; ggiocreate.gctl_flags = 0; - ggiocreate.gctl_maxcount = G_GATE_MAX_QUEUE_SIZE; + ggiocreate.gctl_maxcount = 0; ggiocreate.gctl_timeout = 0; ggiocreate.gctl_unit = G_GATE_NAME_GIVEN; snprintf(ggiocreate.gctl_name, sizeof(ggiocreate.gctl_name), "hast/%s", @@ -868,7 +873,7 @@ hastd_primary(struct hast_resource *res) pjdlog_init(mode); pjdlog_debug_set(debuglevel); pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); - setproctitle("%s (primary)", res->hr_name); + setproctitle("%s (%s)", res->hr_name, role2str(res->hr_role)); init_local(res); init_ggate(res); Modified: stable/8/sbin/hastd/proto_common.c ============================================================================== --- stable/8/sbin/hastd/proto_common.c Sun Apr 10 15:40:57 2011 (r220524) +++ stable/8/sbin/hastd/proto_common.c Sun Apr 10 15:48:16 2011 (r220525) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2009-2010 The FreeBSD Foundation + * Copyright (c) 2011 Pawel Jakub Dawidek * All rights reserved. * * This software was developed by Pawel Jakub Dawidek under sponsorship from @@ -34,8 +35,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include +#include #include "pjdlog.h" #include "proto_impl.h" @@ -45,6 +49,16 @@ __FBSDID("$FreeBSD$"); #define MAX_SEND_SIZE 32768 #endif +static bool +blocking_socket(int sock) +{ + int flags; + + flags = fcntl(sock, F_GETFL); + PJDLOG_ASSERT(flags >= 0); + return ((flags & O_NONBLOCK) == 0); +} + static int proto_descriptor_send(int sock, int fd) { @@ -80,24 +94,65 @@ proto_common_send(int sock, const unsign { ssize_t done; size_t sendsize; + int errcount = 0; PJDLOG_ASSERT(sock >= 0); + + if (data == NULL) { + /* The caller is just trying to decide about direction. */ + + PJDLOG_ASSERT(size == 0); + + if (shutdown(sock, SHUT_RD) == -1) + return (errno); + return (0); + } + PJDLOG_ASSERT(data != NULL); PJDLOG_ASSERT(size > 0); do { sendsize = size < MAX_SEND_SIZE ? size : MAX_SEND_SIZE; done = send(sock, data, sendsize, MSG_NOSIGNAL); - if (done == 0) + if (done == 0) { return (ENOTCONN); - else if (done < 0) { + } else if (done < 0) { if (errno == EINTR) continue; + if (errno == ENOBUFS) { + /* + * If there are no buffers we retry. + * After each try we increase delay before the + * next one and we give up after fifteen times. + * This gives 11s of total wait time. + */ + if (errcount == 15) { + pjdlog_warning("Getting ENOBUFS errors for 11s on send(), giving up."); + } else { + if (errcount == 0) + pjdlog_warning("Got ENOBUFS error on send(), retrying for a bit."); + errcount++; + usleep(100000 * errcount); + continue; + } + } + /* + * If this is blocking socket and we got EAGAIN, this + * means the request timed out. Translate errno to + * ETIMEDOUT, to give administrator a hint to + * eventually increase timeout. + */ + if (errno == EAGAIN && blocking_socket(sock)) + errno = ETIMEDOUT; return (errno); } data += done; size -= done; } while (size > 0); + if (errcount > 0) { + pjdlog_info("Data sent successfully after %d ENOBUFS error%s.", + errcount, errcount == 1 ? "" : "s"); + } if (fd == -1) return (0); @@ -141,16 +196,36 @@ proto_common_recv(int sock, unsigned cha ssize_t done; PJDLOG_ASSERT(sock >= 0); + + if (data == NULL) { + /* The caller is just trying to decide about direction. */ + + PJDLOG_ASSERT(size == 0); + + if (shutdown(sock, SHUT_WR) == -1) + return (errno); + return (0); + } + PJDLOG_ASSERT(data != NULL); PJDLOG_ASSERT(size > 0); do { done = recv(sock, data, size, MSG_WAITALL); } while (done == -1 && errno == EINTR); - if (done == 0) + if (done == 0) { return (ENOTCONN); - else if (done < 0) + } else if (done < 0) { + /* + * If this is blocking socket and we got EAGAIN, this + * means the request timed out. Translate errno to + * ETIMEDOUT, to give administrator a hint to + * eventually increase timeout. + */ + if (errno == EAGAIN && blocking_socket(sock)) + errno = ETIMEDOUT; return (errno); + } if (fdp == NULL) return (0); return (proto_descriptor_recv(sock, fdp)); Modified: stable/8/sbin/hastd/secondary.c ============================================================================== --- stable/8/sbin/hastd/secondary.c Sun Apr 10 15:40:57 2011 (r220524) +++ stable/8/sbin/hastd/secondary.c Sun Apr 10 15:48:16 2011 (r220525) @@ -183,6 +183,10 @@ init_remote(struct hast_resource *res, s unsigned char *map; size_t mapsize; + /* Setup direction. */ + if (proto_send(res->hr_remoteout, NULL, 0) == -1) + pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); + map = NULL; mapsize = 0; nvout = nv_alloc(); @@ -201,7 +205,6 @@ init_remote(struct hast_resource *res, s "Unable to allocate memory (%zu bytes) for activemap.", mapsize); } - nv_add_uint32(nvout, (uint32_t)mapsize, "mapsize"); /* * When we work as primary and secondary is missing we will increase * localcnt in our metadata. When secondary is connected and synced @@ -339,6 +342,7 @@ init_remote(struct hast_resource *res, s (uintmax_t)res->hr_secondary_localcnt, (uintmax_t)res->hr_secondary_remotecnt); } + nv_add_uint32(nvout, (uint32_t)mapsize, "mapsize"); if (hast_proto_send(res, res->hr_remotein, nvout, map, mapsize) < 0) { pjdlog_exit(EX_TEMPFAIL, "Unable to send activemap to %s", res->hr_remoteaddr); @@ -346,6 +350,9 @@ init_remote(struct hast_resource *res, s if (map != NULL) free(map); nv_free(nvout); + /* Setup direction. */ + if (proto_recv(res->hr_remotein, NULL, 0) == -1) + pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && res->hr_primary_localcnt > res->hr_secondary_remotecnt) { /* Exit on split-brain. */ @@ -414,7 +421,7 @@ hastd_secondary(struct hast_resource *re pjdlog_init(mode); pjdlog_debug_set(debuglevel); pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); - setproctitle("%s (secondary)", res->hr_name); + setproctitle("%s (%s)", res->hr_name, role2str(res->hr_role)); PJDLOG_VERIFY(sigemptyset(&mask) == 0); PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 19:31:01 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C7E0106564A; Sun, 10 Apr 2011 19:31:01 +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 F043D8FC1A; Sun, 10 Apr 2011 19:31:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3AJV0CZ057205; Sun, 10 Apr 2011 19:31:00 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3AJV00f057203; Sun, 10 Apr 2011 19:31:00 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201104101931.p3AJV00f057203@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 10 Apr 2011 19:31:00 +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: r220529 - stable/8/sys/geom/eli X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 19:31:01 -0000 Author: trociny Date: Sun Apr 10 19:31:00 2011 New Revision: 220529 URL: http://svn.freebsd.org/changeset/base/220529 Log: MFC r220299: In g_eli_read_done() and g_eli_write_done(), for a bio with bio_children > 1, g_destroy_bio() is never called and the bio leaks. Fix this by calling g_destroy_bio() earlier, before the check. Submitted by: Victor Balada Diaz (initial version) Approved by: pjd (mentor) Modified: stable/8/sys/geom/eli/g_eli.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/geom/eli/g_eli.c ============================================================================== --- stable/8/sys/geom/eli/g_eli.c Sun Apr 10 18:36:24 2011 (r220528) +++ stable/8/sys/geom/eli/g_eli.c Sun Apr 10 19:31:00 2011 (r220529) @@ -160,13 +160,13 @@ g_eli_read_done(struct bio *bp) pbp = bp->bio_parent; if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; + g_destroy_bio(bp); /* * Do we have all sectors already? */ pbp->bio_inbed++; if (pbp->bio_inbed < pbp->bio_children) return; - g_destroy_bio(bp); sc = pbp->bio_to->geom->softc; if (pbp->bio_error != 0) { G_ELI_LOGREQ(0, pbp, "%s() failed", __func__); @@ -202,6 +202,7 @@ g_eli_write_done(struct bio *bp) if (bp->bio_error != 0) pbp->bio_error = bp->bio_error; } + g_destroy_bio(bp); /* * Do we have all sectors already? */ @@ -215,7 +216,6 @@ g_eli_write_done(struct bio *bp) pbp->bio_error); pbp->bio_completed = 0; } - g_destroy_bio(bp); /* * Write is finished, send it up. */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 11 08:25:26 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D967106566C; Mon, 11 Apr 2011 08:25:26 +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 4D3888FC16; Mon, 11 Apr 2011 08:25:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3B8PQxI078831; Mon, 11 Apr 2011 08:25:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3B8PQnq078827; Mon, 11 Apr 2011 08:25:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201104110825.p3B8PQnq078827@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Apr 2011 08:25:26 +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: r220536 - in stable/8/sys: dev/ksyms kern sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2011 08:25:26 -0000 Author: kib Date: Mon Apr 11 08:25:25 2011 New Revision: 220536 URL: http://svn.freebsd.org/changeset/base/220536 Log: MFC r220100: Promote ksyms_map() and ksyms_unmap() to general facility copyout_map() and copyout_unmap() interfaces. MFC r220101: Handle zero length in copyout_unmap(). MFC r220102: Trim white spaces, adjust style. MFC r220114: Fix the check for vm_map_remove() error. Modified: stable/8/sys/dev/ksyms/ksyms.c stable/8/sys/kern/kern_subr.c stable/8/sys/sys/uio.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/ksyms/ksyms.c ============================================================================== --- stable/8/sys/dev/ksyms/ksyms.c Mon Apr 11 08:23:27 2011 (r220535) +++ stable/8/sys/dev/ksyms/ksyms.c Mon Apr 11 08:25:25 2011 (r220536) @@ -360,53 +360,6 @@ ksyms_snapshot(struct tsizes *ts, vm_off return (error); } -/* - * Map some anonymous memory in user space of size sz, rounded up to the page - * boundary. - */ -static int -ksyms_map(struct thread *td, vm_offset_t *addr, size_t sz) -{ - struct vmspace *vms = td->td_proc->p_vmspace; - int error; - vm_size_t size; - - - /* - * Map somewhere after heap in process memory. - */ - PROC_LOCK(td->td_proc); - *addr = round_page((vm_offset_t)vms->vm_daddr + - lim_max(td->td_proc, RLIMIT_DATA)); - PROC_UNLOCK(td->td_proc); - - /* round size up to page boundry */ - size = (vm_size_t) round_page(sz); - - error = vm_mmap(&vms->vm_map, addr, size, PROT_READ | PROT_WRITE, - VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0); - - return (error); -} - -/* - * Unmap memory in user space. - */ -static int -ksyms_unmap(struct thread *td, vm_offset_t addr, size_t sz) -{ - vm_map_t map; - vm_size_t size; - - map = &td->td_proc->p_vmspace->vm_map; - size = (vm_size_t) round_page(sz); - - if (!vm_map_remove(map, addr, addr + size)) - return (EINVAL); - - return (0); -} - static void ksyms_cdevpriv_dtr(void *data) { @@ -475,7 +428,7 @@ ksyms_open(struct cdev *dev, int flags, total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz; - error = ksyms_map(td, &(sc->sc_uaddr), + error = copyout_map(td, &(sc->sc_uaddr), (vm_size_t) total_elf_sz); if (error) break; @@ -488,7 +441,7 @@ ksyms_open(struct cdev *dev, int flags, } /* Snapshot failed, unmap the memory and try again */ - (void) ksyms_unmap(td, sc->sc_uaddr, sc->sc_usize); + (void) copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); } failed: @@ -624,7 +577,7 @@ ksyms_close(struct cdev *dev, int flags return (error); /* Unmap the buffer from the process address space. */ - error = ksyms_unmap(td, sc->sc_uaddr, sc->sc_usize); + error = copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); devfs_clear_cdevpriv(); Modified: stable/8/sys/kern/kern_subr.c ============================================================================== --- stable/8/sys/kern/kern_subr.c Mon Apr 11 08:23:27 2011 (r220535) +++ stable/8/sys/kern/kern_subr.c Mon Apr 11 08:25:25 2011 (r220536) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef ZERO_COPY_SOCKETS @@ -569,3 +571,54 @@ cloneuio(struct uio *uiop) bcopy(uiop->uio_iov, uio->uio_iov, iovlen); return (uio); } + +/* + * Map some anonymous memory in user space of size sz, rounded up to the page + * boundary. + */ +int +copyout_map(struct thread *td, vm_offset_t *addr, size_t sz) +{ + struct vmspace *vms; + int error; + vm_size_t size; + + vms = td->td_proc->p_vmspace; + + /* + * Map somewhere after heap in process memory. + */ + PROC_LOCK(td->td_proc); + *addr = round_page((vm_offset_t)vms->vm_daddr + + lim_max(td->td_proc, RLIMIT_DATA)); + PROC_UNLOCK(td->td_proc); + + /* round size up to page boundry */ + size = (vm_size_t)round_page(sz); + + error = vm_mmap(&vms->vm_map, addr, size, PROT_READ | PROT_WRITE, + VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0); + + return (error); +} + +/* + * Unmap memory in user space. + */ +int +copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz) +{ + vm_map_t map; + vm_size_t size; + + if (sz == 0) + return (0); + + map = &td->td_proc->p_vmspace->vm_map; + size = (vm_size_t)round_page(sz); + + if (vm_map_remove(map, addr, addr + size) != KERN_SUCCESS) + return (EINVAL); + + return (0); +} Modified: stable/8/sys/sys/uio.h ============================================================================== --- stable/8/sys/sys/uio.h Mon Apr 11 08:23:27 2011 (r220535) +++ stable/8/sys/sys/uio.h Mon Apr 11 08:25:25 2011 (r220536) @@ -94,6 +94,8 @@ int copyiniov(struct iovec *iovp, u_int int copyinstrfrom(const void * __restrict src, void * __restrict dst, size_t len, size_t * __restrict copied, int seg); int copyinuio(struct iovec *iovp, u_int iovcnt, struct uio **uiop); +int copyout_map(struct thread *td, vm_offset_t *addr, size_t sz); +int copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz); void uio_yield(void); int uiomove(void *cp, int n, struct uio *uio); int uiomove_frombuf(void *buf, int buflen, struct uio *uio); From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 11 09:06:12 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0118A106564A; Mon, 11 Apr 2011 09:06:12 +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 E57A98FC08; Mon, 11 Apr 2011 09:06:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3B96BAr079762; Mon, 11 Apr 2011 09:06:11 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3B96BLh079760; Mon, 11 Apr 2011 09:06:11 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104110906.p3B96BLh079760@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 11 Apr 2011 09:06:11 +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: r220537 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2011 09:06:12 -0000 Author: pluknet Date: Mon Apr 11 09:06:11 2011 New Revision: 220537 URL: http://svn.freebsd.org/changeset/base/220537 Log: MFC r220328: Remove malloc type M_NETADDR unused since splitting into vfs_subr.c and vfs_export.c. Modified: stable/8/sys/kern/vfs_subr.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/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Mon Apr 11 08:25:25 2011 (r220536) +++ stable/8/sys/kern/vfs_subr.c Mon Apr 11 09:06:11 2011 (r220537) @@ -93,8 +93,6 @@ __FBSDID("$FreeBSD$"); #define WI_MPSAFEQ 0 #define WI_GIANTQ 1 -static MALLOC_DEFINE(M_NETADDR, "subr_export_host", "Export host address structure"); - static void delmntque(struct vnode *vp); static int flushbuflist(struct bufv *bufv, int flags, struct bufobj *bo, int slpflag, int slptimeo); From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 11 17:49:27 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1835F1065672; Mon, 11 Apr 2011 17:49:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E17BD8FC08; Mon, 11 Apr 2011 17:49:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3BHnQcc095420; Mon, 11 Apr 2011 17:49:26 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3BHnQSP095418; Mon, 11 Apr 2011 17:49:26 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201104111749.p3BHnQSP095418@svn.freebsd.org> From: Andriy Gapon Date: Mon, 11 Apr 2011 17:49:26 +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: r220544 - stable/8/sys/dev/agp X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2011 17:49:27 -0000 Author: avg Date: Mon Apr 11 17:49:26 2011 New Revision: 220544 URL: http://svn.freebsd.org/changeset/base/220544 Log: MFC r197076,197191: apperture size printing changes Reduce diff to head. On behalf of: n_hibma Modified: stable/8/sys/dev/agp/agp_i810.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/agp/agp_i810.c ============================================================================== --- stable/8/sys/dev/agp/agp_i810.c Mon Apr 11 17:39:07 2011 (r220543) +++ stable/8/sys/dev/agp/agp_i810.c Mon Apr 11 17:49:26 2011 (r220544) @@ -489,12 +489,6 @@ agp_i810_attach(device_t dev) agp_generic_detach(dev); return EINVAL; } - if (sc->stolen > 0) { - device_printf(dev, "detected %dk stolen memory\n", - sc->stolen * 4); - } - device_printf(dev, "aperture size is %dM\n", - sc->initial_aperture / 1024 / 1024); /* GATT address is already in there, make sure it's enabled */ pgtblctl = bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL); @@ -684,9 +678,6 @@ agp_i810_attach(device_t dev) gtt_size += 4; sc->stolen = (stolen - gtt_size) * 1024 / 4096; - if (sc->stolen > 0) - device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4); - device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024); /* GATT address is already in there, make sure it's enabled */ pgtblctl = bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL); @@ -696,6 +687,13 @@ agp_i810_attach(device_t dev) gatt->ag_physical = pgtblctl & ~1; } + device_printf(dev, "aperture size is %dM", + sc->initial_aperture / 1024 / 1024); + if (sc->stolen > 0) + printf(", detected %dk stolen memory\n", sc->stolen * 4); + else + printf("\n"); + if (0) agp_i810_dump_regs(dev); From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 11 21:59:13 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1F7F1065674; Mon, 11 Apr 2011 21:59:13 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 866B88FC12; Mon, 11 Apr 2011 21:59:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3BLxDb0000900; Mon, 11 Apr 2011 21:59:13 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3BLxDwg000898; Mon, 11 Apr 2011 21:59:13 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201104112159.p3BLxDwg000898@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 11 Apr 2011 21:59:13 +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: r220550 - stable/8/share/zoneinfo X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2011 21:59:13 -0000 Author: edwin Date: Mon Apr 11 21:59:13 2011 New Revision: 220550 URL: http://svn.freebsd.org/changeset/base/220550 Log: MFC of 220549, tzdata2011f: - During 2011 the Falkland Islands will remain on Summer time. Obtained from: ftp://elsie.nci.nih.gov/pub/ Modified: stable/8/share/zoneinfo/southamerica Directory Properties: stable/8/share/zoneinfo/ (props changed) Modified: stable/8/share/zoneinfo/southamerica ============================================================================== --- stable/8/share/zoneinfo/southamerica Mon Apr 11 21:57:59 2011 (r220549) +++ stable/8/share/zoneinfo/southamerica Mon Apr 11 21:59:13 2011 (r220550) @@ -1,5 +1,5 @@ #
-# @(#)southamerica	8.47
+# @(#)southamerica	8.48
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1343,6 +1343,24 @@ Zone Pacific/Galapagos	-5:58:24 -	LMT	19
 # For now, we'll just record the time in Stanley, since we have no
 # better info.
 
+# From Steffen Thorsen (2011-04-01):
+# The Falkland Islands will not turn back clocks this winter, but stay on
+# daylight saving time.
+#
+# One source:
+# 
+# http://www.falklandnews.com/public/story.cfm?get=5914&source=3
+# 
+#
+# We have gotten this confirmed by a clerk of the legislative assembly:
+# Normally the clocks revert to Local Mean Time (UTC/GMT -4 hours) on the
+# third Sunday of April at 0200hrs and advance to Summer Time (UTC/GMT -3
+# hours) on the first Sunday of September at 0200hrs.
+#
+# IMPORTANT NOTE: During 2011, on a trial basis, the Falkland Islands
+# will not revert to local mean time, but clocks will remain on Summer
+# time (UTC/GMT - 3 hours) throughout the whole of 2011.  Any long term
+# change to local time following the trial period will be notified.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Falk	1937	1938	-	Sep	lastSun	0:00	1:00	S
 Rule	Falk	1938	1942	-	Mar	Sun>=19	0:00	0	-
@@ -1354,7 +1372,8 @@ Rule	Falk	1984	1985	-	Apr	lastSun	0:00	0
 Rule	Falk	1984	only	-	Sep	16	0:00	1:00	S
 Rule	Falk	1985	2000	-	Sep	Sun>=9	0:00	1:00	S
 Rule	Falk	1986	2000	-	Apr	Sun>=16	0:00	0	-
-Rule	Falk	2001	max	-	Apr	Sun>=15	2:00	0	-
+Rule	Falk	2001	2010	-	Apr	Sun>=15	2:00	0	-
+Rule	Falk	2012	max	-	Apr	Sun>=15	2:00	0	-
 Rule	Falk	2001	max	-	Sep	Sun>=1	2:00	1:00	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Atlantic/Stanley	-3:51:24 -	LMT	1890

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Apr 12 08:54:49 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D8B841065672;
	Tue, 12 Apr 2011 08:54:49 +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 CA9818FC1B;
	Tue, 12 Apr 2011 08:54:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3C8snGX015901;
	Tue, 12 Apr 2011 08:54:49 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3C8snp1015899;
	Tue, 12 Apr 2011 08:54:49 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201104120854.p3C8snp1015899@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Tue, 12 Apr 2011 08:54:49 +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: r220561 - stable/8/usr.bin/limits
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 12 Apr 2011 08:54:50 -0000

Author: pluknet
Date: Tue Apr 12 08:54:49 2011
New Revision: 220561
URL: http://svn.freebsd.org/changeset/base/220561

Log:
  MFC r220358:
  
   Document -w for swapuse.
  
  PR:		docs/156089
  Submitted by:	Andrey Ignatov 

Modified:
  stable/8/usr.bin/limits/limits.1
Directory Properties:
  stable/8/usr.bin/limits/   (props changed)

Modified: stable/8/usr.bin/limits/limits.1
==============================================================================
--- stable/8/usr.bin/limits/limits.1	Tue Apr 12 08:13:18 2011	(r220560)
+++ stable/8/usr.bin/limits/limits.1	Tue Apr 12 08:54:49 2011	(r220561)
@@ -19,7 +19,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2002
+.Dd April 5, 2011
 .Dt LIMITS 1
 .Os
 .Sh NAME
@@ -30,11 +30,11 @@
 .Op Fl C Ar class | Fl U Ar user
 .Op Fl SHB
 .Op Fl ea
-.Op Fl bcdflmnstuvp Op Ar val
+.Op Fl bcdflmnstuvpw Op Ar val
 .Nm
 .Op Fl C Ar class | Fl U Ar user
 .Op Fl SHB
-.Op Fl bcdflmnstuvp Op Ar val
+.Op Fl bcdflmnstuvpw Op Ar val
 .Op Fl E
 .Oo
 .Op Ar name Ns = Ns Ar value ...
@@ -266,6 +266,10 @@ space.
 Select or set the
 .Va pseudoterminals
 resource limit.
+.It Fl w Op Ar val
+Select or set the
+.Va swapuse
+resource limit.
 .El
 .Pp
 Valid values for

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Apr 12 11:17:47 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42CA1106564A;
	Tue, 12 Apr 2011 11:17:47 +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 315608FC16;
	Tue, 12 Apr 2011 11:17:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3CBHlkf022593;
	Tue, 12 Apr 2011 11:17:47 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3CBHlbC022591;
	Tue, 12 Apr 2011 11:17:47 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201104121117.p3CBHlbC022591@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Tue, 12 Apr 2011 11:17:47 +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: r220564 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 12 Apr 2011 11:17:47 -0000

Author: bz
Date: Tue Apr 12 11:17:46 2011
New Revision: 220564
URL: http://svn.freebsd.org/changeset/base/220564

Log:
  MFC r212502 (qingli):
  
    Adding an address on an interface also requires the loopback route to
    that address be installed.
  
    Submitted by:	Ingo Flaschberger 
  PR:		kern/150481

Modified:
  stable/8/sys/netinet/raw_ip.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/netinet/raw_ip.c
==============================================================================
--- stable/8/sys/netinet/raw_ip.c	Tue Apr 12 09:55:24 2011	(r220563)
+++ stable/8/sys/netinet/raw_ip.c	Tue Apr 12 11:17:46 2011	(r220564)
@@ -755,6 +755,8 @@ rip_ctlinput(int cmd, struct sockaddr *s
 		if (err == 0)
 			ia->ia_flags |= IFA_ROUTE;
 		err = ifa_add_loopback_route((struct ifaddr *)ia, sa);
+		if (err == 0)
+			ia->ia_flags |= IFA_RTSELF;
 		ifa_free(&ia->ia_ifa);
 		break;
 	}

From owner-svn-src-stable-8@FreeBSD.ORG  Tue Apr 12 16:43:30 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 584F7106564A;
	Tue, 12 Apr 2011 16:43:30 +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 46F328FC21;
	Tue, 12 Apr 2011 16:43:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3CGhUAf030037;
	Tue, 12 Apr 2011 16:43:30 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3CGhUwq030035;
	Tue, 12 Apr 2011 16:43:30 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <201104121643.p3CGhUwq030035@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 12 Apr 2011 16:43:30 +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: r220570 - stable/8/sys/fs/devfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 12 Apr 2011 16:43:30 -0000

Author: jh
Date: Tue Apr 12 16:43:29 2011
New Revision: 220570
URL: http://svn.freebsd.org/changeset/base/220570

Log:
  MFC r216391:
  
  Handle the special ruleset 0 in devfs_ruleset_use(). An attempt set the
  current ruleset to 0 with command "devfs ruleset 0" triggered a KASSERT
  in devfs_ruleset_create().
  
  PR:		kern/125030

Modified:
  stable/8/sys/fs/devfs/devfs_rule.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/fs/devfs/devfs_rule.c
==============================================================================
--- stable/8/sys/fs/devfs/devfs_rule.c	Tue Apr 12 16:01:27 2011	(r220569)
+++ stable/8/sys/fs/devfs/devfs_rule.c	Tue Apr 12 16:43:29 2011	(r220570)
@@ -742,6 +742,11 @@ devfs_ruleset_use(devfs_rsnum rsnum, str
 		devfs_ruleset_reap(cds);
 	}
 
+	if (rsnum == 0) {
+		dm->dm_ruleset = 0;
+		return (0);
+	}
+
 	ds = devfs_ruleset_bynum(rsnum);
 	if (ds == NULL)
 		ds = devfs_ruleset_create(rsnum);

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 13 19:34:59 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1ECD41065675;
	Wed, 13 Apr 2011 19:34:59 +0000 (UTC)
	(envelope-from zack@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E98A28FC23;
	Wed, 13 Apr 2011 19:34:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3DJYwYc009361;
	Wed, 13 Apr 2011 19:34:58 GMT (envelope-from zack@svn.freebsd.org)
Received: (from zack@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3DJYwcA009358;
	Wed, 13 Apr 2011 19:34:58 GMT (envelope-from zack@svn.freebsd.org)
Message-Id: <201104131934.p3DJYwcA009358@svn.freebsd.org>
From: Zack Kirsch 
Date: Wed, 13 Apr 2011 19:34:58 +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: r220607 - stable/8/sys/fs/nfsclient
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 13 Apr 2011 19:34:59 -0000

Author: zack
Date: Wed Apr 13 19:34:58 2011
New Revision: 220607
URL: http://svn.freebsd.org/changeset/base/220607

Log:
  MFC: 220152
    This patch fixes the Experimental NFS client to properly deal with 32 bit or
    64 bit fileid's in NFSv2 and NFSv3. Without this fix, invalid casting (and sign
    extension) was creating problems for any fileid greater than 2^31.
  
    We discovered this because we have test clusters with more than 2 billion
    allocated files and 64-bit ino_t's (and friend structures).
  
  Reviewed by:    rmacklem
  Approved by:    zml (mentor)

Modified:
  stable/8/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/8/sys/fs/nfsclient/nfs_clrpcops.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/fs/nfsclient/nfs_clcomsubs.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clcomsubs.c	Wed Apr 13 19:10:56 2011	(r220606)
+++ stable/8/sys/fs/nfsclient/nfs_clcomsubs.c	Wed Apr 13 19:34:58 2011	(r220607)
@@ -289,8 +289,7 @@ nfsm_loadattr(struct nfsrv_descript *nd,
 		nap->na_size = fxdr_hyper(&fp->fa3_size);
 		nap->na_blocksize = NFS_FABLKSIZE;
 		nap->na_bytes = fxdr_hyper(&fp->fa3_used);
-		nap->na_fileid = fxdr_unsigned(int32_t,
-		    fp->fa3_fileid.nfsuquad[1]);
+		nap->na_fileid = fxdr_hyper(&fp->fa3_fileid);
 		fxdr_nfsv3time(&fp->fa3_atime, &nap->na_atime);
 		fxdr_nfsv3time(&fp->fa3_ctime, &nap->na_ctime);
 		fxdr_nfsv3time(&fp->fa3_mtime, &nap->na_mtime);
@@ -317,7 +316,7 @@ nfsm_loadattr(struct nfsrv_descript *nd,
 		nap->na_bytes =
 		    (u_quad_t)fxdr_unsigned(int32_t, fp->fa2_blocks) *
 		    NFS_FABLKSIZE;
-		nap->na_fileid = fxdr_unsigned(int32_t, fp->fa2_fileid);
+		nap->na_fileid = fxdr_unsigned(uint64_t, fp->fa2_fileid);
 		fxdr_nfsv2time(&fp->fa2_atime, &nap->na_atime);
 		fxdr_nfsv2time(&fp->fa2_mtime, &nap->na_mtime);
 		nap->na_flags = 0;

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Wed Apr 13 19:10:56 2011	(r220606)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Wed Apr 13 19:34:58 2011	(r220607)
@@ -2745,9 +2745,9 @@ nfsrpc_readdir(vnode_t vp, struct uio *u
 				len = fxdr_unsigned(int, *tl);
 			} else if (nd->nd_flag & ND_NFSV3) {
 				NFSM_DISSECT(tl, u_int32_t *, 3*NFSX_UNSIGNED);
-				nfsva.na_fileid =
-				    fxdr_unsigned(long, *++tl);
-				len = fxdr_unsigned(int, *++tl);
+				nfsva.na_fileid = fxdr_hyper(tl);
+				tl += 2;
+				len = fxdr_unsigned(int, *tl);
 			} else {
 				NFSM_DISSECT(tl, u_int32_t *, 2*NFSX_UNSIGNED);
 				nfsva.na_fileid =

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 13 19:54:54 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A6444106566B;
	Wed, 13 Apr 2011 19:54:54 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 962218FC1B;
	Wed, 13 Apr 2011 19:54:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3DJss21009800;
	Wed, 13 Apr 2011 19:54:54 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3DJsswD009798;
	Wed, 13 Apr 2011 19:54:54 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201104131954.p3DJsswD009798@svn.freebsd.org>
From: Doug Barton 
Date: Wed, 13 Apr 2011 19:54:54 +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: r220608 - stable/8
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 13 Apr 2011 19:54:54 -0000

Author: dougb
Date: Wed Apr 13 19:54:54 2011
New Revision: 220608
URL: http://svn.freebsd.org/changeset/base/220608

Log:
  MFC r220512:
  
  Update recommendation for mergemaster. The -a and -i options are exclusive.

Modified:
  stable/8/Makefile   (contents, props changed)

Modified: stable/8/Makefile
==============================================================================
--- stable/8/Makefile	Wed Apr 13 19:34:58 2011	(r220607)
+++ stable/8/Makefile	Wed Apr 13 19:54:54 2011	(r220608)
@@ -58,7 +58,7 @@
 #  6.  `mergemaster -p'
 #  7.  `make installworld'
 #  8.  `make delete-old'
-#  9.  `mergemaster'                         (you may wish to use -U or -ai).
+#  9.  `mergemaster'		(you may wish to use -i, along with -U or -F).
 # 10.  `reboot'
 # 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
 #

From owner-svn-src-stable-8@FreeBSD.ORG  Wed Apr 13 23:09:37 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 66A661065676;
	Wed, 13 Apr 2011 23:09:37 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5182A8FC1C;
	Wed, 13 Apr 2011 23:09:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3DN9bDC014059;
	Wed, 13 Apr 2011 23:09:37 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3DN9bVt014048;
	Wed, 13 Apr 2011 23:09:37 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <201104132309.p3DN9bVt014048@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Wed, 13 Apr 2011 23:09:37 +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: r220612 - in stable/8: etc/mtree include lib/libedit
	lib/libedit/edit sbin/gvinum usr.sbin/ntp/ntpdc
	usr.sbin/ntp/ntpq usr.sbin/wpa/wpa_cli
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 13 Apr 2011 23:09:37 -0000

Author: obrien
Date: Wed Apr 13 23:09:36 2011
New Revision: 220612
URL: http://svn.freebsd.org/changeset/base/220612

Log:
  MFC: r220370, r209136, r209219
  
  * Add the readline(3) API to libedit.  The libedit versions of
    {readline,history}.h are in /usr/include/edit so as to not conflict with
    the GNU libreadline versions.  To use the libedit readline(3) one should
    add "-I/usr/include/edit" to their Makefile
    (spelled "-I${DESTDIR}/${INCLUDEDIR}/edit" within the FreeBSD source tree).
  * Enable its use in the BSD licensed utilities that support readline(3).
  * histedit.h is moved into libedit's directory
  
  * Add basic filename completion code.
  * Allow simple quoting in filename completion.

Added:
  stable/8/lib/libedit/chartype.h
     - copied unchanged from r220370, head/lib/libedit/chartype.h
  stable/8/lib/libedit/edit/
     - copied from r220370, head/lib/libedit/edit/
  stable/8/lib/libedit/filecomplete.c
     - copied, changed from r209136, head/lib/libedit/filecomplete.c
  stable/8/lib/libedit/filecomplete.h
     - copied, changed from r209136, head/lib/libedit/filecomplete.h
  stable/8/lib/libedit/histedit.h
     - copied unchanged from r220370, head/lib/libedit/histedit.h
  stable/8/lib/libedit/readline.c
     - copied unchanged from r220370, head/lib/libedit/readline.c
Deleted:
  stable/8/include/histedit.h
Modified:
  stable/8/etc/mtree/BSD.include.dist
  stable/8/include/Makefile
  stable/8/lib/libedit/Makefile
  stable/8/lib/libedit/read.c
  stable/8/sbin/gvinum/Makefile
  stable/8/sbin/gvinum/gvinum.c
  stable/8/usr.sbin/ntp/ntpdc/Makefile
  stable/8/usr.sbin/ntp/ntpq/Makefile
  stable/8/usr.sbin/wpa/wpa_cli/Makefile
Directory Properties:
  stable/8/etc/mtree/   (props changed)
  stable/8/include/   (props changed)
  stable/8/lib/libedit/   (props changed)
  stable/8/sbin/gvinum/   (props changed)
  stable/8/usr.sbin/ntp/   (props changed)
  stable/8/usr.sbin/wpa/   (props changed)

Modified: stable/8/etc/mtree/BSD.include.dist
==============================================================================
--- stable/8/etc/mtree/BSD.include.dist	Wed Apr 13 22:37:28 2011	(r220611)
+++ stable/8/etc/mtree/BSD.include.dist	Wed Apr 13 23:09:36 2011	(r220612)
@@ -133,6 +133,10 @@
         wi
         ..
     ..
+    edit
+        readline
+        ..
+    ..
     fs
         devfs
         ..

Modified: stable/8/include/Makefile
==============================================================================
--- stable/8/include/Makefile	Wed Apr 13 22:37:28 2011	(r220611)
+++ stable/8/include/Makefile	Wed Apr 13 23:09:36 2011	(r220612)
@@ -11,7 +11,7 @@ INCS=	a.out.h ar.h assert.h bitstring.h 
 	db.h \
 	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
 	fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
-	histedit.h ieeefp.h ifaddrs.h \
+	ieeefp.h ifaddrs.h \
 	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
 	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
 	ndbm.h netconfig.h \

Modified: stable/8/lib/libedit/Makefile
==============================================================================
--- stable/8/lib/libedit/Makefile	Wed Apr 13 22:37:28 2011	(r220611)
+++ stable/8/lib/libedit/Makefile	Wed Apr 13 23:09:36 2011	(r220612)
@@ -6,7 +6,8 @@ LIB=	edit
 SHLIB_MAJOR=	7
 SHLIBDIR?= /lib
 
-OSRCS=	chared.c common.c el.c emacs.c fcns.c help.c hist.c key.c map.c \
+OSRCS=	chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
+	hist.c key.c map.c \
 	parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c
 
 DPADD=	${LIBNCURSES}
@@ -25,16 +26,21 @@ MLINKS=	editline.3 el_deletestr.3 editli
 	editline.3 tok_line.3 editline.3 tok_str.3
 
 # For speed and debugging
-#SRCS=   ${OSRCS} tokenizer.c history.c
+#SRCS=   ${OSRCS}
 # For protection
-SRCS=	editline.c tokenizer.c history.c
+SRCS=	editline.c
+SRCS+=	tokenizer.c history.c readline.c
 SRCS+=	common.h emacs.h fcns.h help.h vi.h
 CLEANFILES+= common.h editline.c emacs.h fcns.c fcns.h help.c help.h vi.h
 
-CFLAGS+= -I. -I${.CURDIR}
+INCS=	histedit.h
+
+CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit
 CFLAGS+= #-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
 CFLAGS+= #-DDEBUG_PASTE -DDEBUG_EDIT
 
+SUBDIR= edit/readline
+
 AHDR=	vi.h emacs.h common.h
 ASRC=	${.CURDIR}/vi.c ${.CURDIR}/emacs.c ${.CURDIR}/common.c
 

Copied: stable/8/lib/libedit/chartype.h (from r220370, head/lib/libedit/chartype.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/lib/libedit/chartype.h	Wed Apr 13 23:09:36 2011	(r220612, copy of r220370, head/lib/libedit/chartype.h)
@@ -0,0 +1,245 @@
+/*	$NetBSD: chartype.h,v 1.6 2010/04/20 02:01:13 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _h_chartype_f
+#define _h_chartype_f
+
+
+
+#ifdef WIDECHAR
+
+/* Ideally we should also test the value of the define to see if it
+ * supports non-BMP code points without requiring UTF-16, but nothing
+ * seems to actually advertise this properly, despite Unicode 3.1 having
+ * been around since 2001... */
+#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__))
+#ifndef __STDC_ISO_10646__
+/* In many places it is assumed that the first 127 code points are ASCII
+ * compatible, so ensure wchar_t indeed does ISO 10646 and not some other
+ * funky encoding that could break us in weird and wonderful ways. */
+	#error wchar_t must store ISO 10646 characters
+#endif
+#endif
+
+/* Oh for a  with char32_t and __STDC_UTF_32__ in it...
+ * ref: ISO/IEC DTR 19769
+ */
+#if WCHAR_MAX < INT32_MAX
+#warning Build environment does not support non-BMP characters
+#endif
+
+#define ct_mbtowc            mbtowc
+#define ct_mbtowc_reset      mbtowc(0,0,0)
+#define ct_wctomb            wctomb
+#define ct_wctomb_reset      wctomb(0,0)
+#define ct_wcstombs          wcstombs
+#define ct_mbstowcs          mbstowcs
+
+#define Char			wchar_t
+#define Int			wint_t
+#define FUN(prefix,rest)	prefix ## _w ## rest
+#define FUNW(type)		type ## _w
+#define TYPE(type)		type ## W
+#define FSTR			"%ls"
+#define STR(x) 			L ## x
+#define UC(c)			c
+#define Isalpha(x)  iswalpha(x)
+#define Isalnum(x)  iswalnum(x)
+#define Isgraph(x)  iswgraph(x)
+#define Isspace(x)  iswspace(x)
+#define Isdigit(x)  iswdigit(x)
+#define Iscntrl(x)  iswcntrl(x)
+#define Isprint(x)  iswprint(x)
+
+#define Isupper(x)  iswupper(x)
+#define Islower(x)  iswlower(x)
+#define Toupper(x)  towupper(x)
+#define Tolower(x)  towlower(x)
+
+#define IsASCII(x)  (x < 0x100)
+
+#define Strlen(x)       wcslen(x)
+#define Strchr(s,c)     wcschr(s,c)
+#define Strrchr(s,c)    wcsrchr(s,c)
+#define Strstr(s,v)     wcsstr(s,v)
+#define Strdup(x)       wcsdup(x)
+#define Strcpy(d,s)     wcscpy(d,s)
+#define Strncpy(d,s,n)  wcsncpy(d,s,n)
+#define Strncat(d,s,n)  wcsncat(d,s,n)
+
+#define Strcmp(s,v)     wcscmp(s,v)
+#define Strncmp(s,v,n)  wcsncmp(s,v,n)
+#define Strcspn(s,r)    wcscspn(s,r)
+
+#define Strtol(p,e,b)   wcstol(p,e,b)
+
+#define Width(c)	wcwidth(c)
+
+#else /* NARROW */
+
+#define ct_mbtowc            error
+#define ct_mbtowc_reset      
+#define ct_wctomb            error
+#define ct_wctomb_reset      
+#define ct_wcstombs(a, b, c)    (strncpy(a, b, c), strlen(a))
+#define ct_mbstowcs(a, b, c)    (strncpy(a, b, c), strlen(a))
+
+#define Char			char
+#define Int			int
+#define FUN(prefix,rest)	prefix ## _ ## rest
+#define FUNW(type)		type
+#define TYPE(type)		type
+#define FSTR			"%s"
+#define STR(x) 			x
+#define UC(c)			(unsigned char)(c)
+
+#define Isalpha(x)  isalpha((unsigned char)x)
+#define Isalnum(x)  isalnum((unsigned char)x)
+#define Isgraph(x)  isgraph((unsigned char)x)
+#define Isspace(x)  isspace((unsigned char)x)
+#define Isdigit(x)  isdigit((unsigned char)x)
+#define Iscntrl(x)  iscntrl((unsigned char)x)
+#define Isprint(x)  isprint((unsigned char)x)
+
+#define Isupper(x)  isupper((unsigned char)x)
+#define Islower(x)  islower((unsigned char)x)
+#define Toupper(x)  toupper((unsigned char)x)
+#define Tolower(x)  tolower((unsigned char)x)
+
+#define IsASCII(x)  isascii((unsigned char)x)
+
+#define Strlen(x)       strlen(x)
+#define Strchr(s,c)     strchr(s,c)
+#define Strrchr(s,c)    strrchr(s,c)
+#define Strstr(s,v)     strstr(s,v)
+#define Strdup(x)       strdup(x)
+#define Strcpy(d,s)     strcpy(d,s)
+#define Strncpy(d,s,n)  strncpy(d,s,n)
+#define Strncat(d,s,n)  strncat(d,s,n)
+
+#define Strcmp(s,v)     strcmp(s,v)
+#define Strncmp(s,v,n)  strncmp(s,v,n)
+#define Strcspn(s,r)    strcspn(s,r)
+
+#define Strtol(p,e,b)   strtol(p,e,b)
+
+#define Width(c)	1
+
+#endif
+
+
+#ifdef WIDECHAR
+/*
+ * Conversion buffer
+ */
+typedef struct ct_buffer_t {
+        char    *cbuff;
+        size_t  csize;
+        Char *wbuff;
+        size_t  wsize;
+} ct_buffer_t;
+
+#define ct_encode_string __ct_encode_string
+/* Encode a wide character string and return the UTF-8 encoded result. */
+public char *ct_encode_string(const Char *, ct_buffer_t *);
+
+#define ct_decode_string __ct_decode_string
+/* Decode a (multi)?byte string and return the wide character string result. */
+public Char *ct_decode_string(const char *, ct_buffer_t *);
+
+/* Decode a (multi)?byte argv string array.
+ * The pointer returned must be free()d when done. */
+protected Char **ct_decode_argv(int, const char *[],  ct_buffer_t *);
+
+/* Resizes the conversion buffer(s) if needed. */
+protected void ct_conv_buff_resize(ct_buffer_t *, size_t, size_t);
+protected ssize_t ct_encode_char(char *, size_t, Char);
+protected size_t ct_enc_width(Char);
+
+#define ct_free_argv(s)	el_free(s)
+
+#else
+#define	ct_encode_string(s, b)	(s)
+#define ct_decode_string(s, b)	(s)
+#define ct_decode_argv(l, s, b)	(s)
+#define ct_conv_buff_resize(b, os, ns)
+#define ct_encode_char(d, l, s)	(*d = s, 1)
+#define ct_free_argv(s)
+#endif
+
+#ifndef NARROWCHAR
+/* Encode a characted into the destination buffer, provided there is sufficent
+ * buffer space available. Returns the number of bytes used up (zero if the
+ * character cannot be encoded, -1 if there was not enough space available). */
+
+/* The maximum buffer size to hold the most unwieldly visual representation,
+ * in this case \U+nnnnn. */
+#define VISUAL_WIDTH_MAX 8
+
+/* The terminal is thought of in terms of X columns by Y lines. In the cases
+ * where a wide character takes up more than one column, the adjacent 
+ * occupied column entries will contain this faux character. */
+#define MB_FILL_CHAR ((Char)-1)
+
+/* Visual width of character c, taking into account ^? , \0177 and \U+nnnnn
+ * style visual expansions. */
+protected int ct_visual_width(Char);
+
+/* Turn the given character into the appropriate visual format, matching
+ * the width given by ct_visual_width(). Returns the number of characters used
+ * up, or -1 if insufficient space. Buffer length is in count of Char's. */
+protected ssize_t ct_visual_char(Char *, size_t, Char);
+
+/* Convert the given string into visual format, using the ct_visual_char()
+ * function. Uses a static buffer, so not threadsafe. */
+protected const Char *ct_visual_string(const Char *);
+
+
+/* printable character, use ct_visual_width() to find out display width */
+#define CHTYPE_PRINT        ( 0)
+/* control character found inside the ASCII portion of the charset */
+#define CHTYPE_ASCIICTL     (-1)
+/* a \t */
+#define CHTYPE_TAB          (-2)
+/* a \n */
+#define CHTYPE_NL           (-3)
+/* non-printable character */
+#define CHTYPE_NONPRINT     (-4)
+/* classification of character c, as one of the above defines */
+protected int ct_chr_class(Char c);
+#endif
+
+
+#endif /* _chartype_f */

Copied and modified: stable/8/lib/libedit/filecomplete.c (from r209136, head/lib/libedit/filecomplete.c)
==============================================================================
--- head/lib/libedit/filecomplete.c	Sun Jun 13 17:04:42 2010	(r209136, copy source)
+++ stable/8/lib/libedit/filecomplete.c	Wed Apr 13 23:09:36 2011	(r220612)
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
 
 static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@',
     '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' };
+/* Tilde is deliberately omitted here, we treat it specially. */
+static char extra_quote_chars[] = { ')', '}', '\0' };
 
 
 /********************************/
@@ -381,10 +383,14 @@ fn_complete(EditLine *el,
 	char **(*attempted_completion_function)(const char *, int, int),
 	const char *word_break, const char *special_prefixes,
 	const char *(*app_func)(const char *), size_t query_items,
-	int *completion_type, int *over, int *point, int *end)
+	int *completion_type, int *over, int *point, int *end,
+	const char *(*find_word_start_func)(const char *, const char *),
+	char *(*dequoting_func)(const char *),
+	char *(*quoting_func)(const char *))
 {
 	const LineInfo *li;
 	char *temp;
+	char *dequoted_temp;
 	char **matches;
 	const char *ctemp;
 	size_t len;
@@ -405,11 +411,15 @@ fn_complete(EditLine *el,
 
 	/* We now look backwards for the start of a filename/variable word */
 	li = el_line(el);
-	ctemp = li->cursor;
-	while (ctemp > li->buffer
-	    && !strchr(word_break, ctemp[-1])
-	    && (!special_prefixes || !strchr(special_prefixes, ctemp[-1]) ) )
-		ctemp--;
+	if (find_word_start_func)
+		ctemp = find_word_start_func(li->buffer, li->cursor);
+	else {
+		ctemp = li->cursor;
+		while (ctemp > li->buffer
+		    && !strchr(word_break, ctemp[-1])
+		    && (!special_prefixes || !strchr(special_prefixes, ctemp[-1]) ) )
+			ctemp--;
+	}
 
 	len = li->cursor - ctemp;
 #if defined(__SSP__) || defined(__SSP_ALL__)
@@ -422,6 +432,13 @@ fn_complete(EditLine *el,
 	(void)strncpy(temp, ctemp, len);
 	temp[len] = '\0';
 
+	if (dequoting_func) {
+		dequoted_temp = dequoting_func(temp);
+		if (dequoted_temp == NULL)
+			return retval;
+	} else
+		dequoted_temp = NULL;
+
 	/* these can be used by function called in completion_matches() */
 	/* or (*attempted_completion_function)() */
 	if (point != 0)
@@ -431,13 +448,13 @@ fn_complete(EditLine *el,
 
 	if (attempted_completion_function) {
 		int cur_off = (int)(li->cursor - li->buffer);
-		matches = (*attempted_completion_function) (temp,
+		matches = (*attempted_completion_function) (dequoted_temp ? dequoted_temp : temp,
 		    (int)(cur_off - len), cur_off);
 	} else
 		matches = 0;
 	if (!attempted_completion_function || 
 	    (over != NULL && !*over && !matches))
-		matches = completion_matches(temp, complet_func);
+		matches = completion_matches(dequoted_temp ? dequoted_temp : temp, complet_func);
 
 	if (over != NULL)
 		*over = 0;
@@ -452,8 +469,18 @@ fn_complete(EditLine *el,
 		 * possible matches if there is possible completion.
 		 */
 		if (matches[0][0] != '\0') {
+			char *quoted_match;
+			if (quoting_func) {
+				quoted_match = quoting_func(matches[0]);
+				if (quoted_match == NULL)
+					goto free_matches;
+			} else
+				quoted_match = NULL;
+
 			el_deletestr(el, (int) len);
-			el_insertstr(el, matches[0]);
+			el_insertstr(el, quoted_match ? quoted_match : matches[0]);
+
+			free(quoted_match);
 		}
 
 		if (what_to_do == '?')
@@ -515,12 +542,14 @@ fn_complete(EditLine *el,
 			retval = CC_NORM;
 		}
 
+free_matches:
 		/* free elements of array and the array itself */
 		for (i = 0; matches[i]; i++)
 			free(matches[i]);
 		free(matches);
 		matches = NULL;
 	}
+	free(dequoted_temp);
 #if defined(__SSP__) || defined(__SSP_ALL__)
 	free(temp);
 #endif
@@ -537,5 +566,99 @@ _el_fn_complete(EditLine *el, int ch __a
 {
 	return (unsigned char)fn_complete(el, NULL, NULL,
 	    break_chars, NULL, NULL, 100,
-	    NULL, NULL, NULL, NULL);
+	    NULL, NULL, NULL, NULL,
+	    NULL, NULL, NULL);
+}
+
+
+static const char *
+sh_find_word_start(const char *buffer, const char *cursor)
+{
+	const char *word_start = buffer;
+
+	while (buffer < cursor) {
+		if (*buffer == '\\')
+			buffer++;
+		else if (strchr(break_chars, *buffer))
+			word_start = buffer + 1;
+
+		buffer++;
+	}
+
+	return word_start;
+}
+
+
+static char *
+sh_quote(const char *str)
+{
+	const char *src;
+	int extra_len = 0;
+	char *quoted_str, *dst;
+
+	for (src = str; *src != '\0'; src++)
+		if (strchr(break_chars, *src) ||
+		    strchr(extra_quote_chars, *src))
+			extra_len++;
+
+	quoted_str = malloc(sizeof(*quoted_str) *
+	    (strlen(str) + extra_len + 1));
+	if (quoted_str == NULL)
+		return NULL;
+
+	dst = quoted_str;
+	for (src = str; *src != '\0'; src++) {
+		if (strchr(break_chars, *src) ||
+		    strchr(extra_quote_chars, *src))
+			*dst++ = '\\';
+		*dst++ = *src;
+	}
+	*dst = '\0';
+
+	return quoted_str;
+}
+
+
+static char *
+sh_dequote(const char *str)
+{
+	char *dequoted_str, *dst;
+
+	/* save extra space to replace \~ with ./~ */
+	dequoted_str = malloc(sizeof(*dequoted_str) * (strlen(str) + 1 + 1));
+	if (dequoted_str == NULL)
+		return NULL;
+
+	dst = dequoted_str;
+
+	/* dequote \~ at start as ./~ */
+	if (*str == '\\' && str[1] == '~') {
+		str++;
+		*dst++ = '.';
+		*dst++ = '/';
+	}
+
+	while (*str) {
+		if (*str == '\\')
+			str++;
+		if (*str)
+			*dst++ = *str++;
+	}
+	*dst = '\0';
+
+	return dequoted_str;
+}
+
+
+/*
+ * completion function using sh quoting rules; for key binding
+ */
+/* ARGSUSED */
+unsigned char
+_el_fn_sh_complete(EditLine *el, int ch __attribute__((__unused__)))
+{
+	return (unsigned char)fn_complete(el, NULL, NULL,
+	    break_chars, NULL, NULL, 100,
+	    NULL, NULL, NULL, NULL,
+	    sh_find_word_start, sh_dequote, sh_quote);
 }

Copied and modified: stable/8/lib/libedit/filecomplete.h (from r209136, head/lib/libedit/filecomplete.h)
==============================================================================
--- head/lib/libedit/filecomplete.h	Sun Jun 13 17:04:42 2010	(r209136, copy source)
+++ stable/8/lib/libedit/filecomplete.h	Wed Apr 13 23:09:36 2011	(r220612)
@@ -36,7 +36,10 @@ int fn_complete(EditLine *,
     char *(*)(const char *, int),
     char **(*)(const char *, int, int),
     const char *, const char *, const char *(*)(const char *), size_t,
-    int *, int *, int *, int *);
+    int *, int *, int *, int *,
+    const char *(*)(const char *, const char *),
+    char *(*)(const char *),
+    char *(*)(const char *));
 
 void fn_display_match_list(EditLine *, char **, size_t, size_t);
 char *fn_tilde_expand(const char *);

Copied: stable/8/lib/libedit/histedit.h (from r220370, head/lib/libedit/histedit.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/lib/libedit/histedit.h	Wed Apr 13 23:09:36 2011	(r220612, copy of r220370, head/lib/libedit/histedit.h)
@@ -0,0 +1,242 @@
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * 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.
+ *
+ *	@(#)histedit.h	8.2 (Berkeley) 1/3/94
+ *	$NetBSD: histedit.h,v 1.32 2007/06/10 20:20:28 christos Exp $
+ * $FreeBSD$
+ */
+
+/*
+ * histedit.h: Line editor and history interface.
+ */
+#ifndef _HISTEDIT_H_
+#define	_HISTEDIT_H_
+
+#include 
+#include 
+
+__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * ==== Editing ====
+ */
+
+typedef struct editline EditLine;
+
+/*
+ * For user-defined function interface
+ */
+typedef struct lineinfo {
+	const char	*buffer;
+	const char	*cursor;
+	const char	*lastchar;
+} LineInfo;
+
+/*
+ * EditLine editor function return codes.
+ * For user-defined function interface
+ */
+#define	CC_NORM		0
+#define	CC_NEWLINE	1
+#define	CC_EOF		2
+#define	CC_ARGHACK	3
+#define	CC_REFRESH	4
+#define	CC_CURSOR	5
+#define	CC_ERROR	6
+#define	CC_FATAL	7
+#define	CC_REDISPLAY	8
+#define	CC_REFRESH_BEEP	9
+
+/*
+ * Initialization, cleanup, and resetting
+ */
+EditLine	*el_init(const char *, FILE *, FILE *, FILE *);
+void		 el_end(EditLine *);
+void		 el_reset(EditLine *);
+
+/*
+ * Get a line, a character or push a string back in the input queue
+ */
+const char	*el_gets(EditLine *, int *);
+int		 el_getc(EditLine *, char *);
+void		 el_push(EditLine *, const char *);
+
+/*
+ * Beep!
+ */
+void		 el_beep(EditLine *);
+
+/*
+ * High level function internals control
+ * Parses argc, argv array and executes builtin editline commands
+ */
+int		 el_parse(EditLine *, int, const char **);
+
+/*
+ * Low level editline access functions
+ */
+int		 el_set(EditLine *, int, ...);
+int		 el_get(EditLine *, int, ...);
+unsigned char	_el_fn_complete(EditLine *, int);
+unsigned char	_el_fn_sh_complete(EditLine *, int);
+
+/*
+ * el_set/el_get parameters
+ */
+#define	EL_PROMPT	0	/* , el_pfunc_t);		*/
+#define	EL_TERMINAL	1	/* , const char *);		*/
+#define	EL_EDITOR	2	/* , const char *);		*/
+#define	EL_SIGNAL	3	/* , int);			*/
+#define	EL_BIND		4	/* , const char *, ..., NULL);	*/
+#define	EL_TELLTC	5	/* , const char *, ..., NULL);	*/
+#define	EL_SETTC	6	/* , const char *, ..., NULL);	*/
+#define	EL_ECHOTC	7	/* , const char *, ..., NULL);	*/
+#define	EL_SETTY	8	/* , const char *, ..., NULL);	*/
+#define	EL_ADDFN	9	/* , const char *, const char *	*/
+				/* , el_func_t);		*/
+#define	EL_HIST		10	/* , hist_fun_t, const char *);	*/
+#define	EL_EDITMODE	11	/* , int);			*/
+#define	EL_RPROMPT	12	/* , el_pfunc_t);		*/
+#define	EL_GETCFN	13	/* , el_rfunc_t);		*/
+#define	EL_CLIENTDATA	14	/* , void *);			*/
+#define	EL_UNBUFFERED	15	/* , int);			*/
+#define	EL_PREP_TERM    16      /* , int);                      */
+#define	EL_GETTC	17	/* , const char *, ..., NULL);	*/
+#define	EL_GETFP	18	/* , int, FILE **)		*/
+#define	EL_SETFP	19	/* , int, FILE *)		*/
+#define	EL_REFRESH	20	/* , void);			      set     */
+#define	EL_PROMPT_ESC	21	/* , prompt_func, Char);	      set/get */
+#define	EL_RPROMPT_ESC	22	/* , prompt_func, Char);	      set/get */
+#define	EL_RESIZE	23	/* , el_zfunc_t, void *);	      set     */
+
+#define	EL_BUILTIN_GETCFN	(NULL)
+
+/*
+ * Source named file or $PWD/.editrc or $HOME/.editrc
+ */
+int		el_source(EditLine *, const char *);
+
+/*
+ * Must be called when the terminal changes size; If EL_SIGNAL
+ * is set this is done automatically otherwise it is the responsibility
+ * of the application
+ */
+void		 el_resize(EditLine *);
+
+
+/*
+ * Set user private data.
+ */
+void            el_data_set    __P((EditLine *, void *));
+void *          el_data_get    __P((EditLine *));
+
+/*
+ * User-defined function interface.
+ */
+const LineInfo	*el_line(EditLine *);
+int		 el_insertstr(EditLine *, const char *);
+void		 el_deletestr(EditLine *, int);
+
+
+/*
+ * ==== History ====
+ */
+
+typedef struct history History;
+
+typedef struct HistEvent {
+	int		 num;
+	const char	*str;
+} HistEvent;
+
+/*
+ * History access functions.
+ */
+History *	history_init(void);
+void		history_end(History *);
+
+int		history(History *, HistEvent *, int, ...);
+
+#define	H_FUNC		 0	/* , UTSL		*/
+#define	H_SETSIZE	 1	/* , const int);	*/
+#define	H_EVENT		 1	/* , const int);	*/
+#define	H_GETSIZE	 2	/* , void);		*/
+#define	H_FIRST		 3	/* , void);		*/
+#define	H_LAST		 4	/* , void);		*/
+#define	H_PREV		 5	/* , void);		*/
+#define	H_NEXT		 6	/* , void);		*/
+#define	H_CURR		 8	/* , const int);	*/
+#define	H_SET		 7	/* , int);		*/
+#define	H_ADD		 9	/* , const char *);	*/
+#define	H_ENTER		10	/* , const char *);	*/
+#define	H_APPEND	11	/* , const char *);	*/
+#define	H_END		12	/* , void);		*/
+#define	H_NEXT_STR	13	/* , const char *);	*/
+#define	H_PREV_STR	14	/* , const char *);	*/
+#define	H_NEXT_EVENT	15	/* , const int);	*/
+#define	H_PREV_EVENT	16	/* , const int);	*/
+#define	H_LOAD		17	/* , const char *);	*/
+#define	H_SAVE		18	/* , const char *);	*/
+#define	H_CLEAR		19	/* , void);		*/
+#define	H_SETUNIQUE	20	/* , int);		*/
+#define	H_GETUNIQUE	21	/* , void);		*/
+#define	H_DEL		22	/* , int);		*/
+#define	H_NEXT_EVDATA	23	/* , const int, histdata_t *);	*/
+#define	H_DELDATA	24	/* , int, histdata_t *);*/
+#define	H_REPLACE	25	/* , const char *, histdata_t);	*/
+
+
+/*
+ * ==== Tokenization ====
+ */
+
+typedef struct tokenizer Tokenizer;
+
+/*
+ * String tokenization functions, using simplified sh(1) quoting rules
+ */
+Tokenizer	*tok_init(const char *);
+void		 tok_end(Tokenizer *);
+void		 tok_reset(Tokenizer *);
+int		 tok_line(Tokenizer *, const LineInfo *,
+		    int *, const char ***, int *, int *);
+int		 tok_str(Tokenizer *, const char *,
+		    int *, const char ***);
+
+__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HISTEDIT_H_ */

Modified: stable/8/lib/libedit/read.c
==============================================================================
--- stable/8/lib/libedit/read.c	Wed Apr 13 22:37:28 2011	(r220611)
+++ stable/8/lib/libedit/read.c	Wed Apr 13 23:09:36 2011	(r220612)
@@ -211,7 +211,7 @@ read_preread(EditLine *el)
  *	Push a macro
  */
 public void
-el_push(EditLine *el, char *str)
+el_push(EditLine *el, const char *str)
 {
 	c_macro_t *ma = &el->el_chared.c_macro;
 

Copied: stable/8/lib/libedit/readline.c (from r220370, head/lib/libedit/readline.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/lib/libedit/readline.c	Wed Apr 13 23:09:36 2011	(r220612, copy of r220370, head/lib/libedit/readline.c)
@@ -0,0 +1,2239 @@
+/*	$NetBSD: readline.c,v 1.90 2010/08/04 20:29:18 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jaromir Dolecek.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include 
+__RCSID("$NetBSD: readline.c,v 1.90 2010/08/04 20:29:18 christos Exp $");
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "sys.h"
+#include "readline/readline.h"
+#include "chartype.h"
+#include "el.h"
+#include "fcns.h"		/* for EL_NUM_FCNS */
+#include "histedit.h"
+#include "filecomplete.h"
+
+void rl_prep_terminal(int);
+void rl_deprep_terminal(void);
+
+/* for rl_complete() */
+#define TAB		'\r'
+
+/* see comment at the #ifdef for sense of this */
+/* #define GDB_411_HACK */
+
+/* readline compatibility stuff - look at readline sources/documentation */
+/* to see what these variables mean */
+const char *rl_library_version = "EditLine wrapper";
+int rl_readline_version = RL_READLINE_VERSION;
+static char empty[] = { '\0' };
+static char expand_chars[] = { ' ', '\t', '\n', '=', '(', '\0' };
+static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$',
+    '>', '<', '=', ';', '|', '&', '{', '(', '\0' };
+char *rl_readline_name = empty;
+FILE *rl_instream = NULL;
+FILE *rl_outstream = NULL;
+int rl_point = 0;
+int rl_end = 0;
+char *rl_line_buffer = NULL;
+VCPFunction *rl_linefunc = NULL;
+int rl_done = 0;
+VFunction *rl_event_hook = NULL;
+KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
+    emacs_meta_keymap,
+    emacs_ctlx_keymap;
+
+int history_base = 1;		/* probably never subject to change */
+int history_length = 0;
+int max_input_history = 0;
+char history_expansion_char = '!';
+char history_subst_char = '^';
+char *history_no_expand_chars = expand_chars;
+Function *history_inhibit_expansion_function = NULL;
+char *history_arg_extract(int start, int end, const char *str);
+
+int rl_inhibit_completion = 0;
+int rl_attempted_completion_over = 0;
+char *rl_basic_word_break_characters = break_chars;
+char *rl_completer_word_break_characters = NULL;
+char *rl_completer_quote_characters = NULL;
+Function *rl_completion_entry_function = NULL;
+CPPFunction *rl_attempted_completion_function = NULL;
+Function *rl_pre_input_hook = NULL;
+Function *rl_startup1_hook = NULL;
+int (*rl_getc_function)(FILE *) = NULL;
+char *rl_terminal_name = NULL;
+int rl_already_prompted = 0;
+int rl_filename_completion_desired = 0;
+int rl_ignore_completion_duplicates = 0;
+int rl_catch_signals = 1;
+int readline_echoing_p = 1;
+int _rl_print_completions_horizontally = 0;
+VFunction *rl_redisplay_function = NULL;
+Function *rl_startup_hook = NULL;
+VFunction *rl_completion_display_matches_hook = NULL;
+VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
+VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
+KEYMAP_ENTRY_ARRAY emacs_meta_keymap;
+
+#ifdef WIDECHAR
+static ct_buffer_t conv;
+#endif
+
+/*
+ * The current prompt string.
+ */
+char *rl_prompt = NULL;
+/*
+ * This is set to character indicating type of completion being done by
+ * rl_complete_internal(); this is available for application completion
+ * functions.
+ */
+int rl_completion_type = 0;
+
+/*
+ * If more than this number of items results from query for possible
+ * completions, we ask user if they are sure to really display the list.
+ */
+int rl_completion_query_items = 100;
+
+/*
+ * List of characters which are word break characters, but should be left
+ * in the parsed text when it is passed to the completion function.
+ * Shell uses this to help determine what kind of completing to do.
+ */
+char *rl_special_prefixes = NULL;
+
+/*
+ * This is the character appended to the completed words if at the end of
+ * the line. Default is ' ' (a space).
+ */
+int rl_completion_append_character = ' ';
+
+/* stuff below is used internally by libedit for readline emulation */
+
+static TYPE(History) *h = NULL;
+static EditLine *e = NULL;
+static Function *map[256];
+static jmp_buf topbuf;
+
+/* internal functions */
+static unsigned char	 _el_rl_complete(EditLine *, int);
+static unsigned char	 _el_rl_tstp(EditLine *, int);
+static char		*_get_prompt(EditLine *);
+static int		 _getc_function(EditLine *, char *);
+static HIST_ENTRY	*_move_history(int);
+static int		 _history_expand_command(const char *, size_t, size_t,
+    char **);
+static char		*_rl_compat_sub(const char *, const char *,
+    const char *, int);
+static int		 _rl_event_read_char(EditLine *, char *);
+static void		 _rl_update_pos(void);
+
+
+/* ARGSUSED */
+static char *
+_get_prompt(EditLine *el __attribute__((__unused__)))
+{
+	rl_already_prompted = 1;
+	return (rl_prompt);
+}
+
+
+/*
+ * generic function for moving around history
+ */
+static HIST_ENTRY *
+_move_history(int op)
+{
+	TYPE(HistEvent) ev;
+	static HIST_ENTRY rl_he;
+
+	if (FUNW(history)(h, &ev, op) != 0)
+		return (HIST_ENTRY *) NULL;
+
+	rl_he.line = ct_encode_string(ev.str, &conv);
+	rl_he.data = NULL;
+
+	return (&rl_he);
+}
+
+
+/*

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 14 15:25:27 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB3891065672;
	Thu, 14 Apr 2011 15:25:27 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D9B2E8FC22;
	Thu, 14 Apr 2011 15:25:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3EFPRK0038285;
	Thu, 14 Apr 2011 15:25:27 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3EFPREq038283;
	Thu, 14 Apr 2011 15:25:27 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <201104141525.p3EFPREq038283@svn.freebsd.org>
From: Andriy Gapon 
Date: Thu, 14 Apr 2011 15:25:27 +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: r220623 - stable/8/sys/dev/drm
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 14 Apr 2011 15:25:28 -0000

Author: avg
Date: Thu Apr 14 15:25:27 2011
New Revision: 220623
URL: http://svn.freebsd.org/changeset/base/220623

Log:
  MFC r210819: Add support for ATI Radeon HD 4250.
  
  On behalf of:	olli

Modified:
  stable/8/sys/dev/drm/drm_pciids.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/drm/drm_pciids.h
==============================================================================
--- stable/8/sys/dev/drm/drm_pciids.h	Thu Apr 14 14:54:22 2011	(r220622)
+++ stable/8/sys/dev/drm/drm_pciids.h	Thu Apr 14 15:25:27 2011	(r220623)
@@ -335,6 +335,7 @@
 	{0x1002, 0x9712, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Mobility Radeon HD 4200"}, \
 	{0x1002, 0x9713, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Mobility Radeon 4100"}, \
 	{0x1002, 0x9714, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI RS880"}, \
+	{0x1002, 0x9715, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4250"}, \
 	{0x1002, 0x9440, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
 	{0x1002, 0x9441, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4870 X2"}, \
 	{0x1002, 0x9442, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \

From owner-svn-src-stable-8@FreeBSD.ORG  Thu Apr 14 15:43:21 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 72816106564A;
	Thu, 14 Apr 2011 15:43:21 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 60D908FC0A;
	Thu, 14 Apr 2011 15:43:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3EFhLXX038862;
	Thu, 14 Apr 2011 15:43:21 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3EFhLwK038859;
	Thu, 14 Apr 2011 15:43:21 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <201104141543.p3EFhLwK038859@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Thu, 14 Apr 2011 15:43: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: r220625 - in stable/8/lib/libedit: . edit/readline
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 14 Apr 2011 15:43:21 -0000

Author: obrien
Date: Thu Apr 14 15:43:21 2011
New Revision: 220625
URL: http://svn.freebsd.org/changeset/base/220625

Log:
  MFC: 220624: add $FreeBSD$.

Modified:
  stable/8/lib/libedit/chartype.h
  stable/8/lib/libedit/edit/readline/readline.h
Directory Properties:
  stable/8/lib/libedit/   (props changed)

Modified: stable/8/lib/libedit/chartype.h
==============================================================================
--- stable/8/lib/libedit/chartype.h	Thu Apr 14 15:42:15 2011	(r220624)
+++ stable/8/lib/libedit/chartype.h	Thu Apr 14 15:43:21 2011	(r220625)
@@ -31,6 +31,8 @@
  * 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$
  */
 
 #ifndef _h_chartype_f

Modified: stable/8/lib/libedit/edit/readline/readline.h
==============================================================================
--- stable/8/lib/libedit/edit/readline/readline.h	Thu Apr 14 15:42:15 2011	(r220624)
+++ stable/8/lib/libedit/edit/readline/readline.h	Thu Apr 14 15:43:21 2011	(r220625)
@@ -27,6 +27,8 @@
  * 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$
  */
 #ifndef _READLINE_H_
 #define _READLINE_H_

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 10:33:20 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A4062106564A;
	Fri, 15 Apr 2011 10:33:20 +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 9205C8FC1A;
	Fri, 15 Apr 2011 10:33:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FAXKTj067324;
	Fri, 15 Apr 2011 10:33:20 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FAXKWk067322;
	Fri, 15 Apr 2011 10:33:20 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201104151033.p3FAXKWk067322@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 15 Apr 2011 10:33:20 +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: r220651 - stable/8/sys/amd64/amd64
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 10:33:20 -0000

Author: kib
Date: Fri Apr 15 10:33:20 2011
New Revision: 220651
URL: http://svn.freebsd.org/changeset/base/220651

Log:
  MFC r220461:
  Remove setting of PCB_FULL_IRET at the places where we are going to call
  update_gdt_{f,g}sbase. The functions set the flag when td == curthread,
  and sysarch is always called with curthread.

Modified:
  stable/8/sys/amd64/amd64/sys_machdep.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/amd64/amd64/sys_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/sys_machdep.c	Fri Apr 15 07:07:29 2011	(r220650)
+++ stable/8/sys/amd64/amd64/sys_machdep.c	Fri Apr 15 10:33:20 2011	(r220651)
@@ -214,7 +214,6 @@ sysarch(td, uap)
 		if (!error) {
 			pcb->pcb_fsbase = i386base;
 			td->td_frame->tf_fs = _ufssel;
-			set_pcb_flags(pcb, PCB_FULL_IRET);
 			update_gdt_fsbase(td, i386base);
 		}
 		break;
@@ -226,7 +225,6 @@ sysarch(td, uap)
 		error = copyin(uap->parms, &i386base, sizeof(i386base));
 		if (!error) {
 			pcb->pcb_gsbase = i386base;
-			set_pcb_flags(pcb, PCB_FULL_IRET);
 			td->td_frame->tf_gs = _ugssel;
 			update_gdt_gsbase(td, i386base);
 		}

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 19:46:25 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C06CB1065670;
	Fri, 15 Apr 2011 19:46:25 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ACE388FC20;
	Fri, 15 Apr 2011 19:46:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FJkPYL079742;
	Fri, 15 Apr 2011 19:46:25 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FJkP5Q079737;
	Fri, 15 Apr 2011 19:46:25 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201104151946.p3FJkP5Q079737@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 15 Apr 2011 19:46:25 +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: r220664 - in stable/8: lib/libc/gen lib/libc/string
	tools/regression/lib/libc/string
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 19:46:25 -0000

Author: jilles
Date: Fri Apr 15 19:46:25 2011
New Revision: 220664
URL: http://svn.freebsd.org/changeset/base/220664

Log:
  MFC r220376: Allow strerror(0) and strerror_r(0, ...).
  
  Of course, strerror_r() may still fail with ERANGE.
  
  Although the POSIX specification said this could fail with EINVAL and
  doing this likely indicates invalid use of errno, most other
  implementations permitted it, various POSIX testsuites require it to
  work (matching the older sys_errlist array) and apparently some
  applications depend on it.
  
  PR:		standards/151316

Modified:
  stable/8/lib/libc/gen/errlst.c
  stable/8/lib/libc/string/strerror.3
  stable/8/lib/libc/string/strerror.c
  stable/8/tools/regression/lib/libc/string/test-strerror.c
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/tools/regression/lib/libc/   (props changed)

Modified: stable/8/lib/libc/gen/errlst.c
==============================================================================
--- stable/8/lib/libc/gen/errlst.c	Fri Apr 15 18:34:27 2011	(r220663)
+++ stable/8/lib/libc/gen/errlst.c	Fri Apr 15 19:46:25 2011	(r220664)
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 const char *const sys_errlist[] = {
-	"Undefined error: 0",			/*  0 - ENOERROR */
+	"No error: 0",				/*  0 - ENOERROR */
 	"Operation not permitted",		/*  1 - EPERM */
 	"No such file or directory",		/*  2 - ENOENT */
 	"No such process",			/*  3 - ESRCH */

Modified: stable/8/lib/libc/string/strerror.3
==============================================================================
--- stable/8/lib/libc/string/strerror.3	Fri Apr 15 18:34:27 2011	(r220663)
+++ stable/8/lib/libc/string/strerror.3	Fri Apr 15 19:46:25 2011	(r220664)
@@ -32,7 +32,7 @@
 .\"     @(#)strerror.3	8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd October 12, 2004
+.Dd April 5, 2011
 .Dt STRERROR 3
 .Os
 .Sh NAME
@@ -114,6 +114,9 @@ the range 0 <
 .Fa errnum
 <
 .Fa sys_nerr .
+The number 0 is also recognized, although applications that take advantage of
+this are likely to use unspecified values of
+.Va errno .
 .Pp
 If insufficient storage is provided in
 .Fa strerrbuf

Modified: stable/8/lib/libc/string/strerror.c
==============================================================================
--- stable/8/lib/libc/string/strerror.c	Fri Apr 15 18:34:27 2011	(r220663)
+++ stable/8/lib/libc/string/strerror.c	Fri Apr 15 19:46:25 2011	(r220664)
@@ -87,7 +87,7 @@ strerror_r(int errnum, char *strerrbuf, 
 	catd = catopen("libc", NL_CAT_LOCALE);
 #endif
 
-	if (errnum < 1 || errnum >= sys_nerr) {
+	if (errnum < 0 || errnum >= sys_nerr) {
 		errstr(errnum,
 #if defined(NLS)
 			catgets(catd, 1, 0xffff, UPREFIX),

Modified: stable/8/tools/regression/lib/libc/string/test-strerror.c
==============================================================================
--- stable/8/tools/regression/lib/libc/string/test-strerror.c	Fri Apr 15 18:34:27 2011	(r220663)
+++ stable/8/tools/regression/lib/libc/string/test-strerror.c	Fri Apr 15 19:46:25 2011	(r220664)
@@ -42,17 +42,12 @@ main(void)
 	char *sret;
 	int iret;
 
-	plan_tests(25);
+	plan_tests(27);
 
 	/*
 	 * strerror() failure tests.
 	 */
 	errno = 0;
-	sret = strerror(0);
-	ok1(strcmp(sret, "Unknown error: 0") == 0);
-	ok1(errno == EINVAL);
-
-	errno = 0;
 	sret = strerror(INT_MAX);
 	snprintf(buf, sizeof(buf), "Unknown error: %d", INT_MAX);
 	ok1(strcmp(sret, buf) == 0);
@@ -62,6 +57,11 @@ main(void)
 	 * strerror() success tests.
 	 */
 	errno = 0;
+	sret = strerror(0);
+	ok1(strcmp(sret, "No error: 0") == 0);
+	ok1(errno == 0);
+
+	errno = 0;
 	sret = strerror(EPERM);
 	ok1(strcmp(sret, "Operation not permitted") == 0);
 	ok1(errno == 0);
@@ -79,8 +79,8 @@ main(void)
 	 * strerror_r() failure tests.
 	 */
 	memset(buf, '*', sizeof(buf));
-	iret = strerror_r(0, buf, sizeof(buf));
-	ok1(strcmp(buf, "Unknown error: 0") == 0);
+	iret = strerror_r(-1, buf, sizeof(buf));
+	ok1(strcmp(buf, "Unknown error: -1") == 0);
 	ok1(iret == EINVAL);
 
 	memset(buf, '*', sizeof(buf));
@@ -117,6 +117,11 @@ main(void)
 	 * strerror_r() success tests.
 	 */
 	memset(buf, '*', sizeof(buf));
+	iret = strerror_r(0, buf, sizeof(buf));
+	ok1(strcmp(buf, "No error: 0") == 0);
+	ok1(iret == 0);
+
+	memset(buf, '*', sizeof(buf));
 	iret = strerror_r(EDEADLK, buf, sizeof(buf));
 	ok1(strcmp(buf, "Resource deadlock avoided") == 0);
 	ok1(iret == 0);

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 19:50:26 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37E831065672;
	Fri, 15 Apr 2011 19:50:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24CB28FC1D;
	Fri, 15 Apr 2011 19:50:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FJoQQC079913;
	Fri, 15 Apr 2011 19:50:26 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FJoQC9079909;
	Fri, 15 Apr 2011 19:50:26 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104151950.p3FJoQC9079909@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 15 Apr 2011 19:50:26 +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: r220665 - stable/8/usr.sbin/mfiutil
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 19:50:26 -0000

Author: jhb
Date: Fri Apr 15 19:50:25 2011
New Revision: 220665
URL: http://svn.freebsd.org/changeset/base/220665

Log:
  MFC 219717,220363:
  - Add more details to the 'show battery' command including more raw
    capacity values, charge cycle count, temperature, and more detailed
    status.
  - Add the ability to manage the state of write caching when the battery
    back-up is missing or dead.  The current state of this field is reported
    in 'mfiutil cache ' and can be adjusted via
    'mfiutil cache  bad-bbu-write-cache '.  This
    setting should generally be disabled to avoid data loss.

Modified:
  stable/8/usr.sbin/mfiutil/mfi_show.c
  stable/8/usr.sbin/mfiutil/mfi_volume.c
  stable/8/usr.sbin/mfiutil/mfiutil.8
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	Fri Apr 15 19:46:25 2011	(r220664)
+++ stable/8/usr.sbin/mfiutil/mfi_show.c	Fri Apr 15 19:50:25 2011	(r220665)
@@ -138,8 +138,9 @@ show_battery(int ac, char **av)
 {
 	struct mfi_bbu_capacity_info cap;
 	struct mfi_bbu_design_info design;
+	struct mfi_bbu_status stat;
 	uint8_t status;
-	int error, fd;
+	int comma, error, fd;
 
 	if (ac != 1) {
 		warnx("show battery: extra arguments");
@@ -171,16 +172,57 @@ show_battery(int ac, char **av)
 		return (error);
 	}
 
+	if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_STATUS, &stat, sizeof(stat),
+	    NULL, 0, NULL) < 0) {
+		warn("Failed to get status");
+		return (errno);
+	}
+
 	printf("mfi%d: Battery State:\n", mfi_unit);
-	printf(" Manufacture Date: %d/%d/%d\n", design.mfg_date >> 5 & 0x0f,
+	printf("     Manufacture Date: %d/%d/%d\n", design.mfg_date >> 5 & 0x0f,
 	    design.mfg_date & 0x1f, design.mfg_date >> 9 & 0xffff);
-	printf("    Serial Number: %d\n", design.serial_number);
-	printf("     Manufacturer: %s\n", design.mfg_name);
-	printf("            Model: %s\n", design.device_name);
-	printf("        Chemistry: %s\n", design.device_chemistry);
-	printf("  Design Capacity: %d mAh\n", design.design_capacity);
-	printf("   Design Voltage: %d mV\n", design.design_voltage);
-	printf("   Current Charge: %d%%\n", cap.relative_charge);
+	printf("        Serial Number: %d\n", design.serial_number);
+	printf("         Manufacturer: %s\n", design.mfg_name);
+	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);
+	printf("       Design Voltage: %d mV\n", design.design_voltage);
+	printf("      Current Voltage: %d mV\n", stat.voltage);
+	printf("          Temperature: %d C\n", stat.temperature);
+	printf("               Status:");
+	comma = 0;
+	if (stat.fw_status & MFI_BBU_STATE_PACK_MISSING) {
+		printf(" PACK_MISSING");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_VOLTAGE_LOW) {
+		printf("%s VOLTAGE_LOW", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_TEMPERATURE_HIGH) {
+		printf("%s TEMPERATURE_HIGH", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_CHARGE_ACTIVE) {
+		printf("%s CHARGING", comma ? "," : "");
+		comma = 1;
+	}
+	if (stat.fw_status & MFI_BBU_STATE_DISCHARGE_ACTIVE) {
+		printf("%s DISCHARGING", comma ? "," : "");
+	}
+	if (!comma)
+		printf(" normal");
+	printf("\n");
+	switch (stat.battery_type) {
+	case MFI_BBU_TYPE_BBU:
+		printf("      State of Health: %s\n",
+		    stat.detail.bbu.is_SOH_good ? "good" : "bad");
+		break;
+	}
 
 	close(fd);
 

Modified: stable/8/usr.sbin/mfiutil/mfi_volume.c
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfi_volume.c	Fri Apr 15 19:46:25 2011	(r220664)
+++ stable/8/usr.sbin/mfiutil/mfi_volume.c	Fri Apr 15 19:50:25 2011	(r220665)
@@ -138,6 +138,10 @@ update_cache_policy(int fd, struct mfi_l
 		    policy & MR_LD_CACHE_READ_AHEAD ?
 		    (policy & MR_LD_CACHE_READ_ADAPTIVE ?
 		    "adaptive" : "always") : "none");
+	if (changes & MR_LD_CACHE_WRITE_CACHE_BAD_BBU)
+		printf("%s write caching with bad BBU\n",
+		    policy & MR_LD_CACHE_WRITE_CACHE_BAD_BBU ? "Enabling" :
+		    "Disabling");
 
 	props->default_cache_policy = policy;
 	if (mfi_ld_set_props(fd, props) < 0) {
@@ -182,7 +186,7 @@ volume_cache(int ac, char **av)
 	if (ac == 2) {
 		printf("mfi%u volume %s cache settings:\n", mfi_unit,
 		    mfi_volume_name(fd, target_id));
-		printf("      I/O caching: ");
+		printf("             I/O caching: ");
 		switch (props.default_cache_policy &
 		    (MR_LD_CACHE_ALLOW_WRITE_CACHE |
 		    MR_LD_CACHE_ALLOW_READ_CACHE)) {
@@ -200,14 +204,17 @@ volume_cache(int ac, char **av)
 			printf("writes and reads\n");
 			break;
 		}
-		printf("    write caching: %s\n",
+		printf("           write caching: %s\n",
 		    props.default_cache_policy & MR_LD_CACHE_WRITE_BACK ?
 		    "write-back" : "write-through");
-		printf("       read ahead: %s\n",
+		printf("write cache with bad BBU: %s\n",
+		    props.default_cache_policy &
+		    MR_LD_CACHE_WRITE_CACHE_BAD_BBU ? "enabled" : "disabled");
+		printf("              read ahead: %s\n",
 		    props.default_cache_policy & MR_LD_CACHE_READ_AHEAD ?
 		    (props.default_cache_policy & MR_LD_CACHE_READ_ADAPTIVE ?
 		    "adaptive" : "always") : "none");
-		printf("drive write cache: ");
+		printf("       drive write cache: ");
 		switch (props.disk_cache_policy) {
 		case MR_PD_CACHE_UNCHANGED:
 			printf("default\n");
@@ -273,6 +280,21 @@ volume_cache(int ac, char **av)
 			error = update_cache_policy(fd, &props, policy,
 			    MR_LD_CACHE_READ_AHEAD |
 			    MR_LD_CACHE_READ_ADAPTIVE);
+		} else if (strcmp(av[2], "bad-bbu-write-cache") == 0) {
+			if (ac < 4) {
+				warnx("cache: bad BBU setting required");
+				return (EINVAL);
+			}
+			if (strcmp(av[3], "enable") == 0)
+				policy = MR_LD_CACHE_WRITE_CACHE_BAD_BBU;
+			else if (strcmp(av[3], "disable") == 0)
+				policy = 0;
+			else {
+				warnx("cache: invalid bad BBU setting");
+				return (EINVAL);
+			}
+			error = update_cache_policy(fd, &props, policy,
+			    MR_LD_CACHE_WRITE_CACHE_BAD_BBU);
 		} else if (strcmp(av[2], "write-cache") == 0) {
 			if (ac < 4) {
 				warnx("cache: write-cache setting required");

Modified: stable/8/usr.sbin/mfiutil/mfiutil.8
==============================================================================
--- stable/8/usr.sbin/mfiutil/mfiutil.8	Fri Apr 15 19:46:25 2011	(r220664)
+++ stable/8/usr.sbin/mfiutil/mfiutil.8	Fri Apr 15 19:50:25 2011	(r220665)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 16, 2009
+.Dd April 5, 2011
 .Dt MFIUTIL 8
 .Os
 .Sh NAME
@@ -367,7 +367,7 @@ Enable caching only for write I/O operat
 Use write-back policy for cached writes.
 .It Cm write-through
 Use write-through policy for cached writes.
-.It Cm read-ahead Op Ar value
+.It Cm read-ahead Ar value
 Set the read ahead policy for cached reads.
 The
 .Ar value
@@ -376,7 +376,18 @@ argument can be set to either
 .Dq adaptive ,
 or
 .Dq always .
-.It Cm write-cache Op Ar value
+.It Cm bad-bbu-write-cache Ar value
+Control the behavior of I/O write caching if the battery is dead or
+missing.
+The
+.Ar value
+argument can be set to either
+.Dq disable
+or
+.Dq enable .
+In general this setting should be left disabled to avoid data loss when
+the system loses power.
+.It Cm write-cache Ar value
 Control the write caches on the physical drives backing
 .Ar volume .
 The

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 20:19:51 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 531031065675;
	Fri, 15 Apr 2011 20:19:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 371D38FC1C;
	Fri, 15 Apr 2011 20:19:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FKJpJT080737;
	Fri, 15 Apr 2011 20:19:51 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FKJp1i080734;
	Fri, 15 Apr 2011 20:19:51 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104152019.p3FKJp1i080734@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 15 Apr 2011 20:19:51 +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: r220669 - stable/8/sys/dev/pci
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 20:19:51 -0000

Author: jhb
Date: Fri Apr 15 20:19:50 2011
New Revision: 220669
URL: http://svn.freebsd.org/changeset/base/220669

Log:
  MFC 219865:
  Add pci_find_cap() as an alias for pci_find_extcap() to ease driver
  portability with 9+ where pci_find_extcap() has been renamed to
  pci_find_cap().

Modified:
  stable/8/sys/dev/pci/pci.c
  stable/8/sys/dev/pci/pcivar.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/pci/pci.c
==============================================================================
--- stable/8/sys/dev/pci/pci.c	Fri Apr 15 20:19:18 2011	(r220668)
+++ stable/8/sys/dev/pci/pci.c	Fri Apr 15 20:19:50 2011	(r220669)
@@ -98,7 +98,7 @@ static char		*pci_describe_device(device
 static int		pci_modevent(module_t mod, int what, void *arg);
 static void		pci_hdrtypedata(device_t pcib, int b, int s, int f,
 			    pcicfgregs *cfg);
-static void		pci_read_extcap(device_t pcib, pcicfgregs *cfg);
+static void		pci_read_cap(device_t pcib, pcicfgregs *cfg);
 static int		pci_read_vpd_reg(device_t pcib, pcicfgregs *cfg,
 			    int reg, uint32_t *data);
 #if 0
@@ -507,7 +507,7 @@ pci_read_device(device_t pcib, int d, in
 		pci_hdrtypedata(pcib, b, s, f, cfg);
 
 		if (REG(PCIR_STATUS, 2) & PCIM_STATUS_CAPPRESENT)
-			pci_read_extcap(pcib, cfg);
+			pci_read_cap(pcib, cfg);
 
 		STAILQ_INSERT_TAIL(devlist_head, devlist_entry, pci_links);
 
@@ -535,7 +535,7 @@ pci_read_device(device_t pcib, int d, in
 }
 
 static void
-pci_read_extcap(device_t pcib, pcicfgregs *cfg)
+pci_read_cap(device_t pcib, pcicfgregs *cfg)
 {
 #define	REG(n, w)	PCIB_READ_CONFIG(pcib, cfg->bus, cfg->slot, cfg->func, n, w)
 #define	WREG(n, v, w)	PCIB_WRITE_CONFIG(pcib, cfg->bus, cfg->slot, cfg->func, n, v, w)
@@ -1612,7 +1612,7 @@ pci_get_max_read_req(device_t dev)
 	int cap;
 	uint16_t val;
 
-	if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) != 0)
+	if (pci_find_cap(dev, PCIY_EXPRESS, &cap) != 0)
 		return (0);
 	val = pci_read_config(dev, cap + PCIR_EXPRESS_DEVICE_CTL, 2);
 	val &= PCIM_EXP_CTL_MAX_READ_REQUEST;
@@ -1626,7 +1626,7 @@ pci_set_max_read_req(device_t dev, int s
 	int cap;
 	uint16_t val;
 
-	if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) != 0)
+	if (pci_find_cap(dev, PCIY_EXPRESS, &cap) != 0)
 		return (0);
 	if (size < 128)
 		size = 128;

Modified: stable/8/sys/dev/pci/pcivar.h
==============================================================================
--- stable/8/sys/dev/pci/pcivar.h	Fri Apr 15 20:19:18 2011	(r220668)
+++ stable/8/sys/dev/pci/pcivar.h	Fri Apr 15 20:19:50 2011	(r220669)
@@ -400,9 +400,15 @@ pci_get_powerstate(device_t dev)
 }
 
 static __inline int
+pci_find_cap(device_t dev, int capability, int *capreg)
+{
+    return (PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg));
+}
+
+static __inline int
 pci_find_extcap(device_t dev, int capability, int *capreg)
 {
-    return PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg);
+    return (PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg));
 }
 
 static __inline int

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 20:26:24 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C0258106566C;
	Fri, 15 Apr 2011 20:26:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ADC978FC0A;
	Fri, 15 Apr 2011 20:26:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FKQOVX080973;
	Fri, 15 Apr 2011 20:26:24 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FKQOtc080971;
	Fri, 15 Apr 2011 20:26:24 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104152026.p3FKQOtc080971@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 15 Apr 2011 20:26:24 +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: r220671 - stable/8/sys/ufs/ffs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 20:26:24 -0000

Author: jhb
Date: Fri Apr 15 20:26:24 2011
New Revision: 220671
URL: http://svn.freebsd.org/changeset/base/220671

Log:
  MFC 219276:
  Use ffs() to locate free bits in the inode bitmap rather than a loop with
  bit shifts.

Modified:
  stable/8/sys/ufs/ffs/ffs_alloc.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/ufs/ffs/ffs_alloc.c
==============================================================================
--- stable/8/sys/ufs/ffs/ffs_alloc.c	Fri Apr 15 20:20:11 2011	(r220670)
+++ stable/8/sys/ufs/ffs/ffs_alloc.c	Fri Apr 15 20:26:24 2011	(r220671)
@@ -1770,17 +1770,13 @@ ffs_nodealloccg(ip, cg, ipref, mode)
 		}
 	}
 	i = start + len - loc;
-	map = inosused[i];
-	ipref = i * NBBY;
-	for (i = 1; i < (1 << NBBY); i <<= 1, ipref++) {
-		if ((map & i) == 0) {
-			cgp->cg_irotor = ipref;
-			goto gotit;
-		}
+	map = inosused[i] ^ 0xff;
+	if (map == 0) {
+		printf("fs = %s\n", fs->fs_fsmnt);
+		panic("ffs_nodealloccg: block not in map");
 	}
-	printf("fs = %s\n", fs->fs_fsmnt);
-	panic("ffs_nodealloccg: block not in map");
-	/* NOTREACHED */
+	ipref = i * NBBY + ffs(map) - 1;
+	cgp->cg_irotor = ipref;
 gotit:
 	/*
 	 * Check to see if we need to initialize more inodes.

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 20:28:38 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B7B9C106566B;
	Fri, 15 Apr 2011 20:28:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A5AC28FC19;
	Fri, 15 Apr 2011 20:28:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FKScxK081097;
	Fri, 15 Apr 2011 20:28:38 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FKScid081095;
	Fri, 15 Apr 2011 20:28:38 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104152028.p3FKScid081095@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 15 Apr 2011 20:28:38 +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: r220673 - stable/8/sys/isa
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 20:28:38 -0000

Author: jhb
Date: Fri Apr 15 20:28:38 2011
New Revision: 220673
URL: http://svn.freebsd.org/changeset/base/220673

Log:
  MFC 220126:
  - Enable an extra debugging bootverbose printf when probing ISA PNP cards
    listing   each card as it is found on non-PC98 (PC98 already had this).
  - Increase the length of the DELAY() used before timing out while reading
    PNP resource data.

Modified:
  stable/8/sys/isa/pnp.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/isa/pnp.c
==============================================================================
--- stable/8/sys/isa/pnp.c	Fri Apr 15 20:26:36 2011	(r220672)
+++ stable/8/sys/isa/pnp.c	Fri Apr 15 20:28:38 2011	(r220673)
@@ -209,7 +209,7 @@ pnp_get_resource_info(u_char *buffer, in
 		for (j = 0; j < 100; j++) {
 			if ((inb((pnp_rd_port << 2) | 0x3)) & 0x1)
 				break;
-			DELAY(1);
+			DELAY(10);
 		}
 		if (j == 100) {
 			printf("PnP device failed to report resource data\n");
@@ -743,10 +743,10 @@ pnp_isolation_protocol(device_t parent)
 					printf("A Normal-ISA-PnP card (%s).\n",
 					    pnp_eisaformat(id.vendor_id));
 			}
+#endif
 			if (bootverbose)
 				printf("Reading PnP configuration for %s.\n",
 				    pnp_eisaformat(id.vendor_id));
-#endif
 			error = pnp_read_resources(&resources, &space, &len);
 			if (error)
 				break;

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 20:32:17 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEF3D1065673;
	Fri, 15 Apr 2011 20:32:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ACD5A8FC18;
	Fri, 15 Apr 2011 20:32:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FKWH89081269;
	Fri, 15 Apr 2011 20:32:17 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FKWHIx081267;
	Fri, 15 Apr 2011 20:32:17 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104152032.p3FKWHIx081267@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 15 Apr 2011 20:32:17 +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: r220675 - stable/8/sys/amd64/ia32
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 20:32:17 -0000

Author: jhb
Date: Fri Apr 15 20:32:17 2011
New Revision: 220675
URL: http://svn.freebsd.org/changeset/base/220675

Log:
  MFC 220451:
  Catch up to PCB_FULL_IRET becoming a pcb flag rather than a full field.

Modified:
  stable/8/sys/amd64/ia32/ia32_exception.S
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/amd64/ia32/ia32_exception.S
==============================================================================
--- stable/8/sys/amd64/ia32/ia32_exception.S	Fri Apr 15 20:31:02 2011	(r220674)
+++ stable/8/sys/amd64/ia32/ia32_exception.S	Fri Apr 15 20:32:17 2011	(r220675)
@@ -46,7 +46,7 @@ IDTVEC(int0x80_syscall)
 	subq	$TF_ERR,%rsp		/* skip over tf_trapno */
 	movq	%rdi,TF_RDI(%rsp)
 	movq	PCPU(CURPCB),%rdi
-	movb	$0,PCB_FULL_IRET(%rdi)
+	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
 	movw	%fs,TF_FS(%rsp)
 	movw	%gs,TF_GS(%rsp)
 	movw	%es,TF_ES(%rsp)

From owner-svn-src-stable-8@FreeBSD.ORG  Fri Apr 15 20:42:27 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C5E761065679;
	Fri, 15 Apr 2011 20:42:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B3EE38FC1C;
	Fri, 15 Apr 2011 20:42:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3FKgR6h081723;
	Fri, 15 Apr 2011 20:42:27 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3FKgRqI081721;
	Fri, 15 Apr 2011 20:42:27 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201104152042.p3FKgRqI081721@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 15 Apr 2011 20:42:27 +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: r220679 - stable/8/sys/netinet
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 15 Apr 2011 20:42:27 -0000

Author: jhb
Date: Fri Apr 15 20:42:27 2011
New Revision: 220679
URL: http://svn.freebsd.org/changeset/base/220679

Log:
  MFC 220156:
  Clamp the initial advertised receive window when responding to a SYN/ACK
  to the maximum allowed window.  Growing the window too large would cause
  an underflow in the calculations in tcp_output() to decide if a window
  update should be sent which would prevent the persist timer from being
  started if data was pending and the other end of the connection advertised
  an initial window size of 0.

Modified:
  stable/8/sys/netinet/tcp_input.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/netinet/tcp_input.c
==============================================================================
--- stable/8/sys/netinet/tcp_input.c	Fri Apr 15 20:42:14 2011	(r220678)
+++ stable/8/sys/netinet/tcp_input.c	Fri Apr 15 20:42:27 2011	(r220679)
@@ -1558,7 +1558,8 @@ tcp_do_segment(struct mbuf *m, struct tc
 				(TF_RCVD_SCALE|TF_REQ_SCALE)) {
 				tp->rcv_scale = tp->request_r_scale;
 			}
-			tp->rcv_adv += tp->rcv_wnd;
+			tp->rcv_adv += imin(tp->rcv_wnd,
+			    TCP_MAXWIN << tp->rcv_scale);
 			tp->snd_una++;		/* SYN is acked */
 			/*
 			 * If there's data, delay ACK; if there's also a FIN

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 00:10:55 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EBDC1106566C;
	Sat, 16 Apr 2011 00:10:55 +0000 (UTC)
	(envelope-from rstone@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 867818FC0A;
	Sat, 16 Apr 2011 00:10:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3G0AtBs086281;
	Sat, 16 Apr 2011 00:10:55 GMT (envelope-from rstone@svn.freebsd.org)
Received: (from rstone@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3G0At4J086278;
	Sat, 16 Apr 2011 00:10:55 GMT (envelope-from rstone@svn.freebsd.org)
Message-Id: <201104160010.p3G0At4J086278@svn.freebsd.org>
From: Ryan Stone 
Date: Sat, 16 Apr 2011 00:10:55 +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: r220684 - in stable/8/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 00:10:56 -0000

Author: rstone
Date: Sat Apr 16 00:10:55 2011
New Revision: 220684
URL: http://svn.freebsd.org/changeset/base/220684

Log:
  MFC r220453:
   Add tunables that mirror the functionality of sysctls machdep.panic_on_nmi
   and machdep.kdb_on_nmi.
  
  Approved by:	emaste (mentor)

Modified:
  stable/8/sys/amd64/amd64/trap.c
  stable/8/sys/i386/i386/trap.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/amd64/amd64/trap.c
==============================================================================
--- stable/8/sys/amd64/amd64/trap.c	Fri Apr 15 23:07:48 2011	(r220683)
+++ stable/8/sys/amd64/amd64/trap.c	Sat Apr 16 00:10:55 2011	(r220684)
@@ -168,10 +168,12 @@ static char *trap_msg[] = {
 static int kdb_on_nmi = 1;
 SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RW,
 	&kdb_on_nmi, 0, "Go to KDB on NMI");
+TUNABLE_INT("machdep.kdb_on_nmi", &kdb_on_nmi);
 #endif
 static int panic_on_nmi = 1;
 SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW,
 	&panic_on_nmi, 0, "Panic on NMI");
+TUNABLE_INT("machdep.panic_on_nmi", &panic_on_nmi);
 static int prot_fault_translation = 0;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
 	&prot_fault_translation, 0, "Select signal to deliver on protection fault");

Modified: stable/8/sys/i386/i386/trap.c
==============================================================================
--- stable/8/sys/i386/i386/trap.c	Fri Apr 15 23:07:48 2011	(r220683)
+++ stable/8/sys/i386/i386/trap.c	Sat Apr 16 00:10:55 2011	(r220684)
@@ -183,10 +183,12 @@ extern int has_f00f_bug;
 static int kdb_on_nmi = 1;
 SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RW,
 	&kdb_on_nmi, 0, "Go to KDB on NMI");
+TUNABLE_INT("machdep.kdb_on_nmi", &kdb_on_nmi);
 #endif
 static int panic_on_nmi = 1;
 SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW,
 	&panic_on_nmi, 0, "Panic on NMI");
+TUNABLE_INT("machdep.panic_on_nmi", &panic_on_nmi);
 static int prot_fault_translation = 0;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
 	&prot_fault_translation, 0, "Select signal to deliver on protection fault");

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 09:56:28 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E4E91065670;
	Sat, 16 Apr 2011 09:56:28 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0CAFC8FC08;
	Sat, 16 Apr 2011 09:56:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3G9uR9r098929;
	Sat, 16 Apr 2011 09:56:27 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3G9uRCq098927;
	Sat, 16 Apr 2011 09:56:27 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104160956.p3G9uRCq098927@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 09:56:27 +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: r220695 - stable/8/usr.bin/netstat
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 09:56:28 -0000

Author: brucec
Date: Sat Apr 16 09:56:27 2011
New Revision: 220695
URL: http://svn.freebsd.org/changeset/base/220695

Log:
  MFC r219613:
  
  Fix typo.

Modified:
  stable/8/usr.bin/netstat/sctp.c
Directory Properties:
  stable/8/usr.bin/netstat/   (props changed)

Modified: stable/8/usr.bin/netstat/sctp.c
==============================================================================
--- stable/8/usr.bin/netstat/sctp.c	Sat Apr 16 09:39:08 2011	(r220694)
+++ stable/8/usr.bin/netstat/sctp.c	Sat Apr 16 09:56:27 2011	(r220695)
@@ -563,7 +563,7 @@ sctp_stats(u_long off, const char *name,
 	p(sctps_sendfastretrans, "\t\t%ju fast retransmitted DATA chunk%s\n");
 	p(sctps_sendmultfastretrans, "\t\t%ju FR'%s that happened more "
 	    "than once to same chunk\n");
-	p(sctps_sendheartbeat, "\t\t%ju intput HB chunk%s\n");
+	p(sctps_sendheartbeat, "\t\t%ju output HB chunk%s\n");
 	p(sctps_sendecne, "\t\t%ju output ECNE chunk%s\n");
 	p(sctps_sendauth, "\t\t%ju output AUTH chunk%s\n");
 	p1a(sctps_senderrors, "\t\t%ju ip_output error counter\n");

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 10:18:08 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 333B7106566B;
	Sat, 16 Apr 2011 10:18:08 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21B358FC15;
	Sat, 16 Apr 2011 10:18:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GAI8VC001191;
	Sat, 16 Apr 2011 10:18:08 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GAI8FS001188;
	Sat, 16 Apr 2011 10:18:08 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104161018.p3GAI8FS001188@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 10:18:08 +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: r220697 - stable/8/tools/regression/doat
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 10:18:08 -0000

Author: brucec
Date: Sat Apr 16 10:18:07 2011
New Revision: 220697
URL: http://svn.freebsd.org/changeset/base/220697

Log:
  MFC r219568:
  
  Fix warnings and style(9) issues.
  Set WARNS to 6.

Modified:
  stable/8/tools/regression/doat/Makefile
  stable/8/tools/regression/doat/doat.c
Directory Properties:
  stable/8/tools/regression/doat/   (props changed)

Modified: stable/8/tools/regression/doat/Makefile
==============================================================================
--- stable/8/tools/regression/doat/Makefile	Sat Apr 16 09:57:17 2011	(r220696)
+++ stable/8/tools/regression/doat/Makefile	Sat Apr 16 10:18:07 2011	(r220697)
@@ -3,5 +3,6 @@
 PROG=	doat
 
 NO_MAN=
+WARNS?=6
 
 .include 

Modified: stable/8/tools/regression/doat/doat.c
==============================================================================
--- stable/8/tools/regression/doat/doat.c	Sat Apr 16 09:57:17 2011	(r220696)
+++ stable/8/tools/regression/doat/doat.c	Sat Apr 16 10:18:07 2011	(r220697)
@@ -26,25 +26,31 @@
  * $FreeBSD$
  */
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+
+void cleanup(void);
+void setup(void);
+void setup_once(void);
 
 union param {
 	int		i;
-	char		*cp;
+	const char	*cp;
 	mode_t		m;
 	dev_t		d;
 	void		*vp;
 	uid_t		u;
 	gid_t		g;
-	char		**cpp;
+	const char	**cpp;
 };
 
 struct testcase {
@@ -55,7 +61,7 @@ struct testcase {
 struct test {
 	int	syscall;
 	int	num_of_cases;
-	char	*name;
+	const char *name;
 	struct testcase	tests[10];	/* no more than 10 tests */
 	
 };
@@ -64,21 +70,21 @@ struct test *tests;
 #define	NUM_OF_TESTS	14		/* we dont want the fexecve test to run */
 
 char *absolute_path = NULL;
-char *relative_path = "tmp/";
-char *not_dir_path = "/bin/date";
+const char *relative_path = "tmp/";
+const char *not_dir_path = "/bin/date";
 
-char *file = "foo";
+const char *file = "foo";
 char *absolute_file = NULL;
 char *relative_file = NULL;
-char *symlinkf = "link";
-char *newlink = "nlink1";
-char *newlink2 = "nlink2";
-char *newlink3 = "nlink3";
-char *newdir = "newdir";
-char *fifo = "fifo";
-char *nod = "nod";
-char *newfile = "newfile";
-char *newslink = "nslink1";
+const char *symlinkf = "link";
+const char *newlink = "nlink1";
+const char *newlink2 = "nlink2";
+const char *newlink3 = "nlink3";
+const char *newdir = "newdir";
+const char *fifo = "fifo";
+const char *nod = "nod";
+const char *newfile = "newfile";
+const char *newslink = "nslink1";
 
 bool dir_exist = false;
 bool file_exist = false;
@@ -88,15 +94,14 @@ int rel_fd, abs_fd, notd_fd, exec_fd;
 
 struct timeval times[2];
 struct stat buf;
-char *pargv[2] = { "/bin/date", NULL };
+const char *pargv[2] = { "/bin/date", NULL };
 #define	PATH_MAX	1024
 char cbuf[PATH_MAX];
 
 void
-setup()
+setup(void)
 {
 	int i, error;
-	size_t siz;
 	struct stat sb;
 
 	tests = calloc(NUM_OF_TESTS, sizeof(struct test));
@@ -607,13 +612,13 @@ setup()
 }
 
 void
-cleanup()
+cleanup(void)
 {
 	system("/bin/sh -c 'rm -rf tmp'");
 }
 
 void
-setup_once()
+setup_once(void)
 {
 }
 
@@ -623,10 +628,13 @@ main(int argc, char *argv[])
 	int i,j;
 	int error;
 
+	(void)argc;
+	(void)argv;
+
 	setup();
 
 	for (i = 0; i < NUM_OF_TESTS; i++) {
-	   	printf("\nTest: %s\n", tests[i].name);
+		printf("\nTest: %s\n", tests[i].name);
 		for (j = 0; j < tests[i].num_of_cases; j++) {
 			error = syscall(tests[i].syscall,
 				tests[i].tests[j].params[0],
@@ -652,13 +660,10 @@ main(int argc, char *argv[])
 						printf("#%i ... OK\n", j);
 				}
 			}
-
-
 		}
 	}
 
 	cleanup();
 
-
 	return (0);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 10:20:45 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB0FA106564A;
	Sat, 16 Apr 2011 10:20:45 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B99DA8FC08;
	Sat, 16 Apr 2011 10:20:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GAKjqa001294;
	Sat, 16 Apr 2011 10:20:45 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GAKjrh001291;
	Sat, 16 Apr 2011 10:20:45 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104161020.p3GAKjrh001291@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 10:20:45 +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: r220698 - stable/8/tools/tools/iwi
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 10:20:45 -0000

Author: brucec
Date: Sat Apr 16 10:20:45 2011
New Revision: 220698
URL: http://svn.freebsd.org/changeset/base/220698

Log:
  MFC r219527:
  
  Fix warnings and style(9) issues.
  Set WARNS to 6.

Modified:
  stable/8/tools/tools/iwi/Makefile
  stable/8/tools/tools/iwi/iwistats.c
Directory Properties:
  stable/8/tools/tools/iwi/   (props changed)

Modified: stable/8/tools/tools/iwi/Makefile
==============================================================================
--- stable/8/tools/tools/iwi/Makefile	Sat Apr 16 10:18:07 2011	(r220697)
+++ stable/8/tools/tools/iwi/Makefile	Sat Apr 16 10:20:45 2011	(r220698)
@@ -2,5 +2,6 @@
 
 PROG=	iwistats
 NO_MAN=
+WARNS?=6
 
 .include 

Modified: stable/8/tools/tools/iwi/iwistats.c
==============================================================================
--- stable/8/tools/tools/iwi/iwistats.c	Sat Apr 16 10:18:07 2011	(r220697)
+++ stable/8/tools/tools/iwi/iwistats.c	Sat Apr 16 10:20:45 2011	(r220698)
@@ -113,16 +113,17 @@ get_statistics(const char *iface)
 	static uint32_t stats[256];
 	const struct statistic *stat;
 	char oid[32];
-	int ifaceno, len;
+	size_t len;
+	int ifaceno;
 
 	if (sscanf(iface, "iwi%u", &ifaceno) != 1)
 		errx(EX_DATAERR, "Invalid interface name '%s'", iface);
 
-	len = sizeof stats;
-	(void)snprintf(oid, sizeof oid, "dev.iwi.%u.stats", ifaceno);
+	len = sizeof(stats);
+	(void)snprintf(oid, sizeof(oid), "dev.iwi.%u.stats", ifaceno);
 	if (sysctlbyname(oid, stats, &len, NULL, 0) == -1)
 		err(EX_OSERR, "Can't retrieve statistics");
 
 	for (stat = tbl; stat->index != -1; stat++)
-		(void)printf("%-60s[%lu]\n", stat->desc, stats[stat->index]);
+		(void)printf("%-60s[%u]\n", stat->desc, stats[stat->index]);
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 10:42:23 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50F9C106566B;
	Sat, 16 Apr 2011 10:42:23 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FF638FC15;
	Sat, 16 Apr 2011 10:42:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GAgNRV001978;
	Sat, 16 Apr 2011 10:42:23 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GAgN0I001975;
	Sat, 16 Apr 2011 10:42:23 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104161042.p3GAgN0I001975@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 10:42:23 +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: r220703 - stable/8/tools/tools/cfi
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 10:42:23 -0000

Author: brucec
Date: Sat Apr 16 10:42:22 2011
New Revision: 220703
URL: http://svn.freebsd.org/changeset/base/220703

Log:
  MFC r219521:
  
  Fix warnings and set WARNS to 6.

Modified:
  stable/8/tools/tools/cfi/Makefile
  stable/8/tools/tools/cfi/cfi.c
Directory Properties:
  stable/8/tools/tools/cfi/   (props changed)

Modified: stable/8/tools/tools/cfi/Makefile
==============================================================================
--- stable/8/tools/tools/cfi/Makefile	Sat Apr 16 10:38:27 2011	(r220702)
+++ stable/8/tools/tools/cfi/Makefile	Sat Apr 16 10:42:22 2011	(r220703)
@@ -3,5 +3,6 @@
 PROG=	cfi
 BINDIR=	/usr/local/bin
 NO_MAN=
+WARNS?=6
 
 .include 

Modified: stable/8/tools/tools/cfi/cfi.c
==============================================================================
--- stable/8/tools/tools/cfi/cfi.c	Sat Apr 16 10:38:27 2011	(r220702)
+++ stable/8/tools/tools/cfi/cfi.c	Sat Apr 16 10:42:22 2011	(r220703)
@@ -38,9 +38,12 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
+#include 
 #include 
+#include 
+#include 
 
 const char *progname;
 const char *dvname;
@@ -48,8 +51,6 @@ const char *dvname;
 static void
 usage(void)
 {
-	int i;
-
 	fprintf(stderr, "usage: %s [-f device] op...\n", progname);
 	fprintf(stderr, "where op's are:\n");
 	fprintf(stderr, "fact\t\tread factory PR segment\n");

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 10:57:12 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F2737106566B;
	Sat, 16 Apr 2011 10:57:11 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C74208FC13;
	Sat, 16 Apr 2011 10:57:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GAvBSS002378;
	Sat, 16 Apr 2011 10:57:11 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GAvBQM002375;
	Sat, 16 Apr 2011 10:57:11 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104161057.p3GAvBQM002375@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 10:57:11 +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: r220705 - stable/8/tools/test/malloc
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 10:57:12 -0000

Author: brucec
Date: Sat Apr 16 10:57:11 2011
New Revision: 220705
URL: http://svn.freebsd.org/changeset/base/220705

Log:
  MFC r219511:
  
  Fix warnings and style(9) issues.
  Set WARNS to 6.

Modified:
  stable/8/tools/test/malloc/Makefile
  stable/8/tools/test/malloc/main.c
Directory Properties:
  stable/8/tools/test/malloc/   (props changed)

Modified: stable/8/tools/test/malloc/Makefile
==============================================================================
--- stable/8/tools/test/malloc/Makefile	Sat Apr 16 10:52:11 2011	(r220704)
+++ stable/8/tools/test/malloc/Makefile	Sat Apr 16 10:57:11 2011	(r220705)
@@ -4,6 +4,7 @@ SRCS=	main.c
 .PATH:	${.CURDIR}/../../../lib/libc/stdlib
 
 NO_MAN=
+WARNS?=6
 
 test:	malloc
 	@echo

Modified: stable/8/tools/test/malloc/main.c
==============================================================================
--- stable/8/tools/test/malloc/main.c	Sat Apr 16 10:52:11 2011	(r220704)
+++ stable/8/tools/test/malloc/main.c	Sat Apr 16 10:57:11 2011	(r220705)
@@ -1,6 +1,7 @@
 /* $FreeBSD$ */
 #include 
 #include 
+#include 
 #include 
 
 u_long NBUCKETS		= 2000;
@@ -12,25 +13,25 @@ char **foo;
 int
 main(int argc, char **argv) 
 {
-    int i,j,k;
+    u_long i,j,k;
     
     if (argc > 1) NOPS     = strtoul(argv[1],0,0);
     if (argc > 2) NBUCKETS = strtoul(argv[2],0,0);
     if (argc > 3) NSIZE	   = strtoul(argv[3],0,0);
-    printf("BRK(0)=%x ",sbrk(0));
-    foo = malloc (sizeof *foo * NBUCKETS);
-    memset(foo,0,sizeof *foo * NBUCKETS);
+    printf("BRK(0)=%p ", sbrk(0));
+    foo = malloc(sizeof(*foo) * NBUCKETS);
+    memset(foo, 0, sizeof(*foo) * NBUCKETS);
     for (i = 1; i <= 4096; i *= 2) {
-        for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) {
+        for (j = 0; j < 40960/i && j < NBUCKETS; j++) {
 	    foo[j] = malloc(i);
         }
-        for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) {
+        for (j = 0; j < 40960/i && j < NBUCKETS; j++) {
 	    free(foo[j]);
-	    foo[j] = 0;
+	    foo[j] = NULL;
         }
     }
 
-    for (i = 0 ; i < NOPS ; i++) {
+    for (i = 0; i < NOPS; i++) {
 	j = random() % NBUCKETS;
 	k = random() % NSIZE;
 	foo[j] = realloc(foo[j], k & 1 ? 0 : k);
@@ -39,19 +40,19 @@ main(int argc, char **argv) 
 		 * Workaround because realloc return bogus pointer rather than
 		 * NULL if passed zero length.
 		 */
-		foo[j] = 0;
+		foo[j] = NULL;
 	}
 	if (foo[j])
 	    foo[j][0] = 1;
     }
-    printf("BRK(1)=%x ",sbrk(0));
-    for (j = 0 ; j < NBUCKETS ; j++) {
+    printf("BRK(1)=%p ", sbrk(0));
+    for (j = 0; j < NBUCKETS; j++) {
 	if (foo[j]) {
 	    free(foo[j]);
-	    foo[j] = 0;
+	    foo[j] = NULL;
 	}
     }
-    printf("BRK(2)=%x NOPS=%lu NBUCKETS=%lu NSIZE=%lu\n",
-	sbrk(0),NOPS,NBUCKETS,NSIZE);
+    printf("BRK(2)=%p NOPS=%lu NBUCKETS=%lu NSIZE=%lu\n",
+	sbrk(0), NOPS, NBUCKETS, NSIZE);
     return 0;
 }

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 11:04:17 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B541B106564A;
	Sat, 16 Apr 2011 11:04:17 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A44FF8FC08;
	Sat, 16 Apr 2011 11:04:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GB4H4R002701;
	Sat, 16 Apr 2011 11:04:17 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GB4HxB002698;
	Sat, 16 Apr 2011 11:04:17 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104161104.p3GB4HxB002698@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 11:04:17 +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: r220708 - stable/8/tools/tools/aac
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 11:04:17 -0000

Author: brucec
Date: Sat Apr 16 11:04:17 2011
New Revision: 220708
URL: http://svn.freebsd.org/changeset/base/220708

Log:
  MFC r219522:
  
  Fix warnings and set WARNS to 6.

Modified:
  stable/8/tools/tools/aac/Makefile
  stable/8/tools/tools/aac/aac_checkq.c
Directory Properties:
  stable/8/tools/tools/aac/   (props changed)

Modified: stable/8/tools/tools/aac/Makefile
==============================================================================
--- stable/8/tools/tools/aac/Makefile	Sat Apr 16 11:01:35 2011	(r220707)
+++ stable/8/tools/tools/aac/Makefile	Sat Apr 16 11:04:17 2011	(r220708)
@@ -2,6 +2,7 @@
 
 PROG=	aac_checkq
 NO_MAN=
+WARNS?=6
 BINDIR?=/usr/local/bin
 
 .include 

Modified: stable/8/tools/tools/aac/aac_checkq.c
==============================================================================
--- stable/8/tools/tools/aac/aac_checkq.c	Sat Apr 16 11:01:35 2011	(r220707)
+++ stable/8/tools/tools/aac/aac_checkq.c	Sat Apr 16 11:04:17 2011	(r220708)
@@ -34,7 +34,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+
+void usage(void);
 
 /*
  * Simple program to print out the queue stats on the given queue index.

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 11:06:10 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26D431065678;
	Sat, 16 Apr 2011 11:06:10 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 15F268FC20;
	Sat, 16 Apr 2011 11:06:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GB69uY002788;
	Sat, 16 Apr 2011 11:06:09 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GB692L002786;
	Sat, 16 Apr 2011 11:06:09 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201104161106.p3GB692L002786@svn.freebsd.org>
From: Bruce Cran 
Date: Sat, 16 Apr 2011 11:06: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: r220709 - stable/8/tools/tools/ether_reflect
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 11:06:10 -0000

Author: brucec
Date: Sat Apr 16 11:06:09 2011
New Revision: 220709
URL: http://svn.freebsd.org/changeset/base/220709

Log:
  MFC r219524:
  
  Fix the build: we have snprintf(3).

Modified:
  stable/8/tools/tools/ether_reflect/Makefile
Directory Properties:
  stable/8/tools/tools/ether_reflect/   (props changed)

Modified: stable/8/tools/tools/ether_reflect/Makefile
==============================================================================
--- stable/8/tools/tools/ether_reflect/Makefile	Sat Apr 16 11:04:17 2011	(r220708)
+++ stable/8/tools/tools/ether_reflect/Makefile	Sat Apr 16 11:06:09 2011	(r220709)
@@ -4,6 +4,7 @@
 # A Makefile that builds both the ether_reflect program and its manual page.
 
 PROG=   ether_reflect
+CFLAGS+=-DHAVE_SNPRINTF
 
 LDADD+= -lpcap
 

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 12:41:22 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B170A106564A;
	Sat, 16 Apr 2011 12:41:22 +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 9ED7E8FC0C;
	Sat, 16 Apr 2011 12:41:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GCfMZs005316;
	Sat, 16 Apr 2011 12:41:22 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GCfMES005313;
	Sat, 16 Apr 2011 12:41:22 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201104161241.p3GCfMES005313@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 16 Apr 2011 12:41:22 +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: r220714 - stable/8/sys/compat/freebsd32
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 12:41:22 -0000

Author: kib
Date: Sat Apr 16 12:41:22 2011
New Revision: 220714
URL: http://svn.freebsd.org/changeset/base/220714

Log:
  MFC r220280:
  Provide the structures and ioctl number definition for handling
  PCIOCGETCONF compat32.

Modified:
  stable/8/sys/compat/freebsd32/freebsd32_ioctl.c
  stable/8/sys/compat/freebsd32/freebsd32_ioctl.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/compat/freebsd32/freebsd32_ioctl.c
==============================================================================
--- stable/8/sys/compat/freebsd32/freebsd32_ioctl.c	Sat Apr 16 11:59:37 2011	(r220713)
+++ stable/8/sys/compat/freebsd32/freebsd32_ioctl.c	Sat Apr 16 12:41:22 2011	(r220714)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,6 +59,9 @@ CTASSERT((sizeof(struct md_ioctl32)+4) =
 CTASSERT(sizeof(struct ioc_read_toc_entry32) == 8);
 CTASSERT(sizeof(struct ioc_toc_header32) == 4);
 CTASSERT(sizeof(struct mem_range_op32) == 12);
+CTASSERT(sizeof(struct pci_conf_io32) == 36);
+CTASSERT(sizeof(struct pci_match_conf32) == 44);
+CTASSERT(sizeof(struct pci_conf32) == 44);
 
 
 static int

Modified: stable/8/sys/compat/freebsd32/freebsd32_ioctl.h
==============================================================================
--- stable/8/sys/compat/freebsd32/freebsd32_ioctl.h	Sat Apr 16 11:59:37 2011	(r220713)
+++ stable/8/sys/compat/freebsd32/freebsd32_ioctl.h	Sat Apr 16 12:41:22 2011	(r220714)
@@ -73,6 +73,45 @@ struct mem_range_op32
 	int		mo_arg[2];
 };
 
+struct pci_conf32 {
+	struct pcisel	pc_sel;		/* domain+bus+slot+function */
+	u_int8_t	pc_hdr;		/* PCI header type */
+	u_int16_t	pc_subvendor;	/* card vendor ID */
+	u_int16_t	pc_subdevice;	/* card device ID, assigned by
+					   card vendor */
+	u_int16_t	pc_vendor;	/* chip vendor ID */
+	u_int16_t	pc_device;	/* chip device ID, assigned by
+					   chip vendor */
+	u_int8_t	pc_class;	/* chip PCI class */
+	u_int8_t	pc_subclass;	/* chip PCI subclass */
+	u_int8_t	pc_progif;	/* chip PCI programming interface */
+	u_int8_t	pc_revid;	/* chip revision ID */
+	char		pd_name[PCI_MAXNAMELEN + 1];  /* device name */
+	u_int32_t	pd_unit;	/* device unit number */
+};
+
+struct pci_match_conf32 {
+	struct pcisel		pc_sel;		/* domain+bus+slot+function */
+	char			pd_name[PCI_MAXNAMELEN + 1];  /* device name */
+	u_int32_t		pd_unit;	/* Unit number */
+	u_int16_t		pc_vendor;	/* PCI Vendor ID */
+	u_int16_t		pc_device;	/* PCI Device ID */
+	u_int8_t		pc_class;	/* PCI class */
+	u_int32_t		flags;		/* Matching expression */
+};
+
+struct pci_conf_io32 {
+	u_int32_t		pat_buf_len;	/* pattern buffer length */
+	u_int32_t		num_patterns;	/* number of patterns */
+	caddr_t32		patterns;	/* struct pci_match_conf ptr */
+	u_int32_t		match_buf_len;	/* match buffer length */
+	u_int32_t		num_matches;	/* number of matches returned */
+	caddr_t32		matches;	/* struct pci_conf ptr */
+	u_int32_t		offset;		/* offset into device list */
+	u_int32_t		generation;	/* device list generation */
+	u_int32_t		status;		/* request status */
+};
+
 #define	CDIOREADTOCENTRYS_32 _IOWR('c', 5, struct ioc_read_toc_entry32)
 #define	CDIOREADTOCHEADER_32 _IOR('c', 4, struct ioc_toc_header32)
 #define	MDIOCATTACH_32	_IOC(IOC_INOUT, 'm', 0, sizeof(struct md_ioctl32) + 4)
@@ -82,5 +121,6 @@ struct mem_range_op32
 #define	FIODGNAME_32	_IOW('f', 120, struct fiodgname_arg32)
 #define	MEMRANGE_GET32	_IOWR('m', 50, struct mem_range_op32)
 #define	MEMRANGE_SET32	_IOW('m', 51, struct mem_range_op32)
+#define	PCIOCGETCONF_32	_IOWR('p', 5, struct pci_conf_io32)
 
 #endif	/* _COMPAT_FREEBSD32_IOCTL_H_ */

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 12:43:04 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CCDC91065851;
	Sat, 16 Apr 2011 12:43: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 B9A2C8FC1B;
	Sat, 16 Apr 2011 12:43:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GCh41K005435;
	Sat, 16 Apr 2011 12:43:04 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GCh4kC005433;
	Sat, 16 Apr 2011 12:43:04 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201104161243.p3GCh4kC005433@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 16 Apr 2011 12:43: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: r220716 - stable/8/sys/compat/freebsd32
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 12:43:05 -0000

Author: kib
Date: Sat Apr 16 12:43:04 2011
New Revision: 220716
URL: http://svn.freebsd.org/changeset/base/220716

Log:
  MFC r220281:
  Implement compat32 shims for PCIOCGETCONF.

Modified:
  stable/8/sys/compat/freebsd32/freebsd32_ioctl.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/compat/freebsd32/freebsd32_ioctl.c
==============================================================================
--- stable/8/sys/compat/freebsd32/freebsd32_ioctl.c	Sat Apr 16 12:42:54 2011	(r220715)
+++ stable/8/sys/compat/freebsd32/freebsd32_ioctl.c	Sat Apr 16 12:43:04 2011	(r220716)
@@ -241,6 +241,108 @@ freebsd32_ioctl_memrange(struct thread *
 	return (error);
 }
 
+static int
+freebsd32_ioctl_pciocgetconf(struct thread *td,
+    struct freebsd32_ioctl_args *uap, struct file *fp)
+{
+	struct pci_conf_io pci;
+	struct pci_conf_io32 pci32;
+	struct pci_match_conf32 pmc32;
+	struct pci_match_conf32 *pmc32p;
+	struct pci_match_conf pmc;
+	struct pci_match_conf *pmcp;
+	struct pci_conf32 pc32;
+	struct pci_conf32 *pc32p;
+	struct pci_conf pc;
+	struct pci_conf *pcp;
+	u_int32_t i;
+	u_int32_t npat_to_convert;
+	u_int32_t nmatch_to_convert;
+	vm_offset_t addr;
+	int error;
+
+	if ((error = copyin(uap->data, &pci32, sizeof(pci32))) != 0)
+		return (error);
+
+	CP(pci32, pci, num_patterns);
+	CP(pci32, pci, offset);
+	CP(pci32, pci, generation);
+
+	npat_to_convert = pci32.pat_buf_len / sizeof(struct pci_match_conf32);
+	pci.pat_buf_len = npat_to_convert * sizeof(struct pci_match_conf);
+	pci.patterns = NULL;
+	nmatch_to_convert = pci32.match_buf_len / sizeof(struct pci_conf32);
+	pci.match_buf_len = nmatch_to_convert * sizeof(struct pci_conf);
+	pci.matches = NULL;
+
+	if ((error = copyout_map(td, &addr, pci.pat_buf_len)) != 0)
+		goto cleanup;
+	pci.patterns = (struct pci_match_conf *)addr;
+	if ((error = copyout_map(td, &addr, pci.match_buf_len)) != 0)
+		goto cleanup;
+	pci.matches = (struct pci_conf *)addr;
+
+	npat_to_convert = min(npat_to_convert, pci.num_patterns);
+
+	for (i = 0, pmc32p = (struct pci_match_conf32 *)PTRIN(pci32.patterns),
+	     pmcp = pci.patterns;
+	     i < npat_to_convert; i++, pmc32p++, pmcp++) {
+		if ((error = copyin(pmc32p, &pmc32, sizeof(pmc32))) != 0)
+			goto cleanup;
+		CP(pmc32,pmc,pc_sel);
+		strlcpy(pmc.pd_name, pmc32.pd_name, sizeof(pmc.pd_name));
+		CP(pmc32,pmc,pd_unit);
+		CP(pmc32,pmc,pc_vendor);
+		CP(pmc32,pmc,pc_device);
+		CP(pmc32,pmc,pc_class);
+		CP(pmc32,pmc,flags);
+		if ((error = copyout(&pmc, pmcp, sizeof(pmc))) != 0)
+			goto cleanup;
+	}
+
+	if ((error = fo_ioctl(fp, PCIOCGETCONF, (caddr_t)&pci,
+			      td->td_ucred, td)) != 0)
+		goto cleanup;
+
+	nmatch_to_convert = min(nmatch_to_convert, pci.num_matches);
+
+	for (i = 0, pcp = pci.matches,
+	     pc32p = (struct pci_conf32 *)PTRIN(pci32.matches);
+	     i < nmatch_to_convert; i++, pcp++, pc32p++) {
+		if ((error = copyin(pcp, &pc, sizeof(pc))) != 0)
+			goto cleanup;
+		CP(pc,pc32,pc_sel);
+		CP(pc,pc32,pc_hdr);
+		CP(pc,pc32,pc_subvendor);
+		CP(pc,pc32,pc_subdevice);
+		CP(pc,pc32,pc_vendor);
+		CP(pc,pc32,pc_device);
+		CP(pc,pc32,pc_class);
+		CP(pc,pc32,pc_subclass);
+		CP(pc,pc32,pc_progif);
+		CP(pc,pc32,pc_revid);
+		strlcpy(pc32.pd_name, pc.pd_name, sizeof(pc32.pd_name));
+		CP(pc,pc32,pd_unit);
+		if ((error = copyout(&pc32, pc32p, sizeof(pc32))) != 0)
+			goto cleanup;
+	}
+
+	CP(pci, pci32, num_matches);
+	CP(pci, pci32, offset);
+	CP(pci, pci32, generation);
+	CP(pci, pci32, status);
+
+	error = copyout(&pci32, uap->data, sizeof(pci32));
+
+cleanup:
+	if (pci.patterns)
+		copyout_unmap(td, (vm_offset_t)pci.patterns, pci.pat_buf_len);
+	if (pci.matches)
+		copyout_unmap(td, (vm_offset_t)pci.matches, pci.match_buf_len);
+
+	return (error);
+}
+
 int
 freebsd32_ioctl(struct thread *td, struct freebsd32_ioctl_args *uap)
 {
@@ -284,6 +386,10 @@ freebsd32_ioctl(struct thread *td, struc
 		error = freebsd32_ioctl_memrange(td, uap, fp);
 		break;
 
+	case PCIOCGETCONF_32:
+		error = freebsd32_ioctl_pciocgetconf(td, uap, fp);
+		break;
+
 	default:
 		fdrop(fp, td);
 		ap.fd = uap->fd;

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 12:45:09 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6EA301065673;
	Sat, 16 Apr 2011 12:45:09 +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 5CAFC8FC16;
	Sat, 16 Apr 2011 12:45:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GCj9dH005541;
	Sat, 16 Apr 2011 12:45:09 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GCj9F3005539;
	Sat, 16 Apr 2011 12:45:09 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201104161245.p3GCj9F3005539@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 16 Apr 2011 12:45: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: r220717 - stable/8/sys/fs/fdescfs
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 12:45:09 -0000

Author: kib
Date: Sat Apr 16 12:45:09 2011
New Revision: 220717
URL: http://svn.freebsd.org/changeset/base/220717

Log:
  MFC r220506:
  Implement a workaround for fdescfs to not panic when ncookies is not NULL.
  
  PR:	kern/156177

Modified:
  stable/8/sys/fs/fdescfs/fdesc_vnops.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/fs/fdescfs/fdesc_vnops.c
==============================================================================
--- stable/8/sys/fs/fdescfs/fdesc_vnops.c	Sat Apr 16 12:43:04 2011	(r220716)
+++ stable/8/sys/fs/fdescfs/fdesc_vnops.c	Sat Apr 16 12:45:09 2011	(r220717)
@@ -500,16 +500,12 @@ fdesc_readdir(ap)
 	struct dirent *dp = &d;
 	int error, i, off, fcnt;
 
-	/*
-	 * We don't allow exporting fdesc mounts, and currently local
-	 * requests do not need cookies.
-	 */
-	if (ap->a_ncookies)
-		panic("fdesc_readdir: not hungry");
-
 	if (VTOFDESC(ap->a_vp)->fd_type != Froot)
 		panic("fdesc_readdir: not dir");
 
+	if (ap->a_ncookies != NULL)
+		*ap->a_ncookies = 0;
+
 	off = (int)uio->uio_offset;
 	if (off != uio->uio_offset || off < 0 || (u_int)off % UIO_MX != 0 ||
 	    uio->uio_resid < UIO_MX)

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 21:34:09 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE8FA1065672;
	Sat, 16 Apr 2011 21:34:09 +0000 (UTC)
	(envelope-from oliver.pntr@gmail.com)
Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50])
	by mx1.freebsd.org (Postfix) with ESMTP id DCE508FC13;
	Sat, 16 Apr 2011 21:34:08 +0000 (UTC)
Received: by wwc33 with SMTP id 33so4291116wwc.31
	for ; Sat, 16 Apr 2011 14:34:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type;
	bh=CqOBizRFFLZm76MwYWhLLKs2gKN8txZQB3lKN1IxJJE=;
	b=UKSgPV5UYU+mCKpgt/nee1GleHm1wBBP4ajbk36rgDDEBzpxASRTANxhZFu7U6jHjx
	0hm874Y+Z0IjFos+/pNuoyQHjAy/LGRWD2nsOhavN4cjZEOJTcv0cXLgxoMg7naLCbI7
	9aYR0Ol6G7ziFE+IXSvZ21v/iYexxaiUKMzVA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	b=LbaaideS0z40GVI+2e2L3oliYB8P+JtMi3uejfD8EGbCiz4WjHy4gQWhzGsIex9tbA
	54eVPU5X8gOERPn935ZdlSBP1ZE9p5XlgT6pcQ6at2p/s2Cv1pp7923gt0hTH076BcAi
	3MbJiWMrJfqKrYLc4WSMlzUFJUNF2R13DiXkY=
MIME-Version: 1.0
Received: by 10.227.163.13 with SMTP id y13mr3455682wbx.56.1302987878614; Sat,
	16 Apr 2011 14:04:38 -0700 (PDT)
Received: by 10.227.136.199 with HTTP; Sat, 16 Apr 2011 14:04:38 -0700 (PDT)
In-Reply-To: <201102190739.p1J7dFjO087910@svn.freebsd.org>
References: <201102190739.p1J7dFjO087910@svn.freebsd.org>
Date: Sat, 16 Apr 2011 23:04:38 +0200
Message-ID: 
From: Oliver Pinter 
To: Konstantin Belousov 
Content-Type: text/plain; charset=ISO-8859-1
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject: Re: svn commit: r218836 - in stable/8/sys: amd64/amd64 amd64/ia32
 i386/i386 kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 21:34:09 -0000

MFC this for 7-STABLE?

On 2/19/11, Konstantin Belousov  wrote:
> Author: kib
> Date: Sat Feb 19 07:39:14 2011
> New Revision: 218836
> URL: http://svn.freebsd.org/changeset/base/218836
>
> Log:
>   MFC r218327:
>   Clear the padding when returning context to the usermode.
>
> Modified:
>   stable/8/sys/amd64/amd64/machdep.c
>   stable/8/sys/amd64/ia32/ia32_signal.c
>   stable/8/sys/i386/i386/machdep.c
>   stable/8/sys/kern/kern_context.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/amd64/amd64/machdep.c
> ==============================================================================
> --- stable/8/sys/amd64/amd64/machdep.c	Sat Feb 19 03:32:10 2011	(r218835)
> +++ stable/8/sys/amd64/amd64/machdep.c	Sat Feb 19 07:39:14 2011	(r218836)
> @@ -329,6 +329,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi,
>  	fpstate_drop(td);
>  	sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase;
>  	sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase;
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -350,6 +353,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi,
>  	/* Build the argument list for the signal handler. */
>  	regs->tf_rdi = sig;			/* arg 1 in %rdi */
>  	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		regs->tf_rsi = (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
> @@ -2034,6 +2038,7 @@ get_mcontext(struct thread *td, mcontext
>  	get_fpcontext(td, mcp);
>  	mcp->mc_fsbase = td->td_pcb->pcb_fsbase;
>  	mcp->mc_gsbase = td->td_pcb->pcb_gsbase;
> +	bzero(mcp->mc_spare, sizeof(mcp->mc_spare));
>  	return (0);
>  }
>
>
> Modified: stable/8/sys/amd64/ia32/ia32_signal.c
> ==============================================================================
> --- stable/8/sys/amd64/ia32/ia32_signal.c	Sat Feb 19 03:32:10 2011	(r218835)
> +++ stable/8/sys/amd64/ia32/ia32_signal.c	Sat Feb 19 07:39:14 2011	(r218836)
> @@ -164,6 +164,8 @@ ia32_get_mcontext(struct thread *td, str
>  	ia32_get_fpcontext(td, mcp);
>  	mcp->mc_fsbase = td->td_pcb->pcb_fsbase;
>  	mcp->mc_gsbase = td->td_pcb->pcb_gsbase;
> +	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
> +	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
>  	td->td_pcb->pcb_full_iret = 1;
>  	return (0);
>  }
> @@ -230,6 +232,7 @@ freebsd32_getcontext(struct thread *td,
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> +		bzero(&uc.__spare__, sizeof(uc.__spare__));
>  		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
>  	}
>  	return (ret);
> @@ -345,6 +348,11 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi
>  	sf.sf_uc.uc_mcontext.mc_es = regs->tf_es;
>  	sf.sf_uc.uc_mcontext.mc_fs = regs->tf_fs;
>  	sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs;
> +	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
> +	bzero(sf.sf_uc.uc_mcontext.__spare__,
> +	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -362,6 +370,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
> @@ -464,6 +473,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
>  	fpstate_drop(td);
>  	sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase;
>  	sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase;
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -483,6 +493,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
>
> Modified: stable/8/sys/i386/i386/machdep.c
> ==============================================================================
> --- stable/8/sys/i386/i386/machdep.c	Sat Feb 19 03:32:10 2011	(r218835)
> +++ stable/8/sys/i386/i386/machdep.c	Sat Feb 19 07:39:14 2011	(r218836)
> @@ -379,12 +379,14 @@ osendsig(sig_t catcher, ksiginfo_t *ksi,
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
> +	bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
>  		sf.sf_siginfo.si_signo = sig;
>  		sf.sf_siginfo.si_code = ksi->ksi_code;
>  		sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher;
> +		sf.sf_addr = 0;
>  	} else {
>  		/* Old FreeBSD-style arguments. */
>  		sf.sf_arg2 = ksi->ksi_code;
> @@ -498,6 +500,11 @@ freebsd4_sendsig(sig_t catcher, ksiginfo
>  	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
>  	sf.sf_uc.uc_mcontext.mc_gs = rgs();
>  	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
> +	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
> +	bzero(sf.sf_uc.uc_mcontext.__spare__,
> +	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -517,6 +524,7 @@ freebsd4_sendsig(sig_t catcher, ksiginfo
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (register_t)&sfp->sf_si;
> @@ -643,6 +651,11 @@ sendsig(sig_t catcher, ksiginfo_t *ksi,
>  	sdp = &td->td_pcb->pcb_gsd;
>  	sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 |
>  	    sdp->sd_lobase;
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -664,6 +677,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi,
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (register_t)&sfp->sf_si;
> @@ -3268,7 +3282,8 @@ get_mcontext(struct thread *td, mcontext
>  	mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
>  	sdp = &td->td_pcb->pcb_gsd;
>  	mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
> -
> +	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
> +	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
>  	return (0);
>  }
>
> @@ -3317,6 +3332,7 @@ get_fpcontext(struct thread *td, mcontex
>  #ifndef DEV_NPX
>  	mcp->mc_fpformat = _MC_FPFMT_NODEV;
>  	mcp->mc_ownedfp = _MC_FPOWNED_NONE;
> +	bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
>  #else
>  	mcp->mc_ownedfp = npxgetregs(td);
>  	bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate,
>
> Modified: stable/8/sys/kern/kern_context.c
> ==============================================================================
> --- stable/8/sys/kern/kern_context.c	Sat Feb 19 03:32:10 2011	(r218835)
> +++ stable/8/sys/kern/kern_context.c	Sat Feb 19 07:39:14 2011	(r218836)
> @@ -71,6 +71,7 @@ getcontext(struct thread *td, struct get
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> +		bzero(uc.__spare__, sizeof(uc.__spare__));
>  		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
>  	}
>  	return (ret);
> @@ -107,6 +108,7 @@ swapcontext(struct thread *td, struct sw
>  		ret = EINVAL;
>  	else {
>  		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
> +		bzero(uc.__spare__, sizeof(uc.__spare__));
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> _______________________________________________
> svn-src-stable@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-stable
> To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org"
>

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 22:19:19 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D47EC1065680;
	Sat, 16 Apr 2011 22:19:19 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200])
	by mx1.freebsd.org (Postfix) with ESMTP id 200598FC18;
	Sat, 16 Apr 2011 22:19:18 +0000 (UTC)
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p3GMJFxr075887
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sun, 17 Apr 2011 01:19:15 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id
	p3GMJFtQ021386; Sun, 17 Apr 2011 01:19:15 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p3GMJFj5021385; 
	Sun, 17 Apr 2011 01:19:15 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Sun, 17 Apr 2011 01:19:15 +0300
From: Kostik Belousov 
To: Oliver Pinter 
Message-ID: <20110416221915.GR48734@deviant.kiev.zoral.com.ua>
References: <201102190739.p1J7dFjO087910@svn.freebsd.org>
	
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="EqVOK5mkaJAMmtSx"
Content-Disposition: inline
In-Reply-To: 
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20,
	DNS_FROM_OPENWHOIS autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject: Re: svn commit: r218836 - in stable/8/sys: amd64/amd64 amd64/ia32
	i386/i386 kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 22:19:19 -0000


--EqVOK5mkaJAMmtSx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Apr 16, 2011 at 11:04:38PM +0200, Oliver Pinter wrote:
> MFC this for 7-STABLE?
I do not reject the proposal, but I am quite curious why ?

I do not have any machine running 7, so please test the patch below.
It compiled for me on amd64.

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /head/sys:r218327

Index: kern/kern_context.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- kern/kern_context.c	(revision 220730)
+++ kern/kern_context.c	(working copy)
@@ -71,6 +71,7 @@
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask =3D td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
+		bzero(uc.__spare__, sizeof(uc.__spare__));
 		ret =3D copyout(&uc, uap->ucp, UC_COPY_SIZE);
 	}
 	return (ret);
@@ -109,6 +110,7 @@
 		ret =3D EINVAL;
 	else {
 		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
+		bzero(uc.__spare__, sizeof(uc.__spare__));
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask =3D td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
Index: i386/i386/machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- i386/i386/machdep.c	(revision 220730)
+++ i386/i386/machdep.c	(working copy)
@@ -342,12 +342,14 @@
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum =3D sig;
 	sf.sf_scp =3D (register_t)&fp->sf_siginfo.si_sc;
+	bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_arg2 =3D (register_t)&fp->sf_siginfo;
 		sf.sf_siginfo.si_signo =3D sig;
 		sf.sf_siginfo.si_code =3D ksi->ksi_code;
 		sf.sf_ahu.sf_action =3D (__osiginfohandler_t *)catcher;
+		sf.sf_addr =3D 0;
 	} else {
 		/* Old FreeBSD-style arguments. */
 		sf.sf_arg2 =3D ksi->ksi_code;
@@ -461,6 +463,11 @@
 	sf.sf_uc.uc_mcontext.mc_onstack =3D (oonstack) ? 1 : 0;
 	sf.sf_uc.uc_mcontext.mc_gs =3D rgs();
 	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
+	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
+	bzero(sf.sf_uc.uc_mcontext.__spare__,
+	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
=20
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) !=3D 0 && !oonstack &&
@@ -480,6 +487,7 @@
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum =3D sig;
 	sf.sf_ucontext =3D (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo =3D (register_t)&sfp->sf_si;
@@ -596,6 +604,11 @@
 	sf.sf_uc.uc_mcontext.mc_len =3D sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
+	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
=20
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) !=3D 0 && !oonstack &&
@@ -617,6 +630,7 @@
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum =3D sig;
 	sf.sf_ucontext =3D (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo =3D (register_t)&sfp->sf_si;
@@ -2716,6 +2730,8 @@
 	mcp->mc_ss =3D tp->tf_ss;
 	mcp->mc_len =3D sizeof(*mcp);
 	get_fpcontext(td, mcp);
+	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	return (0);
 }
=20
@@ -2763,6 +2779,7 @@
 #ifndef DEV_NPX
 	mcp->mc_fpformat =3D _MC_FPFMT_NODEV;
 	mcp->mc_ownedfp =3D _MC_FPOWNED_NONE;
+	bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
 #else
 	union savefpu *addr;
=20

Property changes on: contrib/pf
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /head/sys/contrib/pf:r218327


Property changes on: contrib/dev/acpica
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /head/sys/contrib/dev/acpica:r218327


Property changes on: cddl/contrib/opensolaris
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /head/sys/cddl/contrib/opensolaris:r218327

Index: amd64/amd64/machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- amd64/amd64/machdep.c	(revision 220730)
+++ amd64/amd64/machdep.c	(working copy)
@@ -306,6 +306,9 @@
 	sf.sf_uc.uc_mcontext.mc_len =3D sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	bzero(sf.sf_uc.uc_mcontext.mc_spare,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
=20
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) !=3D 0 && !oonstack &&
@@ -327,6 +330,7 @@
 	/* Build the argument list for the signal handler. */
 	regs->tf_rdi =3D sig;			/* arg 1 in %rdi */
 	regs->tf_rdx =3D (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		regs->tf_rsi =3D (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
@@ -1653,6 +1657,7 @@
 	mcp->mc_ss =3D tp->tf_ss;
 	mcp->mc_len =3D sizeof(*mcp);
 	get_fpcontext(td, mcp);
+	bzero(mcp->mc_spare, sizeof(mcp->mc_spare));
 	return (0);
 }
=20
Index: amd64/ia32/ia32_signal.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- amd64/ia32/ia32_signal.c	(revision 220730)
+++ amd64/ia32/ia32_signal.c	(working copy)
@@ -158,6 +158,8 @@
 	mcp->mc_ss =3D tp->tf_ss;
 	mcp->mc_len =3D sizeof(*mcp);
 	ia32_get_fpcontext(td, mcp);
+	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	return (0);
 }
=20
@@ -226,6 +228,7 @@
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask =3D td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
+		bzero(&uc.__spare__, sizeof(uc.__spare__));
 		ret =3D copyout(&uc, uap->ucp, UC_COPY_SIZE);
 	}
 	return (ret);
@@ -345,6 +348,11 @@
 	sf.sf_uc.uc_mcontext.mc_eflags =3D regs->tf_rflags;
 	sf.sf_uc.uc_mcontext.mc_esp =3D regs->tf_rsp;
 	sf.sf_uc.uc_mcontext.mc_ss =3D regs->tf_ss;
+	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
+	bzero(sf.sf_uc.uc_mcontext.__spare__,
+	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
=20
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) !=3D 0 && !oonstack &&
@@ -362,6 +370,7 @@
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum =3D sig;
 	sf.sf_ucontext =3D (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo =3D (u_int32_t)(uintptr_t)&sfp->sf_si;
@@ -463,6 +472,7 @@
 	sf.sf_uc.uc_mcontext.mc_len =3D sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
=20
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) !=3D 0 && !oonstack &&
@@ -482,6 +492,7 @@
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum =3D sig;
 	sf.sf_ucontext =3D (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo =3D (u_int32_t)(uintptr_t)&sfp->sf_si;

--EqVOK5mkaJAMmtSx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk2qFeIACgkQC3+MBN1Mb4hY7wCfbGQLZTOA0/mn4vEdbP2Yxyq4
TrwAoKw2g0eiHNk27FBA4C8WdkR8+Eq4
=Ro4W
-----END PGP SIGNATURE-----

--EqVOK5mkaJAMmtSx--

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 23:30:54 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E0C61065670;
	Sat, 16 Apr 2011 23:30:54 +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 49F1E8FC14;
	Sat, 16 Apr 2011 23:30:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GNUsLc019876;
	Sat, 16 Apr 2011 23:30:54 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GNUrIs019853;
	Sat, 16 Apr 2011 23:30:53 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201104162330.p3GNUrIs019853@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 16 Apr 2011 23:30:53 +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: r220733 - in stable/8/sys: fs/nfsclient fs/portalfs
	kern net netgraph/bluetooth/socket netinet nfsclient rpc
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 23:30:54 -0000

Author: bz
Date: Sat Apr 16 23:30:53 2011
New Revision: 220733
URL: http://svn.freebsd.org/changeset/base/220733

Log:
  MFC r218757:
  
    Mfp4 CH=177274,177280,177284-177285,177297,177324-177325
  
      VNET socket push back:
      try to minimize the number of places where we have to switch vnets
      and narrow down the time we stay switched.  Add assertions to the
      socket code to catch possibly unset vnets as seen in r204147.
  
      While this reduces the number of vnet recursion in some places like
      NFS, POSIX local sockets and some netgraph, .. recursions are
      impossible to fix.
  
      The current expectations are documented at the beginning of
      uipc_socket.c along with the other information there.
  
      Sponsored by: The FreeBSD Foundation
      Sponsored by: CK Software GmbH
      Reviewed by:  jhb
      Tested by:    zec
  
    Tested by:    Mikolaj Golub (to.my.trociny gmail.com)

Modified:
  stable/8/sys/fs/nfsclient/nfs_clvfsops.c
  stable/8/sys/fs/portalfs/portal_vnops.c
  stable/8/sys/kern/kern_descrip.c
  stable/8/sys/kern/sys_socket.c
  stable/8/sys/kern/uipc_socket.c
  stable/8/sys/kern/uipc_syscalls.c
  stable/8/sys/kern/uipc_usrreq.c
  stable/8/sys/net/if.c
  stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
  stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
  stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
  stable/8/sys/netinet/sctp_input.c
  stable/8/sys/netinet/sctp_peeloff.c
  stable/8/sys/nfsclient/bootp_subr.c
  stable/8/sys/nfsclient/krpc_subr.c
  stable/8/sys/nfsclient/nfs_diskless.c
  stable/8/sys/nfsclient/nfs_vfsops.c
  stable/8/sys/rpc/clnt_dg.c
  stable/8/sys/rpc/clnt_vc.c
  stable/8/sys/rpc/rpc_generic.c
  stable/8/sys/rpc/svc_dg.c
  stable/8/sys/rpc/svc_generic.c
  stable/8/sys/rpc/svc_vc.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/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvfsops.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -452,10 +452,12 @@ ncl_mountroot(struct mount *mp)
 		sin.sin_family = AF_INET;
 		sin.sin_len = sizeof(sin);
                 /* XXX MRT use table 0 for this sort of thing */
+		CURVNET_SET(TD_TO_VNET(td));
 		error = rtrequest(RTM_ADD, (struct sockaddr *)&sin,
 		    (struct sockaddr *)&nd->mygateway,
 		    (struct sockaddr *)&mask,
 		    RTF_UP | RTF_GATEWAY, NULL);
+		CURVNET_RESTORE();
 		if (error)
 			panic("nfs_mountroot: RTM_ADD: %d", error);
 	}

Modified: stable/8/sys/fs/portalfs/portal_vnops.c
==============================================================================
--- stable/8/sys/fs/portalfs/portal_vnops.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/fs/portalfs/portal_vnops.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -60,6 +60,8 @@
 
 #include 
 
+#include 
+
 static int portal_fileid = PORTAL_ROOTFILEID+1;
 
 static void	portal_closefd(struct thread *td, int fd);
@@ -185,8 +187,12 @@ portal_connect(so, so2)
 	if ((so2->so_options & SO_ACCEPTCONN) == 0)
 		return (ECONNREFUSED);
 
-	if ((so3 = sonewconn(so2, 0)) == 0)
+	CURVNET_SET(so2->so_vnet);
+	if ((so3 = sonewconn(so2, 0)) == 0) {
+		CURVNET_RESTORE();
 		return (ECONNREFUSED);
+	}
+	CURVNET_RESTORE();
 
 	unp2 = sotounpcb(so2);
 	unp3 = sotounpcb(so3);

Modified: stable/8/sys/kern/kern_descrip.c
==============================================================================
--- stable/8/sys/kern/kern_descrip.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/kern/kern_descrip.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#include 
+
 #include 
 
 #include 
@@ -2339,7 +2341,9 @@ fputsock(struct socket *so)
 
 	ACCEPT_LOCK();
 	SOCK_LOCK(so);
+	CURVNET_SET(so->so_vnet);
 	sorele(so);
+	CURVNET_RESTORE();
 }
 
 /*

Modified: stable/8/sys/kern/sys_socket.c
==============================================================================
--- stable/8/sys/kern/sys_socket.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/kern/sys_socket.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -80,9 +80,7 @@ soo_read(struct file *fp, struct uio *ui
 	if (error)
 		return (error);
 #endif
-	CURVNET_SET(so->so_vnet);
 	error = soreceive(so, 0, uio, 0, 0, 0);
-	CURVNET_RESTORE();
 	return (error);
 }
 
@@ -123,7 +121,6 @@ soo_ioctl(struct file *fp, u_long cmd, v
 	struct socket *so = fp->f_data;
 	int error = 0;
 
-	CURVNET_SET(so->so_vnet);
 	switch (cmd) {
 	case FIONBIO:
 		SOCK_LOCK(so);
@@ -210,14 +207,18 @@ soo_ioctl(struct file *fp, u_long cmd, v
 		 */
 		if (IOCGROUP(cmd) == 'i')
 			error = ifioctl(so, cmd, data, td);
-		else if (IOCGROUP(cmd) == 'r')
+		else if (IOCGROUP(cmd) == 'r') {
+			CURVNET_SET(so->so_vnet);
 			error = rtioctl_fib(cmd, data, so->so_fibnum);
-		else
+			CURVNET_RESTORE();
+		} else {
+			CURVNET_SET(so->so_vnet);
 			error = ((*so->so_proto->pr_usrreqs->pru_control)
 			    (so, cmd, data, 0, td));
+			CURVNET_RESTORE();
+		}
 		break;
 	}
-	CURVNET_RESTORE();
 	return (error);
 }
 

Modified: stable/8/sys/kern/uipc_socket.c
==============================================================================
--- stable/8/sys/kern/uipc_socket.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/kern/uipc_socket.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -92,6 +92,12 @@
  * from a listen queue to a file descriptor, in order to prevent garbage
  * collection of the socket at an untimely moment.  For a number of reasons,
  * these interfaces are not preferred, and should be avoided.
+ * 
+ * NOTE: With regard to VNETs the general rule is that callers do not set
+ * curvnet. Exceptions to this rule include soabort(), sodisconnect(),
+ * sofree() (and with that sorele(), sotryfree()), as well as sonewconn()
+ * and sorflush(), which are usually called from a pre-set VNET context.
+ * sopoll() currently does not need a VNET context to be set.
  */
 
 #include 
@@ -166,6 +172,10 @@ int	maxsockets;
 MALLOC_DEFINE(M_SONAME, "soname", "socket name");
 MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
 
+#define	VNET_SO_ASSERT(so)						\
+	VNET_ASSERT(curvnet != NULL,					\
+	    ("%s:%d curvnet is NULL, so=%p", __func__, __LINE__, (so)));
+
 static int somaxconn = SOMAXCONN;
 static int sysctl_somaxconn(SYSCTL_HANDLER_ARGS);
 /* XXX: we dont have SYSCTL_USHORT */
@@ -286,6 +296,8 @@ soalloc(struct vnet *vnet)
 	so->so_gencnt = ++so_gencnt;
 	++numopensockets;
 #ifdef VIMAGE
+	VNET_ASSERT(vnet != NULL, ("%s:%d vnet is NULL, so=%p",
+	    __func__, __LINE__, so));
 	vnet->vnet_sockcnt++;
 	so->so_vnet = vnet;
 #endif
@@ -309,6 +321,8 @@ sodealloc(struct socket *so)
 	so->so_gencnt = ++so_gencnt;
 	--numopensockets;	/* Could be below, but faster here. */
 #ifdef VIMAGE
+	VNET_ASSERT(so->so_vnet != NULL, ("%s:%d so_vnet is NULL, so=%p",
+	    __func__, __LINE__, so));
 	so->so_vnet->vnet_sockcnt--;
 #endif
 	mtx_unlock(&so_global_mtx);
@@ -448,6 +462,7 @@ sonewconn(struct socket *head, int conns
 #endif
 	knlist_init_mtx(&so->so_rcv.sb_sel.si_note, SOCKBUF_MTX(&so->so_rcv));
 	knlist_init_mtx(&so->so_snd.sb_sel.si_note, SOCKBUF_MTX(&so->so_snd));
+	VNET_SO_ASSERT(head);
 	if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) ||
 	    (*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
 		sodealloc(so);
@@ -522,8 +537,12 @@ sobind(struct socket *so, struct sockadd
 int
 solisten(struct socket *so, int backlog, struct thread *td)
 {
+	int error;
 
-	return ((*so->so_proto->pr_usrreqs->pru_listen)(so, backlog, td));
+	CURVNET_SET(so->so_vnet);
+	error = (*so->so_proto->pr_usrreqs->pru_listen)(so, backlog, td);
+	CURVNET_RESTORE();
+	return error;
 }
 
 int
@@ -611,6 +630,7 @@ sofree(struct socket *so)
 	SOCK_UNLOCK(so);
 	ACCEPT_UNLOCK();
 
+	VNET_SO_ASSERT(so);
 	if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL)
 		(*pr->pr_domain->dom_dispose)(so->so_rcv.sb_mb);
 	if (pr->pr_usrreqs->pru_detach != NULL)
@@ -740,6 +760,7 @@ soabort(struct socket *so)
 	KASSERT(so->so_state & SS_NOFDREF, ("soabort: !SS_NOFDREF"));
 	KASSERT((so->so_state & SQ_COMP) == 0, ("soabort: SQ_COMP"));
 	KASSERT((so->so_state & SQ_INCOMP) == 0, ("soabort: SQ_INCOMP"));
+	VNET_SO_ASSERT(so);
 
 	if (so->so_proto->pr_usrreqs->pru_abort != NULL)
 		(*so->so_proto->pr_usrreqs->pru_abort)(so);
@@ -757,7 +778,10 @@ soaccept(struct socket *so, struct socka
 	KASSERT((so->so_state & SS_NOFDREF) != 0, ("soaccept: !NOFDREF"));
 	so->so_state &= ~SS_NOFDREF;
 	SOCK_UNLOCK(so);
+
+	CURVNET_SET(so->so_vnet);
 	error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam);
+	CURVNET_RESTORE();
 	return (error);
 }
 
@@ -795,8 +819,12 @@ soconnect(struct socket *so, struct sock
 int
 soconnect2(struct socket *so1, struct socket *so2)
 {
+	int error;
 
-	return ((*so1->so_proto->pr_usrreqs->pru_connect2)(so1, so2));
+	CURVNET_SET(so1->so_vnet);
+	error = (*so1->so_proto->pr_usrreqs->pru_connect2)(so1, so2);
+	CURVNET_RESTORE();
+	return (error);
 }
 
 int
@@ -808,6 +836,7 @@ sodisconnect(struct socket *so)
 		return (ENOTCONN);
 	if (so->so_state & SS_ISDISCONNECTING)
 		return (EALREADY);
+	VNET_SO_ASSERT(so);
 	error = (*so->so_proto->pr_usrreqs->pru_disconnect)(so);
 	return (error);
 }
@@ -1071,6 +1100,7 @@ sosend_dgram(struct socket *so, struct s
 	 * there are probably other places that this also happens.  We must
 	 * rethink this.
 	 */
+	VNET_SO_ASSERT(so);
 	error = (*so->so_proto->pr_usrreqs->pru_send)(so,
 	    (flags & MSG_OOB) ? PRUS_OOB :
 	/*
@@ -1258,6 +1288,7 @@ restart:
 			 * places that this also happens.  We must rethink
 			 * this.
 			 */
+			VNET_SO_ASSERT(so);
 			error = (*so->so_proto->pr_usrreqs->pru_send)(so,
 			    (flags & MSG_OOB) ? PRUS_OOB :
 			/*
@@ -1324,6 +1355,7 @@ soreceive_rcvoob(struct socket *so, stru
 	int error;
 
 	KASSERT(flags & MSG_OOB, ("soreceive_rcvoob: (flags & MSG_OOB) == 0"));
+	VNET_SO_ASSERT(so);
 
 	m = m_get(M_WAIT, MT_DATA);
 	error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK);
@@ -1432,8 +1464,10 @@ soreceive_generic(struct socket *so, str
 	if (mp != NULL)
 		*mp = NULL;
 	if ((pr->pr_flags & PR_WANTRCVD) && (so->so_state & SS_ISCONFIRMING)
-	    && uio->uio_resid)
+	    && uio->uio_resid) {
+		VNET_SO_ASSERT(so);
 		(*pr->pr_usrreqs->pru_rcvd)(so, 0);
+	}
 
 	error = sblock(&so->so_rcv, SBLOCKWAIT(flags));
 	if (error)
@@ -1580,6 +1614,7 @@ dontblock:
 			cm->m_next = NULL;
 			if (pr->pr_domain->dom_externalize != NULL) {
 				SOCKBUF_UNLOCK(&so->so_rcv);
+				VNET_SO_ASSERT(so);
 				error = (*pr->pr_domain->dom_externalize)
 				    (cm, controlp);
 				SOCKBUF_LOCK(&so->so_rcv);
@@ -1795,6 +1830,7 @@ dontblock:
 			 */
 			if (pr->pr_flags & PR_WANTRCVD) {
 				SOCKBUF_UNLOCK(&so->so_rcv);
+				VNET_SO_ASSERT(so);
 				(*pr->pr_usrreqs->pru_rcvd)(so, flags);
 				SOCKBUF_LOCK(&so->so_rcv);
 			}
@@ -1841,6 +1877,7 @@ dontblock:
 		if (!(flags & MSG_SOCALLBCK) &&
 		    (pr->pr_flags & PR_WANTRCVD)) {
 			SOCKBUF_UNLOCK(&so->so_rcv);
+			VNET_SO_ASSERT(so);
 			(*pr->pr_usrreqs->pru_rcvd)(so, flags);
 			SOCKBUF_LOCK(&so->so_rcv);
 		}
@@ -2036,6 +2073,7 @@ deliver:
 		    (((flags & MSG_WAITALL) && uio->uio_resid > 0) ||
 		     !(flags & MSG_SOCALLBCK))) {
 			SOCKBUF_UNLOCK(sb);
+			VNET_SO_ASSERT(so);
 			(*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags);
 			SOCKBUF_LOCK(sb);
 		}
@@ -2245,9 +2283,13 @@ int
 soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio,
     struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
 {
+	int error;
 
-	return (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, mp0,
+	CURVNET_SET(so->so_vnet);
+	error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, mp0,
 	    controlp, flagsp));
+	CURVNET_RESTORE();
+	return (error);
 }
 
 int
@@ -2258,17 +2300,19 @@ soshutdown(struct socket *so, int how)
 
 	if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR))
 		return (EINVAL);
+
+	CURVNET_SET(so->so_vnet);
 	if (pr->pr_usrreqs->pru_flush != NULL) {
 	        (*pr->pr_usrreqs->pru_flush)(so, how);
 	}
 	if (how != SHUT_WR)
 		sorflush(so);
 	if (how != SHUT_RD) {
-		CURVNET_SET(so->so_vnet);
 		error = (*pr->pr_usrreqs->pru_shutdown)(so);
 		CURVNET_RESTORE();
 		return (error);
 	}
+	CURVNET_RESTORE();
 	return (0);
 }
 
@@ -2279,6 +2323,8 @@ sorflush(struct socket *so)
 	struct protosw *pr = so->so_proto;
 	struct sockbuf asb;
 
+	VNET_SO_ASSERT(so);
+
 	/*
 	 * In order to avoid calling dom_dispose with the socket buffer mutex
 	 * held, and in order to generally avoid holding the lock for a long
@@ -2292,7 +2338,6 @@ sorflush(struct socket *so)
 	 * socket buffer.  Don't let our acquire be interrupted by a signal
 	 * despite any existing socket disposition on interruptable waiting.
 	 */
-	CURVNET_SET(so->so_vnet);
 	socantrcvmore(so);
 	(void) sblock(sb, SBL_WAIT | SBL_NOINTR);
 
@@ -2316,7 +2361,6 @@ sorflush(struct socket *so)
 	if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL)
 		(*pr->pr_domain->dom_dispose)(asb.sb_mb);
 	sbrelease_internal(&asb, so);
-	CURVNET_RESTORE();
 }
 
 /*
@@ -2380,11 +2424,14 @@ sosetopt(struct socket *so, struct socko
 	struct mac extmac;
 #endif
 
+	CURVNET_SET(so->so_vnet);
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
-		if (so->so_proto && so->so_proto->pr_ctloutput)
-			return ((*so->so_proto->pr_ctloutput)
-				  (so, sopt));
+		if (so->so_proto && so->so_proto->pr_ctloutput) {
+			error = (*so->so_proto->pr_ctloutput)(so, sopt);
+			CURVNET_RESTORE();
+			return (error);
+		}
 		error = ENOPROTOOPT;
 	} else {
 		switch (sopt->sopt_name) {
@@ -2570,6 +2617,7 @@ sosetopt(struct socket *so, struct socko
 		}
 	}
 bad:
+	CURVNET_RESTORE();
 	return (error);
 }
 
@@ -2613,13 +2661,15 @@ sogetopt(struct socket *so, struct socko
 	struct mac extmac;
 #endif
 
+	CURVNET_SET(so->so_vnet);
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
-		if (so->so_proto && so->so_proto->pr_ctloutput) {
-			return ((*so->so_proto->pr_ctloutput)
-				  (so, sopt));
-		} else
-			return (ENOPROTOOPT);
+		if (so->so_proto && so->so_proto->pr_ctloutput)
+			error = (*so->so_proto->pr_ctloutput)(so, sopt);
+		else
+			error = ENOPROTOOPT;
+		CURVNET_RESTORE();
+		return (error);
 	} else {
 		switch (sopt->sopt_name) {
 #ifdef INET
@@ -2703,11 +2753,11 @@ integer:
 			error = sooptcopyin(sopt, &extmac, sizeof(extmac),
 			    sizeof(extmac));
 			if (error)
-				return (error);
+				goto bad;
 			error = mac_getsockopt_label(sopt->sopt_td->td_ucred,
 			    so, &extmac);
 			if (error)
-				return (error);
+				goto bad;
 			error = sooptcopyout(sopt, &extmac, sizeof extmac);
 #else
 			error = EOPNOTSUPP;
@@ -2719,11 +2769,11 @@ integer:
 			error = sooptcopyin(sopt, &extmac, sizeof(extmac),
 			    sizeof(extmac));
 			if (error)
-				return (error);
+				goto bad;
 			error = mac_getsockopt_peerlabel(
 			    sopt->sopt_td->td_ucred, so, &extmac);
 			if (error)
-				return (error);
+				goto bad;
 			error = sooptcopyout(sopt, &extmac, sizeof extmac);
 #else
 			error = EOPNOTSUPP;
@@ -2746,8 +2796,12 @@ integer:
 			error = ENOPROTOOPT;
 			break;
 		}
-		return (error);
 	}
+#ifdef MAC
+bad:
+#endif
+	CURVNET_RESTORE();
+	return (error);
 }
 
 /* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */
@@ -2881,6 +2935,10 @@ sopoll(struct socket *so, int events, st
     struct thread *td)
 {
 
+	/*
+	 * We do not need to set or assert curvnet as long as everyone uses
+	 * sopoll_generic().
+	 */
 	return (so->so_proto->pr_usrreqs->pru_sopoll(so, events, active_cred,
 	    td));
 }

Modified: stable/8/sys/kern/uipc_syscalls.c
==============================================================================
--- stable/8/sys/kern/uipc_syscalls.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/kern/uipc_syscalls.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -260,14 +260,9 @@ listen(td, uap)
 		so = fp->f_data;
 #ifdef MAC
 		error = mac_socket_check_listen(td->td_ucred, so);
-		if (error == 0) {
+		if (error == 0)
 #endif
-			CURVNET_SET(so->so_vnet);
 			error = solisten(so, uap->backlog, td);
-			CURVNET_RESTORE();
-#ifdef MAC
-		}
-#endif
 		fdrop(fp, td);
 	}
 	return(error);
@@ -428,9 +423,7 @@ kern_accept(struct thread *td, int s, st
 	tmp = fflag & FASYNC;
 	(void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td);
 	sa = 0;
-	CURVNET_SET(so->so_vnet);
 	error = soaccept(so, &sa);
-	CURVNET_RESTORE();
 	if (error) {
 		/*
 		 * return a namelen of zero for older code which might
@@ -981,11 +974,9 @@ kern_recvit(td, s, mp, fromseg, controlp
 		ktruio = cloneuio(&auio);
 #endif
 	len = auio.uio_resid;
-	CURVNET_SET(so->so_vnet);
 	error = soreceive(so, &fromsa, &auio, (struct mbuf **)0,
 	    (mp->msg_control || controlp) ? &control : (struct mbuf **)0,
 	    &mp->msg_flags);
-	CURVNET_RESTORE();
 	if (error) {
 		if (auio.uio_resid != (int)len && (error == ERESTART ||
 		    error == EINTR || error == EWOULDBLOCK))
@@ -1331,9 +1322,7 @@ kern_setsockopt(td, s, level, name, val,
 	error = getsock(td->td_proc->p_fd, s, &fp, NULL);
 	if (error == 0) {
 		so = fp->f_data;
-		CURVNET_SET(so->so_vnet);
 		error = sosetopt(so, &sopt);
-		CURVNET_RESTORE();
 		fdrop(fp, td);
 	}
 	return(error);
@@ -1412,9 +1401,7 @@ kern_getsockopt(td, s, level, name, val,
 	error = getsock(td->td_proc->p_fd, s, &fp, NULL);
 	if (error == 0) {
 		so = fp->f_data;
-		CURVNET_SET(so->so_vnet);
 		error = sogetopt(so, &sopt);
-		CURVNET_RESTORE();
 		*valsize = sopt.sopt_valsize;
 		fdrop(fp, td);
 	}

Modified: stable/8/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/8/sys/kern/uipc_usrreq.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/kern/uipc_usrreq.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -1227,7 +1227,9 @@ unp_connect(struct socket *so, struct so
 	}
 	if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
 		if (so2->so_options & SO_ACCEPTCONN) {
+			CURVNET_SET(so2->so_vnet);
 			so3 = sonewconn(so2, 0);
+			CURVNET_RESTORE();
 		} else
 			so3 = NULL;
 		if (so3 == NULL) {
@@ -2107,8 +2109,14 @@ unp_gc(__unused void *arg, int pending)
 	 * struct files associated with these sockets but leave each socket
 	 * with one remaining ref.
 	 */
-	for (i = 0; i < total; i++)
-		sorflush(unref[i]->f_data);
+	for (i = 0; i < total; i++) {
+		struct socket *so;
+
+		so = unref[i]->f_data;
+		CURVNET_SET(so->so_vnet);
+		sorflush(so);
+		CURVNET_RESTORE();
+	}
 
 	/*
 	 * And finally release the sockets so they can be reclaimed.

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/net/if.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -2507,10 +2507,13 @@ ifioctl(struct socket *so, u_long cmd, c
 	int error;
 	int oif_flags;
 
+	CURVNET_SET(so->so_vnet);
 	switch (cmd) {
 	case SIOCGIFCONF:
 	case OSIOCGIFCONF:
-		return (ifconf(cmd, data));
+		error = ifconf(cmd, data);
+		CURVNET_RESTORE();
+		return (error);
 
 #ifdef COMPAT_FREEBSD32
 	case SIOCGIFCONF32:
@@ -2522,7 +2525,9 @@ ifioctl(struct socket *so, u_long cmd, c
 			ifc.ifc_len = ifc32->ifc_len;
 			ifc.ifc_buf = PTRIN(ifc32->ifc_buf);
 
-			return (ifconf(SIOCGIFCONF, (void *)&ifc));
+			error = ifconf(SIOCGIFCONF, (void *)&ifc);
+			CURVNET_RESTORE();
+			return (error);
 		}
 #endif
 	}
@@ -2532,42 +2537,55 @@ ifioctl(struct socket *so, u_long cmd, c
 #ifdef VIMAGE
 	case SIOCSIFRVNET:
 		error = priv_check(td, PRIV_NET_SETIFVNET);
-		if (error)
-			return (error);
-		return (if_vmove_reclaim(td, ifr->ifr_name, ifr->ifr_jid));
+		if (error == 0)
+			error = if_vmove_reclaim(td, ifr->ifr_name,
+			    ifr->ifr_jid);
+		CURVNET_RESTORE();
+		return (error);
 #endif
 	case SIOCIFCREATE:
 	case SIOCIFCREATE2:
 		error = priv_check(td, PRIV_NET_IFCREATE);
-		if (error)
-			return (error);
-		return (if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name),
-			cmd == SIOCIFCREATE2 ? ifr->ifr_data : NULL));
+		if (error == 0)
+			error = if_clone_create(ifr->ifr_name,
+			    sizeof(ifr->ifr_name),
+			    cmd == SIOCIFCREATE2 ? ifr->ifr_data : NULL);
+		CURVNET_RESTORE();
+		return (error);
 	case SIOCIFDESTROY:
 		error = priv_check(td, PRIV_NET_IFDESTROY);
-		if (error)
-			return (error);
-		return if_clone_destroy(ifr->ifr_name);
+		if (error == 0)
+			error = if_clone_destroy(ifr->ifr_name);
+		CURVNET_RESTORE();
+		return (error);
 
 	case SIOCIFGCLONERS:
-		return (if_clone_list((struct if_clonereq *)data));
+		error = if_clone_list((struct if_clonereq *)data);
+		CURVNET_RESTORE();
+		return (error);
 	case SIOCGIFGMEMB:
-		return (if_getgroupmembers((struct ifgroupreq *)data));
+		error = if_getgroupmembers((struct ifgroupreq *)data);
+		CURVNET_RESTORE();
+		return (error);
 	}
 
 	ifp = ifunit_ref(ifr->ifr_name);
-	if (ifp == NULL)
+	if (ifp == NULL) {
+		CURVNET_RESTORE();
 		return (ENXIO);
+	}
 
 	error = ifhwioctl(cmd, ifp, data, td);
 	if (error != ENOIOCTL) {
 		if_rele(ifp);
+		CURVNET_RESTORE();
 		return (error);
 	}
 
 	oif_flags = ifp->if_flags;
 	if (so->so_proto == NULL) {
 		if_rele(ifp);
+		CURVNET_RESTORE();
 		return (EOPNOTSUPP);
 	}
 #ifndef COMPAT_43
@@ -2642,6 +2660,7 @@ ifioctl(struct socket *so, u_long cmd, c
 #endif
 	}
 	if_rele(ifp);
+	CURVNET_RESTORE();
 	return (error);
 }
 

Modified: stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
==============================================================================
--- stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -50,6 +50,9 @@
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 #include 
 #include 
@@ -592,8 +595,11 @@ ng_btsocket_l2cap_process_l2ca_con_ind(s
 		 * space then create new socket and set proper source address.
 		 */
 
-		if (pcb->so->so_qlen <= pcb->so->so_qlimit)
+		if (pcb->so->so_qlen <= pcb->so->so_qlimit) {
+			CURVNET_SET(pcb->so->so_vnet);
 			so1 = sonewconn(pcb->so, 0);
+			CURVNET_RESTORE();
+		}
 
 		if (so1 == NULL) {
 			result = NG_L2CAP_NO_RESOURCES;

Modified: stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
==============================================================================
--- stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -52,6 +52,9 @@
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 #include 
 #include 
@@ -1163,8 +1166,11 @@ ng_btsocket_rfcomm_connect_ind(ng_btsock
 
 	mtx_lock(&pcb->pcb_mtx);
 
-	if (pcb->so->so_qlen <= pcb->so->so_qlimit)
+	if (pcb->so->so_qlen <= pcb->so->so_qlimit) {
+		CURVNET_SET(pcb->so->so_vnet);
 		so1 = sonewconn(pcb->so, 0);
+		CURVNET_RESTORE();
+	}
 
 	mtx_unlock(&pcb->pcb_mtx);
 

Modified: stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
==============================================================================
--- stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -50,6 +50,9 @@
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 #include 
 #include 
@@ -477,8 +480,11 @@ ng_btsocket_sco_process_lp_con_ind(struc
 		 * space then create new socket and set proper source address.
 		 */
 
-		if (pcb->so->so_qlen <= pcb->so->so_qlimit)
+		if (pcb->so->so_qlen <= pcb->so->so_qlimit) {
+			CURVNET_SET(pcb->so->so_vnet);
 			so1 = sonewconn(pcb->so, 0);
+			CURVNET_RESTORE();
+		}
 
 		if (so1 == NULL) {
 			status = 0x0d; /* Rejected due to limited resources */

Modified: stable/8/sys/netinet/sctp_input.c
==============================================================================
--- stable/8/sys/netinet/sctp_input.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/netinet/sctp_input.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -2678,8 +2678,10 @@ sctp_handle_cookie_echo(struct mbuf *m, 
 			oso = (*inp_p)->sctp_socket;
 			atomic_add_int(&(*stcb)->asoc.refcnt, 1);
 			SCTP_TCB_UNLOCK((*stcb));
+			CURVNET_SET(oso->so_vnet);
 			so = sonewconn(oso, 0
 			    );
+			CURVNET_RESTORE();
 			SCTP_TCB_LOCK((*stcb));
 			atomic_subtract_int(&(*stcb)->asoc.refcnt, 1);
 

Modified: stable/8/sys/netinet/sctp_peeloff.c
==============================================================================
--- stable/8/sys/netinet/sctp_peeloff.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/netinet/sctp_peeloff.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -164,8 +164,10 @@ sctp_get_peeloff(struct socket *head, sc
 	}
 	atomic_add_int(&stcb->asoc.refcnt, 1);
 	SCTP_TCB_UNLOCK(stcb);
+	CURVNET_SET(head->so_vnet);
 	newso = sonewconn(head, SS_ISCONNECTED
 	    );
+	CURVNET_RESTORE();
 	if (newso == NULL) {
 		SCTPDBG(SCTP_DEBUG_PEEL1, "sctp_peeloff:sonewconn failed\n");
 		SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOMEM);

Modified: stable/8/sys/nfsclient/bootp_subr.c
==============================================================================
--- stable/8/sys/nfsclient/bootp_subr.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/nfsclient/bootp_subr.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -584,8 +584,6 @@ bootpc_call(struct bootpc_globalcontext 
 	int retry;
 	const char *s;
 
-	CURVNET_SET(TD_TO_VNET(td));
-
 	/*
 	 * Create socket and set its recieve timeout.
 	 */
@@ -962,7 +960,6 @@ gotreply:
 out:
 	soclose(so);
 out0:
-	CURVNET_RESTORE();
 	return error;
 }
 
@@ -977,8 +974,6 @@ bootpc_fakeup_interface(struct bootpc_if
 	struct ifaddr *ifa;
 	struct sockaddr_dl *sdl;
 
-	CURVNET_SET(TD_TO_VNET(td));
-
 	error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td);
 	if (error != 0)
 		panic("nfs_boot: socreate, error=%d", error);
@@ -1053,8 +1048,6 @@ bootpc_fakeup_interface(struct bootpc_if
 		      ifctx->ireq.ifr_name);
 	ifctx->sdl = sdl;
 
-	CURVNET_RESTORE();
-
 	return error;
 }
 
@@ -1630,6 +1623,7 @@ bootpc_init(void)
 	/*
 	 * Find a network interface.
 	 */
+	CURVNET_SET(TD_TO_VNET(td));
 #ifdef BOOTP_WIRED_TO
 	printf("bootpc_init: wired to interface '%s'\n",
 	       __XSTRING(BOOTP_WIRED_TO));
@@ -1676,6 +1670,7 @@ bootpc_init(void)
 		ifctx = ifctx->next;
 	}
 	IFNET_RUNLOCK();
+	CURVNET_RESTORE();
 
 	if (gctx->interfaces == NULL || gctx->interfaces->ifp == NULL) {
 #ifdef BOOTP_WIRED_TO

Modified: stable/8/sys/nfsclient/krpc_subr.c
==============================================================================
--- stable/8/sys/nfsclient/krpc_subr.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/nfsclient/krpc_subr.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -216,8 +216,6 @@ krpc_call(struct sockaddr_in *sa, u_int 
 	nam = mhead = NULL;
 	from = NULL;
 
-	CURVNET_SET(TD_TO_VNET(td));
-
 	/*
 	 * Create socket and set its recieve timeout.
 	 */
@@ -430,7 +428,6 @@ krpc_call(struct sockaddr_in *sa, u_int 
 	if (mhead) m_freem(mhead);
 	if (from) free(from, M_SONAME);
 	soclose(so);
-	CURVNET_RESTORE();
 	return error;
 }
 

Modified: stable/8/sys/nfsclient/nfs_diskless.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_diskless.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/nfsclient/nfs_diskless.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -202,6 +203,7 @@ nfs_setup_diskless(void)
 		return;
 	}
 	ifa = NULL;
+	CURVNET_SET(TD_TO_VNET(curthread));
 	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -213,12 +215,14 @@ nfs_setup_diskless(void)
 					  LLADDR(&ourdl),
 					  sdl->sdl_alen)) {
 				    IFNET_RUNLOCK();
+				    CURVNET_RESTORE();
 				    goto match_done;
 				}
 			}
 		}
 	}
 	IFNET_RUNLOCK();
+	CURVNET_RESTORE();
 	printf("nfs_diskless: no interface\n");
 	return;	/* no matching interface */
 match_done:

Modified: stable/8/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vfsops.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/nfsclient/nfs_vfsops.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -428,7 +428,6 @@ nfs_mountroot(struct mount *mp)
 	char buf[128];
 	char *cp;
 
-	CURVNET_SET(TD_TO_VNET(td));
 
 #if defined(BOOTP_NFSROOT) && defined(BOOTP)
 	bootpc_init();		/* use bootp to get nfs_diskless filled in */
@@ -437,7 +436,6 @@ nfs_mountroot(struct mount *mp)
 #endif
 
 	if (nfs_diskless_valid == 0) {
-		CURVNET_RESTORE();
 		return (-1);
 	}
 	if (nfs_diskless_valid == 1)
@@ -504,10 +502,12 @@ nfs_mountroot(struct mount *mp)
 		sin.sin_family = AF_INET;
 		sin.sin_len = sizeof(sin);
                 /* XXX MRT use table 0 for this sort of thing */
+		CURVNET_SET(TD_TO_VNET(td));
 		error = rtrequest(RTM_ADD, (struct sockaddr *)&sin,
 		    (struct sockaddr *)&nd->mygateway,
 		    (struct sockaddr *)&mask,
 		    RTF_UP | RTF_GATEWAY, NULL);
+		CURVNET_RESTORE();
 		if (error)
 			panic("nfs_mountroot: RTM_ADD: %d", error);
 	}
@@ -525,7 +525,6 @@ nfs_mountroot(struct mount *mp)
 	nd->root_args.hostname = buf;
 	if ((error = nfs_mountdiskless(buf,
 	    &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) {
-		CURVNET_RESTORE();
 		return (error);
 	}
 
@@ -539,7 +538,6 @@ nfs_mountroot(struct mount *mp)
 	    sizeof (prison0.pr_hostname));
 	mtx_unlock(&prison0.pr_mtx);
 	inittodr(ntohl(nd->root_time));
-	CURVNET_RESTORE();
 	return (0);
 }
 

Modified: stable/8/sys/rpc/clnt_dg.c
==============================================================================
--- stable/8/sys/rpc/clnt_dg.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/rpc/clnt_dg.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -200,14 +200,11 @@ clnt_dg_create(
 		return (NULL);
 	}
 
-	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
 		rpc_createerr.cf_stat = RPC_TLIERROR;
 		rpc_createerr.cf_error.re_errno = 0;
-		CURVNET_RESTORE();
 		return (NULL);
 	}
-	CURVNET_RESTORE();
 
 	/*
 	 * Find the receive and the send size

Modified: stable/8/sys/rpc/clnt_vc.c
==============================================================================
--- stable/8/sys/rpc/clnt_vc.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/rpc/clnt_vc.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -220,9 +220,7 @@ clnt_vc_create(
 		}
 	}
 
-	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
-		CURVNET_RESTORE();
 		goto err;
 	}
 
@@ -245,7 +243,6 @@ clnt_vc_create(
 		sopt.sopt_valsize = sizeof(one);
 		sosetopt(so, &sopt);
 	}
-	CURVNET_RESTORE();
 
 	ct->ct_closeit = FALSE;
 

Modified: stable/8/sys/rpc/rpc_generic.c
==============================================================================
--- stable/8/sys/rpc/rpc_generic.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/rpc/rpc_generic.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -187,7 +187,9 @@ __rpc_socket2sockinfo(struct socket *so,
 	struct sockopt opt;
 	int error;
 
+	CURVNET_SET(so->so_vnet);
 	error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
+	CURVNET_RESTORE();
 	if (error)
 		return 0;
 
@@ -825,7 +827,6 @@ bindresvport(struct socket *so, struct s
 	sa->sa_len = salen;
 
 	if (*portp == 0) {
-		CURVNET_SET(so->so_vnet);
 		bzero(&opt, sizeof(opt));
 		opt.sopt_dir = SOPT_GET;
 		opt.sopt_level = proto;
@@ -834,14 +835,12 @@ bindresvport(struct socket *so, struct s
 		opt.sopt_valsize = sizeof(old);
 		error = sogetopt(so, &opt);
 		if (error) {
-			CURVNET_RESTORE();
 			goto out;
 		}
 
 		opt.sopt_dir = SOPT_SET;
 		opt.sopt_val = &portlow;
 		error = sosetopt(so, &opt);
-		CURVNET_RESTORE();
 		if (error)
 			goto out;
 	}
@@ -852,9 +851,7 @@ bindresvport(struct socket *so, struct s
 		if (error) {
 			opt.sopt_dir = SOPT_SET;
 			opt.sopt_val = &old;
-			CURVNET_SET(so->so_vnet);
 			sosetopt(so, &opt);
-			CURVNET_RESTORE();
 		}
 	}
 out:

Modified: stable/8/sys/rpc/svc_dg.c
==============================================================================
--- stable/8/sys/rpc/svc_dg.c	Sat Apr 16 23:20:21 2011	(r220732)
+++ stable/8/sys/rpc/svc_dg.c	Sat Apr 16 23:30:53 2011	(r220733)
@@ -103,10 +103,8 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	struct sockaddr* sa;
 	int error;
 
-	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
 		printf(svc_dg_str, svc_dg_err1);
-		CURVNET_RESTORE();
 		return (NULL);
 	}
 	/*
@@ -116,7 +114,6 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
 	if ((sendsize == 0) || (recvsize == 0)) {
 		printf(svc_dg_str, svc_dg_err2);
-		CURVNET_RESTORE();
 		return (NULL);
 	}
 
@@ -128,6 +125,7 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	xprt->xp_p2 = NULL;
 	xprt->xp_ops = &svc_dg_ops;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 23:38:36 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D5B71065675;
	Sat, 16 Apr 2011 23:38:36 +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 3C7748FC15;
	Sat, 16 Apr 2011 23:38:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3GNcagD020499;
	Sat, 16 Apr 2011 23:38:36 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3GNcaXZ020497;
	Sat, 16 Apr 2011 23:38:36 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201104162338.p3GNcaXZ020497@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Sat, 16 Apr 2011 23:38:36 +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: r220734 - stable/8
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 23:38:36 -0000

Author: bz
Date: Sat Apr 16 23:38:35 2011
New Revision: 220734
URL: http://svn.freebsd.org/changeset/base/220734

Log:
  MFC r220556:
  
    If building (custom) FreeBSD images people tend to patch param.h.  In case
    this happens just before the build is started (within the same second)
    CHECK_TIME actually triggers thinking param.h is in the future (see f_Xtime,
    c_Xtime logi in find(1) sources for the details in !F_EXACTTIME case).
    Using the -mtime -0s (seconds, rather than no unit) avoids this 1s race.

Modified:
  stable/8/Makefile   (contents, props changed)

Modified: stable/8/Makefile
==============================================================================
--- stable/8/Makefile	Sat Apr 16 23:30:53 2011	(r220733)
+++ stable/8/Makefile	Sat Apr 16 23:38:35 2011	(r220734)
@@ -173,7 +173,7 @@ ${TGTS}:
 .MAIN:	all
 
 STARTTIME!= LC_ALL=C date
-CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0
+CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s
 .if !empty(CHECK_TIME)
 .error check your date/time: ${STARTTIME}
 .endif

From owner-svn-src-stable-8@FreeBSD.ORG  Sat Apr 16 23:47:43 2011
Return-Path: 
Delivered-To: svn-src-stable-8@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F8DD1065670;
	Sat, 16 Apr 2011 23:47:43 +0000 (UTC)
	(envelope-from oliver.pntr@gmail.com)
Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com
	[209.85.216.182])
	by mx1.freebsd.org (Postfix) with ESMTP id D04F88FC0A;
	Sat, 16 Apr 2011 23:47:42 +0000 (UTC)
Received: by qyk27 with SMTP id 27so2516745qyk.13
	for ; Sat, 16 Apr 2011 16:47:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type;
	bh=EYZGB4C/GPZTD+QGRcOOdDFLBC1cDH+ztdKE5yyV9qE=;
	b=OiPksdKukG63Q8Kbg3MsFcAkQkNksY5sDzr18NASEU+XcvfiOtNC5q/xSqlELbS2xY
	W1VKR/nIlm/Qn0pVs4wT1SCDBwP7dEFqDFkLpCHj0z9cP3+5bblaaR1CEmRLoqMeBWvX
	7MYUVdbainq+yExEpqRy6ER810Vhn3VXMwthE=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	b=HORKM4XTxd8USfmY/fMMee2nX37cQnSrFUnXXXlixxgyeYl6yDNZi0aTIl+Z2rNtxP
	E1+P1E3HX9ih0UgWb9WbyzbMSj0Wy7XXu2zScUX/lxrUivaDpfD+fskBV1Oru+D6lBhr
	9N2DMXejhCsQabq9gN5tqpcaKbP0fqSMJ3U0Q=
MIME-Version: 1.0
Received: by 10.229.78.96 with SMTP id j32mr2503920qck.121.1302997661181; Sat,
	16 Apr 2011 16:47:41 -0700 (PDT)
Received: by 10.229.238.65 with HTTP; Sat, 16 Apr 2011 16:47:40 -0700 (PDT)
In-Reply-To: <20110416221915.GR48734@deviant.kiev.zoral.com.ua>
References: <201102190739.p1J7dFjO087910@svn.freebsd.org>
	
	<20110416221915.GR48734@deviant.kiev.zoral.com.ua>
Date: Sun, 17 Apr 2011 01:47:40 +0200
Message-ID: 
From: Oliver Pinter 
To: Kostik Belousov 
Content-Type: multipart/mixed; boundary=002354471a10bce7a904a111c8b0
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject: Re: svn commit: r218836 - in stable/8/sys: amd64/amd64 amd64/ia32
 i386/i386 kern
X-BeenThere: svn-src-stable-8@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 8-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 16 Apr 2011 23:47:43 -0000

--002354471a10bce7a904a111c8b0
Content-Type: text/plain; charset=ISO-8859-1

tested on: FreeBSD pandora-d 7.4-STABLE FreeBSD 7.4-STABLE #77
r220609+b221718: Sun Apr 17 01:00:01 CEST 2011
root@pandora-d:/usr/obj/usr/src/sys/stable  amd64



On 4/17/11, Kostik Belousov  wrote:
> On Sat, Apr 16, 2011 at 11:04:38PM +0200, Oliver Pinter wrote:
>> MFC this for 7-STABLE?
> I do not reject the proposal, but I am quite curious why ?

I think, it is not bad, when cleaning out some generated section after not used.
(~ ITSec)

>
> I do not have any machine running 7, so please test the patch below.
> It compiled for me on amd64.
>
> Property changes on: .
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys:r218327
>
> Index: kern/kern_context.c
> ===================================================================
> --- kern/kern_context.c	(revision 220730)
> +++ kern/kern_context.c	(working copy)
> @@ -71,6 +71,7 @@
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> +		bzero(uc.__spare__, sizeof(uc.__spare__));
>  		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
>  	}
>  	return (ret);
> @@ -109,6 +110,7 @@
>  		ret = EINVAL;
>  	else {
>  		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
> +		bzero(uc.__spare__, sizeof(uc.__spare__));
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> Index: i386/i386/machdep.c
> ===================================================================
> --- i386/i386/machdep.c	(revision 220730)
> +++ i386/i386/machdep.c	(working copy)
> @@ -342,12 +342,14 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
> +	bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
>  		sf.sf_siginfo.si_signo = sig;
>  		sf.sf_siginfo.si_code = ksi->ksi_code;
>  		sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher;
> +		sf.sf_addr = 0;
>  	} else {
>  		/* Old FreeBSD-style arguments. */
>  		sf.sf_arg2 = ksi->ksi_code;
> @@ -461,6 +463,11 @@
>  	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
>  	sf.sf_uc.uc_mcontext.mc_gs = rgs();
>  	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
> +	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
> +	bzero(sf.sf_uc.uc_mcontext.__spare__,
> +	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -480,6 +487,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (register_t)&sfp->sf_si;
> @@ -596,6 +604,11 @@
>  	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
>  	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
>  	fpstate_drop(td);
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -617,6 +630,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (register_t)&sfp->sf_si;
> @@ -2716,6 +2730,8 @@
>  	mcp->mc_ss = tp->tf_ss;
>  	mcp->mc_len = sizeof(*mcp);
>  	get_fpcontext(td, mcp);
> +	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
> +	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
>  	return (0);
>  }
>
> @@ -2763,6 +2779,7 @@
>  #ifndef DEV_NPX
>  	mcp->mc_fpformat = _MC_FPFMT_NODEV;
>  	mcp->mc_ownedfp = _MC_FPOWNED_NONE;
> +	bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
>  #else
>  	union savefpu *addr;
>
>
> Property changes on: contrib/pf
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys/contrib/pf:r218327
>
>
> Property changes on: contrib/dev/acpica
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys/contrib/dev/acpica:r218327
>
>
> Property changes on: cddl/contrib/opensolaris
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /head/sys/cddl/contrib/opensolaris:r218327
>
> Index: amd64/amd64/machdep.c
> ===================================================================
> --- amd64/amd64/machdep.c	(revision 220730)
> +++ amd64/amd64/machdep.c	(working copy)
> @@ -306,6 +306,9 @@
>  	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
>  	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
>  	fpstate_drop(td);
> +	bzero(sf.sf_uc.uc_mcontext.mc_spare,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_spare));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -327,6 +330,7 @@
>  	/* Build the argument list for the signal handler. */
>  	regs->tf_rdi = sig;			/* arg 1 in %rdi */
>  	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		regs->tf_rsi = (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
> @@ -1653,6 +1657,7 @@
>  	mcp->mc_ss = tp->tf_ss;
>  	mcp->mc_len = sizeof(*mcp);
>  	get_fpcontext(td, mcp);
> +	bzero(mcp->mc_spare, sizeof(mcp->mc_spare));
>  	return (0);
>  }
>
> Index: amd64/ia32/ia32_signal.c
> ===================================================================
> --- amd64/ia32/ia32_signal.c	(revision 220730)
> +++ amd64/ia32/ia32_signal.c	(working copy)
> @@ -158,6 +158,8 @@
>  	mcp->mc_ss = tp->tf_ss;
>  	mcp->mc_len = sizeof(*mcp);
>  	ia32_get_fpcontext(td, mcp);
> +	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
> +	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
>  	return (0);
>  }
>
> @@ -226,6 +228,7 @@
>  		PROC_LOCK(td->td_proc);
>  		uc.uc_sigmask = td->td_sigmask;
>  		PROC_UNLOCK(td->td_proc);
> +		bzero(&uc.__spare__, sizeof(uc.__spare__));
>  		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
>  	}
>  	return (ret);
> @@ -345,6 +348,11 @@
>  	sf.sf_uc.uc_mcontext.mc_eflags = regs->tf_rflags;
>  	sf.sf_uc.uc_mcontext.mc_esp = regs->tf_rsp;
>  	sf.sf_uc.uc_mcontext.mc_ss = regs->tf_ss;
> +	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
> +	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
> +	bzero(sf.sf_uc.uc_mcontext.__spare__,
> +	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -362,6 +370,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
> @@ -463,6 +472,7 @@
>  	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
>  	ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext);
>  	fpstate_drop(td);
> +	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
>
>  	/* Allocate space for the signal handler context. */
>  	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
> @@ -482,6 +492,7 @@
>  	/* Build the argument list for the signal handler. */
>  	sf.sf_signum = sig;
>  	sf.sf_ucontext = (register_t)&sfp->sf_uc;
> +	bzero(&sf.sf_si, sizeof(sf.sf_si));
>  	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
>  		/* Signal handler installed with SA_SIGINFO. */
>  		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
>

--002354471a10bce7a904a111c8b0
Content-Type: text/x-diff; charset=US-ASCII; 
	name="0001-svn-commit-r218836-in-stable-8-sys-amd64-amd64-amd64.patch"
Content-Disposition: attachment; 
	filename="0001-svn-commit-r218836-in-stable-8-sys-amd64-amd64-amd64.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: file0

RnJvbSBiMjIxNzE4YmRmMjUyMmEzMWI3ZTljODkxMjYwODMzY2MxM2E4NjBlIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLb3N0aWsgQmVsb3Vzb3YgPGtvc3Rpa2JlbEBnbWFpbC5jb20+
CkRhdGU6IFN1biwgMTcgQXByIDIwMTEgMDE6MTk6MTUgKzAzMDAKU3ViamVjdDogW1BBVENIXSBz
dm4gY29tbWl0OiByMjE4ODM2IC0gaW4gc3RhYmxlLzgvc3lzOiBhbWQ2NC9hbWQ2NCBhbWQ2NC9p
YTMyIGkzODYvaTM4NiBrZXJuCgpPbiBTYXQsIEFwciAxNiwgMjAxMSBhdCAxMTowNDozOFBNICsw
MjAwLCBPbGl2ZXIgUGludGVyIHdyb3RlOgo+IE1GQyB0aGlzIGZvciA3LVNUQUJMRT8KSSBkbyBu
b3QgcmVqZWN0IHRoZSBwcm9wb3NhbCwgYnV0IEkgYW0gcXVpdGUgY3VyaW91cyB3aHkgPwoKSSBk
byBub3QgaGF2ZSBhbnkgbWFjaGluZSBydW5uaW5nIDcsIHNvIHBsZWFzZSB0ZXN0IHRoZSBwYXRj
aCBiZWxvdy4KSXQgY29tcGlsZWQgZm9yIG1lIG9uIGFtZDY0LgoKUHJvcGVydHkgY2hhbmdlcyBv
bjogLgpfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fCk1vZGlmaWVkOiBzdm46bWVyZ2VpbmZvCiAgIE1lcmdlZCAvaGVhZC9z
eXM6cjIxODMyNwoKVGVzdGVkLWJ5OiBPbGl2ZXIgUGludGVyIDxvbGl2ZXIucG50ckBnbWFpbC5j
b20+Ci0tLQogc3lzL2FtZDY0L2FtZDY0L21hY2hkZXAuYyAgICB8ICAgIDUgKysrKysKIHN5cy9h
bWQ2NC9pYTMyL2lhMzJfc2lnbmFsLmMgfCAgIDExICsrKysrKysrKysrCiBzeXMvaTM4Ni9pMzg2
L21hY2hkZXAuYyAgICAgIHwgICAxNyArKysrKysrKysrKysrKysrKwogc3lzL2tlcm4va2Vybl9j
b250ZXh0LmMgICAgICB8ICAgIDIgKysKIDQgZmlsZXMgY2hhbmdlZCwgMzUgaW5zZXJ0aW9ucygr
KSwgMCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9zeXMvYW1kNjQvYW1kNjQvbWFjaGRlcC5j
IGIvc3lzL2FtZDY0L2FtZDY0L21hY2hkZXAuYwppbmRleCBkYTA4MWYwLi4yN2ZiZThlIDEwMDY0
NAotLS0gYS9zeXMvYW1kNjQvYW1kNjQvbWFjaGRlcC5jCisrKyBiL3N5cy9hbWQ2NC9hbWQ2NC9t
YWNoZGVwLmMKQEAgLTMwNiw2ICszMDYsOSBAQCBzZW5kc2lnKHNpZ190IGNhdGNoZXIsIGtzaWdp
bmZvX3QgKmtzaSwgc2lnc2V0X3QgKm1hc2spCiAJc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNfbGVu
ID0gc2l6ZW9mKHNmLnNmX3VjLnVjX21jb250ZXh0KTsgLyogbWFnaWMgKi8KIAlnZXRfZnBjb250
ZXh0KHRkLCAmc2Yuc2ZfdWMudWNfbWNvbnRleHQpOwogCWZwc3RhdGVfZHJvcCh0ZCk7CisJYnpl
cm8oc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNfc3BhcmUsCisJICAgIHNpemVvZihzZi5zZl91Yy51
Y19tY29udGV4dC5tY19zcGFyZSkpOworCWJ6ZXJvKHNmLnNmX3VjLl9fc3BhcmVfXywgc2l6ZW9m
KHNmLnNmX3VjLl9fc3BhcmVfXykpOwogCiAJLyogQWxsb2NhdGUgc3BhY2UgZm9yIHRoZSBzaWdu
YWwgaGFuZGxlciBjb250ZXh0LiAqLwogCWlmICgodGQtPnRkX3BmbGFncyAmIFREUF9BTFRTVEFD
SykgIT0gMCAmJiAhb29uc3RhY2sgJiYKQEAgLTMyNyw2ICszMzAsNyBAQCBzZW5kc2lnKHNpZ190
IGNhdGNoZXIsIGtzaWdpbmZvX3QgKmtzaSwgc2lnc2V0X3QgKm1hc2spCiAJLyogQnVpbGQgdGhl
IGFyZ3VtZW50IGxpc3QgZm9yIHRoZSBzaWduYWwgaGFuZGxlci4gKi8KIAlyZWdzLT50Zl9yZGkg
PSBzaWc7CQkJLyogYXJnIDEgaW4gJXJkaSAqLwogCXJlZ3MtPnRmX3JkeCA9IChyZWdpc3Rlcl90
KSZzZnAtPnNmX3VjOwkvKiBhcmcgMyBpbiAlcmR4ICovCisJYnplcm8oJnNmLnNmX3NpLCBzaXpl
b2Yoc2Yuc2Zfc2kpKTsKIAlpZiAoU0lHSVNNRU1CRVIocHNwLT5wc19zaWdpbmZvLCBzaWcpKSB7
CiAJCS8qIFNpZ25hbCBoYW5kbGVyIGluc3RhbGxlZCB3aXRoIFNBX1NJR0lORk8uICovCiAJCXJl
Z3MtPnRmX3JzaSA9IChyZWdpc3Rlcl90KSZzZnAtPnNmX3NpOwkvKiBhcmcgMiBpbiAlcnNpICov
CkBAIC0xNjUzLDYgKzE2NTcsNyBAQCBnZXRfbWNvbnRleHQoc3RydWN0IHRocmVhZCAqdGQsIG1j
b250ZXh0X3QgKm1jcCwgaW50IGZsYWdzKQogCW1jcC0+bWNfc3MgPSB0cC0+dGZfc3M7CiAJbWNw
LT5tY19sZW4gPSBzaXplb2YoKm1jcCk7CiAJZ2V0X2ZwY29udGV4dCh0ZCwgbWNwKTsKKwliemVy
byhtY3AtPm1jX3NwYXJlLCBzaXplb2YobWNwLT5tY19zcGFyZSkpOwogCXJldHVybiAoMCk7CiB9
CiAKZGlmZiAtLWdpdCBhL3N5cy9hbWQ2NC9pYTMyL2lhMzJfc2lnbmFsLmMgYi9zeXMvYW1kNjQv
aWEzMi9pYTMyX3NpZ25hbC5jCmluZGV4IGFiOWU2ZjkuLjJjOTM1NmEgMTAwNjQ0Ci0tLSBhL3N5
cy9hbWQ2NC9pYTMyL2lhMzJfc2lnbmFsLmMKKysrIGIvc3lzL2FtZDY0L2lhMzIvaWEzMl9zaWdu
YWwuYwpAQCAtMTU4LDYgKzE1OCw4IEBAIGlhMzJfZ2V0X21jb250ZXh0KHN0cnVjdCB0aHJlYWQg
KnRkLCBzdHJ1Y3QgaWEzMl9tY29udGV4dCAqbWNwLCBpbnQgZmxhZ3MpCiAJbWNwLT5tY19zcyA9
IHRwLT50Zl9zczsKIAltY3AtPm1jX2xlbiA9IHNpemVvZigqbWNwKTsKIAlpYTMyX2dldF9mcGNv
bnRleHQodGQsIG1jcCk7CisJYnplcm8obWNwLT5tY19zcGFyZTEsIHNpemVvZihtY3AtPm1jX3Nw
YXJlMSkpOworCWJ6ZXJvKG1jcC0+bWNfc3BhcmUyLCBzaXplb2YobWNwLT5tY19zcGFyZTIpKTsK
IAlyZXR1cm4gKDApOwogfQogCkBAIC0yMjYsNiArMjI4LDcgQEAgZnJlZWJzZDMyX2dldGNvbnRl
eHQoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBmcmVlYnNkMzJfZ2V0Y29udGV4dF9hcmdzICp1
YXApCiAJCVBST0NfTE9DSyh0ZC0+dGRfcHJvYyk7CiAJCXVjLnVjX3NpZ21hc2sgPSB0ZC0+dGRf
c2lnbWFzazsKIAkJUFJPQ19VTkxPQ0sodGQtPnRkX3Byb2MpOworCQliemVybygmdWMuX19zcGFy
ZV9fLCBzaXplb2YodWMuX19zcGFyZV9fKSk7CiAJCXJldCA9IGNvcHlvdXQoJnVjLCB1YXAtPnVj
cCwgVUNfQ09QWV9TSVpFKTsKIAl9CiAJcmV0dXJuIChyZXQpOwpAQCAtMzQ1LDYgKzM0OCwxMSBA
QCBmcmVlYnNkNF9pYTMyX3NlbmRzaWcoc2lnX3QgY2F0Y2hlciwga3NpZ2luZm9fdCAqa3NpLCBz
aWdzZXRfdCAqbWFzaykKIAlzZi5zZl91Yy51Y19tY29udGV4dC5tY19lZmxhZ3MgPSByZWdzLT50
Zl9yZmxhZ3M7CiAJc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNfZXNwID0gcmVncy0+dGZfcnNwOwog
CXNmLnNmX3VjLnVjX21jb250ZXh0Lm1jX3NzID0gcmVncy0+dGZfc3M7CisJYnplcm8oc2Yuc2Zf
dWMudWNfbWNvbnRleHQubWNfZnByZWdzLAorCSAgICBzaXplb2Yoc2Yuc2ZfdWMudWNfbWNvbnRl
eHQubWNfZnByZWdzKSk7CisJYnplcm8oc2Yuc2ZfdWMudWNfbWNvbnRleHQuX19zcGFyZV9fLAor
CSAgICBzaXplb2Yoc2Yuc2ZfdWMudWNfbWNvbnRleHQuX19zcGFyZV9fKSk7CisJYnplcm8oc2Yu
c2ZfdWMuX19zcGFyZV9fLCBzaXplb2Yoc2Yuc2ZfdWMuX19zcGFyZV9fKSk7CiAKIAkvKiBBbGxv
Y2F0ZSBzcGFjZSBmb3IgdGhlIHNpZ25hbCBoYW5kbGVyIGNvbnRleHQuICovCiAJaWYgKCh0ZC0+
dGRfcGZsYWdzICYgVERQX0FMVFNUQUNLKSAhPSAwICYmICFvb25zdGFjayAmJgpAQCAtMzYyLDYg
KzM3MCw3IEBAIGZyZWVic2Q0X2lhMzJfc2VuZHNpZyhzaWdfdCBjYXRjaGVyLCBrc2lnaW5mb190
ICprc2ksIHNpZ3NldF90ICptYXNrKQogCS8qIEJ1aWxkIHRoZSBhcmd1bWVudCBsaXN0IGZvciB0
aGUgc2lnbmFsIGhhbmRsZXIuICovCiAJc2Yuc2Zfc2lnbnVtID0gc2lnOwogCXNmLnNmX3Vjb250
ZXh0ID0gKHJlZ2lzdGVyX3QpJnNmcC0+c2ZfdWM7CisJYnplcm8oJnNmLnNmX3NpLCBzaXplb2Yo
c2Yuc2Zfc2kpKTsKIAlpZiAoU0lHSVNNRU1CRVIocHNwLT5wc19zaWdpbmZvLCBzaWcpKSB7CiAJ
CS8qIFNpZ25hbCBoYW5kbGVyIGluc3RhbGxlZCB3aXRoIFNBX1NJR0lORk8uICovCiAJCXNmLnNm
X3NpZ2luZm8gPSAodV9pbnQzMl90KSh1aW50cHRyX3QpJnNmcC0+c2Zfc2k7CkBAIC00NjMsNiAr
NDcyLDcgQEAgaWEzMl9zZW5kc2lnKHNpZ190IGNhdGNoZXIsIGtzaWdpbmZvX3QgKmtzaSwgc2ln
c2V0X3QgKm1hc2spCiAJc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNfbGVuID0gc2l6ZW9mKHNmLnNm
X3VjLnVjX21jb250ZXh0KTsgLyogbWFnaWMgKi8KIAlpYTMyX2dldF9mcGNvbnRleHQodGQsICZz
Zi5zZl91Yy51Y19tY29udGV4dCk7CiAJZnBzdGF0ZV9kcm9wKHRkKTsKKwliemVybyhzZi5zZl91
Yy5fX3NwYXJlX18sIHNpemVvZihzZi5zZl91Yy5fX3NwYXJlX18pKTsKIAogCS8qIEFsbG9jYXRl
IHNwYWNlIGZvciB0aGUgc2lnbmFsIGhhbmRsZXIgY29udGV4dC4gKi8KIAlpZiAoKHRkLT50ZF9w
ZmxhZ3MgJiBURFBfQUxUU1RBQ0spICE9IDAgJiYgIW9vbnN0YWNrICYmCkBAIC00ODIsNiArNDky
LDcgQEAgaWEzMl9zZW5kc2lnKHNpZ190IGNhdGNoZXIsIGtzaWdpbmZvX3QgKmtzaSwgc2lnc2V0
X3QgKm1hc2spCiAJLyogQnVpbGQgdGhlIGFyZ3VtZW50IGxpc3QgZm9yIHRoZSBzaWduYWwgaGFu
ZGxlci4gKi8KIAlzZi5zZl9zaWdudW0gPSBzaWc7CiAJc2Yuc2ZfdWNvbnRleHQgPSAocmVnaXN0
ZXJfdCkmc2ZwLT5zZl91YzsKKwliemVybygmc2Yuc2Zfc2ksIHNpemVvZihzZi5zZl9zaSkpOwog
CWlmIChTSUdJU01FTUJFUihwc3AtPnBzX3NpZ2luZm8sIHNpZykpIHsKIAkJLyogU2lnbmFsIGhh
bmRsZXIgaW5zdGFsbGVkIHdpdGggU0FfU0lHSU5GTy4gKi8KIAkJc2Yuc2Zfc2lnaW5mbyA9ICh1
X2ludDMyX3QpKHVpbnRwdHJfdCkmc2ZwLT5zZl9zaTsKZGlmZiAtLWdpdCBhL3N5cy9pMzg2L2kz
ODYvbWFjaGRlcC5jIGIvc3lzL2kzODYvaTM4Ni9tYWNoZGVwLmMKaW5kZXggNzQxM2E5My4uMWU0
NGFhMiAxMDA2NDQKLS0tIGEvc3lzL2kzODYvaTM4Ni9tYWNoZGVwLmMKKysrIGIvc3lzL2kzODYv
aTM4Ni9tYWNoZGVwLmMKQEAgLTM0MiwxMiArMzQyLDE0IEBAIG9zZW5kc2lnKHNpZ190IGNhdGNo
ZXIsIGtzaWdpbmZvX3QgKmtzaSwgc2lnc2V0X3QgKm1hc2spCiAJLyogQnVpbGQgdGhlIGFyZ3Vt
ZW50IGxpc3QgZm9yIHRoZSBzaWduYWwgaGFuZGxlci4gKi8KIAlzZi5zZl9zaWdudW0gPSBzaWc7
CiAJc2Yuc2Zfc2NwID0gKHJlZ2lzdGVyX3QpJmZwLT5zZl9zaWdpbmZvLnNpX3NjOworCWJ6ZXJv
KCZzZi5zZl9zaWdpbmZvLCBzaXplb2Yoc2Yuc2Zfc2lnaW5mbykpOwogCWlmIChTSUdJU01FTUJF
Uihwc3AtPnBzX3NpZ2luZm8sIHNpZykpIHsKIAkJLyogU2lnbmFsIGhhbmRsZXIgaW5zdGFsbGVk
IHdpdGggU0FfU0lHSU5GTy4gKi8KIAkJc2Yuc2ZfYXJnMiA9IChyZWdpc3Rlcl90KSZmcC0+c2Zf
c2lnaW5mbzsKIAkJc2Yuc2Zfc2lnaW5mby5zaV9zaWdubyA9IHNpZzsKIAkJc2Yuc2Zfc2lnaW5m
by5zaV9jb2RlID0ga3NpLT5rc2lfY29kZTsKIAkJc2Yuc2ZfYWh1LnNmX2FjdGlvbiA9IChfX29z
aWdpbmZvaGFuZGxlcl90ICopY2F0Y2hlcjsKKwkJc2Yuc2ZfYWRkciA9IDA7CiAJfSBlbHNlIHsK
IAkJLyogT2xkIEZyZWVCU0Qtc3R5bGUgYXJndW1lbnRzLiAqLwogCQlzZi5zZl9hcmcyID0ga3Np
LT5rc2lfY29kZTsKQEAgLTQ2MSw2ICs0NjMsMTEgQEAgZnJlZWJzZDRfc2VuZHNpZyhzaWdfdCBj
YXRjaGVyLCBrc2lnaW5mb190ICprc2ksIHNpZ3NldF90ICptYXNrKQogCXNmLnNmX3VjLnVjX21j
b250ZXh0Lm1jX29uc3RhY2sgPSAob29uc3RhY2spID8gMSA6IDA7CiAJc2Yuc2ZfdWMudWNfbWNv
bnRleHQubWNfZ3MgPSByZ3MoKTsKIAliY29weShyZWdzLCAmc2Yuc2ZfdWMudWNfbWNvbnRleHQu
bWNfZnMsIHNpemVvZigqcmVncykpOworCWJ6ZXJvKHNmLnNmX3VjLnVjX21jb250ZXh0Lm1jX2Zw
cmVncywKKwkgICAgc2l6ZW9mKHNmLnNmX3VjLnVjX21jb250ZXh0Lm1jX2ZwcmVncykpOworCWJ6
ZXJvKHNmLnNmX3VjLnVjX21jb250ZXh0Ll9fc3BhcmVfXywKKwkgICAgc2l6ZW9mKHNmLnNmX3Vj
LnVjX21jb250ZXh0Ll9fc3BhcmVfXykpOworCWJ6ZXJvKHNmLnNmX3VjLl9fc3BhcmVfXywgc2l6
ZW9mKHNmLnNmX3VjLl9fc3BhcmVfXykpOwogCiAJLyogQWxsb2NhdGUgc3BhY2UgZm9yIHRoZSBz
aWduYWwgaGFuZGxlciBjb250ZXh0LiAqLwogCWlmICgodGQtPnRkX3BmbGFncyAmIFREUF9BTFRT
VEFDSykgIT0gMCAmJiAhb29uc3RhY2sgJiYKQEAgLTQ4MCw2ICs0ODcsNyBAQCBmcmVlYnNkNF9z
ZW5kc2lnKHNpZ190IGNhdGNoZXIsIGtzaWdpbmZvX3QgKmtzaSwgc2lnc2V0X3QgKm1hc2spCiAJ
LyogQnVpbGQgdGhlIGFyZ3VtZW50IGxpc3QgZm9yIHRoZSBzaWduYWwgaGFuZGxlci4gKi8KIAlz
Zi5zZl9zaWdudW0gPSBzaWc7CiAJc2Yuc2ZfdWNvbnRleHQgPSAocmVnaXN0ZXJfdCkmc2ZwLT5z
Zl91YzsKKwliemVybygmc2Yuc2Zfc2ksIHNpemVvZihzZi5zZl9zaSkpOwogCWlmIChTSUdJU01F
TUJFUihwc3AtPnBzX3NpZ2luZm8sIHNpZykpIHsKIAkJLyogU2lnbmFsIGhhbmRsZXIgaW5zdGFs
bGVkIHdpdGggU0FfU0lHSU5GTy4gKi8KIAkJc2Yuc2Zfc2lnaW5mbyA9IChyZWdpc3Rlcl90KSZz
ZnAtPnNmX3NpOwpAQCAtNTk2LDYgKzYwNCwxMSBAQCBzZW5kc2lnKHNpZ190IGNhdGNoZXIsIGtz
aWdpbmZvX3QgKmtzaSwgc2lnc2V0X3QgKm1hc2spCiAJc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNf
bGVuID0gc2l6ZW9mKHNmLnNmX3VjLnVjX21jb250ZXh0KTsgLyogbWFnaWMgKi8KIAlnZXRfZnBj
b250ZXh0KHRkLCAmc2Yuc2ZfdWMudWNfbWNvbnRleHQpOwogCWZwc3RhdGVfZHJvcCh0ZCk7CisJ
Ynplcm8oc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNfc3BhcmUxLAorCSAgICBzaXplb2Yoc2Yuc2Zf
dWMudWNfbWNvbnRleHQubWNfc3BhcmUxKSk7CisJYnplcm8oc2Yuc2ZfdWMudWNfbWNvbnRleHQu
bWNfc3BhcmUyLAorCSAgICBzaXplb2Yoc2Yuc2ZfdWMudWNfbWNvbnRleHQubWNfc3BhcmUyKSk7
CisJYnplcm8oc2Yuc2ZfdWMuX19zcGFyZV9fLCBzaXplb2Yoc2Yuc2ZfdWMuX19zcGFyZV9fKSk7
CiAKIAkvKiBBbGxvY2F0ZSBzcGFjZSBmb3IgdGhlIHNpZ25hbCBoYW5kbGVyIGNvbnRleHQuICov
CiAJaWYgKCh0ZC0+dGRfcGZsYWdzICYgVERQX0FMVFNUQUNLKSAhPSAwICYmICFvb25zdGFjayAm
JgpAQCAtNjE3LDYgKzYzMCw3IEBAIHNlbmRzaWcoc2lnX3QgY2F0Y2hlciwga3NpZ2luZm9fdCAq
a3NpLCBzaWdzZXRfdCAqbWFzaykKIAkvKiBCdWlsZCB0aGUgYXJndW1lbnQgbGlzdCBmb3IgdGhl
IHNpZ25hbCBoYW5kbGVyLiAqLwogCXNmLnNmX3NpZ251bSA9IHNpZzsKIAlzZi5zZl91Y29udGV4
dCA9IChyZWdpc3Rlcl90KSZzZnAtPnNmX3VjOworCWJ6ZXJvKCZzZi5zZl9zaSwgc2l6ZW9mKHNm
LnNmX3NpKSk7CiAJaWYgKFNJR0lTTUVNQkVSKHBzcC0+cHNfc2lnaW5mbywgc2lnKSkgewogCQkv
KiBTaWduYWwgaGFuZGxlciBpbnN0YWxsZWQgd2l0aCBTQV9TSUdJTkZPLiAqLwogCQlzZi5zZl9z
aWdpbmZvID0gKHJlZ2lzdGVyX3QpJnNmcC0+c2Zfc2k7CkBAIC0yNzE2LDYgKzI3MzAsOCBAQCBn
ZXRfbWNvbnRleHQoc3RydWN0IHRocmVhZCAqdGQsIG1jb250ZXh0X3QgKm1jcCwgaW50IGZsYWdz
KQogCW1jcC0+bWNfc3MgPSB0cC0+dGZfc3M7CiAJbWNwLT5tY19sZW4gPSBzaXplb2YoKm1jcCk7
CiAJZ2V0X2ZwY29udGV4dCh0ZCwgbWNwKTsKKwliemVybyhtY3AtPm1jX3NwYXJlMSwgc2l6ZW9m
KG1jcC0+bWNfc3BhcmUxKSk7CisJYnplcm8obWNwLT5tY19zcGFyZTIsIHNpemVvZihtY3AtPm1j
X3NwYXJlMikpOwogCXJldHVybiAoMCk7CiB9CiAKQEAgLTI3NjMsNiArMjc3OSw3IEBAIGdldF9m
cGNvbnRleHQoc3RydWN0IHRocmVhZCAqdGQsIG1jb250ZXh0X3QgKm1jcCkKICNpZm5kZWYgREVW
X05QWAogCW1jcC0+bWNfZnBmb3JtYXQgPSBfTUNfRlBGTVRfTk9ERVY7CiAJbWNwLT5tY19vd25l
ZGZwID0gX01DX0ZQT1dORURfTk9ORTsKKwliemVybyhtY3AtPm1jX2Zwc3RhdGUsIHNpemVvZiht
Y3AtPm1jX2Zwc3RhdGUpKTsKICNlbHNlCiAJdW5pb24gc2F2ZWZwdSAqYWRkcjsKIApkaWZmIC0t
Z2l0IGEvc3lzL2tlcm4va2Vybl9jb250ZXh0LmMgYi9zeXMva2Vybi9rZXJuX2NvbnRleHQuYwpp
bmRleCBmOTUxZmNhLi4zNmUyMzk0IDEwMDY0NAotLS0gYS9zeXMva2Vybi9rZXJuX2NvbnRleHQu
YworKysgYi9zeXMva2Vybi9rZXJuX2NvbnRleHQuYwpAQCAtNzEsNiArNzEsNyBAQCBnZXRjb250
ZXh0KHN0cnVjdCB0aHJlYWQgKnRkLCBzdHJ1Y3QgZ2V0Y29udGV4dF9hcmdzICp1YXApCiAJCVBS
T0NfTE9DSyh0ZC0+dGRfcHJvYyk7CiAJCXVjLnVjX3NpZ21hc2sgPSB0ZC0+dGRfc2lnbWFzazsK
IAkJUFJPQ19VTkxPQ0sodGQtPnRkX3Byb2MpOworCQliemVybyh1Yy5fX3NwYXJlX18sIHNpemVv
Zih1Yy5fX3NwYXJlX18pKTsKIAkJcmV0ID0gY29weW91dCgmdWMsIHVhcC0+dWNwLCBVQ19DT1BZ
X1NJWkUpOwogCX0KIAlyZXR1cm4gKHJldCk7CkBAIC0xMDksNiArMTEwLDcgQEAgc3dhcGNvbnRl
eHQoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBzd2FwY29udGV4dF9hcmdzICp1YXApCiAJCXJl
dCA9IEVJTlZBTDsKIAllbHNlIHsKIAkJZ2V0X21jb250ZXh0KHRkLCAmdWMudWNfbWNvbnRleHQs
IEdFVF9NQ19DTEVBUl9SRVQpOworCQliemVybyh1Yy5fX3NwYXJlX18sIHNpemVvZih1Yy5fX3Nw
YXJlX18pKTsKIAkJUFJPQ19MT0NLKHRkLT50ZF9wcm9jKTsKIAkJdWMudWNfc2lnbWFzayA9IHRk
LT50ZF9zaWdtYXNrOwogCQlQUk9DX1VOTE9DSyh0ZC0+dGRfcHJvYyk7Ci0tIAoxLjcuNC4zCgo=
--002354471a10bce7a904a111c8b0--