From owner-svn-src-stable@FreeBSD.ORG Sun May 10 19:27:05 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FDB7106566B; Sun, 10 May 2009 19:27:05 +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 7CA7C8FC17; Sun, 10 May 2009 19:27:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AJR5tL066528; Sun, 10 May 2009 19:27:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AJR5FX066527; Sun, 10 May 2009 19:27:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905101927.n4AJR5FX066527@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 19:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191975 - in stable/7/sys: . boot/sparc64/loader contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 19:27:06 -0000 Author: marius Date: Sun May 10 19:27:05 2009 New Revision: 191975 URL: http://svn.freebsd.org/changeset/base/191975 Log: MFC: r191012 Fix whitespace. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/sparc64/loader/main.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/7/sys/boot/sparc64/loader/main.c Sun May 10 18:58:30 2009 (r191974) +++ stable/7/sys/boot/sparc64/loader/main.c Sun May 10 19:27:05 2009 (r191975) @@ -472,7 +472,7 @@ dtlb_enter_sun4u(u_long vpn, u_long data reg = rdpr(pstate); wrpr(pstate, reg & ~PSTATE_IE, 0); stxa(AA_DMMU_TAR, ASI_DMMU, - TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL)); + TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL)); stxa(0, ASI_DTLB_DATA_IN_REG, data); membar(Sync); wrpr(pstate, reg, 0); @@ -497,7 +497,7 @@ itlb_enter_sun4u(u_long vpn, u_long data continue; stxa(AA_IMMU_TAR, ASI_IMMU, - TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL)); + TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL)); stxa(TLB_DAR_SLOT(i), ASI_ITLB_DATA_ACCESS_REG, data); flush(PROMBASE); break; @@ -509,7 +509,7 @@ itlb_enter_sun4u(u_long vpn, u_long data } stxa(AA_IMMU_TAR, ASI_IMMU, - TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL)); + TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL)); stxa(0, ASI_ITLB_DATA_IN_REG, data); flush(PROMBASE); wrpr(pstate, reg, 0); From owner-svn-src-stable@FreeBSD.ORG Sun May 10 19:29:06 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5062106566B; Sun, 10 May 2009 19:29:06 +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 921EC8FC1E; Sun, 10 May 2009 19:29:06 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AJT6gw066607; Sun, 10 May 2009 19:29:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AJT6Hk066606; Sun, 10 May 2009 19:29:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905101929.n4AJT6Hk066606@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 19:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191976 - in stable/7/sys: . boot/sparc64/loader contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 19:29:07 -0000 Author: marius Date: Sun May 10 19:29:06 2009 New Revision: 191976 URL: http://svn.freebsd.org/changeset/base/191976 Log: MFC: r191071 Fix masking of TTE bits; the TD_*_MASK macros need shifting via the corresponding TD_*_SHIFT. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/sparc64/loader/main.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/7/sys/boot/sparc64/loader/main.c Sun May 10 19:27:05 2009 (r191975) +++ stable/7/sys/boot/sparc64/loader/main.c Sun May 10 19:29:06 2009 (r191976) @@ -434,9 +434,10 @@ dtlb_va_to_pa_sun4u(vm_offset_t va) continue; reg = dtlb_get_data_sun4u(i); wrpr(pstate, pstate, 0); + reg >>= TD_PA_SHIFT; if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) - return ((reg & TD_PA_CH_MASK) >> TD_PA_SHIFT); - return ((reg & TD_PA_SF_MASK) >> TD_PA_SHIFT); + return (reg & TD_PA_CH_MASK); + return (reg & TD_PA_SF_MASK); } wrpr(pstate, pstate, 0); return (-1); @@ -456,9 +457,10 @@ itlb_va_to_pa_sun4u(vm_offset_t va) continue; reg = itlb_get_data_sun4u(i); wrpr(pstate, pstate, 0); + reg >>= TD_PA_SHIFT; if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) - return ((reg & TD_PA_CH_MASK) >> TD_PA_SHIFT); - return ((reg & TD_PA_SF_MASK) >> TD_PA_SHIFT); + return (reg & TD_PA_CH_MASK); + return (reg & TD_PA_SF_MASK); } wrpr(pstate, pstate, 0); return (-1); @@ -846,7 +848,7 @@ pmap_print_tte_sun4u(tte_t tag, tte_t tt { printf("%s %s ", - page_sizes[(tte & TD_SIZE_MASK) >> TD_SIZE_SHIFT], + page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK], tag & TD_G ? "G" : " "); printf(tte & TD_W ? "W " : " "); printf(tte & TD_P ? "\e[33mP\e[0m " : " "); From owner-svn-src-stable@FreeBSD.ORG Sun May 10 19:41:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E42511065672; Sun, 10 May 2009 19:40:59 +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 D0CB98FC1D; Sun, 10 May 2009 19:40:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AJex1p066885; Sun, 10 May 2009 19:40:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AJexDi066884; Sun, 10 May 2009 19:40:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905101940.n4AJexDi066884@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 19:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191977 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/fb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 19:41:00 -0000 Author: marius Date: Sun May 10 19:40:59 2009 New Revision: 191977 URL: http://svn.freebsd.org/changeset/base/191977 Log: MFC: r191077 Fix whitespace. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/fb/creator.c Modified: stable/7/sys/dev/fb/creator.c ============================================================================== --- stable/7/sys/dev/fb/creator.c Sun May 10 19:29:06 2009 (r191976) +++ stable/7/sys/dev/fb/creator.c Sun May 10 19:40:59 2009 (r191977) @@ -474,7 +474,7 @@ creator_init(int unit, video_adapter_t * vid_init_struct(adp, CREATOR_DRIVER_NAME, -1, unit); - if (OF_getprop(sc->sc_node, "height", &sc->sc_height, + if (OF_getprop(sc->sc_node, "height", &sc->sc_height, sizeof(sc->sc_height)) == -1) return (ENXIO); if (OF_getprop(sc->sc_node, "width", &sc->sc_width, @@ -503,7 +503,7 @@ creator_init(int unit, video_adapter_t * FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_DID); if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) & FFB_DAC_CFG_DID_PNUM) >> 12) != 0x236e) { - sc->sc_flags |= CREATOR_PAC1; + sc->sc_flags |= CREATOR_PAC1; FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_UCTRL); if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) & FFB_DAC_UCTRL_MANREV) >> 8) <= 2) @@ -517,7 +517,7 @@ creator_init(int unit, video_adapter_t * /* * Setting V_ADP_MODECHANGE serves as hack so creator_set_mode() * (which will invalidate our caches and restore our settings) is - * called when the X server shuts down. Otherwise screen corruption + * called when the X server shuts down. Otherwise screen corruption * happens most of the time. */ adp->va_flags |= V_ADP_COLOR | V_ADP_MODECHANGE | V_ADP_BORDER | @@ -916,8 +916,8 @@ creator_bus_attach(device_t dev) node = ofw_bus_get_node(dev); if ((sc = (struct creator_softc *)vid_get_adapter(vid_find_adapter( CREATOR_DRIVER_NAME, 0))) != NULL && sc->sc_node == node) { - device_printf(dev, "console\n"); - device_set_softc(dev, sc); + device_printf(dev, "console\n"); + device_set_softc(dev, sc); } else { sc = device_get_softc(dev); sc->sc_node = node; @@ -930,9 +930,9 @@ creator_bus_attach(device_t dev) * and FFB_FBC register banks in creator_configure() or not so * the resources are marked as taken in the respective RMAN. * The supported cards use either 15 (Creator, Elite3D?) or 24 - * (Creator3D?) register banks. We make sure that we can also + * (Creator3D?) register banks. We make sure that we can also * allocate the resources for at least the FFB_DAC and FFB_FBC - * banks here. We try but don't actually care whether we can + * banks here. We try but don't actually care whether we can * allocate more than these two resources and just limit the * range accessible via creator_fb_mmap() accordingly. */ @@ -965,7 +965,7 @@ creator_bus_attach(device_t dev) rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]); i++) ; - adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) - + adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) - adp->va_mem_base + 1; if (!(sc->sc_flags & CREATOR_CONSOLE)) { @@ -977,9 +977,9 @@ creator_bus_attach(device_t dev) /* * During device configuration we don't necessarily probe * the adapter which is the console first so we can't use - * the device unit number for the video adapter unit. The + * the device unit number for the video adapter unit. The * worst case would be that we use the video adapter unit - * 0 twice. As it doesn't really matter which unit number + * 0 twice. As it doesn't really matter which unit number * the corresponding video adapter has just use the next * unused one. */ @@ -990,7 +990,7 @@ creator_bus_attach(device_t dev) sc->sc_flags |= CREATOR_AFB; if ((error = sw->init(i, adp, 0)) != 0) { device_printf(dev, "cannot initialize adapter\n"); - goto fail; + goto fail; } } @@ -1019,7 +1019,7 @@ creator_bus_attach(device_t dev) for (i = 0; i < FFB_NREG && sc->sc_reg[i] != NULL; i++) bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->sc_reg[i]), sc->sc_reg[i]); - return (error); + return (error); } /* @@ -1064,7 +1064,7 @@ creator_fb_mmap(struct cdev *dev, vm_off for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) { if (offset >= creator_fb_map[i].virt && offset < creator_fb_map[i].virt + creator_fb_map[i].size) { - offset += creator_fb_map[i].phys - + offset += creator_fb_map[i].phys - creator_fb_map[i].virt; if (offset >= sc->sc_va.va_mem_size) return (EINVAL); From owner-svn-src-stable@FreeBSD.ORG Sun May 10 19:50:24 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89FA1106566B; Sun, 10 May 2009 19:50:24 +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 768D58FC18; Sun, 10 May 2009 19:50:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AJoO8l067101; Sun, 10 May 2009 19:50:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AJoOxH067100; Sun, 10 May 2009 19:50:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905101950.n4AJoOxH067100@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 19:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191978 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/fb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 19:50:25 -0000 Author: marius Date: Sun May 10 19:50:24 2009 New Revision: 191978 URL: http://svn.freebsd.org/changeset/base/191978 Log: MFC: r191638 - Change some softc members to be unsigned where more appropriate. - Add some missing const. - Move the size of the window spun by the registers to the softc as neither using va_mem_size for this nor va_mem_base for the start of the bus addresses is appropriate. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/fb/creator.c Modified: stable/7/sys/dev/fb/creator.c ============================================================================== --- stable/7/sys/dev/fb/creator.c Sun May 10 19:40:59 2009 (r191977) +++ stable/7/sys/dev/fb/creator.c Sun May 10 19:50:24 2009 (r191978) @@ -66,12 +66,13 @@ struct creator_softc { struct resource *sc_reg[FFB_NREG]; bus_space_tag_t sc_bt[FFB_NREG]; bus_space_handle_t sc_bh[FFB_NREG]; + u_long sc_reg_size; - int sc_height; - int sc_width; + u_int sc_height; + u_int sc_width; - int sc_xmargin; - int sc_ymargin; + u_int sc_xmargin; + u_int sc_ymargin; const u_char *sc_font; @@ -82,7 +83,7 @@ struct creator_softc { int sc_fontw_cache; int sc_pmask_cache; - int sc_flags; + u_int sc_flags; #define CREATOR_AFB (1 << 0) #define CREATOR_CONSOLE (1 << 1) #define CREATOR_CUREN (1 << 2) @@ -96,7 +97,7 @@ struct creator_softc { bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val)) #define C(r, g, b) ((b << 16) | (g << 8) | (r)) -static const uint32_t creator_cmap[] = { +static const uint32_t const creator_cmap[] = { C(0x00, 0x00, 0x00), /* black */ C(0x00, 0x00, 0xff), /* blue */ C(0x00, 0xff, 0x00), /* green */ @@ -120,7 +121,7 @@ static const struct { vm_offset_t virt; vm_paddr_t phys; vm_size_t size; -} creator_fb_map[] = { +} const creator_fb_map[] = { { FFB_VIRT_SFB8R, FFB_PHYS_SFB8R, FFB_SIZE_SFB8R }, { FFB_VIRT_SFB8G, FFB_PHYS_SFB8G, FFB_SIZE_SFB8G }, { FFB_VIRT_SFB8B, FFB_PHYS_SFB8B, FFB_SIZE_SFB8B }, @@ -252,8 +253,6 @@ static video_switch_t creatorvidsw = { .clear = creator_clear, .fill_rect = creator_fill_rect, .bitblt = creator_bitblt, - NULL, /* XXX brain damage */ - NULL, /* XXX brain damage */ .diag = creator_diag, .save_cursor_palette = creator_save_cursor_palette, .load_cursor_palette = creator_load_cursor_palette, @@ -271,7 +270,7 @@ RENDERER(creator, 0, txtrndrsw, gfb_set) RENDERER_MODULE(creator, gfb_set); -static const u_char creator_mouse_pointer[64][8] __aligned(8) = { +static const u_char const creator_mouse_pointer[64][8] __aligned(8) = { { 0x00, 0x00, }, /* ............ */ { 0x80, 0x00, }, /* *........... */ { 0xc0, 0x00, }, /* **.......... */ @@ -953,20 +952,19 @@ creator_bus_attach(device_t dev) sc->sc_bh[i] = rman_get_bushandle(sc->sc_reg[i]); } /* - * The XFree86/Xorg sunffb(4) expects to be able to access the + * The XFree86/X.Org sunffb(4) expects to be able to access the * memory spanned by the first and the last resource as one chunk * via creator_fb_mmap(), using offsets from the first resource, * even though the backing resources are actually non-continuous. * So make sure that the memory we provide is at least backed by * increasing resources. */ - adp->va_mem_base = rman_get_start(sc->sc_reg[0]); for (i = 1; i < FFB_NREG && sc->sc_reg[i] != NULL && rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]); i++) ; - adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) - - adp->va_mem_base + 1; + sc->sc_reg_size = rman_get_end(sc->sc_reg[i - 1]) - + rman_get_start(sc->sc_reg[0]) + 1; if (!(sc->sc_flags & CREATOR_CONSOLE)) { if ((sw = vid_get_switch(CREATOR_DRIVER_NAME)) == NULL) { @@ -1058,7 +1056,7 @@ creator_fb_mmap(struct cdev *dev, vm_off /* * NB: This is a special implementation based on the /dev/fb - * requirements of the XFree86/Xorg sunffb(4). + * requirements of the XFree86/X.Org sunffb(4). */ sc = dev->si_drv1; for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) { @@ -1066,7 +1064,7 @@ creator_fb_mmap(struct cdev *dev, vm_off offset < creator_fb_map[i].virt + creator_fb_map[i].size) { offset += creator_fb_map[i].phys - creator_fb_map[i].virt; - if (offset >= sc->sc_va.va_mem_size) + if (offset >= sc->sc_reg_size) return (EINVAL); *paddr = sc->sc_bh[0] + offset; return (0); From owner-svn-src-stable@FreeBSD.ORG Mon May 11 16:37:32 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CFBD1065677; Mon, 11 May 2009 16:37:32 +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 19CC38FC1E; Mon, 11 May 2009 16:37:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BGbV8e096422; Mon, 11 May 2009 16:37:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BGbVkG096421; Mon, 11 May 2009 16:37:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905111637.n4BGbVkG096421@svn.freebsd.org> From: John Baldwin Date: Mon, 11 May 2009 16:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191992 - in stable/7/sys: . conf contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 16:37:33 -0000 Author: jhb Date: Mon May 11 16:37:31 2009 New Revision: 191992 URL: http://svn.freebsd.org/changeset/base/191992 Log: MFC: Always compute the root of the kernel source tree and explicitly pass it to module builds. Modified: stable/7/sys/ (props changed) stable/7/sys/conf/kern.post.mk stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/conf/kern.post.mk ============================================================================== --- stable/7/sys/conf/kern.post.mk Mon May 11 16:32:58 2009 (r191991) +++ stable/7/sys/conf/kern.post.mk Mon May 11 16:37:31 2009 (r191992) @@ -12,7 +12,8 @@ .if defined(DESTDIR) MKMODULESENV+= DESTDIR="${DESTDIR}" .endif -MKMODULESENV+= KERNBUILDDIR="${.CURDIR}" +SYSDIR?= ${S:C;^[^/];${.CURDIR}/&;} +MKMODULESENV+= KERNBUILDDIR="${.CURDIR}" SYSDIR="${SYSDIR}" .MAIN: all @@ -29,7 +30,6 @@ modules-${target}: # Handle out of tree ports .if !defined(NO_MODULES) && defined(PORTS_MODULES) -SYSDIR?= ${S:C;^[^/];${.CURDIR}/&;} PORTSMODULESENV=SYSDIR=${SYSDIR} .for __target in all install reinstall clean ${__target}: ports-${__target} From owner-svn-src-stable@FreeBSD.ORG Tue May 12 02:17:26 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BFAA106564A; Tue, 12 May 2009 02:17:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289A28FC1A; Tue, 12 May 2009 02:17:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C2HPhF008444; Tue, 12 May 2009 02:17:25 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C2HPW7008442; Tue, 12 May 2009 02:17:25 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905120217.n4C2HPW7008442@svn.freebsd.org> From: Xin LI Date: Tue, 12 May 2009 02:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192008 - stable/7/libexec/rtld-elf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 02:17:26 -0000 Author: delphij Date: Tue May 12 02:17:25 2009 New Revision: 192008 URL: http://svn.freebsd.org/changeset/base/192008 Log: MFC r190324: Support for a new environment variable, LD_ELF_HINTS_PATH for overriding the rtld hints file. This environment variable would be unset if the process is considered as tainted with setuid/setgid. This feature gives a convenient way of using a custom set of shared library that is not located in the default location and switch back. Feature requested by: iXsystems Original patch by: John Hixson MFC after: 2 weeks Modified: stable/7/libexec/rtld-elf/ (props changed) stable/7/libexec/rtld-elf/rtld.1 stable/7/libexec/rtld-elf/rtld.c Modified: stable/7/libexec/rtld-elf/rtld.1 ============================================================================== --- stable/7/libexec/rtld-elf/rtld.1 Tue May 12 02:08:56 2009 (r192007) +++ stable/7/libexec/rtld-elf/rtld.1 Tue May 12 02:17:25 2009 (r192008) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2006 +.Dd March 23, 2009 .Dt RTLD 1 .Os .Sh NAME @@ -116,6 +116,11 @@ If set, disables the use of and .Ev LD_LIBMAP . This variable is unset for set-user-ID and set-group-ID programs. +.It Ev LD_ELF_HINTS_PATH +This variable will override the default location of +.Dq hints +file. +This variable is unset for set-user-ID and set-group-ID programs. .It Ev LD_LIBRARY_PATH A colon separated list of directories, overriding the default search path for shared libraries. Modified: stable/7/libexec/rtld-elf/rtld.c ============================================================================== --- stable/7/libexec/rtld-elf/rtld.c Tue May 12 02:08:56 2009 (r192007) +++ stable/7/libexec/rtld-elf/rtld.c Tue May 12 02:17:25 2009 (r192008) @@ -157,6 +157,7 @@ static char *ld_debug; /* Environment v static char *ld_library_path; /* Environment variable for search path */ static char *ld_preload; /* Environment variable for libraries to load first */ +static char *ld_elf_hints_path; /* Environment variable for alternative hints path */ static char *ld_tracing; /* Called from ldd to print libs */ static char *ld_utrace; /* Use utrace() to log events. */ static Obj_Entry *obj_list; /* Head of linked list of shared objects */ @@ -365,17 +366,23 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ unsetenv(LD_ "LIBRARY_PATH"); unsetenv(LD_ "LIBMAP_DISABLE"); unsetenv(LD_ "DEBUG"); + unsetenv(LD_ "ELF_HINTS_PATH"); } ld_debug = getenv(LD_ "DEBUG"); libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL; libmap_override = getenv(LD_ "LIBMAP"); ld_library_path = getenv(LD_ "LIBRARY_PATH"); ld_preload = getenv(LD_ "PRELOAD"); + ld_elf_hints_path = getenv(LD_ "ELF_HINTS_PATH"); dangerous_ld_env = libmap_disable || (libmap_override != NULL) || - (ld_library_path != NULL) || (ld_preload != NULL); + (ld_library_path != NULL) || (ld_preload != NULL) || + (ld_elf_hints_path != NULL); ld_tracing = getenv(LD_ "TRACE_LOADED_OBJECTS"); ld_utrace = getenv(LD_ "UTRACE"); + if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0) + ld_elf_hints_path = _PATH_ELF_HINTS; + if (ld_debug != NULL && *ld_debug != '\0') debug = 1; dbg("%s is initialized, base address = %p", __progname, @@ -1094,7 +1101,7 @@ gethints(void) /* Keep from trying again in case the hints file is bad. */ hints = ""; - if ((fd = open(_PATH_ELF_HINTS, O_RDONLY)) == -1) + if ((fd = open(ld_elf_hints_path, O_RDONLY)) == -1) return NULL; if (read(fd, &hdr, sizeof hdr) != sizeof hdr || hdr.magic != ELFHINTS_MAGIC || From owner-svn-src-stable@FreeBSD.ORG Wed May 13 02:55:22 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39654106566C; Wed, 13 May 2009 02:55:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2735C8FC0A; Wed, 13 May 2009 02:55:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4D2tMi0040011; Wed, 13 May 2009 02:55:22 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4D2tMQZ040010; Wed, 13 May 2009 02:55:22 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200905130255.n4D2tMQZ040010@svn.freebsd.org> From: Alexander Motin Date: Wed, 13 May 2009 02:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192033 - stable/7/sys/dev/ata X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 02:55:22 -0000 Author: mav Date: Wed May 13 02:55:21 2009 New Revision: 192033 URL: http://svn.freebsd.org/changeset/base/192033 Log: Make vendor-specific drivers prefered over the generic AHCI one. This fixes some controllers, like JMicron ones, which provide also PATA via PCI function that declared as AHCI controller. This is not an MFC, but the same was already done in 8-CURRENT in other way. PR: kern/132082 Modified: stable/7/sys/dev/ata/ata-pci.c Modified: stable/7/sys/dev/ata/ata-pci.c ============================================================================== --- stable/7/sys/dev/ata/ata-pci.c Wed May 13 02:26:34 2009 (r192032) +++ stable/7/sys/dev/ata/ata-pci.c Wed May 13 02:55:21 2009 (r192033) @@ -76,12 +76,6 @@ ata_pci_probe(device_t dev) if (pci_get_class(dev) != PCIC_STORAGE) return ENXIO; - /* if this is an AHCI chipset grab it */ - if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) { - if (!ata_ahci_ident(dev)) - return ATA_PROBE_OK; - } - /* run through the vendor specific drivers */ switch (pci_get_vendor(dev)) { case ATA_ACARD_ID: @@ -178,6 +172,12 @@ ata_pci_probe(device_t dev) break; } + /* if this is an AHCI chipset grab it */ + if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) { + if (!ata_ahci_ident(dev)) + return ATA_PROBE_OK; + } + /* unknown chipset, try generic DMA if it seems possible */ if (pci_get_subclass(dev) == PCIS_STORAGE_IDE) { if (!ata_generic_ident(dev)) From owner-svn-src-stable@FreeBSD.ORG Wed May 13 19:26:04 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C30DD106566B; Wed, 13 May 2009 19:26:04 +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 B0AC98FC14; Wed, 13 May 2009 19:26:04 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DJQ4DO065320; Wed, 13 May 2009 19:26:04 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DJQ4e5065319; Wed, 13 May 2009 19:26:04 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905131926.n4DJQ4e5065319@svn.freebsd.org> From: Marius Strobl Date: Wed, 13 May 2009 19:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192060 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/isp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 19:26:05 -0000 Author: marius Date: Wed May 13 19:26:04 2009 New Revision: 192060 URL: http://svn.freebsd.org/changeset/base/192060 Log: MFC: r191979 Change uses of the struct ccb_hdr timeout_ch missed when isp(4) was adapted to MPSAFE cam(4) to a isp(4) specific callout structure. Thanks to Florian Smeets for providing access to a machine exhibiting this problem for debugging. Approved by: mjacob Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/isp/isp_freebsd.c Modified: stable/7/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/7/sys/dev/isp/isp_freebsd.c Wed May 13 18:42:49 2009 (r192059) +++ stable/7/sys/dev/isp/isp_freebsd.c Wed May 13 19:26:04 2009 (r192060) @@ -1988,7 +1988,8 @@ isp_watchdog_work(ispsoftc_t *isp, XS_T isp_done(xs); } else { XS_CMD_C_WDOG(xs); - xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); + callout_reset(&PISP_PCMD((union ccb *)xs)->wdog, hz, + isp_watchdog, xs); XS_CMD_S_GRACE(xs); isp->isp_sendmarker |= 1 << XS_CHANNEL(xs); } @@ -3004,7 +3005,7 @@ isp_done(struct ccb_scsiio *sccb) XS_CMD_S_DONE(sccb); if (XS_CMD_WDOG_P(sccb) == 0) { - untimeout(isp_watchdog, sccb, sccb->ccb_h.timeout_ch); + callout_stop(&PISP_PCMD(sccb)->wdog); if (XS_CMD_GRACE_P(sccb)) { isp_prt(isp, ISP_LOGDEBUG2, "finished command on borrowed time"); From owner-svn-src-stable@FreeBSD.ORG Wed May 13 19:26:20 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FA4210656C3; Wed, 13 May 2009 19:26:20 +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 3CB1E8FC1F; Wed, 13 May 2009 19:26:20 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DJQK9D065360; Wed, 13 May 2009 19:26:20 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DJQKlP065359; Wed, 13 May 2009 19:26:20 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905131926.n4DJQKlP065359@svn.freebsd.org> From: Marius Strobl Date: Wed, 13 May 2009 19:26:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192061 - in stable/6/sys: . contrib/pf dev/cxgb dev/isp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 19:26:21 -0000 Author: marius Date: Wed May 13 19:26:19 2009 New Revision: 192061 URL: http://svn.freebsd.org/changeset/base/192061 Log: MFC: r191979 Change uses of the struct ccb_hdr timeout_ch missed when isp(4) was adapted to MPSAFE cam(4) to a isp(4) specific callout structure. Thanks to Florian Smeets for providing access to a machine exhibiting this problem for debugging. Approved by: mjacob Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/dev/isp/isp_freebsd.c Modified: stable/6/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/6/sys/dev/isp/isp_freebsd.c Wed May 13 19:26:04 2009 (r192060) +++ stable/6/sys/dev/isp/isp_freebsd.c Wed May 13 19:26:19 2009 (r192061) @@ -2075,7 +2075,8 @@ isp_watchdog_work(ispsoftc_t *isp, XS_T isp_done(xs); } else { XS_CMD_C_WDOG(xs); - xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); + callout_reset(&PISP_PCMD((union ccb *)xs)->wdog, hz, + isp_watchdog, xs); XS_CMD_S_GRACE(xs); isp->isp_sendmarker |= 1 << XS_CHANNEL(xs); } @@ -3091,7 +3092,7 @@ isp_done(struct ccb_scsiio *sccb) XS_CMD_S_DONE(sccb); if (XS_CMD_WDOG_P(sccb) == 0) { - untimeout(isp_watchdog, sccb, sccb->ccb_h.timeout_ch); + callout_stop(&PISP_PCMD(sccb)->wdog); if (XS_CMD_GRACE_P(sccb)) { isp_prt(isp, ISP_LOGDEBUG2, "finished command on borrowed time"); From owner-svn-src-stable@FreeBSD.ORG Thu May 14 01:35:43 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC95C10656A4; Thu, 14 May 2009 01:35:43 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC4F8FC14; Thu, 14 May 2009 01:35:43 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E1ZhVp072753; Thu, 14 May 2009 01:35:43 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E1ZhQG072751; Thu, 14 May 2009 01:35:43 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140135.n4E1ZhQG072751@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 01:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192068 - in stable/7: etc etc/mtree etc/rc.d gnu/usr.bin/man gnu/usr.bin/man/man X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 01:35:45 -0000 Author: des Date: Thu May 14 01:35:43 2009 New Revision: 192068 URL: http://svn.freebsd.org/changeset/base/192068 Log: MFC r183696, r183698: enable UTF-8 for man pages. Modified: stable/7/etc/ (props changed) stable/7/etc/Makefile stable/7/etc/mtree/BSD.usr.dist stable/7/etc/rc.d/ (props changed) stable/7/gnu/usr.bin/man/ (props changed) stable/7/gnu/usr.bin/man/man/man.c Modified: stable/7/etc/Makefile ============================================================================== --- stable/7/etc/Makefile Thu May 14 00:34:26 2009 (r192067) +++ stable/7/etc/Makefile Thu May 14 01:35:43 2009 (r192068) @@ -261,6 +261,7 @@ distrib-dirs: .endif cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* . + cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* . cd ${DESTDIR}/usr/share/man; \ set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \ while [ $$# -gt 0 ] ; \ Modified: stable/7/etc/mtree/BSD.usr.dist ============================================================================== --- stable/7/etc/mtree/BSD.usr.dist Thu May 14 00:34:26 2009 (r192067) +++ stable/7/etc/mtree/BSD.usr.dist Thu May 14 01:35:43 2009 (r192068) @@ -752,6 +752,46 @@ cat9 .. .. + en.UTF-8 uname=root + cat1 + .. + cat1aout + .. + cat2 + .. + cat3 + .. + cat4 + amd64 + .. + arm + .. + i386 + .. + powerpc + .. + sparc64 + .. + .. + cat5 + .. + cat6 + .. + cat7 + .. + cat8 + amd64 + .. + i386 + .. + powerpc + .. + sparc64 + .. + .. + cat9 + .. + .. ja uname=root cat1 .. Modified: stable/7/gnu/usr.bin/man/man/man.c ============================================================================== --- stable/7/gnu/usr.bin/man/man/man.c Thu May 14 00:34:26 2009 (r192067) +++ stable/7/gnu/usr.bin/man/man/man.c Thu May 14 01:35:43 2009 (r192068) @@ -105,6 +105,7 @@ static struct ltable ltable[] = { {"KOI8-R", "koi8-r"}, {"ISO8859-1", "latin1"}, {"ISO8859-15", "latin1"}, + {"UTF-8", "utf8"}, {NULL} }; #endif From owner-svn-src-stable@FreeBSD.ORG Thu May 14 01:38:06 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B27EF106566B; Thu, 14 May 2009 01:38:06 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FF3E8FC1D; Thu, 14 May 2009 01:38:06 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E1c6XN072842; Thu, 14 May 2009 01:38:06 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E1c6px072838; Thu, 14 May 2009 01:38:06 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140138.n4E1c6px072838@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 01:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192069 - stable/7/lib/libutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 01:38:07 -0000 Author: des Date: Thu May 14 01:38:06 2009 New Revision: 192069 URL: http://svn.freebsd.org/changeset/base/192069 Log: MFC r184633, r184635, r184683: WARNS cleanup Modified: stable/7/lib/libutil/ (props changed) stable/7/lib/libutil/Makefile stable/7/lib/libutil/login_cap.c stable/7/lib/libutil/login_class.c stable/7/lib/libutil/realhostname.c Modified: stable/7/lib/libutil/Makefile ============================================================================== --- stable/7/lib/libutil/Makefile Thu May 14 01:35:43 2009 (r192068) +++ stable/7/lib/libutil/Makefile Thu May 14 01:38:06 2009 (r192069) @@ -16,6 +16,8 @@ SRCS= _secure_path.c auth.c gr_util.c ex stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h +WARNS?= 6 + CFLAGS+= -DLIBC_SCCS .if ${MK_INET6_SUPPORT} != "no" Modified: stable/7/lib/libutil/login_cap.c ============================================================================== --- stable/7/lib/libutil/login_cap.c Thu May 14 01:35:43 2009 (r192068) +++ stable/7/lib/libutil/login_cap.c Thu May 14 01:38:06 2009 (r192069) @@ -61,6 +61,8 @@ static char * internal_string = NULL; static size_t internal_arraysz = 0; static const char ** internal_array = NULL; +static char path_login_conf[] = _PATH_LOGIN_CONF; + static char * allocstr(const char *str) { @@ -215,15 +217,14 @@ login_getclassbyname(char const *name, c if (dir && snprintf(userpath, MAXPATHLEN, "%s/%s", dir, _FILE_LOGIN_CONF) < MAXPATHLEN) { - login_dbarray[i] = userpath; if (_secure_path(userpath, pwd->pw_uid, pwd->pw_gid) != -1) - i++; /* only use 'secure' data */ + login_dbarray[i++] = userpath; } /* * XXX: Why to add the system database if the class is `me'? */ - if (_secure_path(_PATH_LOGIN_CONF, 0, 0) != -1) - login_dbarray[i++] = _PATH_LOGIN_CONF; + if (_secure_path(path_login_conf, 0, 0) != -1) + login_dbarray[i++] = path_login_conf; login_dbarray[i] = NULL; memset(lc, 0, sizeof(login_cap_t)); Modified: stable/7/lib/libutil/login_class.c ============================================================================== --- stable/7/lib/libutil/login_class.c Thu May 14 01:35:43 2009 (r192068) +++ stable/7/lib/libutil/login_class.c Thu May 14 01:38:06 2009 (r192069) @@ -137,14 +137,13 @@ substvar(const char * var, const struct int tildes = 0; int dollas = 0; char *p; + const char *q; if (pwd != NULL) { - /* Count the number of ~'s in var to substitute */ - for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++) - ++tildes; - /* Count the number of $'s in var to substitute */ - for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++) - ++dollas; + for (q = var; *q != '\0'; ++q) { + tildes += (*q == '~'); + dollas += (*q == '$'); + } } np = malloc(strlen(var) + (dollas * nlen) Modified: stable/7/lib/libutil/realhostname.c ============================================================================== --- stable/7/lib/libutil/realhostname.c Thu May 14 01:35:43 2009 (r192068) +++ stable/7/lib/libutil/realhostname.c Thu May 14 01:38:06 2009 (r192069) @@ -84,6 +84,18 @@ realhostname(char *host, size_t hsize, c return result; } +/* + * struct sockaddr has very lax alignment requirements, since all its + * members are char or equivalent. This is a problem when trying to + * dereference a struct sockaddr_in6 * that was passed in as a struct + * sockaddr *. Although we know (or trust) that the passed-in struct was + * properly aligned, the compiler doesn't, and (rightly) complains. These + * macros perform the cast in a way that the compiler will accept. + */ +#define SOCKADDR_IN6(p) ((struct sockaddr_in6 *)(void *)(p)) +#define SOCKADDR_IN(p) ((struct sockaddr_in *)(void *)(p)) +#define SOCKINET(p) ((struct sockinet *)(void *)(p)) + int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen) { @@ -97,10 +109,10 @@ realhostname_sa(char *host, size_t hsize /* IPv4 mapped IPv6 addr consideraton, specified in rfc2373. */ if (addr->sa_family == AF_INET6 && addrlen == sizeof(struct sockaddr_in6) && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)addr)->sin6_addr)) { + IN6_IS_ADDR_V4MAPPED(&SOCKADDR_IN6(addr)->sin6_addr)) { struct sockaddr_in6 *sin6; - sin6 = (struct sockaddr_in6 *)addr; + sin6 = SOCKADDR_IN6(addr); memset(&lsin, 0, sizeof(lsin)); lsin.sin_len = sizeof(struct sockaddr_in); @@ -143,15 +155,16 @@ realhostname_sa(char *host, size_t hsize } if (sa->sa_len == addrlen && sa->sa_family == addr->sa_family) { - ((struct sockinet *)sa)->si_port = ((struct sockinet *)addr)->si_port; + SOCKINET(sa)->si_port = SOCKINET(addr)->si_port; #ifdef INET6 /* * XXX: sin6_socpe_id may not been * filled by DNS */ if (sa->sa_family == AF_INET6 && - ((struct sockaddr_in6 *)sa)->sin6_scope_id == 0) - ((struct sockaddr_in6 *)sa)->sin6_scope_id = ((struct sockaddr_in6 *)addr)->sin6_scope_id; + SOCKADDR_IN6(sa)->sin6_scope_id == 0) + SOCKADDR_IN6(sa)->sin6_scope_id = + SOCKADDR_IN6(addr)->sin6_scope_id; #endif if (!memcmp(sa, addr, sa->sa_len)) { result = HOSTNAME_FOUND; From owner-svn-src-stable@FreeBSD.ORG Thu May 14 01:40:36 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78B7D1065676; Thu, 14 May 2009 01:40:36 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 662168FC14; Thu, 14 May 2009 01:40:36 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E1eari072948; Thu, 14 May 2009 01:40:36 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E1eacL072946; Thu, 14 May 2009 01:40:36 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140140.n4E1eacL072946@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 01:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192070 - stable/7/libexec/rpc.rquotad X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 01:40:37 -0000 Author: des Date: Thu May 14 01:40:36 2009 New Revision: 192070 URL: http://svn.freebsd.org/changeset/base/192070 Log: MFC r184638: style and WARNS cleanup Modified: stable/7/libexec/rpc.rquotad/ (props changed) stable/7/libexec/rpc.rquotad/Makefile stable/7/libexec/rpc.rquotad/rquotad.c Modified: stable/7/libexec/rpc.rquotad/Makefile ============================================================================== --- stable/7/libexec/rpc.rquotad/Makefile Thu May 14 01:38:06 2009 (r192069) +++ stable/7/libexec/rpc.rquotad/Makefile Thu May 14 01:40:36 2009 (r192070) @@ -4,6 +4,8 @@ PROG = rpc.rquotad SRCS = rquotad.c MAN = rpc.rquotad.8 +WARNS ?= 6 + DPADD= ${LIBRPCSVC} LDADD= -lrpcsvc Modified: stable/7/libexec/rpc.rquotad/rquotad.c ============================================================================== --- stable/7/libexec/rpc.rquotad/rquotad.c Thu May 14 01:38:06 2009 (r192069) +++ stable/7/libexec/rpc.rquotad/rquotad.c Thu May 14 01:40:36 2009 (r192070) @@ -1,39 +1,35 @@ /* * by Manuel Bouyer (bouyer@ensta.fr) - * + * * There is no copyright, you can use it as you want. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); #include -#include #include #include #include #include -#include + +#include +#include +#include +#include +#include #include #include #include #include #include +#include #include #include #include -#include - #include - -#include -#include -#include -#include -#include +#include void rquota_service(struct svc_req *request, SVCXPRT *transp); void sendquota(struct svc_req *request, SVCXPRT *transp); @@ -56,15 +52,17 @@ struct fs_stat *fs_begin = NULL; int from_inetd = 1; -void +static void cleanup(int sig) { + + (void) sig; (void) rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL); exit(0); } int -main(int argc, char *argv[]) +main(void) { SVCXPRT *transp; int ok; @@ -101,19 +99,22 @@ main(int argc, char *argv[]) ok = svc_create(rquota_service, RQUOTAPROG, RQUOTAVERS, "udp"); if (!ok) { - syslog(LOG_ERR, "unable to register (RQUOTAPROG, RQUOTAVERS, %s)", (!from_inetd)?"udp":"(inetd)"); + syslog(LOG_ERR, + "unable to register (RQUOTAPROG, RQUOTAVERS, %s)", + from_inetd ? "(inetd)" : "udp"); exit(1); } - initfs(); /* init the fs_stat list */ + initfs(); svc_run(); syslog(LOG_ERR, "svc_run returned"); exit(1); } -void +void rquota_service(struct svc_req *request, SVCXPRT *transp) { + switch (request->rq_proc) { case NULLPROC: (void)svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL); @@ -133,7 +134,7 @@ rquota_service(struct svc_req *request, } /* read quota for the specified id, and send it */ -void +void sendquota(struct svc_req *request, SVCXPRT *transp) { struct getquota_args getq_args; @@ -183,7 +184,7 @@ sendquota(struct svc_req *request, SVCXP } } -void +void printerr_reply(SVCXPRT *transp) /* when a reply to a request failed */ { char name[INET6_ADDRSTRLEN]; @@ -203,7 +204,7 @@ printerr_reply(SVCXPRT *transp) /* when } /* initialise the fs_tab list from entries in /etc/fstab */ -void +void initfs(void) { struct fs_stat *fs_current = NULL; @@ -222,10 +223,12 @@ initfs(void) fs_current = (struct fs_stat *) malloc(sizeof(struct fs_stat)); fs_current->fs_next = fs_next; /* next element */ - fs_current->fs_file = malloc(sizeof(char) * (strlen(fs->fs_file) + 1)); + fs_current->fs_file = + malloc(sizeof(char) * (strlen(fs->fs_file) + 1)); strcpy(fs_current->fs_file, fs->fs_file); - fs_current->qfpathname = malloc(sizeof(char) * (strlen(qfpathname) + 1)); + fs_current->qfpathname = + malloc(sizeof(char) * (strlen(qfpathname) + 1)); strcpy(fs_current->qfpathname, qfpathname); stat(fs_current->fs_file, &st); @@ -242,7 +245,7 @@ initfs(void) * Return 0 if fail, 1 otherwise */ int -getfsquota(long id, char *path, struct dqblk *dqblk) +getfsquota(long id, char *path, struct dqblk *dqblk) { struct stat st_path; struct fs_stat *fs; @@ -301,8 +304,8 @@ hasquota(struct fstab *fs, char **qfnam { static char initname, usrname[100]; static char buf[BUFSIZ]; - char *opt, *cp; - char *qfextension[] = INITQFNAMES; + char *opt, *cp; + const char *qfextension[] = INITQFNAMES; if (!initname) { sprintf(usrname, "%s%s", qfextension[USRQUOTA], QUOTAFILENAME); @@ -321,7 +324,8 @@ hasquota(struct fstab *fs, char **qfnam *qfnamep = cp; return (1); } - sprintf(buf, "%s/%s.%s", fs->fs_file, QUOTAFILENAME, qfextension[USRQUOTA]); + sprintf(buf, "%s/%s.%s", fs->fs_file, QUOTAFILENAME, + qfextension[USRQUOTA]); *qfnamep = buf; return (1); } From owner-svn-src-stable@FreeBSD.ORG Thu May 14 01:41:55 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52F8F106566C; Thu, 14 May 2009 01:41:55 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0608B8FC0A; Thu, 14 May 2009 01:41:55 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E1fsGZ073020; Thu, 14 May 2009 01:41:54 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E1fsdM073019; Thu, 14 May 2009 01:41:54 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140141.n4E1fsdM073019@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 01:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192071 - stable/7/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 01:41:55 -0000 Author: des Date: Thu May 14 01:41:54 2009 New Revision: 192071 URL: http://svn.freebsd.org/changeset/base/192071 Log: MFC r184690: missing email address Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/pseudofs.9 Modified: stable/7/share/man/man9/pseudofs.9 ============================================================================== --- stable/7/share/man/man9/pseudofs.9 Thu May 14 01:40:36 2009 (r192070) +++ stable/7/share/man/man9/pseudofs.9 Thu May 14 01:41:54 2009 (r192071) @@ -67,4 +67,4 @@ module appeared in The .Nm module and this manual page were written by -.An Dag-Erling Sm\(/orgrav . +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:00:50 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C73D1106566C; Thu, 14 May 2009 02:00:50 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4DBE8FC15; Thu, 14 May 2009 02:00:50 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E20oFY073434; Thu, 14 May 2009 02:00:50 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E20oui073433; Thu, 14 May 2009 02:00:50 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140200.n4E20oui073433@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192072 - in stable/7/sys: . compat/linprocfs contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:00:51 -0000 Author: des Date: Thu May 14 02:00:50 2009 New Revision: 192072 URL: http://svn.freebsd.org/changeset/base/192072 Log: MFC r184691: convert to UTF-8. Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linprocfs/linprocfs.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/7/sys/compat/linprocfs/linprocfs.c Thu May 14 01:41:54 2009 (r192071) +++ stable/7/sys/compat/linprocfs/linprocfs.c Thu May 14 02:00:50 2009 (r192072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav * Copyright (c) 1999 Pierre Beyssac * Copyright (c) 1993 Jan-Simon Pendry * Copyright (c) 1993 From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:07:41 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7251106564A; Thu, 14 May 2009 02:07:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAF3E8FC0C; Thu, 14 May 2009 02:07:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E27flZ073614; Thu, 14 May 2009 02:07:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E27fHo073613; Thu, 14 May 2009 02:07:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140207.n4E27fHo073613@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192073 - stable/7/usr.bin/fetch X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:07:42 -0000 Author: des Date: Thu May 14 02:07:41 2009 New Revision: 192073 URL: http://svn.freebsd.org/changeset/base/192073 Log: MFC 185912: Apply the same defaults to HTTPS as to HTTP. MFC 187361: Fix FTP / HTTP timeouts Modified: stable/7/usr.bin/fetch/ (props changed) stable/7/usr.bin/fetch/fetch.c Modified: stable/7/usr.bin/fetch/fetch.c ============================================================================== --- stable/7/usr.bin/fetch/fetch.c Thu May 14 02:00:50 2009 (r192072) +++ stable/7/usr.bin/fetch/fetch.c Thu May 14 02:07:41 2009 (r192073) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #define MINBUFSIZE 4096 +#define TIMEOUT 120 /* Option flags */ int A_flag; /* -A: do not follow 302 redirects */ @@ -75,7 +76,7 @@ int R_flag; /* -R: don't delete part int r_flag; /* -r: restart previously interrupted transfer */ off_t S_size; /* -S: require size to match */ int s_flag; /* -s: show size, don't fetch */ -long T_secs = 120; /* -T: transfer timeout in seconds */ +long T_secs; /* -T: transfer timeout in seconds */ int t_flag; /*! -t: workaround TCP bug */ int U_flag; /* -U: do not use high ports */ int v_level = 1; /* -v: verbosity level */ @@ -88,8 +89,8 @@ int sigalrm; /* SIGALRM received */ int siginfo; /* SIGINFO received */ int sigint; /* SIGINT received */ -long ftp_timeout; /* default timeout for FTP transfers */ -long http_timeout; /* default timeout for HTTP transfers */ +long ftp_timeout = TIMEOUT; /* default timeout for FTP transfers */ +long http_timeout = TIMEOUT; /* default timeout for HTTP transfers */ char *buf; /* transfer buffer */ @@ -376,7 +377,8 @@ fetch(char *URL, const char *path) } /* HTTP specific flags */ - if (strcmp(url->scheme, SCHEME_HTTP) == 0) { + if (strcmp(url->scheme, SCHEME_HTTP) == 0 || + strcmp(url->scheme, SCHEME_HTTPS) == 0) { if (d_flag) strcat(flags, "d"); if (A_flag) From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:09:09 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E46FF106564A; Thu, 14 May 2009 02:09:09 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2AAB8FC08; Thu, 14 May 2009 02:09:09 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E299aR073685; Thu, 14 May 2009 02:09:09 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E299x9073684; Thu, 14 May 2009 02:09:09 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140209.n4E299x9073684@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192074 - stable/7/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:09:10 -0000 Author: des Date: Thu May 14 02:09:09 2009 New Revision: 192074 URL: http://svn.freebsd.org/changeset/base/192074 Log: MFC r186224: exeunt Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/style.9 Modified: stable/7/share/man/man9/style.9 ============================================================================== --- stable/7/share/man/man9/style.9 Thu May 14 02:07:41 2009 (r192073) +++ stable/7/share/man/man9/style.9 Thu May 14 02:09:09 2009 (r192074) @@ -26,7 +26,7 @@ .\" From: @(#)style 1.14 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd February 10, 2005 +.Dd December 17, 2008 .Dt STYLE 9 .Os .Sh NAME @@ -602,11 +602,9 @@ Do YOU understand the following? k = !(l & FLAGS); .Ed .Pp -Exits should be 0 on success, or according to the predefined -values in -.Xr sysexits 3 . +Exits should be 0 on success, or 1 on failure. .Bd -literal - exit(EX_OK); /* + exit(0); /* * Avoid obvious comments such as * "Exit 0 on success." */ @@ -806,7 +804,7 @@ placed in a single set of brackets. .Ed .Bd -literal (void)fprintf(stderr, "usage: f [-ab]\en"); - exit(EX_USAGE); + exit(1); } .Ed .Pp @@ -840,7 +838,6 @@ and produce minimal warnings. .Xr indent 1 , .Xr lint 1 , .Xr err 3 , -.Xr sysexits 3 , .Xr warn 3 , .Xr style.Makefile 5 .Sh HISTORY From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:10:32 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 503B8106564A; Thu, 14 May 2009 02:10:32 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E36C8FC0A; Thu, 14 May 2009 02:10:32 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E2AWQN073770; Thu, 14 May 2009 02:10:32 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E2AW5S073769; Thu, 14 May 2009 02:10:32 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140210.n4E2AW5S073769@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192075 - stable/7/usr.bin/sockstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:10:32 -0000 Author: des Date: Thu May 14 02:10:31 2009 New Revision: 192075 URL: http://svn.freebsd.org/changeset/base/192075 Log: MFC r187915: make sure columns don't run into each other. PR: bin/129318 Modified: stable/7/usr.bin/sockstat/ (props changed) stable/7/usr.bin/sockstat/sockstat.c Modified: stable/7/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/7/usr.bin/sockstat/sockstat.c Thu May 14 02:09:09 2009 (r192074) +++ stable/7/usr.bin/sockstat/sockstat.c Thu May 14 02:10:31 2009 (r192075) @@ -584,25 +584,25 @@ display(void) continue; pos = 0; if ((pwd = getpwuid(xf->xf_uid)) == NULL) - pos += xprintf("%lu", (u_long)xf->xf_uid); + pos += xprintf("%lu ", (u_long)xf->xf_uid); else - pos += xprintf("%s", pwd->pw_name); + pos += xprintf("%s ", pwd->pw_name); while (pos < 9) pos += xprintf(" "); pos += xprintf("%.10s", getprocname(xf->xf_pid)); while (pos < 20) pos += xprintf(" "); - pos += xprintf("%lu", (u_long)xf->xf_pid); + pos += xprintf("%lu ", (u_long)xf->xf_pid); while (pos < 26) pos += xprintf(" "); - pos += xprintf("%d", xf->xf_fd); + pos += xprintf("%d ", xf->xf_fd); while (pos < 29) pos += xprintf(" "); pos += xprintf("%s", s->protoname); if (s->vflag & INP_IPV4) - pos += xprintf("4"); + pos += xprintf("4 "); if (s->vflag & INP_IPV6) - pos += xprintf("6"); + pos += xprintf("6 "); while (pos < 36) pos += xprintf(" "); switch (s->family) { From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:14:46 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67AAA1065677; Thu, 14 May 2009 02:14:46 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55E538FC13; Thu, 14 May 2009 02:14:46 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E2Ek6c073894; Thu, 14 May 2009 02:14:46 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E2EkAI073893; Thu, 14 May 2009 02:14:46 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140214.n4E2EkAI073893@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192076 - in stable/7/etc: . rc.d X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:14:47 -0000 Author: des Date: Thu May 14 02:14:46 2009 New Revision: 192076 URL: http://svn.freebsd.org/changeset/base/192076 Log: MFC r190032: add hostid Modified: stable/7/etc/ (props changed) stable/7/etc/netstart stable/7/etc/rc.d/ (props changed) Modified: stable/7/etc/netstart ============================================================================== --- stable/7/etc/netstart Thu May 14 02:10:31 2009 (r192075) +++ stable/7/etc/netstart Thu May 14 02:14:46 2009 (r192076) @@ -38,6 +38,7 @@ load_rc_config 'XXX' /etc/rc.d/devd start +/etc/rc.d/hostid start /etc/rc.d/hostname start /etc/rc.d/ipmon start /etc/rc.d/ipfilter start From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:20:37 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3034106566B; Thu, 14 May 2009 02:20:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C12FF8FC1A; Thu, 14 May 2009 02:20:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E2Kb4I074047; Thu, 14 May 2009 02:20:37 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E2Kblu074046; Thu, 14 May 2009 02:20:37 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140220.n4E2Kblu074046@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192077 - stable/7/share/timedef X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:20:38 -0000 Author: des Date: Thu May 14 02:20:37 2009 New Revision: 192077 URL: http://svn.freebsd.org/changeset/base/192077 Log: MFC r190774: fix ISO8859-15 links for nb_NO / no_NO. Modified: stable/7/share/timedef/ (props changed) stable/7/share/timedef/Makefile Modified: stable/7/share/timedef/Makefile ============================================================================== --- stable/7/share/timedef/Makefile Thu May 14 02:14:46 2009 (r192076) +++ stable/7/share/timedef/Makefile Thu May 14 02:20:37 2009 (r192077) @@ -126,10 +126,9 @@ GB2312_GBK= zh_CN ISO8859-1_ISO8859-1= ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} \ ${NL_LINKS} ${NO_LINKS} en_US:af_ZA ISO8859-1_ISO8859-15= ca_ES da_DK de_AT de_DE en_GB en_US es_ES eu_ES \ - fi_FI fr_FR is_IS it_IT la_LN nl_NL nn_NO no_NO pt_PT \ + fi_FI fr_FR is_IS it_IT la_LN nb_NO nl_NL nn_NO no_NO pt_PT \ sv_SE \ - ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} ${NL_LINKS} \ - ${NO_LINKS} + ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} ${NL_LINKS} ISO8859-1_US-ASCII= ${GB_LINKS} en_GB en_US la_LN ISO8859-1_ISO8859-2= la_LN ISO8859-1_ISO8859-4= la_LN From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:27:39 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC26E1065670; Thu, 14 May 2009 02:27:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8E468FC12; Thu, 14 May 2009 02:27:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E2RcHQ074229; Thu, 14 May 2009 02:27:38 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E2RcjA074228; Thu, 14 May 2009 02:27:38 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140227.n4E2RcjA074228@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192078 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/ichwd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:27:39 -0000 Author: des Date: Thu May 14 02:27:38 2009 New Revision: 192078 URL: http://svn.freebsd.org/changeset/base/192078 Log: MFC r190030: rename a couple of functions, add comments Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/ichwd/ichwd.c Modified: stable/7/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/7/sys/dev/ichwd/ichwd.c Thu May 14 02:20:37 2009 (r192077) +++ stable/7/sys/dev/ichwd/ichwd.c Thu May 14 02:27:38 2009 (r192078) @@ -141,26 +141,55 @@ static devclass_t ichwd_devclass; device_printf(dev, __VA_ARGS__);\ } while (0) +/* + * Disable the watchdog timeout SMI handler. + * + * Apparently, some BIOSes install handlers that reset or disable the + * watchdog timer instead of resetting the system, so we disable the SMI + * (by clearing the SMI_TCO_EN bit of the SMI_EN register) to prevent this + * from happening. + */ static __inline void -ichwd_intr_enable(struct ichwd_softc *sc) +ichwd_smi_disable(struct ichwd_softc *sc) { ichwd_write_smi_4(sc, SMI_EN, ichwd_read_smi_4(sc, SMI_EN) & ~SMI_TCO_EN); } +/* + * Enable the watchdog timeout SMI handler. See above for details. + */ static __inline void -ichwd_intr_disable(struct ichwd_softc *sc) +ichwd_smi_enable(struct ichwd_softc *sc) { ichwd_write_smi_4(sc, SMI_EN, ichwd_read_smi_4(sc, SMI_EN) | SMI_TCO_EN); } +/* + * Reset the watchdog status bits. + */ static __inline void ichwd_sts_reset(struct ichwd_softc *sc) { + /* + * The watchdog status bits are set to 1 by the hardware to + * indicate various conditions. They can be cleared by software + * by writing a 1, not a 0. + */ ichwd_write_tco_2(sc, TCO1_STS, TCO_TIMEOUT); + /* + * XXX The datasheet says that TCO_SECOND_TO_STS must be cleared + * before TCO_BOOT_STS, not the other way around. + */ ichwd_write_tco_2(sc, TCO2_STS, TCO_BOOT_STS); ichwd_write_tco_2(sc, TCO2_STS, TCO_SECOND_TO_STS); } +/* + * Enable the watchdog timer by clearing the TCO_TMR_HALT bit in the + * TCO1_CNT register. This is complicated by the need to preserve bit 9 + * of that same register, and the requirement that all other bits must be + * written back as zero. + */ static __inline void ichwd_tmr_enable(struct ichwd_softc *sc) { @@ -172,6 +201,9 @@ ichwd_tmr_enable(struct ichwd_softc *sc) ichwd_verbose_printf(sc->device, "timer enabled\n"); } +/* + * Disable the watchdog timer. See above for details. + */ static __inline void ichwd_tmr_disable(struct ichwd_softc *sc) { @@ -183,6 +215,11 @@ ichwd_tmr_disable(struct ichwd_softc *sc ichwd_verbose_printf(sc->device, "timer disabled\n"); } +/* + * Reload the watchdog timer: writing anything to any of the lower five + * bits of the TCO_RLD register reloads the timer from the last value + * written to TCO_TMR. + */ static __inline void ichwd_tmr_reload(struct ichwd_softc *sc) { @@ -194,6 +231,10 @@ ichwd_tmr_reload(struct ichwd_softc *sc) ichwd_verbose_printf(sc->device, "timer reloaded\n"); } +/* + * Set the initial timeout value. Note that this must always be followed + * by a reload. + */ static __inline void ichwd_tmr_set(struct ichwd_softc *sc, unsigned int timeout) { @@ -262,7 +303,8 @@ ichwd_clear_noreboot(struct ichwd_softc } /* - * Watchdog event handler. + * Watchdog event handler - called by the framework to enable or disable + * the watchdog or change the initial timeout value. */ static void ichwd_event(void *arg, unsigned int cmd, int *error) @@ -426,6 +468,13 @@ ichwd_attach(device_t dev) device_printf(dev, "%s (ICH%d or equivalent)\n", device_get_desc(dev), sc->ich_version); + /* + * XXX we should check the status registers (specifically, the + * TCO_SECOND_TO_STS bit in the TCO2_STS register) to see if we + * just came back from a watchdog-induced reset, and let the user + * know. + */ + /* reset the watchdog status registers */ ichwd_sts_reset(sc); @@ -435,8 +484,8 @@ ichwd_attach(device_t dev) /* register the watchdog event handler */ sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, ichwd_event, sc, 0); - /* enable watchdog timeout interrupts */ - ichwd_intr_enable(sc); + /* disable the SMI handler */ + ichwd_smi_disable(sc); return (0); fail: @@ -466,8 +515,8 @@ ichwd_detach(device_t dev) if (sc->active) ichwd_tmr_disable(sc); - /* disable watchdog timeout interrupts */ - ichwd_intr_disable(sc); + /* enable the SMI handler */ + ichwd_smi_enable(sc); /* deregister event handler */ if (sc->ev_tag != NULL) From owner-svn-src-stable@FreeBSD.ORG Thu May 14 02:42:31 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47676106564A; Thu, 14 May 2009 02:42:31 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33FDF8FC15; Thu, 14 May 2009 02:42:31 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E2gTHA074632; Thu, 14 May 2009 02:42:29 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E2gTCr074630; Thu, 14 May 2009 02:42:29 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905140242.n4E2gTCr074630@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 14 May 2009 02:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192079 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/procfs fs/pseudofs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:42:32 -0000 Author: des Date: Thu May 14 02:42:29 2009 New Revision: 192079 URL: http://svn.freebsd.org/changeset/base/192079 Log: MFC r188677: always call pfs_attr if defined MFC r190806: fix incorrect KASSERT, add more MFC r188677: remove incorrect locking Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/procfs/procfs.c stable/7/sys/fs/pseudofs/pseudofs_vnops.c Modified: stable/7/sys/fs/procfs/procfs.c ============================================================================== --- stable/7/sys/fs/procfs/procfs.c Thu May 14 02:27:38 2009 (r192078) +++ stable/7/sys/fs/procfs/procfs.c Thu May 14 02:42:29 2009 (r192079) @@ -99,7 +99,6 @@ procfs_docurproc(PFS_FILL_ARGS) int procfs_attr(PFS_ATTR_ARGS) { - PROC_LOCK_ASSERT(p, MA_OWNED); /* XXX inefficient, split into separate functions */ if (strcmp(pn->pn_name, "ctl") == 0 || @@ -112,11 +111,12 @@ procfs_attr(PFS_ATTR_ARGS) strcmp(pn->pn_name, "fpregs") == 0) vap->va_mode = 0600; - if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir) - vap->va_mode = 0; + if (p != NULL) { + PROC_LOCK_ASSERT(p, MA_OWNED); - vap->va_uid = p->p_ucred->cr_uid; - vap->va_gid = p->p_ucred->cr_gid; + if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir) + vap->va_mode = 0; + } return (0); } Modified: stable/7/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/7/sys/fs/pseudofs/pseudofs_vnops.c Thu May 14 02:27:38 2009 (r192078) +++ stable/7/sys/fs/pseudofs/pseudofs_vnops.c Thu May 14 02:42:29 2009 (r192079) @@ -52,6 +52,20 @@ __FBSDID("$FreeBSD$"); #include #include +#define KASSERT_PN_IS_DIR(pn) \ + KASSERT((pn)->pn_type == pfstype_root || \ + (pn)->pn_type == pfstype_dir || \ + (pn)->pn_type == pfstype_procdir, \ + ("%s(): VDIR vnode refers to non-directory pfs_node", __func__)) + +#define KASSERT_PN_IS_FILE(pn) \ + KASSERT((pn)->pn_type == pfstype_file, \ + ("%s(): VREG vnode refers to non-file pfs_node", __func__)) + +#define KASSERT_PN_IS_LINK(pn) \ + KASSERT((pn)->pn_type == pfstype_symlink, \ + ("%s(): VLNK vnode refers to non-link pfs_node", __func__)) + /* * Returns the fileno, adjusted for target pid */ @@ -226,14 +240,17 @@ pfs_getattr(struct vop_getattr_args *va) if (proc != NULL) { vap->va_uid = proc->p_ucred->cr_ruid; vap->va_gid = proc->p_ucred->cr_rgid; - if (pn->pn_attr != NULL) - error = pn_attr(va->a_td, proc, pn, vap); - PROC_UNLOCK(proc); } else { vap->va_uid = 0; vap->va_gid = 0; } + if (pn->pn_attr != NULL) + error = pn_attr(va->a_td, proc, pn, vap); + + if(proc != NULL) + PROC_UNLOCK(proc); + PFS_RETURN (error); } @@ -254,6 +271,7 @@ pfs_ioctl(struct vop_ioctl_args *va) if (vn->v_type != VREG) PFS_RETURN (EINVAL); + KASSERT_PN_IS_FILE(pn); if (pn->pn_ioctl == NULL) PFS_RETURN (ENOTTY); @@ -330,6 +348,7 @@ pfs_lookup(struct vop_cachedlookup_args if (vn->v_type != VDIR) PFS_RETURN (ENOTDIR); + KASSERT_PN_IS_DIR(pd); error = VOP_ACCESS(vn, VEXEC, cnp->cn_cred, cnp->cn_thread); if (error) @@ -484,6 +503,7 @@ pfs_read(struct vop_read_args *va) if (vn->v_type != VREG) PFS_RETURN (EINVAL); + KASSERT_PN_IS_FILE(pn); if (!(pn->pn_flags & PFS_RD)) PFS_RETURN (EBADF); @@ -626,6 +646,7 @@ pfs_readdir(struct vop_readdir_args *va) if (vn->v_type != VDIR) PFS_RETURN (ENOTDIR); + KASSERT_PN_IS_DIR(pd); uio = va->a_uio; /* only allow reading entire entries */ @@ -734,6 +755,7 @@ pfs_readlink(struct vop_readlink_args *v if (vn->v_type != VLNK) PFS_RETURN (EINVAL); + KASSERT_PN_IS_LINK(pn); if (pn->pn_fill == NULL) PFS_RETURN (EIO); @@ -819,8 +841,7 @@ pfs_write(struct vop_write_args *va) if (vn->v_type != VREG) PFS_RETURN (EINVAL); - KASSERT(pn->pn_type != pfstype_file, - ("%s(): VREG vnode refers to non-file pfs_node", __func__)); + KASSERT_PN_IS_FILE(pn); if (!(pn->pn_flags & PFS_WR)) PFS_RETURN (EBADF); @@ -840,9 +861,7 @@ pfs_write(struct vop_write_args *va) } if (pn->pn_flags & PFS_RAWWR) { - pfs_lock(pn); error = pn_fill(curthread, proc, pn, NULL, uio); - pfs_unlock(pn); if (proc != NULL) PRELE(proc); PFS_RETURN (error); From owner-svn-src-stable@FreeBSD.ORG Thu May 14 07:32:33 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C33341065670; Thu, 14 May 2009 07:32:33 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B007E8FC1A; Thu, 14 May 2009 07:32:33 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E7WX3v080801; Thu, 14 May 2009 07:32:33 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E7WXpn080800; Thu, 14 May 2009 07:32:33 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200905140732.n4E7WXpn080800@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Thu, 14 May 2009 07:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192088 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipsec X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 07:32:34 -0000 Author: vanhu Date: Thu May 14 07:32:33 2009 New Revision: 192088 URL: http://svn.freebsd.org/changeset/base/192088 Log: MFC: Fixed deletion of sav entries in key_delsah() Approved by: gnn(mentor) Obtained from: NETASQ Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netipsec/key.c Modified: stable/7/sys/netipsec/key.c ============================================================================== --- stable/7/sys/netipsec/key.c Thu May 14 06:50:30 2009 (r192087) +++ stable/7/sys/netipsec/key.c Thu May 14 07:32:33 2009 (r192088) @@ -2654,7 +2654,12 @@ key_delsah(sah) if (sav->refcnt == 0) { /* sanity check */ KEY_CHKSASTATE(state, sav->state, __func__); - KEY_FREESAV(&sav); + /* + * do NOT call KEY_FREESAV here: + * it will only delete the sav if refcnt == 1, + * where we already know that refcnt == 0 + */ + key_delsav(sav); } else { /* give up to delete this sa */ zombie++; @@ -4086,6 +4091,7 @@ key_flush_sad(time_t now) /* if LARVAL entry doesn't become MATURE, delete it. */ LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_LARVAL], chain, nextsav) { + /* Need to also check refcnt for a larval SA ??? */ if (now - sav->created > key_larval_lifetime) KEY_FREESAV(&sav); } From owner-svn-src-stable@FreeBSD.ORG Thu May 14 11:03:06 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F1881065670; Thu, 14 May 2009 11:03:06 +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 4D5428FC17; Thu, 14 May 2009 11:03:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EB36K0089217; Thu, 14 May 2009 11:03:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EB36g2089216; Thu, 14 May 2009 11:03:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905141103.n4EB36g2089216@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 14 May 2009 11:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192095 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 11:03:07 -0000 Author: kib Date: Thu May 14 11:03:05 2009 New Revision: 192095 URL: http://svn.freebsd.org/changeset/base/192095 Log: MFC r192001: Prevent overflow of uio_resid. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_syscalls.c Modified: stable/7/sys/kern/vfs_syscalls.c ============================================================================== --- stable/7/sys/kern/vfs_syscalls.c Thu May 14 10:54:57 2009 (r192094) +++ stable/7/sys/kern/vfs_syscalls.c Thu May 14 11:03:05 2009 (r192095) @@ -2360,6 +2360,9 @@ kern_readlink(struct thread *td, char *p struct nameidata nd; int vfslocked; + if (count > INT_MAX) + return (EINVAL); + NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | AUDITVNODE1, pathseg, path, td); if ((error = namei(&nd)) != 0) From owner-svn-src-stable@FreeBSD.ORG Thu May 14 13:36:40 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F60C106566B; Thu, 14 May 2009 13:36:40 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC7C68FC0A; Thu, 14 May 2009 13:36:39 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EDadxa092421; Thu, 14 May 2009 13:36:39 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EDadT4092402; Thu, 14 May 2009 13:36:39 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200905141336.n4EDadT4092402@svn.freebsd.org> From: Attilio Rao Date: Thu, 14 May 2009 13:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192098 - in stable/6: gnu/usr.bin/gdb/libgdb lib/libthr/thread lib/libthread_db lib/libthread_db/arch/alpha lib/libthread_db/arch/amd64 lib/libthread_db/arch/i386 lib/libthread_db/arch... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 13:36:40 -0000 Author: attilio Date: Thu May 14 13:36:39 2009 New Revision: 192098 URL: http://svn.freebsd.org/changeset/base/192098 Log: MFC libthread_db modifies until r181651: - Introduce and use new functions pthread_{read, write}_* - Move psaddr_t from void * to uintptr_t - Fix some ABI mismatches - Introduce WARN 6 for compilation Added: stable/6/lib/libthread_db/libc_r_db.h (contents, props changed) Modified: stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c stable/6/lib/libthr/thread/thr_event.c stable/6/lib/libthread_db/Makefile stable/6/lib/libthread_db/arch/alpha/libc_r_md.c stable/6/lib/libthread_db/arch/alpha/libpthread_md.c stable/6/lib/libthread_db/arch/amd64/libc_r_md.c stable/6/lib/libthread_db/arch/amd64/libpthread_md.c stable/6/lib/libthread_db/arch/i386/libc_r_md.c stable/6/lib/libthread_db/arch/i386/libpthread_md.c stable/6/lib/libthread_db/arch/ia64/libc_r_md.c stable/6/lib/libthread_db/arch/ia64/libpthread_md.c stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c stable/6/lib/libthread_db/libc_r_db.c stable/6/lib/libthread_db/libpthread_db.c stable/6/lib/libthread_db/libpthread_db.h stable/6/lib/libthread_db/libthr_db.c stable/6/lib/libthread_db/thread_db.c stable/6/lib/libthread_db/thread_db.h stable/6/lib/libthread_db/thread_db_int.h stable/6/sys/sys/procfs.h Modified: stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c ============================================================================== --- stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Thu May 14 13:36:39 2009 (r192098) @@ -710,7 +710,7 @@ check_event (ptid_t ptid) error ("Cannot get thread event message: %s", thread_db_err_str (err)); } - err = td_thr_get_info_p (msg.th_p, &ti); + err = td_thr_get_info_p ((void*)(uintptr_t)msg.th_p, &ti); if (err != TD_OK) error ("Cannot get thread info: %s", thread_db_err_str (err)); ptid = BUILD_THREAD (ti.ti_tid, GET_PID (ptid)); @@ -720,7 +720,7 @@ check_event (ptid_t ptid) /* We may already know about this thread, for instance when the user has issued the `info threads' command before the SIGTRAP for hitting the thread creation breakpoint was reported. */ - attach_thread (ptid, msg.th_p, &ti, 1); + attach_thread (ptid, (void *)(uintptr_t)msg.th_p, &ti, 1); break; case TD_DEATH: if (!in_thread_list (ptid)) @@ -1178,13 +1178,14 @@ fbsd_thread_pid_to_str (ptid_t ptid) if (ti.ti_lid != 0) { - snprintf (buf, sizeof (buf), "Thread %p (LWP %d)", - th.th_thread, ti.ti_lid); + snprintf (buf, sizeof (buf), "Thread %llx (LWP %d)", + (unsigned long long)th.th_thread, ti.ti_lid); } else { - snprintf (buf, sizeof (buf), "Thread %p (%s)", - th.th_thread, thread_db_state_str (ti.ti_state)); + snprintf (buf, sizeof (buf), "Thread %llx (%s)", + (unsigned long long)th.th_thread, + thread_db_state_str (ti.ti_state)); } return buf; Modified: stable/6/lib/libthr/thread/thr_event.c ============================================================================== --- stable/6/lib/libthr/thread/thr_event.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthr/thread/thr_event.c Thu May 14 13:36:39 2009 (r192098) @@ -42,7 +42,7 @@ void _thr_report_creation(struct pthread *curthread, struct pthread *newthread) { curthread->event_buf.event = TD_CREATE; - curthread->event_buf.th_p = (td_thrhandle_t *)newthread; + curthread->event_buf.th_p = (uintptr_t)newthread; curthread->event_buf.data = 0; THR_UMTX_LOCK(curthread, &_thr_event_lock); _thread_last_event = curthread; @@ -55,7 +55,7 @@ void _thr_report_death(struct pthread *curthread) { curthread->event_buf.event = TD_DEATH; - curthread->event_buf.th_p = (td_thrhandle_t *)curthread; + curthread->event_buf.th_p = (uintptr_t)curthread; curthread->event_buf.data = 0; THR_UMTX_LOCK(curthread, &_thr_event_lock); _thread_last_event = curthread; Modified: stable/6/lib/libthread_db/Makefile ============================================================================== --- stable/6/lib/libthread_db/Makefile Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/Makefile Thu May 14 13:36:39 2009 (r192098) @@ -9,7 +9,7 @@ SRCS+= libpthread_db.c libpthread_md.c SRCS+= libc_r_db.c libc_r_md.c SRCS+= libthr_db.c INCS= thread_db.h -WARNS?= 1 +WARNS?= 6 CFLAGS+=-I. -I${.CURDIR} Modified: stable/6/lib/libthread_db/arch/alpha/libc_r_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/alpha/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/alpha/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) @@ -27,8 +27,7 @@ #include __FBSDID("$FreeBSD$"); -#include -#include +#include "libc_r_db.h" void libc_r_md_getgregs(jmp_buf jb, prgregset_t r) @@ -68,6 +67,6 @@ libc_r_md_getgregs(jmp_buf jb, prgregset } void -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) { } Modified: stable/6/lib/libthread_db/arch/alpha/libpthread_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) @@ -30,23 +30,25 @@ __FBSDID("$FreeBSD$"); #include #include +#include "libpthread_db.h" + void -pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) +pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) { } void -pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) +pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) { } void -pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) +pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) { } void -pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) +pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) { } @@ -56,7 +58,7 @@ pt_md_init(void) } int -pt_reg_sstep(struct reg *reg, int step) +pt_reg_sstep(struct reg *reg __unused, int step __unused) { return (0); } Modified: stable/6/lib/libthread_db/arch/amd64/libc_r_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/amd64/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/amd64/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) @@ -27,15 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include +#include "libc_r_db.h" void -libc_r_md_getgregs(jmp_buf jb, prgregset_t *r) +libc_r_md_getgregs(jmp_buf jb __unused, prgregset_t r __unused) { } void -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) { } Modified: stable/6/lib/libthread_db/arch/amd64/libpthread_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/amd64/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/amd64/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) @@ -29,8 +29,11 @@ __FBSDID("$FreeBSD$"); #include +#include #include +#include "libpthread_db.h" + void pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) { Modified: stable/6/lib/libthread_db/arch/i386/libc_r_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/i386/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/i386/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) @@ -27,8 +27,7 @@ #include __FBSDID("$FreeBSD$"); -#include -#include +#include "libc_r_db.h" void libc_r_md_getgregs(jmp_buf jb, prgregset_t r) @@ -43,6 +42,6 @@ libc_r_md_getgregs(jmp_buf jb, prgregset } void -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) { } Modified: stable/6/lib/libthread_db/arch/i386/libpthread_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/i386/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/i386/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) @@ -27,11 +27,10 @@ #include __FBSDID("$FreeBSD$"); -#include #include -#include -#include #include +#include +#include #include "libpthread_db.h" Modified: stable/6/lib/libthread_db/arch/ia64/libc_r_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/ia64/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/ia64/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) @@ -27,15 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include +#include "libc_r_db.h" void -libc_r_md_getgregs(jmp_buf jb, prgregset_t *r) +libc_r_md_getgregs(jmp_buf jb __unused, prgregset_t r __unused) { } void -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) { } Modified: stable/6/lib/libthread_db/arch/ia64/libpthread_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/ia64/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/ia64/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) @@ -28,25 +28,28 @@ __FBSDID("$FreeBSD$"); #include +#include #include +#include "libpthread_db.h" + void -pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) +pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) { } void -pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) +pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) { } void -pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) +pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) { } void -pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) +pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) { } @@ -56,7 +59,7 @@ pt_md_init(void) } int -pt_reg_sstep(struct reg *reg, int step) +pt_reg_sstep(struct reg *reg __unused, int step __unused) { return (0); } Modified: stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) @@ -27,15 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include +#include "libc_r_db.h" void -libc_r_md_getgregs(jmp_buf jb, prgregset_t *r) +libc_r_md_getgregs(jmp_buf jb __unused, prgregset_t r __unused) { } void -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) { } Modified: stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) @@ -28,25 +28,28 @@ __FBSDID("$FreeBSD$"); #include +#include #include +#include "libpthread_db.h" + void -pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) +pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) { } void -pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) +pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) { } void -pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) +pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) { } void -pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) +pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) { } @@ -56,7 +59,7 @@ pt_md_init(void) } int -pt_reg_sstep(struct reg *reg, int step) +pt_reg_sstep(struct reg *reg __unused, int step __unused) { return (0); } Modified: stable/6/lib/libthread_db/libc_r_db.c ============================================================================== --- stable/6/lib/libthread_db/libc_r_db.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/libc_r_db.c Thu May 14 13:36:39 2009 (r192098) @@ -34,11 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include "libc_r_db.h" #include "thread_db_int.h" -void libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *); -void libc_r_md_getgregs(jmp_buf jb, prgregset_t); - struct td_thragent { TD_THRAGENT_FIELDS; struct ps_prochandle *ta_ph; @@ -51,13 +49,14 @@ struct td_thragent { }; static td_err_e -libc_r_db_init() +libc_r_db_init(void) { return (TD_OK); } static td_err_e -libc_r_db_ta_clear_event(const td_thragent_t *ta, td_thr_events_t *ev) +libc_r_db_ta_clear_event(const td_thragent_t *ta __unused, + td_thr_events_t *ev __unused) { return (0); } @@ -70,27 +69,28 @@ libc_r_db_ta_delete(td_thragent_t *ta) } static td_err_e -libc_r_db_ta_event_addr(const td_thragent_t *ta, td_thr_events_e ev, - td_notify_t *n) +libc_r_db_ta_event_addr(const td_thragent_t *ta __unused, + td_thr_events_e ev __unused, td_notify_t *n __unused) { return (TD_ERR); } static td_err_e -libc_r_db_ta_event_getmsg(const td_thragent_t *ta, td_event_msg_t *msg) +libc_r_db_ta_event_getmsg(const td_thragent_t *ta __unused, + td_event_msg_t *msg __unused) { return (TD_ERR); } static td_err_e -libc_r_db_ta_map_id2thr(const td_thragent_t *ta, thread_t tid, - td_thrhandle_t *th) +libc_r_db_ta_map_id2thr(const td_thragent_t *ta __unused, thread_t tid __unused, + td_thrhandle_t *th __unused) { return (TD_ERR); } static td_err_e -libc_r_db_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwpid, +libc_r_db_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwpid __unused, td_thrhandle_t *th) { psaddr_t addr; @@ -100,7 +100,7 @@ libc_r_db_ta_map_lwp2thr(const td_thrage err = ps_pread(ta->ta_ph, ta->ta_thread_initial, &addr, sizeof(addr)); if (err != PS_OK) return (TD_ERR); - if (addr == NULL) + if (addr == 0) return (TD_NOLWP); err = ps_pread(ta->ta_ph, ta->ta_thread_run, &th->th_thread, sizeof(psaddr_t)); @@ -159,14 +159,16 @@ libc_r_db_ta_new(struct ps_prochandle *p } static td_err_e -libc_r_db_ta_set_event(const td_thragent_t *ta, td_thr_events_t *ev) +libc_r_db_ta_set_event(const td_thragent_t *ta __unused, + td_thr_events_t *ev __unused) { return (0); } static td_err_e libc_r_db_ta_thr_iter(const td_thragent_t *ta, td_thr_iter_f *cb, void *data, - td_thr_state_e state, int pri, sigset_t *mask, unsigned int flags) + td_thr_state_e state __unused, int pri __unused, sigset_t *mask __unused, + unsigned int flags __unused) { td_thrhandle_t th; psaddr_t addr; @@ -178,10 +180,10 @@ libc_r_db_ta_thr_iter(const td_thragent_ sizeof(th.th_thread)); if (err != PS_OK) return (TD_ERR); - while (th.th_thread != NULL) { + while (th.th_thread != 0) { if (cb(&th, data) != 0) return (TD_OK); - addr = (psaddr_t)((uintptr_t)th.th_thread + ta->ta_ofs_next); + addr = (psaddr_t)(th.th_thread + ta->ta_ofs_next); err = ps_pread(ta->ta_ph, addr, &th.th_thread, sizeof(th.th_thread)); if (err != PS_OK) @@ -191,19 +193,21 @@ libc_r_db_ta_thr_iter(const td_thragent_ } static td_err_e -libc_r_db_thr_clear_event(const td_thrhandle_t *th, td_thr_events_t *ev) +libc_r_db_thr_clear_event(const td_thrhandle_t *th __unused, + td_thr_events_t *ev __unused) { return (0); } static td_err_e -libc_r_db_thr_event_enable(const td_thrhandle_t *th, int oo) +libc_r_db_thr_event_enable(const td_thrhandle_t *th __unused, int oo __unused) { return (0); } static td_err_e -libc_r_db_thr_event_getmsg(const td_thrhandle_t *th, td_event_msg_t *msg) +libc_r_db_thr_event_getmsg(const td_thrhandle_t *th __unused, + td_event_msg_t *msg __unused) { return (TD_ERR); } @@ -231,7 +235,8 @@ libc_r_db_thr_get_info(const td_thrhandl #ifdef __i386__ static td_err_e -libc_r_db_thr_getxmmregs(const td_thrhandle_t *th, char *fxsave) +libc_r_db_thr_getxmmregs(const td_thrhandle_t *th __unused, + char *fxsave __unused) { return (TD_NOFPREGS); } @@ -288,33 +293,37 @@ libc_r_db_thr_getgregs(const td_thrhandl } static td_err_e -libc_r_db_thr_set_event(const td_thrhandle_t *th, td_thr_events_t *ev) +libc_r_db_thr_set_event(const td_thrhandle_t *th __unused, + td_thr_events_t *ev __unused) { return (0); } #ifdef __i386__ static td_err_e -libc_r_db_thr_setxmmregs(const td_thrhandle_t *th, const char *fxsave) +libc_r_db_thr_setxmmregs(const td_thrhandle_t *th __unused, + const char *fxsave __unused) { return (TD_NOFPREGS); } #endif static td_err_e -libc_r_db_thr_setfpregs(const td_thrhandle_t *th, const prfpregset_t *r) +libc_r_db_thr_setfpregs(const td_thrhandle_t *th __unused, + const prfpregset_t *r __unused) { return (TD_ERR); } static td_err_e -libc_r_db_thr_setgregs(const td_thrhandle_t *th, const prgregset_t r) +libc_r_db_thr_setgregs(const td_thrhandle_t *th __unused, + const prgregset_t r __unused) { return (TD_ERR); } static td_err_e -libc_r_db_thr_validate(const td_thrhandle_t *th) +libc_r_db_thr_validate(const td_thrhandle_t *th __unused) { return (TD_ERR); } Added: stable/6/lib/libthread_db/libc_r_db.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/6/lib/libthread_db/libc_r_db.h Thu May 14 13:36:39 2009 (r192098) @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008 Sandvine Incorporated + * All rights reserved. + * + * This software was developed by Attilio Rao for the SVOS project under + * contract to Sandvine Incorporated. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LIBC_R_DB_H_ +#define _LIBC_R_DB_H_ + +#include +#include + +void libc_r_md_getgregs(jmp_buf jb, prgregset_t r); +void libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r); + +#endif /* _LIBC_R_DB_H_ */ Modified: stable/6/lib/libthread_db/libpthread_db.c ============================================================================== --- stable/6/lib/libthread_db/libpthread_db.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/libpthread_db.c Thu May 14 13:36:39 2009 (r192098) @@ -70,7 +70,7 @@ ps2td(int c) } static long -pt_map_thread(const td_thragent_t *const_ta, psaddr_t pt, int type) +pt_map_thread(const td_thragent_t *const_ta, psaddr_t pt, enum pt_type type) { td_thragent_t *ta = __DECONST(td_thragent_t *, const_ta); struct pt_map *new; @@ -220,7 +220,6 @@ static td_err_e pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) { prgregset_t gregs; - TAILQ_HEAD(, pthread) thread_list; psaddr_t pt, tcb_addr; lwpid_t lwp; int ret; @@ -229,28 +228,24 @@ pt_ta_map_id2thr(const td_thragent_t *ta if (id < 0 || id >= ta->map_len || ta->map[id].type == PT_NONE) return (TD_NOTHR); - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, - sizeof(thread_list)); + + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); if (ret != 0) - return (P2T(ret)); - pt = (psaddr_t)thread_list.tqh_first; + return (TD_ERR); if (ta->map[id].type == PT_LWP) { /* * if we are referencing a lwp, make sure it was not already * mapped to user thread. */ while (pt != 0) { - ret = ps_pread(ta->ph, - pt + ta->thread_off_tcb, - &tcb_addr, sizeof(tcb_addr)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_tcb, + &tcb_addr); if (ret != 0) - return (P2T(ret)); - ret = ps_pread(ta->ph, - tcb_addr + ta->thread_off_tmbx + - offsetof(struct kse_thr_mailbox, tm_lwp), - &lwp, sizeof(lwp)); + return (TD_ERR); + ret = thr_pread_int(ta, tcb_addr + ta->thread_off_tmbx + + offsetof(struct kse_thr_mailbox, tm_lwp), &lwp); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); /* * If the lwp was already mapped to userland thread, * we shouldn't reference it directly in future. @@ -260,11 +255,9 @@ pt_ta_map_id2thr(const td_thragent_t *ta return (TD_NOTHR); } /* get next thread */ - ret = ps_pread(ta->ph, - pt + ta->thread_off_next, - &pt, sizeof(pt)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); } /* check lwp */ ret = ps_lgetregs(ta->ph, ta->map[id].lwp, gregs); @@ -275,17 +268,14 @@ pt_ta_map_id2thr(const td_thragent_t *ta } } else { while (pt != 0 && ta->map[id].thr != pt) { - ret = ps_pread(ta->ph, - pt + ta->thread_off_tcb, - &tcb_addr, sizeof(tcb_addr)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_tcb, + &tcb_addr); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); /* get next thread */ - ret = ps_pread(ta->ph, - pt + ta->thread_off_next, - &pt, sizeof(pt)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); } if (pt == 0) { @@ -303,29 +293,24 @@ pt_ta_map_id2thr(const td_thragent_t *ta static td_err_e pt_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwp, td_thrhandle_t *th) { - TAILQ_HEAD(, pthread) thread_list; - psaddr_t pt, ptr; - lwpid_t tmp_lwp; + psaddr_t pt, tcb_addr; + lwpid_t lwp1; int ret; - + TDBG_FUNC(); - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, - sizeof(thread_list)); + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); if (ret != 0) - return (P2T(ret)); - pt = (psaddr_t)thread_list.tqh_first; + return (TD_ERR); while (pt != 0) { - ret = ps_pread(ta->ph, pt + ta->thread_off_tcb, - &ptr, sizeof(ptr)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_tcb, &tcb_addr); if (ret != 0) - return (P2T(ret)); - ptr += ta->thread_off_tmbx + - offsetof(struct kse_thr_mailbox, tm_lwp); - ret = ps_pread(ta->ph, ptr, &tmp_lwp, sizeof(lwpid_t)); + return (TD_ERR); + ret = thr_pread_int(ta, tcb_addr + ta->thread_off_tmbx + + offsetof(struct kse_thr_mailbox, tm_lwp), &lwp1); if (ret != 0) - return (P2T(ret)); - if (tmp_lwp == lwp) { + return (TD_ERR); + if (lwp1 == lwp) { th->th_ta = ta; th->th_tid = pt_map_thread(ta, pt, PT_USER); if (th->th_tid == -1) @@ -336,28 +321,23 @@ pt_ta_map_lwp2thr(const td_thragent_t *t } /* get next thread */ - ret = ps_pread(ta->ph, - pt + ta->thread_off_next, - &pt, sizeof(pt)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); } return (TD_NOTHR); } static td_err_e -pt_ta_thr_iter(const td_thragent_t *ta, - td_thr_iter_f *callback, void *cbdata_p, - td_thr_state_e state, int ti_pri, - sigset_t *ti_sigmask_p, - unsigned int ti_user_flags) +pt_ta_thr_iter(const td_thragent_t *ta, td_thr_iter_f *callback, + void *cbdata_p, td_thr_state_e state __unused, int ti_pri __unused, + sigset_t *ti_sigmask_p __unused, unsigned int ti_user_flags __unused) { - TAILQ_HEAD(, pthread) thread_list; td_thrhandle_t th; psaddr_t pt; ps_err_e pserr; - int activated; + int activated, ret; TDBG_FUNC(); @@ -368,11 +348,9 @@ pt_ta_thr_iter(const td_thragent_t *ta, if (!activated) return (TD_OK); - pserr = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, - sizeof(thread_list)); - if (pserr != 0) - return (P2T(pserr)); - pt = (psaddr_t)thread_list.tqh_first; + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); + if (ret != 0) + return (TD_ERR); while (pt != 0) { th.th_ta = ta; th.th_tid = pt_map_thread(ta, pt, PT_USER); @@ -383,11 +361,9 @@ pt_ta_thr_iter(const td_thragent_t *ta, if ((*callback)(&th, cbdata_p)) return (TD_DBERR); /* get next thread */ - pserr = ps_pread(ta->ph, - pt + ta->thread_off_next, &pt, - sizeof(pt)); - if (pserr != PS_OK) - return (P2T(pserr)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); + if (ret != 0) + return (TD_ERR); } return (TD_OK); } @@ -395,7 +371,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, static td_err_e pt_ta_tsd_iter(const td_thragent_t *ta, td_key_iter_f *ki, void *arg) { - char *keytable; + void *keytable; void *destructor; int i, ret, allocated; @@ -411,10 +387,10 @@ pt_ta_tsd_iter(const td_thragent_t *ta, return (P2T(ret)); } for (i = 0; i < ta->thread_max_keys; i++) { - allocated = *(int *)(keytable + i * ta->thread_size_key + - ta->thread_off_key_allocated); - destructor = *(void **)(keytable + i * ta->thread_size_key + - ta->thread_off_key_destructor); + allocated = *(int *)(void *)((uintptr_t)keytable + + i * ta->thread_size_key + ta->thread_off_key_allocated); + destructor = *(void **)(void *)((uintptr_t)keytable + + i * ta->thread_size_key + ta->thread_off_key_destructor); if (allocated) { ret = (ki)(i, destructor, arg); if (ret != 0) { @@ -428,28 +404,32 @@ pt_ta_tsd_iter(const td_thragent_t *ta, } static td_err_e -pt_ta_event_addr(const td_thragent_t *ta, td_event_e event, td_notify_t *ptr) +pt_ta_event_addr(const td_thragent_t *ta __unused, td_event_e event __unused, + td_notify_t *ptr __unused) { TDBG_FUNC(); return (TD_ERR); } static td_err_e -pt_ta_set_event(const td_thragent_t *ta, td_thr_events_t *events) +pt_ta_set_event(const td_thragent_t *ta __unused, + td_thr_events_t *events __unused) { TDBG_FUNC(); return (0); } static td_err_e -pt_ta_clear_event(const td_thragent_t *ta, td_thr_events_t *events) +pt_ta_clear_event(const td_thragent_t *ta __unused, + td_thr_events_t *events __unused) { TDBG_FUNC(); return (0); } static td_err_e -pt_ta_event_getmsg(const td_thragent_t *ta, td_event_msg_t *msg) +pt_ta_event_getmsg(const td_thragent_t *ta __unused, + td_event_msg_t *msg __unused) { TDBG_FUNC(); return (TD_NOMSG); @@ -458,7 +438,7 @@ pt_ta_event_getmsg(const td_thragent_t * static td_err_e pt_dbsuspend(const td_thrhandle_t *th, int suspend) { - td_thragent_t *ta = (td_thragent_t *)th->th_ta; + const td_thragent_t *ta = th->th_ta; psaddr_t tcb_addr, tmbx_addr, ptr; lwpid_t lwp; uint32_t dflags; @@ -952,28 +932,31 @@ pt_thr_setgregs(const td_thrhandle_t *th } static td_err_e -pt_thr_event_enable(const td_thrhandle_t *th, int en) +pt_thr_event_enable(const td_thrhandle_t *th __unused, int en __unused) { TDBG_FUNC(); return (0); } static td_err_e -pt_thr_set_event(const td_thrhandle_t *th, td_thr_events_t *setp) +pt_thr_set_event(const td_thrhandle_t *th __unused, + td_thr_events_t *setp __unused) { TDBG_FUNC(); return (0); } static td_err_e -pt_thr_clear_event(const td_thrhandle_t *th, td_thr_events_t *setp) +pt_thr_clear_event(const td_thrhandle_t *th __unused, + td_thr_events_t *setp __unused) { TDBG_FUNC(); return (0); } static td_err_e -pt_thr_event_getmsg(const td_thrhandle_t *th, td_event_msg_t *msg) +pt_thr_event_getmsg(const td_thrhandle_t *th __unused, + td_event_msg_t *msg __unused) { TDBG_FUNC(); return (TD_NOMSG); @@ -1074,17 +1057,16 @@ pt_validate(const td_thrhandle_t *th) return (TD_OK); } -td_err_e -pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset, - void **address) +static td_err_e +pt_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t _linkmap, size_t offset, + psaddr_t *address) { - char *obj_entry; const td_thragent_t *ta = th->th_ta; - psaddr_t tcb_addr, *dtv_addr; + psaddr_t dtv_addr, obj_entry, tcb_addr; int tls_index, ret; /* linkmap is a member of Obj_Entry */ - obj_entry = (char *)_linkmap - ta->thread_off_linkmap; + obj_entry = _linkmap - ta->thread_off_linkmap; /* get tlsindex of the object file */ ret = ps_pread(ta->ph, @@ -1106,8 +1088,8 @@ pt_thr_tls_get_addr(const td_thrhandle_t if (ret != 0) return (P2T(ret)); /* now get the object's tls block base address */ - ret = ps_pread(ta->ph, &dtv_addr[tls_index+1], address, - sizeof(*address)); + ret = ps_pread(ta->ph, dtv_addr + sizeof (void *) * (tls_index + 1), + address, sizeof(*address)); if (ret != 0) return (P2T(ret)); Modified: stable/6/lib/libthread_db/libpthread_db.h ============================================================================== --- stable/6/lib/libthread_db/libpthread_db.h Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/libpthread_db.h Thu May 14 13:36:39 2009 (r192098) @@ -34,13 +34,14 @@ #include "thread_db_int.h" -struct pt_map { - enum { - PT_NONE, - PT_USER, - PT_LWP - } type; +enum pt_type { + PT_NONE, + PT_USER, + PT_LWP +}; +struct pt_map { + enum pt_type type; union { lwpid_t lwp; psaddr_t thr; Modified: stable/6/lib/libthread_db/libthr_db.c ============================================================================== --- stable/6/lib/libthread_db/libthr_db.c Thu May 14 13:32:33 2009 (r192097) +++ stable/6/lib/libthread_db/libthr_db.c Thu May 14 13:36:39 2009 (r192098) @@ -201,36 +201,30 @@ pt_ta_delete(td_thragent_t *ta) static td_err_e pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) { - TAILQ_HEAD(, pthread) thread_list; psaddr_t pt; - long lwp; + int32_t lwp; int ret; TDBG_FUNC(); if (id == 0) return (TD_NOTHR); - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, - sizeof(thread_list)); + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); /* Iterate through thread list to find pthread */ - pt = (psaddr_t)thread_list.tqh_first; - while (pt != NULL) { - ret = ps_pread(ta->ph, pt + ta->thread_off_tid, - &lwp, sizeof(lwp)); + while (pt != 0) { + ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); if (lwp == id) break; /* get next thread */ - ret = ps_pread(ta->ph, - pt + ta->thread_off_next, - &pt, sizeof(pt)); + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); if (ret != 0) - return (P2T(ret)); + return (TD_ERR); } - if (pt == NULL) + if (pt == 0) return (TD_NOTHR); th->th_ta = ta; th->th_tid = id; @@ -245,30 +239,24 @@ pt_ta_map_lwp2thr(const td_thragent_t *t } static td_err_e -pt_ta_thr_iter(const td_thragent_t *ta, - td_thr_iter_f *callback, void *cbdata_p, - td_thr_state_e state, int ti_pri, - sigset_t *ti_sigmask_p, - unsigned int ti_user_flags) +pt_ta_thr_iter(const td_thragent_t *ta, td_thr_iter_f *callback, + void *cbdata_p, td_thr_state_e state __unused, int ti_pri __unused, + sigset_t *ti_sigmask_p __unused, unsigned int ti_user_flags __unused) { - TAILQ_HEAD(, pthread) thread_list; td_thrhandle_t th; psaddr_t pt; - long lwp; + int32_t lwp; int ret; TDBG_FUNC(); - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, - sizeof(thread_list)); + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); if (ret != 0) - return (P2T(ret)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu May 14 13:40:02 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E2A7106566B; Thu, 14 May 2009 13:40:02 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 879D88FC08; Thu, 14 May 2009 13:40:01 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by bwz9 with SMTP id 9so1287559bwz.43 for ; Thu, 14 May 2009 06:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=SrTd6VDzNnRFbzlvJIwjq/zsfaHA1gtb+I3/L02SlKQ=; b=LWI9DyB9OG1jLgVGloSoVFckxh0631Vnsgxk5SbD4HLzVtkLlH+EqgO438BxQugaXH ojFpXkf9IO0es1aynK+lLzL5v0tFsOeEDKljNPBOj35RulmSZ3zL853ncvSs65didpb5 FDSeprxAVkz2/YI5eRVhrRkT0ljqxap9Jww8U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=YtWIo5Jc2gSMmi0cb5rG+Gnq5Xt3DTyRKhDXbnmkX1neggQYmfo0Ig0VV0WyVE8e6P BBkpLxTqRB3Csgo2tBSAAG/M767XdVPoGiX1+BO7btwjgbXS4gMeHqrQcdbDS44KeZVV lJaWAeJYaKHVed/oEgaCviMZ1L3Dhmh7F+BkQ= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.113.3 with SMTP id y3mr1634034fap.71.1242308400092; Thu, 14 May 2009 06:40:00 -0700 (PDT) In-Reply-To: <200905141336.n4EDadT4092402@svn.freebsd.org> References: <200905141336.n4EDadT4092402@svn.freebsd.org> Date: Thu, 14 May 2009 15:40:00 +0200 X-Google-Sender-Auth: d3106e7abb844198 Message-ID: <3bbf2fe10905140640q548d4ecdh444a3e04fd8bed11@mail.gmail.com> From: Attilio Rao To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r192098 - in stable/6: gnu/usr.bin/gdb/libgdb lib/libthr/thread lib/libthread_db lib/libthread_db/arch/alpha lib/libthread_db/arch/amd64 lib/libthread_db/arch/i386 lib/libthread_db/arch... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 13:40:02 -0000 2009/5/14 Attilio Rao : > Author: attilio > Date: Thu May 14 13:36:39 2009 > New Revision: 192098 > URL: http://svn.freebsd.org/changeset/base/192098 > > Log: > MFC libthread_db modifies until r181651: > - Introduce and use new functions pthread_{read, write}_* > - Move psaddr_t from void * to uintptr_t > - Fix some ABI mismatches > - Introduce WARN 6 for compilation Forgot to mention: Reviewed by: emaste, marcel Tested by: emaste Sponsored by: Sandvine incorporated While here, please note that the patch is not still merged back to 7. It is preferable to wait for tree unfreezing and go-by just when the release was shipped. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-stable@FreeBSD.ORG Thu May 14 22:01:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1BEA106564A; Thu, 14 May 2009 22:01:00 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F17B8FC0A; Thu, 14 May 2009 22:01:00 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EM109R003736; Thu, 14 May 2009 22:01:00 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EM10EM003735; Thu, 14 May 2009 22:01:00 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905142201.n4EM10EM003735@svn.freebsd.org> From: Ed Schouten Date: Thu, 14 May 2009 22:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192123 - stable/7/usr.sbin/pstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:01:02 -0000 Author: ed Date: Thu May 14 22:01:00 2009 New Revision: 192123 URL: http://svn.freebsd.org/changeset/base/192123 Log: Make the layout of pstat -t less awful. Right now we have a device named "consolectl", but pstat only reserves 7 columns for the device name. Increase it to 10 to make it fit. This patch only applies to pre-MPSAFE TTY. Modified: stable/7/usr.sbin/pstat/pstat.c Modified: stable/7/usr.sbin/pstat/pstat.c ============================================================================== --- stable/7/usr.sbin/pstat/pstat.c Thu May 14 21:53:35 2009 (r192122) +++ stable/7/usr.sbin/pstat/pstat.c Thu May 14 22:01:00 2009 (r192123) @@ -215,7 +215,7 @@ static const char fhdr64[] = /* c000000000000000 ------ RWAI 123 123 c000000000000000 1000000000000000 */ static const char hdr[] = -" LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n"; +" LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n"; static void ttymode_kvm(void) @@ -348,9 +348,9 @@ ttyprt(struct xtty *xt) errx(1, "struct xtty size mismatch"); if (usenumflag || xt->xt_dev == 0 || (name = devname(xt->xt_dev, S_IFCHR)) == NULL) - printf(" %2d,%-2d", major(xt->xt_dev), minor(xt->xt_dev)); + printf("%5d,%4d ", major(xt->xt_dev), minor(xt->xt_dev)); else - (void)printf("%7s ", name); + (void)printf("%10s ", name); (void)printf("%2ld %3ld ", xt->xt_rawcc, xt->xt_cancc); (void)printf("%3ld %5d %5d %4d %3d %7d ", xt->xt_outcc, xt->xt_ihiwat, xt->xt_ilowat, xt->xt_ohiwat, xt->xt_olowat, From owner-svn-src-stable@FreeBSD.ORG Thu May 14 22:01:14 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A814010657F7; Thu, 14 May 2009 22:01:14 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ED488FC16; Thu, 14 May 2009 22:01:14 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EM1EOP003779; Thu, 14 May 2009 22:01:14 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EM1Ewa003778; Thu, 14 May 2009 22:01:14 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905142201.n4EM1Ewa003778@svn.freebsd.org> From: Ed Schouten Date: Thu, 14 May 2009 22:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192124 - stable/6/usr.sbin/pstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:01:18 -0000 Author: ed Date: Thu May 14 22:01:14 2009 New Revision: 192124 URL: http://svn.freebsd.org/changeset/base/192124 Log: Make the layout of pstat -t less awful. Right now we have a device named "consolectl", but pstat only reserves 7 columns for the device name. Increase it to 10 to make it fit. This patch only applies to pre-MPSAFE TTY. Modified: stable/6/usr.sbin/pstat/pstat.c Modified: stable/6/usr.sbin/pstat/pstat.c ============================================================================== --- stable/6/usr.sbin/pstat/pstat.c Thu May 14 22:01:00 2009 (r192123) +++ stable/6/usr.sbin/pstat/pstat.c Thu May 14 22:01:14 2009 (r192124) @@ -209,7 +209,7 @@ static const char fhdr64[] = /* c000000000000000 ------ RWAI 123 123 c000000000000000 1000000000000000 */ static const char hdr[] = -" LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n"; +" LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n"; static void ttymode_kvm(void) @@ -342,9 +342,9 @@ ttyprt(struct xtty *xt) errx(1, "struct xtty size mismatch"); if (usenumflag || xt->xt_dev == 0 || (name = devname(xt->xt_dev, S_IFCHR)) == NULL) - printf(" %2d,%-2d", major(xt->xt_dev), minor(xt->xt_dev)); + printf("%5d,%4d ", major(xt->xt_dev), minor(xt->xt_dev)); else - (void)printf("%7s ", name); + (void)printf("%10s ", name); (void)printf("%2ld %3ld ", xt->xt_rawcc, xt->xt_cancc); (void)printf("%3ld %5d %5d %4d %3d %7d ", xt->xt_outcc, xt->xt_ihiwat, xt->xt_ilowat, xt->xt_ohiwat, xt->xt_olowat, From owner-svn-src-stable@FreeBSD.ORG Fri May 15 05:31:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4783E1065670; Fri, 15 May 2009 05:31:00 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 142388FC17; Fri, 15 May 2009 05:30:59 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 5EA20342704; Fri, 15 May 2009 01:13:17 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 15 May 2009 01:13:17 -0400 X-Sasl-enc: Vp+auCbsZVx0uUJir+qt4Yh5ZfJegGlebrXFytaEZnwc 1242364397 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 8405127460; Fri, 15 May 2009 01:13:16 -0400 (EDT) Message-ID: <4A0CF9EA.6080403@FreeBSD.org> Date: Fri, 15 May 2009 06:13:14 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.21 (X11/20090412) MIME-Version: 1.0 To: Alexander Motin References: <200905130255.n4D2tMQZ040010@svn.freebsd.org> In-Reply-To: <200905130255.n4D2tMQZ040010@svn.freebsd.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r192033 - stable/7/sys/dev/ata X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 05:31:01 -0000 Hi, Could this commit have broken boot on my amd64 system with an ULi SATA controller? I have not fully bisected (and to be honest, who really has time to do this for production machines, unless The panic I get with RELENG_7 sources as of yesterday after this commit is 'resource list busy'. If you need any more information let me know, I have transcribed the backtrace and posted it to stable@. thanks, BMS Alexander Motin wrote: > Author: mav > Date: Wed May 13 02:55:21 2009 > New Revision: 192033 > URL: http://svn.freebsd.org/changeset/base/192033 > > Log: > Make vendor-specific drivers prefered over the generic AHCI one. > This fixes some controllers, like JMicron ones, which provide also PATA via > PCI function that declared as AHCI controller. > > This is not an MFC, but the same was already done in 8-CURRENT in other way. > > PR: kern/132082 > > ... > From owner-svn-src-stable@FreeBSD.ORG Fri May 15 10:45:52 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF41C106566C; Fri, 15 May 2009 10:45:52 +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 CBFC68FC08; Fri, 15 May 2009 10:45:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FAjqsi019935; Fri, 15 May 2009 10:45:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FAjqIw019934; Fri, 15 May 2009 10:45:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905151045.n4FAjqIw019934@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 May 2009 10:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192140 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/fdescfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 10:45:53 -0000 Author: kib Date: Fri May 15 10:45:52 2009 New Revision: 192140 URL: http://svn.freebsd.org/changeset/base/192140 Log: MFC r192012: Return controlled EINVAL when the fdescfs lookup routine is given string representing too large integer, instead of overflowing and possibly returning a random but valid vnode. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/fdescfs/fdesc_vnops.c Modified: stable/7/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/7/sys/fs/fdescfs/fdesc_vnops.c Fri May 15 10:11:54 2009 (r192139) +++ stable/7/sys/fs/fdescfs/fdesc_vnops.c Fri May 15 10:45:52 2009 (r192140) @@ -264,7 +264,7 @@ fdesc_lookup(ap) struct thread *td = cnp->cn_thread; struct file *fp; int nlen = cnp->cn_namelen; - u_int fd; + u_int fd, fd1; int error; struct vnode *fvp; @@ -296,7 +296,12 @@ fdesc_lookup(ap) error = ENOENT; goto bad; } - fd = 10 * fd + *pname++ - '0'; + fd1 = 10 * fd + *pname++ - '0'; + if (fd1 < fd) { + error = ENOENT; + goto bad; + } + fd = fd1; } if ((error = fget(td, fd, &fp)) != 0) From owner-svn-src-stable@FreeBSD.ORG Fri May 15 13:58:45 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81A8C106564A; Fri, 15 May 2009 13:58:45 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EA0B8FC26; Fri, 15 May 2009 13:58:45 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FDwjJZ025348; Fri, 15 May 2009 13:58:45 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FDwjoX025344; Fri, 15 May 2009 13:58:45 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200905151358.n4FDwjoX025344@svn.freebsd.org> From: Doug Rabson Date: Fri, 15 May 2009 13:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192142 - stable/7/sys/rpc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 13:58:46 -0000 Author: dfr Date: Fri May 15 13:58:45 2009 New Revision: 192142 URL: http://svn.freebsd.org/changeset/base/192142 Log: Back port a change to the locking model used to manage active transports from FreeBSD-current to avoid a deadlock. PR: 130628 Modified: stable/7/sys/rpc/svc.c stable/7/sys/rpc/svc.h stable/7/sys/rpc/svc_dg.c stable/7/sys/rpc/svc_vc.c Modified: stable/7/sys/rpc/svc.c ============================================================================== --- stable/7/sys/rpc/svc.c Fri May 15 13:26:54 2009 (r192141) +++ stable/7/sys/rpc/svc.c Fri May 15 13:58:45 2009 (r192142) @@ -178,18 +178,23 @@ xprt_active(SVCXPRT *xprt) } void -xprt_inactive(SVCXPRT *xprt) +xprt_inactive_locked(SVCXPRT *xprt) { SVCPOOL *pool = xprt->xp_pool; - mtx_lock(&pool->sp_lock); - if (xprt->xp_active) { TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); xprt->xp_active = FALSE; } - wakeup(&pool->sp_active); +} +void +xprt_inactive(SVCXPRT *xprt) +{ + SVCPOOL *pool = xprt->xp_pool; + + mtx_lock(&pool->sp_lock); + xprt_inactive_locked(xprt); mtx_unlock(&pool->sp_lock); } Modified: stable/7/sys/rpc/svc.h ============================================================================== --- stable/7/sys/rpc/svc.h Fri May 15 13:26:54 2009 (r192141) +++ stable/7/sys/rpc/svc.h Fri May 15 13:58:45 2009 (r192142) @@ -47,6 +47,7 @@ #include #include #include +#include #endif /* @@ -128,7 +129,7 @@ struct __rpc_svcpool; */ typedef struct __rpc_svcxprt { #ifdef _KERNEL - struct mtx xp_lock; + struct sx xp_lock; struct __rpc_svcpool *xp_pool; /* owning pool (see below) */ TAILQ_ENTRY(__rpc_svcxprt) xp_link; TAILQ_ENTRY(__rpc_svcxprt) xp_alink; @@ -332,6 +333,7 @@ __END_DECLS __BEGIN_DECLS extern void xprt_active(SVCXPRT *); extern void xprt_inactive(SVCXPRT *); +extern void xprt_inactive_locked(SVCXPRT *); __END_DECLS #endif Modified: stable/7/sys/rpc/svc_dg.c ============================================================================== --- stable/7/sys/rpc/svc_dg.c Fri May 15 13:26:54 2009 (r192141) +++ stable/7/sys/rpc/svc_dg.c Fri May 15 13:58:45 2009 (r192142) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -118,7 +119,7 @@ svc_dg_create(SVCPOOL *pool, struct sock xprt = mem_alloc(sizeof (SVCXPRT)); memset(xprt, 0, sizeof (SVCXPRT)); - mtx_init(&xprt->xp_lock, "xprt->xp_lock", NULL, MTX_DEF); + sx_init(&xprt->xp_lock, "xprt->xp_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = NULL; @@ -161,6 +162,9 @@ static enum xprt_stat svc_dg_stat(SVCXPRT *xprt) { + if (soreadable(xprt->xp_socket)) + return (XPRT_MOREREQS); + return (XPRT_IDLE); } @@ -173,22 +177,17 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms int error, rcvflag; /* + * Serialise access to the socket. + */ + sx_xlock(&xprt->xp_lock); + + /* * The socket upcall calls xprt_active() which will eventually * cause the server to call us here. We attempt to read a * packet from the socket and process it. If the read fails, * we have drained all pending requests so we call * xprt_inactive(). - * - * The lock protects us in the case where a new packet arrives - * on the socket after our call to soreceive fails with - * EWOULDBLOCK - the call to xprt_active() in the upcall will - * happen only after our call to xprt_inactive() which ensures - * that we will remain active. It might be possible to use - * SOCKBUF_LOCK for this - its not clear to me what locks are - * held during the upcall. */ - mtx_lock(&xprt->xp_lock); - uio.uio_resid = 1000000000; uio.uio_td = curthread; mreq = NULL; @@ -196,8 +195,19 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms error = soreceive(xprt->xp_socket, &raddr, &uio, &mreq, NULL, &rcvflag); if (error == EWOULDBLOCK) { - xprt_inactive(xprt); - mtx_unlock(&xprt->xp_lock); + /* + * We must re-test for readability after taking the + * lock to protect us in the case where a new packet + * arrives on the socket after our call to soreceive + * fails with EWOULDBLOCK. The pool lock protects us + * from racing the upcall after our soreadable() call + * returns false. + */ + mtx_lock(&xprt->xp_pool->sp_lock); + if (!soreadable(xprt->xp_socket)) + xprt_inactive_locked(xprt); + mtx_unlock(&xprt->xp_pool->sp_lock); + sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -208,11 +218,11 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); xprt_inactive(xprt); - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); return (FALSE); } - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); KASSERT(raddr->sa_len < xprt->xp_rtaddr.maxlen, ("Unexpected remote address length")); @@ -301,7 +311,7 @@ svc_dg_destroy(SVCXPRT *xprt) xprt_unregister(xprt); - mtx_destroy(&xprt->xp_lock); + sx_destroy(&xprt->xp_lock); if (xprt->xp_socket) (void)soclose(xprt->xp_socket); @@ -328,7 +338,5 @@ svc_dg_soupcall(struct socket *so, void { SVCXPRT *xprt = (SVCXPRT *) arg; - mtx_lock(&xprt->xp_lock); xprt_active(xprt); - mtx_unlock(&xprt->xp_lock); } Modified: stable/7/sys/rpc/svc_vc.c ============================================================================== --- stable/7/sys/rpc/svc_vc.c Fri May 15 13:26:54 2009 (r192141) +++ stable/7/sys/rpc/svc_vc.c Fri May 15 13:58:45 2009 (r192142) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -142,7 +143,7 @@ svc_vc_create(SVCPOOL *pool, struct sock } xprt = mem_alloc(sizeof(SVCXPRT)); - mtx_init(&xprt->xp_lock, "xprt->xp_lock", NULL, MTX_DEF); + sx_init(&xprt->xp_lock, "xprt->xp_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = NULL; @@ -219,7 +220,7 @@ svc_vc_create_conn(SVCPOOL *pool, struct cd->strm_stat = XPRT_IDLE; xprt = mem_alloc(sizeof(SVCXPRT)); - mtx_init(&xprt->xp_lock, "xprt->xp_lock", NULL, MTX_DEF); + sx_init(&xprt->xp_lock, "xprt->xp_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = cd; @@ -255,9 +256,9 @@ svc_vc_create_conn(SVCPOOL *pool, struct * Throw the transport into the active list in case it already * has some data buffered. */ - mtx_lock(&xprt->xp_lock); + sx_xlock(&xprt->xp_lock); xprt_active(xprt); - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); return (xprt); cleanup_svc_vc_create: @@ -347,22 +348,27 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st * connection from the socket and turn it into a new * transport. If the accept fails, we have drained all pending * connections so we call xprt_inactive(). - * - * The lock protects us in the case where a new connection arrives - * on the socket after our call to accept fails with - * EWOULDBLOCK - the call to xprt_active() in the upcall will - * happen only after our call to xprt_inactive() which ensures - * that we will remain active. It might be possible to use - * SOCKBUF_LOCK for this - its not clear to me what locks are - * held during the upcall. */ - mtx_lock(&xprt->xp_lock); + sx_xlock(&xprt->xp_lock); error = svc_vc_accept(xprt->xp_socket, &so); if (error == EWOULDBLOCK) { - xprt_inactive(xprt); - mtx_unlock(&xprt->xp_lock); + /* + * We must re-test for new connections after taking + * the lock to protect us in the case where a new + * connection arrives after our call to accept fails + * with EWOULDBLOCK. The pool lock protects us from + * racing the upcall after our TAILQ_EMPTY() call + * returns false. + */ + ACCEPT_LOCK(); + mtx_lock(&xprt->xp_pool->sp_lock); + if (TAILQ_EMPTY(&xprt->xp_socket->so_comp)) + xprt_inactive_locked(xprt); + mtx_unlock(&xprt->xp_pool->sp_lock); + ACCEPT_UNLOCK(); + sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -373,11 +379,11 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); xprt_inactive(xprt); - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); return (FALSE); } - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); sa = 0; error = soaccept(so, &sa); @@ -422,7 +428,7 @@ svc_vc_destroy_common(SVCXPRT *xprt) xprt_unregister(xprt); - mtx_destroy(&xprt->xp_lock); + sx_destroy(&xprt->xp_lock); if (xprt->xp_socket) (void)soclose(xprt->xp_socket); @@ -483,21 +489,29 @@ svc_vc_stat(SVCXPRT *xprt) /* * Return XPRT_MOREREQS if we have buffered data and we are - * mid-record or if we have enough data for a record marker. + * mid-record or if we have enough data for a record + * marker. Since this is only a hint, we read mpending and + * resid outside the lock. We do need to take the lock if we + * have to traverse the mbuf chain. */ if (cd->mpending) { if (cd->resid) return (XPRT_MOREREQS); n = 0; + sx_xlock(&xprt->xp_lock); m = cd->mpending; while (m && n < sizeof(uint32_t)) { n += m->m_len; m = m->m_next; } + sx_xunlock(&xprt->xp_lock); if (n >= sizeof(uint32_t)) return (XPRT_MOREREQS); } + if (soreadable(xprt->xp_socket)) + return (XPRT_MOREREQS); + return (XPRT_IDLE); } @@ -509,6 +523,12 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms struct mbuf *m; int error, rcvflag; + /* + * Serialise access to the socket and our own record parsing + * state. + */ + sx_xlock(&xprt->xp_lock); + for (;;) { /* * If we have an mbuf chain in cd->mpending, try to parse a @@ -584,6 +604,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms */ xdrmbuf_create(&xprt->xp_xdrreq, cd->mreq, XDR_DECODE); cd->mreq = NULL; + sx_xunlock(&xprt->xp_lock); if (! xdr_callmsg(&xprt->xp_xdrreq, msg)) { XDR_DESTROY(&xprt->xp_xdrreq); return (FALSE); @@ -602,17 +623,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms * the result in cd->mpending. If the read fails, * we have drained both cd->mpending and the socket so * we can call xprt_inactive(). - * - * The lock protects us in the case where a new packet arrives - * on the socket after our call to soreceive fails with - * EWOULDBLOCK - the call to xprt_active() in the upcall will - * happen only after our call to xprt_inactive() which ensures - * that we will remain active. It might be possible to use - * SOCKBUF_LOCK for this - its not clear to me what locks are - * held during the upcall. */ - mtx_lock(&xprt->xp_lock); - uio.uio_resid = 1000000000; uio.uio_td = curthread; m = NULL; @@ -621,8 +632,20 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms &rcvflag); if (error == EWOULDBLOCK) { - xprt_inactive(xprt); - mtx_unlock(&xprt->xp_lock); + /* + * We must re-test for readability after + * taking the lock to protect us in the case + * where a new packet arrives on the socket + * after our call to soreceive fails with + * EWOULDBLOCK. The pool lock protects us from + * racing the upcall after our soreadable() + * call returns false. + */ + mtx_lock(&xprt->xp_pool->sp_lock); + if (!soreadable(xprt->xp_socket)) + xprt_inactive_locked(xprt); + mtx_unlock(&xprt->xp_pool->sp_lock); + sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -634,7 +657,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); xprt_inactive(xprt); cd->strm_stat = XPRT_DIED; - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -642,8 +665,9 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms /* * EOF - the other end has closed the socket. */ + xprt_inactive(xprt); cd->strm_stat = XPRT_DIED; - mtx_unlock(&xprt->xp_lock); + sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -651,8 +675,6 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms m_last(cd->mpending)->m_next = m; else cd->mpending = m; - - mtx_unlock(&xprt->xp_lock); } } @@ -739,9 +761,7 @@ svc_vc_soupcall(struct socket *so, void { SVCXPRT *xprt = (SVCXPRT *) arg; - mtx_lock(&xprt->xp_lock); xprt_active(xprt); - mtx_unlock(&xprt->xp_lock); } #if 0 From owner-svn-src-stable@FreeBSD.ORG Fri May 15 15:25:34 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B94DC106567C; Fri, 15 May 2009 15:25:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id B3E2E8FC31; Fri, 15 May 2009 15:25:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [66.135.97.2] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 242906913; Fri, 15 May 2009 17:25:31 +0300 Message-ID: <4A0D7B50.4090602@FreeBSD.org> Date: Fri, 15 May 2009 17:25:20 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Bruce Simpson References: <200905130255.n4D2tMQZ040010@svn.freebsd.org> <4A0CF9EA.6080403@FreeBSD.org> In-Reply-To: <4A0CF9EA.6080403@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r192033 - stable/7/sys/dev/ata X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 15:25:36 -0000 Bruce Simpson wrote: > Could this commit have broken boot on my amd64 system with an ULi SATA > controller? This commit could change driver used for controller and so expose some other bug in ALI driver. As I can see, there is present vendor-specific driver for this chip, but without pciconf output I can't say if AHCI driver is also able to attach it. > I have not fully bisected (and to be honest, who really has time to do > this for production machines, unless > > The panic I get with RELENG_7 sources as of yesterday after this commit > is 'resource list busy'. If you need any more information let me know, I > have transcribed the backtrace and posted it to stable@. Which revision was working for you before this? If, as you have said, reverting rev 192033 does not helped, then there should be something different. May be not in ATA, as there was very few merges into 7-STABLE ATA last months. -- Alexander Motin From owner-svn-src-stable@FreeBSD.ORG Fri May 15 18:50:31 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46DE3106564A; Fri, 15 May 2009 18:50:31 +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 3223B8FC0C; Fri, 15 May 2009 18:50:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FIoV6j031349; Fri, 15 May 2009 18:50:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FIoULn031343; Fri, 15 May 2009 18:50:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905151850.n4FIoULn031343@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 18:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192149 - in stable/7: share/man/man4 sys sys/contrib/pf sys/dev/ath/ath_hal sys/dev/cxgb sys/dev/ichsmb sys/dev/ipmi sys/dev/smbus sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 18:50:31 -0000 Author: jhb Date: Fri May 15 18:50:30 2009 New Revision: 192149 URL: http://svn.freebsd.org/changeset/base/192149 Log: MFC: Change ichsmb(4) to follow the format of all the other smbus controllers for slave addressing by using left-adjusted slave addresses (i.e. xxxxxxx0b). Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man4/smb.4 stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/ichsmb/ichsmb.c stable/7/sys/dev/ipmi/ipmi_acpi.c stable/7/sys/dev/ipmi/ipmi_smbios.c stable/7/sys/dev/smbus/smb.c stable/7/sys/sys/param.h Modified: stable/7/share/man/man4/smb.4 ============================================================================== --- stable/7/share/man/man4/smb.4 Fri May 15 18:25:44 2009 (r192148) +++ stable/7/share/man/man4/smb.4 Fri May 15 18:50:30 2009 (r192149) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 1998 +.Dd February 6, 2009 .Dt SMB 4 .Os .Sh NAME @@ -72,6 +72,9 @@ The .Fa slave field is always used, and provides the address of the SMBus slave device to talk to. +The slave address is specified in the seven most significant bits +.Pq i.e. Dq "left-justified" . +The least significant bit of the slave address must be zero. .Pp .Bl -column ".Dv SMB_QUICK_WRITE" -compact .It Em Ioctl Ta Em Description Modified: stable/7/sys/dev/ichsmb/ichsmb.c ============================================================================== --- stable/7/sys/dev/ichsmb/ichsmb.c Fri May 15 18:25:44 2009 (r192148) +++ stable/7/sys/dev/ichsmb/ichsmb.c Fri May 15 18:50:30 2009 (r192149) @@ -182,7 +182,7 @@ ichsmb_quick(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_QUICK; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | (how == SMB_QREAD ? + slave | (how == SMB_QREAD ? ICH_XMIT_SLVA_READ : ICH_XMIT_SLVA_WRITE)); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); @@ -208,7 +208,7 @@ ichsmb_sendb(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_WRITE); + slave | ICH_XMIT_SLVA_WRITE); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, byte); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); @@ -230,7 +230,7 @@ ichsmb_recvb(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_READ); + slave | ICH_XMIT_SLVA_READ); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) @@ -253,7 +253,7 @@ ichsmb_writeb(device_t dev, u_char slave mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_WRITE); + slave | ICH_XMIT_SLVA_WRITE); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, byte); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, @@ -277,7 +277,7 @@ ichsmb_writew(device_t dev, u_char slave mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_WRITE); + slave | ICH_XMIT_SLVA_WRITE); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, word & 0xff); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, word >> 8); @@ -301,7 +301,7 @@ ichsmb_readb(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_READ); + slave | ICH_XMIT_SLVA_READ); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); @@ -324,7 +324,7 @@ ichsmb_readw(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_READ); + slave | ICH_XMIT_SLVA_READ); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); @@ -352,7 +352,7 @@ ichsmb_pcall(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_PROC_CALL; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_WRITE); + slave | ICH_XMIT_SLVA_WRITE); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, sdata & 0xff); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, sdata >> 8); @@ -403,7 +403,7 @@ ichsmb_bwrite(device_t dev, u_char slave mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_WRITE); + slave | ICH_XMIT_SLVA_WRITE); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, count); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_BLOCK_DB, buf[0]); @@ -434,7 +434,7 @@ ichsmb_bread(device_t dev, u_char slave, mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK; bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, - (slave << 1) | ICH_XMIT_SLVA_READ); + slave | ICH_XMIT_SLVA_READ); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, *count); /* XXX? */ bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, Modified: stable/7/sys/dev/ipmi/ipmi_acpi.c ============================================================================== --- stable/7/sys/dev/ipmi/ipmi_acpi.c Fri May 15 18:25:44 2009 (r192148) +++ stable/7/sys/dev/ipmi/ipmi_acpi.c Fri May 15 18:50:30 2009 (r192149) @@ -104,7 +104,7 @@ ipmi_acpi_attach(device_t dev) case SSIF_MODE: if (ACPI_FAILURE(acpi_GetInteger(devh, "_ADR", &flags))) return (ENXIO); - info.address = flags >> 1; + info.address = flags; device_printf(dev, "SSIF interface not supported on ACPI\n"); return (0); default: Modified: stable/7/sys/dev/ipmi/ipmi_smbios.c ============================================================================== --- stable/7/sys/dev/ipmi/ipmi_smbios.c Fri May 15 18:25:44 2009 (r192148) +++ stable/7/sys/dev/ipmi/ipmi_smbios.c Fri May 15 18:50:30 2009 (r192149) @@ -154,10 +154,10 @@ smbios_t38_proc_info(uint8_t *p, char ** case SSIF_MODE: if ((s->base_address & 0xffffffffffffff00) != 0) { printf("SMBIOS: Invalid SSIF SMBus address, using BMC I2C slave address instead\n"); - info->address = s->i2c_slave_address >> 1; + info->address = s->i2c_slave_address; break; } - info->address = IPMI_BAR_ADDR(s->base_address) >> 1; + info->address = IPMI_BAR_ADDR(s->base_address); break; default: return; Modified: stable/7/sys/dev/smbus/smb.c ============================================================================== --- stable/7/sys/dev/smbus/smb.c Fri May 15 18:25:44 2009 (r192148) +++ stable/7/sys/dev/smbus/smb.c Fri May 15 18:50:30 2009 (r192149) @@ -195,6 +195,10 @@ smbioctl(struct cdev *dev, u_long cmd, c parent = device_get_parent(smbdev); + /* Make sure that LSB bit is cleared. */ + if (s->slave & 0x1) + return (EINVAL); + /* Allocate the bus. */ if ((error = smbus_request_bus(parent, smbdev, (flags & O_NONBLOCK) ? SMB_DONTWAIT : (SMB_WAIT | SMB_INTR)))) Modified: stable/7/sys/sys/param.h ============================================================================== --- stable/7/sys/sys/param.h Fri May 15 18:25:44 2009 (r192148) +++ stable/7/sys/sys/param.h Fri May 15 18:50:30 2009 (r192149) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 702100 /* Master, propagated to newvers */ +#define __FreeBSD_version 702101 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-stable@FreeBSD.ORG Fri May 15 19:19:27 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECDBD106566B; Fri, 15 May 2009 19:19: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 DB90B8FC12; Fri, 15 May 2009 19:19:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FJJRMI032066; Fri, 15 May 2009 19:19:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FJJRgn032065; Fri, 15 May 2009 19:19:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905151919.n4FJJRgn032065@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 19:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192150 - stable/7/usr.bin/top X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:19:28 -0000 Author: jhb Date: Fri May 15 19:19:27 2009 New Revision: 192150 URL: http://svn.freebsd.org/changeset/base/192150 Log: MFC: Expand the CPU column to two chars and print in decimal rather than hex. Modified: stable/7/usr.bin/top/ (props changed) stable/7/usr.bin/top/machine.c Modified: stable/7/usr.bin/top/machine.c ============================================================================== --- stable/7/usr.bin/top/machine.c Fri May 15 18:50:30 2009 (r192149) +++ stable/7/usr.bin/top/machine.c Fri May 15 19:19:27 2009 (r192150) @@ -106,12 +106,12 @@ static char io_header[] = "%5d%s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s" static char smp_header_thr[] = - " PID%s %-*.*s THR PRI NICE SIZE RES STATE C TIME %6s COMMAND"; + " PID%s %-*.*s THR PRI NICE SIZE RES STATE C TIME %6s COMMAND"; static char smp_header[] = - " PID%s %-*.*s " "PRI NICE SIZE RES STATE C TIME %6s COMMAND"; + " PID%s %-*.*s " "PRI NICE SIZE RES STATE C TIME %6s COMMAND"; #define smp_Proc_format \ - "%5d%s %-*.*s %s%3d %4s%7s %6s %-6.6s %1x%7s %5.2f%% %.*s" + "%5d%s %-*.*s %s%3d %4s%7s %6s %-6.6s %2d%7s %5.2f%% %.*s" static char up_header_thr[] = " PID%s %-*.*s THR PRI NICE SIZE RES STATE TIME %6s COMMAND"; From owner-svn-src-stable@FreeBSD.ORG Fri May 15 19:54:20 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 887A9106564A; Fri, 15 May 2009 19:54:20 +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 73DB88FC24; Fri, 15 May 2009 19:54:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FJsKl7032931; Fri, 15 May 2009 19:54:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FJsJE1032919; Fri, 15 May 2009 19:54:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905151954.n4FJsJE1032919@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 19:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192154 - in stable/7: sys sys/contrib/pf sys/dev/ath/ath_hal sys/dev/cxgb sys/kern sys/sys sys/ufs/ffs sys/vm usr.bin/systat usr.bin/top X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:54:21 -0000 Author: jhb Date: Fri May 15 19:54:19 2009 New Revision: 192154 URL: http://svn.freebsd.org/changeset/base/192154 Log: MFC: Adjust some variables (mostly related to the buffer cache) that hold address space sizes to be longs instead of ints. This includes an ABI compat shim for the kern.bufspace sysctl for old binaries. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/subr_param.c stable/7/sys/kern/sys_pipe.c stable/7/sys/kern/vfs_bio.c stable/7/sys/sys/buf.h stable/7/sys/sys/pipe.h stable/7/sys/ufs/ffs/ffs_snapshot.c stable/7/sys/ufs/ffs/ffs_vfsops.c stable/7/sys/vm/vm_init.c stable/7/sys/vm/vnode_pager.c stable/7/usr.bin/systat/ (props changed) stable/7/usr.bin/systat/vmstat.c stable/7/usr.bin/top/ (props changed) stable/7/usr.bin/top/machine.c Modified: stable/7/sys/kern/subr_param.c ============================================================================== --- stable/7/sys/kern/subr_param.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/kern/subr_param.c Fri May 15 19:54:19 2009 (r192154) @@ -76,9 +76,9 @@ int maxfilesperproc; /* per-proc open f int ncallout; /* maximum # of timer events */ int nbuf; int nswbuf; -int maxswzone; /* max swmeta KVA storage */ -int maxbcache; /* max buffer cache KVA storage */ -int maxpipekva; /* Limit on pipe KVA */ +long maxswzone; /* max swmeta KVA storage */ +long maxbcache; /* max buffer cache KVA storage */ +long maxpipekva; /* Limit on pipe KVA */ u_long maxtsiz; /* max text size */ u_long dfldsiz; /* initial data size limit */ u_long maxdsiz; /* max data size */ @@ -94,9 +94,9 @@ SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLA "Number of buffers in the buffer cache"); SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, "Number of swap buffers"); -SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0, +SYSCTL_LONG(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0, "Maximum memory for swap metadata"); -SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, +SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, "Maximum value of vfs.maxbufspace"); SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RDTUN, &maxtsiz, 0, "Maximum text size"); @@ -132,11 +132,11 @@ init_param1(void) #ifdef VM_SWZONE_SIZE_MAX maxswzone = VM_SWZONE_SIZE_MAX; #endif - TUNABLE_INT_FETCH("kern.maxswzone", &maxswzone); + TUNABLE_LONG_FETCH("kern.maxswzone", &maxswzone); #ifdef VM_BCACHE_SIZE_MAX maxbcache = VM_BCACHE_SIZE_MAX; #endif - TUNABLE_INT_FETCH("kern.maxbcache", &maxbcache); + TUNABLE_LONG_FETCH("kern.maxbcache", &maxbcache); maxtsiz = MAXTSIZ; TUNABLE_ULONG_FETCH("kern.maxtsiz", &maxtsiz); @@ -211,5 +211,5 @@ init_param3(long kmempages) maxpipekva = (kmempages / 20) * PAGE_SIZE; if (maxpipekva < 512 * 1024) maxpipekva = 512 * 1024; - TUNABLE_INT_FETCH("kern.ipc.maxpipekva", &maxpipekva); + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); } Modified: stable/7/sys/kern/sys_pipe.c ============================================================================== --- stable/7/sys/kern/sys_pipe.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/kern/sys_pipe.c Fri May 15 19:54:19 2009 (r192154) @@ -175,15 +175,15 @@ static struct filterops pipe_wfiltops = #define MINPIPESIZE (PIPE_SIZE/3) #define MAXPIPESIZE (2*PIPE_SIZE/3) -static int amountpipekva; +static long amountpipekva; static int pipefragretry; static int pipeallocfail; static int piperesizefail; static int piperesizeallowed = 1; -SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN, +SYSCTL_LONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN, &maxpipekva, 0, "Pipe KVA limit"); -SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD, +SYSCTL_LONG(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD, &amountpipekva, 0, "Pipe KVA usage"); SYSCTL_INT(_kern_ipc, OID_AUTO, pipefragretry, CTLFLAG_RD, &pipefragretry, 0, "Pipe allocation retries due to fragmentation"); @@ -458,7 +458,7 @@ retry: cpipe->pipe_buffer.in = cnt; cpipe->pipe_buffer.out = 0; cpipe->pipe_buffer.cnt = cnt; - atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size); + atomic_add_long(&amountpipekva, cpipe->pipe_buffer.size); return (0); } @@ -1437,7 +1437,7 @@ pipe_free_kmem(cpipe) ("pipe_free_kmem: pipe mutex locked")); if (cpipe->pipe_buffer.buffer != NULL) { - atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size); + atomic_subtract_long(&amountpipekva, cpipe->pipe_buffer.size); vm_map_remove(pipe_map, (vm_offset_t)cpipe->pipe_buffer.buffer, (vm_offset_t)cpipe->pipe_buffer.buffer + cpipe->pipe_buffer.size); Modified: stable/7/sys/kern/vfs_bio.c ============================================================================== --- stable/7/sys/kern/vfs_bio.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/kern/vfs_bio.c Fri May 15 19:54:19 2009 (r192154) @@ -109,30 +109,31 @@ static int buf_do_flush(struct vnode *vp static int flushbufqueues(struct vnode *, int, int); static void buf_daemon(void); static void bremfreel(struct buf *bp); +static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); int vmiodirenable = TRUE; SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, "Use the VM system for directory writes"); -int runningbufspace; -SYSCTL_INT(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, +long runningbufspace; +SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, "Amount of presently outstanding async buffer io"); -static int bufspace; -SYSCTL_INT(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, - "Virtual memory used for buffers"); -static int maxbufspace; -SYSCTL_INT(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, +static long bufspace; +SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, + &bufspace, 0, sysctl_bufspace, "L", "Virtual memory used for buffers"); +static long maxbufspace; +SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including buf_daemon)"); -static int bufmallocspace; -SYSCTL_INT(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, +static long bufmallocspace; +SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, "Amount of malloced memory for buffers"); -static int maxbufmallocspace; -SYSCTL_INT(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, +static long maxbufmallocspace; +SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, "Maximum amount of malloced memory for buffers"); -static int lobufspace; -SYSCTL_INT(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, +static long lobufspace; +SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, "Minimum amount of buffers we want to have"); -int hibufspace; -SYSCTL_INT(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, +long hibufspace; +SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, "Maximum allowed value of bufspace (excluding buf_daemon)"); static int bufreusecnt; SYSCTL_INT(_vfs, OID_AUTO, bufreusecnt, CTLFLAG_RW, &bufreusecnt, 0, @@ -143,11 +144,11 @@ SYSCTL_INT(_vfs, OID_AUTO, buffreekvacnt static int bufdefragcnt; SYSCTL_INT(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, 0, "Number of times we have had to repeat buffer allocation to defragment"); -static int lorunningspace; -SYSCTL_INT(_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW, &lorunningspace, 0, +static long lorunningspace; +SYSCTL_LONG(_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW, &lorunningspace, 0, "Minimum preferred space used for in-progress I/O"); -static int hirunningspace; -SYSCTL_INT(_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW, &hirunningspace, 0, +static long hirunningspace; +SYSCTL_LONG(_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW, &hirunningspace, 0, "Maximum amount of space to use for in-progress I/O"); int dirtybufferflushes; SYSCTL_INT(_vfs, OID_AUTO, dirtybufferflushes, CTLFLAG_RW, &dirtybufferflushes, @@ -284,6 +285,22 @@ const char *buf_wmesg = BUF_WMESG; #define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ #define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ +static int +sysctl_bufspace(SYSCTL_HANDLER_ARGS) +{ + long lvalue; + int ivalue; + + if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) + return (sysctl_handle_long(oidp, arg1, arg2, req)); + lvalue = *(long *)arg1; + if (lvalue > INT_MAX) + /* On overflow, still write out a long to trigger ENOMEM. */ + return (sysctl_handle_long(oidp, &lvalue, 0, req)); + ivalue = lvalue; + return (sysctl_handle_int(oidp, &ivalue, 0, req)); +} + #ifdef DIRECTIO extern void ffs_rawread_setup(void); #endif /* DIRECTIO */ @@ -343,7 +360,7 @@ runningbufwakeup(struct buf *bp) { if (bp->b_runningbufspace) { - atomic_subtract_int(&runningbufspace, bp->b_runningbufspace); + atomic_subtract_long(&runningbufspace, bp->b_runningbufspace); bp->b_runningbufspace = 0; mtx_lock(&rbreqlock); if (runningbufreq && runningbufspace <= lorunningspace) { @@ -463,7 +480,8 @@ bd_speedup(void) caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) { - int maxbuf; + int tuned_nbuf; + long maxbuf; /* * physmem_est is in pages. Convert it to kilobytes (assumes @@ -493,11 +511,17 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon if (maxbcache && nbuf > maxbcache / BKVASIZE) nbuf = maxbcache / BKVASIZE; + tuned_nbuf = 1; + } else + tuned_nbuf = 0; - /* XXX Avoid integer overflows later on with maxbufspace. */ - maxbuf = (INT_MAX / 3) / BKVASIZE; - if (nbuf > maxbuf) - nbuf = maxbuf; + /* XXX Avoid unsigned long overflows later on with maxbufspace. */ + maxbuf = (LONG_MAX / 3) / BKVASIZE; + if (nbuf > maxbuf) { + if (!tuned_nbuf) + printf("Warning: nbufs lowered from %d to %ld\n", nbuf, + maxbuf); + nbuf = maxbuf; } #if 0 @@ -582,8 +606,8 @@ bufinit(void) * this may result in KVM fragmentation which is not handled optimally * by the system. */ - maxbufspace = nbuf * BKVASIZE; - hibufspace = imax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10); + maxbufspace = (long)nbuf * BKVASIZE; + hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10); lobufspace = hibufspace - MAXBSIZE; lorunningspace = 512 * 1024; @@ -611,7 +635,7 @@ bufinit(void) * be met. We try to size hidirtybuffers to 3/4 our buffer space assuming * BKVASIZE'd (8K) buffers. */ - while (hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) { + while ((long)hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) { hidirtybuffers >>= 1; } lodirtybuffers = hidirtybuffers / 2; @@ -647,7 +671,7 @@ bfreekva(struct buf *bp) if (bp->b_kvasize) { atomic_add_int(&buffreekvacnt, 1); - atomic_subtract_int(&bufspace, bp->b_kvasize); + atomic_subtract_long(&bufspace, bp->b_kvasize); vm_map_remove(buffer_map, (vm_offset_t) bp->b_kvabase, (vm_offset_t) bp->b_kvabase + bp->b_kvasize); bp->b_kvasize = 0; @@ -872,7 +896,7 @@ bufwrite(struct buf *bp) * Normal bwrites pipeline writes */ bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); if (!TD_IS_IDLETHREAD(curthread)) curthread->td_ru.ru_oublock++; @@ -2054,7 +2078,7 @@ restart: bp->b_kvabase = (caddr_t) addr; bp->b_kvasize = maxsize; - atomic_add_int(&bufspace, bp->b_kvasize); + atomic_add_long(&bufspace, bp->b_kvasize); atomic_add_int(&bufreusecnt, 1); } vm_map_unlock(buffer_map); @@ -2822,7 +2846,7 @@ allocbuf(struct buf *bp, int size) } else { free(bp->b_data, M_BIOBUF); if (bp->b_bufsize) { - atomic_subtract_int( + atomic_subtract_long( &bufmallocspace, bp->b_bufsize); bufspacewakeup(); @@ -2859,7 +2883,7 @@ allocbuf(struct buf *bp, int size) bp->b_bufsize = mbsize; bp->b_bcount = size; bp->b_flags |= B_MALLOC; - atomic_add_int(&bufmallocspace, mbsize); + atomic_add_long(&bufmallocspace, mbsize); return 1; } origbuf = NULL; @@ -2873,7 +2897,7 @@ allocbuf(struct buf *bp, int size) origbufsize = bp->b_bufsize; bp->b_data = bp->b_kvabase; if (bp->b_bufsize) { - atomic_subtract_int(&bufmallocspace, + atomic_subtract_long(&bufmallocspace, bp->b_bufsize); bufspacewakeup(); bp->b_bufsize = 0; Modified: stable/7/sys/sys/buf.h ============================================================================== --- stable/7/sys/sys/buf.h Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/sys/buf.h Fri May 15 19:54:19 2009 (r192154) @@ -479,10 +479,10 @@ buf_countdeps(struct buf *bp, int i) #ifdef _KERNEL extern int nbuf; /* The number of buffer headers */ -extern int maxswzone; /* Max KVA for swap structures */ -extern int maxbcache; /* Max KVA for buffer cache */ -extern int runningbufspace; -extern int hibufspace; +extern long maxswzone; /* Max KVA for swap structures */ +extern long maxbcache; /* Max KVA for buffer cache */ +extern long runningbufspace; +extern long hibufspace; extern int dirtybufthresh; extern int bdwriteskip; extern int dirtybufferflushes; Modified: stable/7/sys/sys/pipe.h ============================================================================== --- stable/7/sys/sys/pipe.h Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/sys/pipe.h Fri May 15 19:54:19 2009 (r192154) @@ -56,7 +56,7 @@ /* * See sys_pipe.c for info on what these limits mean. */ -extern int maxpipekva; +extern long maxpipekva; /* * Pipe buffer information. Modified: stable/7/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_snapshot.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/ufs/ffs/ffs_snapshot.c Fri May 15 19:54:19 2009 (r192154) @@ -2272,7 +2272,7 @@ ffs_copyonwrite(devvp, bp) VI_UNLOCK(devvp); if (saved_runningbufspace != 0) { bp->b_runningbufspace = saved_runningbufspace; - atomic_add_int(&runningbufspace, + atomic_add_long(&runningbufspace, bp->b_runningbufspace); } return (0); /* Snapshot gone */ @@ -2397,7 +2397,7 @@ ffs_copyonwrite(devvp, bp) */ if (saved_runningbufspace != 0) { bp->b_runningbufspace = saved_runningbufspace; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); } return (error); } Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_vfsops.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/ufs/ffs/ffs_vfsops.c Fri May 15 19:54:19 2009 (r192154) @@ -1919,7 +1919,7 @@ ffs_geom_strategy(struct bufobj *bo, str } } bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, + atomic_add_long(&runningbufspace, bp->b_runningbufspace); } else { error = ffs_copyonwrite(vp, bp); Modified: stable/7/sys/vm/vm_init.c ============================================================================== --- stable/7/sys/vm/vm_init.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/vm/vm_init.c Fri May 15 19:54:19 2009 (r192154) @@ -186,12 +186,12 @@ again: panic("startup: table size inconsistency"); clean_map = kmem_suballoc(kernel_map, &kmi->clean_sva, &kmi->clean_eva, - nbuf * BKVASIZE + nswbuf * MAXPHYS, FALSE); + (long)nbuf * BKVASIZE + (long)nswbuf * MAXPHYS, FALSE); buffer_map = kmem_suballoc(clean_map, &kmi->buffer_sva, - &kmi->buffer_eva, nbuf * BKVASIZE, FALSE); + &kmi->buffer_eva, (long)nbuf * BKVASIZE, FALSE); buffer_map->system_map = 1; pager_map = kmem_suballoc(clean_map, &kmi->pager_sva, &kmi->pager_eva, - nswbuf * MAXPHYS, FALSE); + (long)nswbuf * MAXPHYS, FALSE); pager_map->system_map = 1; exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, exec_map_entries * (ARG_MAX + (PAGE_SIZE * 3)), FALSE); Modified: stable/7/sys/vm/vnode_pager.c ============================================================================== --- stable/7/sys/vm/vnode_pager.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/sys/vm/vnode_pager.c Fri May 15 19:54:19 2009 (r192154) @@ -526,7 +526,7 @@ vnode_pager_input_smlfs(object, m) bp->b_bcount = bsize; bp->b_bufsize = bsize; bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); /* do the input */ bp->b_iooffset = dbtob(bp->b_blkno); @@ -906,7 +906,7 @@ vnode_pager_generic_getpages(vp, m, byte bp->b_bcount = size; bp->b_bufsize = size; bp->b_runningbufspace = bp->b_bufsize; - atomic_add_int(&runningbufspace, bp->b_runningbufspace); + atomic_add_long(&runningbufspace, bp->b_runningbufspace); PCPU_INC(cnt.v_vnodein); PCPU_ADD(cnt.v_vnodepgsin, count); Modified: stable/7/usr.bin/systat/vmstat.c ============================================================================== --- stable/7/usr.bin/systat/vmstat.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/usr.bin/systat/vmstat.c Fri May 15 19:54:19 2009 (r192154) @@ -115,7 +115,7 @@ static struct Info { struct nchstats nchstats; long nchcount; long *intrcnt; - int bufspace; + long bufspace; int desiredvnodes; long numvnodes; long freevnodes; Modified: stable/7/usr.bin/top/machine.c ============================================================================== --- stable/7/usr.bin/top/machine.c Fri May 15 19:41:10 2009 (r192153) +++ stable/7/usr.bin/top/machine.c Fri May 15 19:54:19 2009 (r192154) @@ -433,7 +433,7 @@ get_system_info(struct system_info *si) static unsigned int swap_delay = 0; static int swapavail = 0; static int swapfree = 0; - static int bufspace = 0; + static long bufspace = 0; static int nspgsin, nspgsout; GETSYSCTL("vfs.bufspace", bufspace); From owner-svn-src-stable@FreeBSD.ORG Fri May 15 20:13:15 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94926106567A; Fri, 15 May 2009 20:13:15 +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 82DCE8FC0C; Fri, 15 May 2009 20:13:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FKDFLG033348; Fri, 15 May 2009 20:13:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FKDFwh033347; Fri, 15 May 2009 20:13:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905152013.n4FKDFwh033347@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 20:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192155 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 20:13:16 -0000 Author: jhb Date: Fri May 15 20:13:15 2009 New Revision: 192155 URL: http://svn.freebsd.org/changeset/base/192155 Log: MFC: Update comment above _fget() now that FWRITE failures return EBADF. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_descrip.c Modified: stable/7/sys/kern/kern_descrip.c ============================================================================== --- stable/7/sys/kern/kern_descrip.c Fri May 15 19:54:19 2009 (r192154) +++ stable/7/sys/kern/kern_descrip.c Fri May 15 20:13:15 2009 (r192155) @@ -2040,10 +2040,8 @@ closef(struct file *fp, struct thread *t * Extract the file pointer associated with the specified descriptor for the * current user process. * - * If the descriptor doesn't exist, EBADF is returned. - * - * If the descriptor exists but doesn't match 'flags' then return EBADF for - * read attempts and EINVAL for write attempts. + * If the descriptor doesn't exist or doesn't match 'flags', EBADF is + * returned. * * If 'hold' is set (non-zero) the file's refcount will be bumped on return. * It should be dropped with fdrop(). If it is not set, then the refcount From owner-svn-src-stable@FreeBSD.ORG Fri May 15 20:36:54 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B95FB106566B; Fri, 15 May 2009 20:36:54 +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 7555E8FC0C; Fri, 15 May 2009 20:36:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FKasgA033838; Fri, 15 May 2009 20:36:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FKashg033833; Fri, 15 May 2009 20:36:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905152036.n4FKashg033833@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 20:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192156 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern nfsclient sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 20:36:55 -0000 Author: jhb Date: Fri May 15 20:36:54 2009 New Revision: 192156 URL: http://svn.freebsd.org/changeset/base/192156 Log: MFC: Add caching of -ve lookups to the NFS client. To prevent clients from not noticing new files created by another client for a "long" time, reduce the default timeout for caching attributes of directories from 30 seconds to 3 seconds. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_cache.c stable/7/sys/nfsclient/nfs.h stable/7/sys/nfsclient/nfs_vnops.c stable/7/sys/nfsclient/nfsnode.h stable/7/sys/sys/vnode.h Modified: stable/7/sys/kern/vfs_cache.c ============================================================================== --- stable/7/sys/kern/vfs_cache.c Fri May 15 20:13:15 2009 (r192155) +++ stable/7/sys/kern/vfs_cache.c Fri May 15 20:36:54 2009 (r192156) @@ -700,6 +700,24 @@ cache_purge(vp) } /* + * Invalidate all negative entries for a particular directory vnode. + */ +void +cache_purge_negative(vp) + struct vnode *vp; +{ + struct namecache *cp, *ncp; + + CTR1(KTR_VFS, "cache_purge_negative(%p)", vp); + CACHE_LOCK(); + LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) { + if (cp->nc_vp == NULL) + cache_zap(cp); + } + CACHE_UNLOCK(); +} + +/* * Flush all entries referencing a particular filesystem. */ void Modified: stable/7/sys/nfsclient/nfs.h ============================================================================== --- stable/7/sys/nfsclient/nfs.h Fri May 15 20:13:15 2009 (r192155) +++ stable/7/sys/nfsclient/nfs.h Fri May 15 20:36:54 2009 (r192156) @@ -63,7 +63,7 @@ #define NFS_MAXATTRTIMO 60 #endif #ifndef NFS_MINDIRATTRTIMO -#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */ +#define NFS_MINDIRATTRTIMO 3 /* VDIR attrib cache timeout in sec */ #endif #ifndef NFS_MAXDIRATTRTIMO #define NFS_MAXDIRATTRTIMO 60 Modified: stable/7/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/7/sys/nfsclient/nfs_vnops.c Fri May 15 20:13:15 2009 (r192155) +++ stable/7/sys/nfsclient/nfs_vnops.c Fri May 15 20:36:54 2009 (r192156) @@ -862,6 +862,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct componentname *cnp = ap->a_cnp; struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; + struct vattr vattr; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -890,16 +891,20 @@ nfs_lookup(struct vop_lookup_args *ap) if (error > 0 && error != ENOENT) return (error); if (error == -1) { - struct vattr vattr; - + /* + * We only accept a positive hit in the cache if the + * change time of the file matches our cached copy. + * Otherwise, we discard the cache entry and fallback + * to doing a lookup RPC. + */ newvp = *vpp; if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) - && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) { - nfsstats.lookupcache_hits++; - if (cnp->cn_nameiop != LOOKUP && - (flags & ISLASTCN)) - cnp->cn_flags |= SAVENAME; - return (0); + && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) { + nfsstats.lookupcache_hits++; + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); } cache_purge(newvp); if (dvp != newvp) @@ -907,6 +912,22 @@ nfs_lookup(struct vop_lookup_args *ap) else vrele(newvp); *vpp = NULLVP; + } else if (error == ENOENT) { + /* + * We only accept a negative hit in the cache if the + * modification time of the parent directory matches + * our cached copy. Otherwise, we discard all of the + * negative cache entries for this directory. + */ + if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred, td) == 0 && + vattr.va_mtime.tv_sec == np->n_dmtime) { + nfsstats.lookupcache_hits++; + return (ENOENT); + } + cache_purge_negative(dvp); + mtx_lock(&np->n_mtx); + np->n_dmtime = 0; + mtx_unlock(&np->n_mtx); } error = 0; newvp = NULLVP; @@ -992,16 +1013,40 @@ nfsmout: vput(newvp); *vpp = NULLVP; } + + if (error != ENOENT) + goto done; + + /* The requested file was not found. */ if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) && - (flags & ISLASTCN) && error == ENOENT) { + (flags & ISLASTCN)) { + /* + * XXX: UFS does a full VOP_ACCESS(dvp, + * VWRITE) here instead of just checking + * MNT_RDONLY. + */ if (dvp->v_mount->mnt_flag & MNT_RDONLY) - error = EROFS; - else - error = EJUSTRETURN; - } - if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) + return (EROFS); cnp->cn_flags |= SAVENAME; + return (EJUSTRETURN); + } + + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + /* + * Maintain n_dmtime as the modification time + * of the parent directory when the oldest -ve + * name cache entry for this directory was + * added. + */ + mtx_lock(&np->n_mtx); + if (np->n_dmtime == 0) + np->n_dmtime = np->n_vattr.va_mtime.tv_sec; + mtx_unlock(&np->n_mtx); + cache_enter(dvp, NULL, cnp); + } + return (ENOENT); } +done: return (error); } Modified: stable/7/sys/nfsclient/nfsnode.h ============================================================================== --- stable/7/sys/nfsclient/nfsnode.h Fri May 15 20:13:15 2009 (r192155) +++ stable/7/sys/nfsclient/nfsnode.h Fri May 15 20:36:54 2009 (r192156) @@ -109,6 +109,7 @@ struct nfsnode { time_t n_modestamp; /* mode cache timestamp */ struct timespec n_mtime; /* Prev modify time. */ time_t n_ctime; /* Prev create time. */ + time_t n_dmtime; /* Prev dir modify time. */ time_t n_expiry; /* Lease expiry time */ nfsfh_t *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ Modified: stable/7/sys/sys/vnode.h ============================================================================== --- stable/7/sys/sys/vnode.h Fri May 15 20:13:15 2009 (r192155) +++ stable/7/sys/sys/vnode.h Fri May 15 20:36:54 2009 (r192156) @@ -564,6 +564,7 @@ void cache_enter(struct vnode *dvp, stru int cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp); void cache_purge(struct vnode *vp); +void cache_purge_negative(struct vnode *vp); void cache_purgevfs(struct mount *mp); int change_dir(struct vnode *vp, struct thread *td); int change_root(struct vnode *vp, struct thread *td); From owner-svn-src-stable@FreeBSD.ORG Fri May 15 20:58:52 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D838C1065672; Fri, 15 May 2009 20:58:52 +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 C44DF8FC19; Fri, 15 May 2009 20:58:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FKwqlt034369; Fri, 15 May 2009 20:58:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FKwqCL034361; Fri, 15 May 2009 20:58:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905152058.n4FKwqCL034361@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 20:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192157 - in stable/7: sys sys/contrib/pf sys/dev/ath/ath_hal sys/dev/cxgb sys/kern sys/sys usr.bin/kdump usr.bin/ktrace X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 20:58:53 -0000 Author: jhb Date: Fri May 15 20:58:52 2009 New Revision: 192157 URL: http://svn.freebsd.org/changeset/base/192157 Log: MFC: Add a new type of KTRACE record for sysctl(3) invocations. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_ktrace.c stable/7/sys/kern/kern_sysctl.c stable/7/sys/sys/ktrace.h stable/7/usr.bin/kdump/ (props changed) stable/7/usr.bin/kdump/kdump.1 stable/7/usr.bin/kdump/kdump.c stable/7/usr.bin/ktrace/ (props changed) stable/7/usr.bin/ktrace/ktrace.1 stable/7/usr.bin/ktrace/ktrace.h stable/7/usr.bin/ktrace/subr.c Modified: stable/7/sys/kern/kern_ktrace.c ============================================================================== --- stable/7/sys/kern/kern_ktrace.c Fri May 15 20:36:54 2009 (r192156) +++ stable/7/sys/kern/kern_ktrace.c Fri May 15 20:58:52 2009 (r192157) @@ -111,6 +111,7 @@ static int data_lengths[] = { sizeof(struct ktr_csw), /* KTR_CSW */ 0, /* KTR_USER */ 0, /* KTR_STRUCT */ + 0, /* KTR_SYSCTL */ }; static STAILQ_HEAD(, ktr_request) ktr_free; @@ -319,7 +320,7 @@ ktr_enqueuerequest(struct thread *td, st * is used both internally before committing other records, and also on * system call return. We drain all the ones we can find at the time when * drain is requested, but don't keep draining after that as those events - * may me approximately "after" the current event. + * may be approximately "after" the current event. */ static void ktr_drain(struct thread *td) @@ -481,6 +482,40 @@ ktrnamei(path) } void +ktrsysctl(name, namelen) + int *name; + u_int namelen; +{ + struct ktr_request *req; + u_int mib[CTL_MAXNAME + 2]; + char *mibname; + size_t mibnamelen; + int error; + + /* Lookup name of mib. */ + KASSERT(namelen <= CTL_MAXNAME, ("sysctl MIB too long")); + mib[0] = 0; + mib[1] = 1; + bcopy(name, mib + 2, namelen * sizeof(*name)); + mibnamelen = 128; + mibname = malloc(mibnamelen, M_KTRACE, M_WAITOK); + error = kernel_sysctl(curthread, mib, namelen + 2, mibname, &mibnamelen, + NULL, 0, &mibnamelen, 0); + if (error) { + free(mibname, M_KTRACE); + return; + } + req = ktr_getrequest(KTR_SYSCTL); + if (req == NULL) { + free(mibname, M_KTRACE); + return; + } + req->ktr_header.ktr_len = mibnamelen; + req->ktr_buffer = mibname; + ktr_submitrequest(curthread, req); +} + +void ktrgenio(fd, rw, uio, error) int fd; enum uio_rw rw; @@ -925,6 +960,9 @@ ktr_writerequest(struct thread *td, stru mtx_unlock(&ktrace_mtx); kth = &req->ktr_header; + KASSERT(((u_short)kth->ktr_type & ~KTR_DROP) < + sizeof(data_lengths) / sizeof(data_lengths[0]), + ("data_lengths array overflow")); datalen = data_lengths[(u_short)kth->ktr_type & ~KTR_DROP]; buflen = kth->ktr_len; auio.uio_iov = &aiov[0]; Modified: stable/7/sys/kern/kern_sysctl.c ============================================================================== --- stable/7/sys/kern/kern_sysctl.c Fri May 15 20:36:54 2009 (r192156) +++ stable/7/sys/kern/kern_sysctl.c Fri May 15 20:58:52 2009 (r192157) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_ktrace.h" #include "opt_mac.h" #include @@ -53,6 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #include @@ -757,7 +761,7 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD, sysctl_sysctl_next, ""); static int -name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidpp) +name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { int i; struct sysctl_oid *oidp; @@ -1498,6 +1502,11 @@ userland_sysctl(struct thread *td, int * req.newfunc = sysctl_new_user; req.lock = REQ_LOCKED; +#ifdef KTRACE + if (KTRPOINT(curthread, KTR_SYSCTL)) + ktrsysctl(name, namelen); +#endif + SYSCTL_XLOCK(); for (;;) { Modified: stable/7/sys/sys/ktrace.h ============================================================================== --- stable/7/sys/sys/ktrace.h Fri May 15 20:36:54 2009 (r192156) +++ stable/7/sys/sys/ktrace.h Fri May 15 20:58:52 2009 (r192157) @@ -158,6 +158,12 @@ struct sockaddr; struct stat; /* + * KTR_SYSCTL - name of a sysctl MIB + */ +#define KTR_SYSCTL 9 + /* record contains null-terminated MIB name */ + +/* * KTR_DROP - If this bit is set in ktr_type, then at least one event * between the previous record and this record was dropped. */ @@ -175,6 +181,8 @@ struct stat; #define KTRFAC_CSW (1<ktr_type); type = unknown; Modified: stable/7/usr.bin/ktrace/ktrace.1 ============================================================================== --- stable/7/usr.bin/ktrace/ktrace.1 Fri May 15 20:36:54 2009 (r192156) +++ stable/7/usr.bin/ktrace/ktrace.1 Fri May 15 20:58:52 2009 (r192157) @@ -125,6 +125,10 @@ trace various structures userland traces .It Cm w context switches +.It Cm y +trace +.Xr sysctl 3 +requests .It Cm + trace the default set of trace points - .Cm c , n , i , s , t , u Modified: stable/7/usr.bin/ktrace/ktrace.h ============================================================================== --- stable/7/usr.bin/ktrace/ktrace.h Fri May 15 20:36:54 2009 (r192156) +++ stable/7/usr.bin/ktrace/ktrace.h Fri May 15 20:58:52 2009 (r192157) @@ -35,7 +35,8 @@ */ #define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \ - KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | KTRFAC_STRUCT) + KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | \ + KTRFAC_STRUCT | KTRFAC_SYSCTL) #define ALL_POINTS (DEF_POINTS | KTRFAC_CSW) Modified: stable/7/usr.bin/ktrace/subr.c ============================================================================== --- stable/7/usr.bin/ktrace/subr.c Fri May 15 20:36:54 2009 (r192156) +++ stable/7/usr.bin/ktrace/subr.c Fri May 15 20:58:52 2009 (r192157) @@ -83,6 +83,9 @@ getpoints(char *s) case 'w': facs |= KTRFAC_CSW; break; + case 'y': + facs |= KTRFAC_SYSCTL; + break; case '+': facs |= DEF_POINTS; break; From owner-svn-src-stable@FreeBSD.ORG Sat May 16 17:15:26 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC2D71065670; Sat, 16 May 2009 17:15: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 C93328FC18; Sat, 16 May 2009 17:15:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GHFQgE064897; Sat, 16 May 2009 17:15:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GHFQvU064896; Sat, 16 May 2009 17:15:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905161715.n4GHFQvU064896@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 May 2009 17:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192200 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 17:15:27 -0000 Author: kib Date: Sat May 16 17:15:26 2009 New Revision: 192200 URL: http://svn.freebsd.org/changeset/base/192200 Log: MFC r191137: Verify that '..' still exists with the same inode number after VFS_VGET() has returned in ufs_lookup(). MFC r191260: When verifying '..' after VFS_VGET() in ufs_lookup(), do not return error if '..' is still there but changed between lookup and check. Start relookup instead. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ufs/ufs_lookup.c Modified: stable/7/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 15:21:08 2009 (r192199) +++ stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 17:15:26 2009 (r192200) @@ -77,6 +77,9 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C /* true if old FS format...*/ #define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) +static int ufs_lookup_(struct vnode *, struct vnode **, struct componentname *, + ino_t *); + /* * Convert a component of a pathname into a pointer to a locked inode. * This is a very central and rather complicated routine. @@ -130,7 +133,14 @@ ufs_lookup(ap) struct componentname *a_cnp; } */ *ap; { - struct vnode *vdp; /* vnode for directory being searched */ + + return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL)); +} + +static int +ufs_lookup_(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp, + ino_t *dd_ino) +{ struct inode *dp; /* inode for directory being searched */ struct buf *bp; /* a buffer of directory entries */ struct direct *ep; /* the current directory entry */ @@ -150,24 +160,16 @@ ufs_lookup(ap) doff_t enduseful; /* pointer past last used dir slot */ u_long bmask; /* block offset mask */ int namlen, error; - struct vnode **vpp = ap->a_vpp; - struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; struct thread *td = cnp->cn_thread; - ino_t ino; + ino_t ino, ino1; int ltype; - bp = NULL; - slotoffset = -1; -/* - * XXX there was a soft-update diff about this I couldn't merge. - * I think this was the equiv. - */ - *vpp = NULL; + if (vpp != NULL) + *vpp = NULL; - vdp = ap->a_dvp; dp = VTOI(vdp); /* @@ -178,6 +180,12 @@ ufs_lookup(ap) */ vnode_create_vobject(vdp, DIP(dp, i_size), cnp->cn_thread); + bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; + +restart: + bp = NULL; + slotoffset = -1; + /* * We now have a segment name to search for, and a directory to search. * @@ -195,7 +203,6 @@ ufs_lookup(ap) slotstatus = NONE; slotneeded = DIRECTSIZ(cnp->cn_namelen); } - bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; #ifdef UFS_DIRHASH /* @@ -364,7 +371,7 @@ foundentry: slotoffset = i_offset; slotsize = ep->d_reclen; enduseful = dp->i_size; - ap->a_cnp->cn_flags |= ISWHITEOUT; + cnp->cn_flags |= ISWHITEOUT; numdirpasses--; goto notfound; } @@ -398,8 +405,8 @@ notfound: */ if ((nameiop == CREATE || nameiop == RENAME || (nameiop == DELETE && - (ap->a_cnp->cn_flags & DOWHITEOUT) && - (ap->a_cnp->cn_flags & ISWHITEOUT))) && + (cnp->cn_flags & DOWHITEOUT) && + (cnp->cn_flags & ISWHITEOUT))) && (flags & ISLASTCN) && dp->i_effnlink != 0) { /* * Access for write is interpreted as allowing @@ -454,7 +461,7 @@ notfound: * Insert name into cache (as non-existent) if appropriate. */ if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) - cache_enter(vdp, *vpp, cnp); + cache_enter(vdp, NULL, cnp); return (ENOENT); found: @@ -480,6 +487,11 @@ found: if ((flags & ISLASTCN) && nameiop == LOOKUP) dp->i_diroff = i_offset &~ (DIRBLKSIZ - 1); + if (dd_ino != NULL) { + *dd_ino = ino; + return (0); + } + /* * If deleting, and at end of pathname, return * parameters which can be used to remove file. @@ -581,6 +593,22 @@ found: error = vn_vget_ino(pdp, ino, cnp->cn_lkflags, &tdp); if (error) return (error); + + /* + * Recheck that ".." entry in the vdp directory points + * to the inode we looked up before vdp lock was + * dropped. + */ + error = ufs_lookup_(pdp, NULL, cnp, &ino1); + if (error) { + vput(tdp); + return (error); + } + if (ino1 != ino) { + vput(tdp); + goto restart; + } + *vpp = tdp; } else if (dp->i_number == ino) { VREF(vdp); /* we want ourself, ie "." */ From owner-svn-src-stable@FreeBSD.ORG Sat May 16 17:22:04 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 641C8106564A; Sat, 16 May 2009 17:22: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 507008FC16; Sat, 16 May 2009 17:22:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GHM3Pl065070; Sat, 16 May 2009 17:22:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GHM3CS065067; Sat, 16 May 2009 17:22:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905161722.n4GHM3CS065067@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 May 2009 17:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192201 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 17:22:05 -0000 Author: kib Date: Sat May 16 17:22:03 2009 New Revision: 192201 URL: http://svn.freebsd.org/changeset/base/192201 Log: MFC r191315: In ufs_checkpath(), recheck that '..' still points to the inode with the same inode number after VFS_VGET() and relock of the vp. If '..' changed, redo the lookup. Supply the source inode number as an argument to ufs_checkpath() instead of the source inode itself. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ufs/ufs_extern.h stable/7/sys/ufs/ufs/ufs_lookup.c stable/7/sys/ufs/ufs/ufs_vnops.c Modified: stable/7/sys/ufs/ufs/ufs_extern.h ============================================================================== --- stable/7/sys/ufs/ufs/ufs_extern.h Sat May 16 17:15:26 2009 (r192200) +++ stable/7/sys/ufs/ufs/ufs_extern.h Sat May 16 17:22:03 2009 (r192201) @@ -58,7 +58,7 @@ int ufs_bmap(struct vop_bmap_args *); int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *, struct buf *, int *, int *); int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **); -int ufs_checkpath(struct inode *, struct inode *, struct ucred *); +int ufs_checkpath(ino_t, struct inode *, struct ucred *); void ufs_dirbad(struct inode *, doff_t, char *); int ufs_dirbadentry(struct vnode *, struct direct *, int); int ufs_dirempty(struct inode *, ino_t, struct ucred *); Modified: stable/7/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 17:15:26 2009 (r192200) +++ stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 17:22:03 2009 (r192201) @@ -1238,69 +1238,81 @@ ufs_dirempty(ip, parentino, cred) return (1); } +static int +ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, ino_t *dd_ino) +{ + struct dirtemplate dirbuf; + int error, namlen; + + if (vp->v_type != VDIR) + return (ENOTDIR); + error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, + sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, + IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, (int *)0, NULL); + if (error != 0) + return (error); +#if (BYTE_ORDER == LITTLE_ENDIAN) + if (OFSFMT(vp)) + namlen = dirbuf.dotdot_type; + else + namlen = dirbuf.dotdot_namlen; +#else + namlen = dirbuf.dotdot_namlen; +#endif + if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || + dirbuf.dotdot_name[1] != '.') + return (ENOTDIR); + *dd_ino = dirbuf.dotdot_ino; + return (0); +} + /* * Check if source directory is in the path of the target directory. * Target is supplied locked, source is unlocked. * The target is always vput before returning. */ int -ufs_checkpath(source, target, cred) - struct inode *source, *target; - struct ucred *cred; +ufs_checkpath(ino_t source_ino, struct inode *target, struct ucred *cred) { - struct vnode *vp; - int error, namlen; - ino_t rootino; - struct dirtemplate dirbuf; + struct vnode *vp, *vp1; + int error; + ino_t dd_ino; vp = ITOV(target); - if (target->i_number == source->i_number) { + if (target->i_number == source_ino) { error = EEXIST; goto out; } - rootino = ROOTINO; error = 0; - if (target->i_number == rootino) + if (target->i_number == ROOTINO) goto out; for (;;) { - if (vp->v_type != VDIR) { - error = ENOTDIR; - break; - } - error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, - IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, (int *)0, - (struct thread *)0); + error = ufs_dir_dd_ino(vp, cred, &dd_ino); if (error != 0) break; -# if (BYTE_ORDER == LITTLE_ENDIAN) - if (OFSFMT(vp)) - namlen = dirbuf.dotdot_type; - else - namlen = dirbuf.dotdot_namlen; -# else - namlen = dirbuf.dotdot_namlen; -# endif - if (namlen != 2 || - dirbuf.dotdot_name[0] != '.' || - dirbuf.dotdot_name[1] != '.') { - error = ENOTDIR; - break; - } - if (dirbuf.dotdot_ino == source->i_number) { + if (dd_ino == source_ino) { error = EINVAL; break; } - if (dirbuf.dotdot_ino == rootino) + if (dd_ino == ROOTINO) break; - vput(vp); - error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, - LK_EXCLUSIVE, &vp); - if (error) { - vp = NULL; + error = vn_vget_ino(vp, dd_ino, LK_EXCLUSIVE, &vp1); + if (error != 0) + break; + /* Recheck that ".." still points to vp1 after relock of vp */ + error = ufs_dir_dd_ino(vp, cred, &dd_ino); + if (error != 0) { + vput(vp1); break; } + /* Redo the check of ".." if directory was reparented */ + if (dd_ino != VTOI(vp1)->i_number) { + vput(vp1); + continue; + } + vput(vp); + vp = vp1; } out: Modified: stable/7/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_vnops.c Sat May 16 17:15:26 2009 (r192200) +++ stable/7/sys/ufs/ufs/ufs_vnops.c Sat May 16 17:22:03 2009 (r192201) @@ -1029,6 +1029,7 @@ ufs_rename(ap) struct direct newdir; int doingdirectory = 0, oldparent = 0, newparent = 0; int error = 0, ioflag; + ino_t fvp_ino; #ifdef INVARIANTS if ((tcnp->cn_flags & HASBUF) == 0 || @@ -1139,6 +1140,7 @@ abortit: * call to checkpath(). */ error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread); + fvp_ino = ip->i_number; VOP_UNLOCK(fvp, 0, td); if (oldparent != dp->i_number) newparent = dp->i_number; @@ -1147,7 +1149,7 @@ abortit: goto bad; if (xp != NULL) vput(tvp); - error = ufs_checkpath(ip, dp, tcnp->cn_cred); + error = ufs_checkpath(fvp_ino, dp, tcnp->cn_cred); if (error) goto out; if ((tcnp->cn_flags & SAVESTART) == 0)