From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 04:15:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15CA51065673; Sun, 15 Jul 2012 04:15:28 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00E7F8FC0C; Sun, 15 Jul 2012 04:15:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F4FRHv025307; Sun, 15 Jul 2012 04:15:27 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F4FRsP025305; Sun, 15 Jul 2012 04:15:27 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201207150415.q6F4FRsP025305@svn.freebsd.org> From: Alexander Kabaev Date: Sun, 15 Jul 2012 04:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238461 - head/usr.sbin/pkg X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 04:15:28 -0000 Author: kan Date: Sun Jul 15 04:15:27 2012 New Revision: 238461 URL: http://svn.freebsd.org/changeset/base/238461 Log: Make pkg bootstrap program ask for confirmation before proceeding. The previous behaviour was to silently download and install the pkg package, without ever telling user about what it was doing and why. Discussed with: bapt Reviewed by: kib Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Sun Jul 15 03:43:56 2012 (r238460) +++ head/usr.sbin/pkg/pkg.c Sun Jul 15 04:15:27 2012 (r238461) @@ -389,6 +389,28 @@ cleanup: return (ret); } +static const char confirmation_message[] = +"The package management tool is not yet installed on your system.\n" +"Do you want to fetch and install it now? [y/N]: "; + +static int +pkg_query_yes_no(void) +{ + int ret, c; + + c = getchar(); + + if (c == 'y' || c == 'Y') + ret = 1; + else + ret = 0; + + while (c != '\n' && c != EOF) + c = getchar(); + + return (ret); +} + int main(__unused int argc, char *argv[]) { @@ -397,9 +419,21 @@ main(__unused int argc, char *argv[]) snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); - if (access(pkgpath, X_OK) == -1) + if (access(pkgpath, X_OK) == -1) { + /* + * Do not ask for confirmation if either of stdin or stdout is + * not tty. Check the environment to see if user has answer + * tucked in there already. + */ + if (getenv("ALWAYS_ASSUME_YES") == NULL && + isatty(fileno(stdin))) { + printf("%s", confirmation_message); + if (pkg_query_yes_no() == 0) + exit(EXIT_FAILURE); + } if (bootstrap_pkg() != 0) exit(EXIT_FAILURE); + } execv(pkgpath, argv); From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 05:35:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48EE8106566B; Sun, 15 Jul 2012 05:35:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3383E8FC0A; Sun, 15 Jul 2012 05:35:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F5ZFMP028564; Sun, 15 Jul 2012 05:35:15 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F5ZENg028556; Sun, 15 Jul 2012 05:35:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207150535.q6F5ZENg028556@svn.freebsd.org> From: Warner Losh Date: Sun, 15 Jul 2012 05:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238463 - in head/sys/boot/arm/at91: bootspi libat91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 05:35:15 -0000 Author: imp Date: Sun Jul 15 05:35:14 2012 New Revision: 238463 URL: http://svn.freebsd.org/changeset/base/238463 Log: Use the pin number rather than the hybrid pin number + name. Modified: head/sys/boot/arm/at91/bootspi/ee.c head/sys/boot/arm/at91/libat91/at91rm9200.h head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c head/sys/boot/arm/at91/libat91/eeprom.c head/sys/boot/arm/at91/libat91/emac_init.c head/sys/boot/arm/at91/libat91/lib_AT91RM9200.h head/sys/boot/arm/at91/libat91/spi_flash.c Modified: head/sys/boot/arm/at91/bootspi/ee.c ============================================================================== --- head/sys/boot/arm/at91/bootspi/ee.c Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/bootspi/ee.c Sun Jul 15 05:35:14 2012 (r238463) @@ -59,11 +59,11 @@ EEInit(void) AT91PS_PIO pPio = (AT91PS_PIO)AT91C_BASE_PIOA; AT91PS_PMC pPMC = (AT91PS_PMC)AT91C_BASE_PMC; - pPio->PIO_ASR = AT91C_PA25_TWD | AT91C_PA26_TWCK; - pPio->PIO_PDR = AT91C_PA25_TWD | AT91C_PA26_TWCK; + pPio->PIO_ASR = AT91C_PIO_PA25 | AT91C_PIO_PA26; + pPio->PIO_PDR = AT91C_PIO_PA25 | AT91C_PIO_PA26; - pPio->PIO_MDDR = ~AT91C_PA25_TWD; - pPio->PIO_MDER = AT91C_PA25_TWD; + pPio->PIO_MDDR = ~AT91C_PIO_PA25; + pPio->PIO_MDER = AT91C_PIO_PA25; pPMC->PMC_PCER = 1u << AT91C_ID_TWI; Modified: head/sys/boot/arm/at91/libat91/at91rm9200.h ============================================================================== --- head/sys/boot/arm/at91/libat91/at91rm9200.h Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/libat91/at91rm9200.h Sun Jul 15 05:35:14 2012 (r238463) @@ -2311,7 +2311,7 @@ typedef struct _AT91S_BFC { // ========== Register definition for BFC peripheral ========== #define AT91C_BFC_MR ((AT91_REG *) 0xFFFFFFC0) // (BFC) BFC Mode Register -#include +#include // ***************************************************************************** // PERIPHERAL ID DEFINITIONS FOR AT91RM9200 Modified: head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c ============================================================================== --- head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c Sun Jul 15 05:35:14 2012 (r238463) @@ -188,8 +188,8 @@ _init(void) AT91C_BASE_PIOC->PIO_PDR = 0xffff0000; #endif // Configure DBGU -use local routine optimized for space - AT91C_BASE_PIOA->PIO_ASR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; - AT91C_BASE_PIOA->PIO_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; + AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA31 | AT91C_PIO_PA30; + AT91C_BASE_PIOA->PIO_PDR = AT91C_PIO_PA31 | AT91C_PIO_PA30; pUSART->US_IDR = (unsigned int) -1; pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS; Modified: head/sys/boot/arm/at91/libat91/eeprom.c ============================================================================== --- head/sys/boot/arm/at91/libat91/eeprom.c Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/libat91/eeprom.c Sun Jul 15 05:35:14 2012 (r238463) @@ -58,11 +58,11 @@ InitEEPROM(void) AT91PS_PIO pPio = (AT91PS_PIO)AT91C_BASE_PIOA; AT91PS_PMC pPMC = (AT91PS_PMC)AT91C_BASE_PMC; - pPio->PIO_ASR = AT91C_PA25_TWD | AT91C_PA26_TWCK; - pPio->PIO_PDR = AT91C_PA25_TWD | AT91C_PA26_TWCK; + pPio->PIO_ASR = AT91C_PIO_PA25 | AT91C_PIO_PA26; + pPio->PIO_PDR = AT91C_PIO_PA25 | AT91C_PIO_PA26; - pPio->PIO_MDDR = ~AT91C_PA25_TWD; - pPio->PIO_MDER = AT91C_PA25_TWD; + pPio->PIO_MDDR = ~AT91C_PIO_PA25; + pPio->PIO_MDER = AT91C_PIO_PA25; pPMC->PMC_PCER = 1u << AT91C_ID_TWI; Modified: head/sys/boot/arm/at91/libat91/emac_init.c ============================================================================== --- head/sys/boot/arm/at91/libat91/emac_init.c Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/libat91/emac_init.c Sun Jul 15 05:35:14 2012 (r238463) @@ -85,24 +85,24 @@ EMAC_SetMACAddress(unsigned char mac[6]) AT91C_BASE_PMC->PMC_PCER = 1u << AT91C_ID_EMAC; AT91C_BASE_PIOA->PIO_ASR = - AT91C_PA14_ERXER | AT91C_PA12_ERX0 | AT91C_PA13_ERX1 | - AT91C_PA8_ETXEN | AT91C_PA16_EMDIO | AT91C_PA9_ETX0 | - AT91C_PA10_ETX1 | AT91C_PA11_ECRS_ECRSDV | AT91C_PA15_EMDC | - AT91C_PA7_ETXCK_EREFCK; + AT91C_PIO_PA14 | AT91C_PIO_PA12 | AT91C_PIO_PA13 | + AT91C_PIO_PA8 | AT91C_PIO_PA16 | AT91C_PIO_PA9 | + AT91C_PIO_PA10 | AT91C_PIO_PA11 | AT91C_PIO_PA15 | + AT91C_PIO_PA7; AT91C_BASE_PIOA->PIO_PDR = - AT91C_PA14_ERXER | AT91C_PA12_ERX0 | AT91C_PA13_ERX1 | - AT91C_PA8_ETXEN | AT91C_PA16_EMDIO | AT91C_PA9_ETX0 | - AT91C_PA10_ETX1 | AT91C_PA11_ECRS_ECRSDV | AT91C_PA15_EMDC | - AT91C_PA7_ETXCK_EREFCK; + AT91C_PIO_PA14 | AT91C_PIO_PA12 | AT91C_PIO_PA13 | + AT91C_PIO_PA8 | AT91C_PIO_PA16 | AT91C_PIO_PA9 | + AT91C_PIO_PA10 | AT91C_PIO_PA11 | AT91C_PIO_PA15 | + AT91C_PIO_PA7; #if defined(BOOT_KB920X) | defined(BOOT_BWCT) /* Really !RMII */ AT91C_BASE_PIOB->PIO_BSR = - AT91C_PB12_ETX2 | AT91C_PB13_ETX3 | AT91C_PB14_ETXER | - AT91C_PB15_ERX2 | AT91C_PB16_ERX3 | AT91C_PB17_ERXDV | - AT91C_PB18_ECOL | AT91C_PB19_ERXCK; + AT91C_PIO_PB12 | AT91C_PIO_PB13 | AT91C_PIO_PB14 | + AT91C_PIO_PB15 | AT91C_PIO_PB16 | AT91C_PIO_PB17 | + AT91C_PIO_PB18 | AT91C_PIO_PB19; AT91C_BASE_PIOB->PIO_PDR = - AT91C_PB12_ETX2 | AT91C_PB13_ETX3 | AT91C_PB14_ETXER | - AT91C_PB15_ERX2 | AT91C_PB16_ERX3 | AT91C_PB17_ERXDV | - AT91C_PB18_ECOL | AT91C_PB19_ERXCK; + AT91C_PIO_PB12 | AT91C_PIO_PB13 | AT91C_PIO_PB14 | + AT91C_PIO_PB15 | AT91C_PIO_PB16 | AT91C_PIO_PB17 | + AT91C_PIO_PB18 | AT91C_PIO_PB19; #endif pEmac->EMAC_CTL = 0; Modified: head/sys/boot/arm/at91/libat91/lib_AT91RM9200.h ============================================================================== --- head/sys/boot/arm/at91/libat91/lib_AT91RM9200.h Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/libat91/lib_AT91RM9200.h Sun Jul 15 05:35:14 2012 (r238463) @@ -134,17 +134,17 @@ AT91F_MCI_CfgPIO(void) // Configure PIO controllers to periph mode AT91F_PIO_CfgPeriph( AT91C_BASE_PIOA, // PIO controller base address - ((unsigned int) AT91C_PA28_MCCDA ) | - ((unsigned int) AT91C_PA29_MCDA0 ) | - ((unsigned int) AT91C_PA27_MCCK ), // Peripheral A + ((unsigned int) AT91C_PIO_PA28 ) | + ((unsigned int) AT91C_PIO_PA29 ) | + ((unsigned int) AT91C_PIO_PA27 ), // Peripheral A 0); // Peripheral B // Configure PIO controllers to periph mode AT91F_PIO_CfgPeriph( AT91C_BASE_PIOB, // PIO controller base address 0, // Peripheral A - ((unsigned int) AT91C_PB5_MCDA3 ) | - ((unsigned int) AT91C_PB3_MCDA1 ) | - ((unsigned int) AT91C_PB4_MCDA2 )); // Peripheral B + ((unsigned int) AT91C_PIO_PB5 ) | + ((unsigned int) AT91C_PIO_PB3 ) | + ((unsigned int) AT91C_PIO_PB4 )); // Peripheral B } Modified: head/sys/boot/arm/at91/libat91/spi_flash.c ============================================================================== --- head/sys/boot/arm/at91/libat91/spi_flash.c Sun Jul 15 05:24:19 2012 (r238462) +++ head/sys/boot/arm/at91/libat91/spi_flash.c Sun Jul 15 05:35:14 2012 (r238463) @@ -223,10 +223,10 @@ SPI_InitFlash(void) // enable CS0, CLK, MOSI, MISO pPio = (AT91PS_PIO)AT91C_BASE_PIOA; - pPio->PIO_ASR = AT91C_PA3_NPCS0 | AT91C_PA1_MOSI | AT91C_PA0_MISO | - AT91C_PA2_SPCK; - pPio->PIO_PDR = AT91C_PA3_NPCS0 | AT91C_PA1_MOSI | AT91C_PA0_MISO | - AT91C_PA2_SPCK; + pPio->PIO_ASR = AT91C_PIO_PA3 | AT91C_PIO_PA1 | AT91C_PIO_PA0 | + AT91C_PIO_PA2; + pPio->PIO_PDR = AT91C_PIO_PA3 | AT91C_PIO_PA1 | AT91C_PIO_PA0 | + AT91C_PIO_PA2; // enable clocks to SPI AT91C_BASE_PMC->PMC_PCER = 1u << AT91C_ID_SPI; From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 05:38:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF915106564A; Sun, 15 Jul 2012 05:38:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB88E8FC12; Sun, 15 Jul 2012 05:38:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F5chqA028730; Sun, 15 Jul 2012 05:38:43 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F5chom028728; Sun, 15 Jul 2012 05:38:43 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207150538.q6F5chom028728@svn.freebsd.org> From: Warner Losh Date: Sun, 15 Jul 2012 05:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238464 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 05:38:44 -0000 Author: imp Date: Sun Jul 15 05:38:43 2012 New Revision: 238464 URL: http://svn.freebsd.org/changeset/base/238464 Log: Force overwrite of gz file, to make NO_CLEAN builds work. Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sun Jul 15 05:35:14 2012 (r238463) +++ head/sys/conf/Makefile.arm Sun Jul 15 05:38:43 2012 (r238464) @@ -105,7 +105,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$ >opt_kernname.h eval $$(stat -s ${KERNEL_KO}.tmp) && \ echo "#define KERNSIZE $$st_size" >>opt_kernname.h - gzip -9 ${KERNEL_KO}.tmp + gzip -f9 ${KERNEL_KO}.tmp eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \ echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/inflate.c -o \ From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 05:41:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 650011065670; Sun, 15 Jul 2012 05:41:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F2608FC1A; Sun, 15 Jul 2012 05:41:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F5fiiX028890; Sun, 15 Jul 2012 05:41:44 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F5fiGj028883; Sun, 15 Jul 2012 05:41:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207150541.q6F5fiGj028883@svn.freebsd.org> From: Warner Losh Date: Sun, 15 Jul 2012 05:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238465 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 05:41:44 -0000 Author: imp Date: Sun Jul 15 05:41:43 2012 New Revision: 238465 URL: http://svn.freebsd.org/changeset/base/238465 Log: Configure the peripheral pins for MCI devices. Eliminate the now-unused at91_pio_rm9200.h. Deleted: head/sys/arm/at91/at91_pio_rm9200.h Modified: head/sys/arm/at91/at91rm9200_devices.c head/sys/arm/at91/at91rm9200var.h head/sys/arm/at91/board_bwct.c head/sys/arm/at91/board_hl200.c head/sys/arm/at91/board_kb920x.c head/sys/arm/at91/board_tsc4370.c Modified: head/sys/arm/at91/at91rm9200_devices.c ============================================================================== --- head/sys/arm/at91/at91rm9200_devices.c Sun Jul 15 05:38:43 2012 (r238464) +++ head/sys/arm/at91/at91rm9200_devices.c Sun Jul 15 05:41:43 2012 (r238465) @@ -80,6 +80,10 @@ at91rm9200_config_uart(unsigned devid, u * to do. */ + /* + * Current boards supported don't need the extras, but they should be + * implemented. But that should wait until the new pin api goes in. + */ switch (devid) { case AT91_ID_DBGU: at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PIO_PA30, 0); /* DRXD */ @@ -122,3 +126,17 @@ at91rm9200_config_uart(unsigned devid, u break; } } + +void +at91rm9200_config_mci(int has_4wire) +{ + /* XXX TODO chip changed GPIO, other slots, etc */ + at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PIO_PA27, 0); /* MCCK */ + at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PIO_PA28, 1); /* MCCDA */ + at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PIO_PA29, 1); /* MCDA0 */ + if (has_4wire) { + at91_pio_use_periph_b(AT91RM92_PIOB_BASE, AT91C_PIO_PB3, 1); /* MCDA1 */ + at91_pio_use_periph_b(AT91RM92_PIOB_BASE, AT91C_PIO_PB4, 1); /* MCDA2 */ + at91_pio_use_periph_b(AT91RM92_PIOB_BASE, AT91C_PIO_PB5, 1); /* MCDA3 */ + } +} Modified: head/sys/arm/at91/at91rm9200var.h ============================================================================== --- head/sys/arm/at91/at91rm9200var.h Sun Jul 15 05:38:43 2012 (r238464) +++ head/sys/arm/at91/at91rm9200var.h Sun Jul 15 05:41:43 2012 (r238465) @@ -50,4 +50,9 @@ void at91rm9200_set_subtype(enum at91_so void at91rm9200_config_uart(unsigned devid, unsigned unit, unsigned pinmask); +/* + * MCI (sd/mmc card support) + */ +void at91rm9200_config_mci(int has_4wire); + #endif /* ARM_AT91_AT91RM9200VAR_H */ Modified: head/sys/arm/at91/board_bwct.c ============================================================================== --- head/sys/arm/at91/board_bwct.c Sun Jul 15 05:38:43 2012 (r238464) +++ head/sys/arm/at91/board_bwct.c Sun Jul 15 05:41:43 2012 (r238465) @@ -45,6 +45,9 @@ board_init(void) */ at91rm9200_config_uart(AT91_ID_DBGU, 0, 0); /* DBGU just Tx and Rx */ + at91rm9200_config_mci(0); + /* Configure ethernet */ + return (at91_ramsize()); } Modified: head/sys/arm/at91/board_hl200.c ============================================================================== --- head/sys/arm/at91/board_hl200.c Sun Jul 15 05:38:43 2012 (r238464) +++ head/sys/arm/at91/board_hl200.c Sun Jul 15 05:41:43 2012 (r238465) @@ -34,8 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include BOARD_INIT long board_init(void) @@ -51,6 +49,16 @@ board_init(void) at91rm9200_config_uart(AT91_ID_DBGU, 0, 0); /* DBGU just Tx and Rx */ at91rm9200_config_uart(AT91RM9200_ID_USART0, 1, 0); /* Tx and Rx */ + at91rm9200_config_mci(0); /* HOTe HL200 unknown 1 vs 4 wire */ + + /* Enable CF card slot */ + /* Enable sound thing */ + /* Enable VGA chip */ + /* Enable ethernet */ + /* Enable TWI + RTC */ + /* Enable USB Host */ + /* Enable USB Device (gadget) */ + return (at91_ramsize()); } Modified: head/sys/arm/at91/board_kb920x.c ============================================================================== --- head/sys/arm/at91/board_kb920x.c Sun Jul 15 05:38:43 2012 (r238464) +++ head/sys/arm/at91/board_kb920x.c Sun Jul 15 05:41:43 2012 (r238465) @@ -32,10 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include -#include BOARD_INIT long board_init(void) @@ -54,13 +51,14 @@ board_init(void) at91rm9200_config_uart(AT91RM9200_ID_USART3, 3, /* Tx, Rx, CTS, RTS - RS485 */ AT91_UART_CTS | AT91_UART_RTS); - /* MMC/SD Interface */ - at91_pio_use_periph_a(AT91RM92_PIOA_BASE,AT91C_PA27_MCCK, 0); - at91_pio_use_periph_a(AT91RM92_PIOA_BASE,AT91C_PA28_MCCDA, 1); - at91_pio_use_periph_a(AT91RM92_PIOA_BASE,AT91C_PA29_MCDA0, 1); - at91_pio_use_periph_b(AT91RM92_PIOB_BASE,AT91C_PB3_MCDA1, 1); - at91_pio_use_periph_b(AT91RM92_PIOB_BASE,AT91C_PB4_MCDA2, 1); - at91_pio_use_periph_b(AT91RM92_PIOB_BASE,AT91C_PB5_MCDA3, 1); + at91rm9200_config_mci(1); + + /* CFE interface */ + /* ethernet interface */ + /* lcd interface */ + /* USB host */ + /* USB device (gadget) */ + /* TWI */ return (at91_ramsize()); } Modified: head/sys/arm/at91/board_tsc4370.c ============================================================================== --- head/sys/arm/at91/board_tsc4370.c Sun Jul 15 05:38:43 2012 (r238464) +++ head/sys/arm/at91/board_tsc4370.c Sun Jul 15 05:41:43 2012 (r238465) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include BOARD_INIT long board_init(void) @@ -49,6 +49,15 @@ board_init(void) at91rm9200_config_uart(AT91RM9200_ID_USART2, 3, 0); /* Tx and Rx */ at91rm9200_config_uart(AT91RM9200_ID_USART3, 4, 0); /* Tx and Rx */ + at91rm9200_config_mci(0); /* tsc4370 board has only 1 wire */ + /* Newer boards may have 4 wires */ + + /* Configure TWI */ + /* Configure SPI + dataflash */ + /* Configure SSC */ + /* Configure USB Host */ + /* Configure FPGA attached to chip selects */ + /* Pin assignment */ /* Assert PA24 low -- talk to rubidium */ at91_pio_use_gpio(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 05:49:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63C64106566B; Sun, 15 Jul 2012 05:49:03 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 353E68FC0A; Sun, 15 Jul 2012 05:49:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F5n3hD029231; Sun, 15 Jul 2012 05:49:03 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F5n2jg029228; Sun, 15 Jul 2012 05:49:02 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201207150549.q6F5n2jg029228@svn.freebsd.org> From: Rui Paulo Date: Sun, 15 Jul 2012 05:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238466 - head/sys/dev/usb/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 05:49:03 -0000 Author: rpaulo Date: Sun Jul 15 05:49:02 2012 New Revision: 238466 URL: http://svn.freebsd.org/changeset/base/238466 Log: The JP1082 device doesn't respond to the MII_BMSR command and it turns out that it has an unusable PHY. It still works, although very slowly, without a PHY, so I implemented non-PHY support in the udav driver. Modified: head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/net/if_udavreg.h Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Sun Jul 15 05:41:43 2012 (r238465) +++ head/sys/dev/usb/net/if_udav.c Sun Jul 15 05:49:02 2012 (r238466) @@ -169,7 +169,7 @@ MODULE_DEPEND(udav, ether, 1, 1, 1); MODULE_DEPEND(udav, miibus, 1, 1, 1); MODULE_VERSION(udav, 1); -static const struct usb_ether_methods udav_ue_methods = { +static struct usb_ether_methods udav_ue_methods = { .ue_attach_post = udav_attach_post, .ue_start = udav_start, .ue_init = udav_init, @@ -206,7 +206,8 @@ static const STRUCT_USB_HOST_ID udav_dev {USB_VPI(USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ADM8515, 0)}, /* Kontron AG USB Ethernet */ {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_DM9601, 0)}, - {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082, 0)}, + {USB_VPI(USB_VENDOR_KONTRON, USB_PRODUCT_KONTRON_JP1082, + UDAV_FLAG_NO_PHY)}, }; static void @@ -259,6 +260,16 @@ udav_attach(device_t dev) goto detach; } + /* + * The JP1082 has an unusable PHY and provides no link information. + */ + if (sc->sc_flags & UDAV_FLAG_NO_PHY) { + udav_ue_methods.ue_tick = NULL; + udav_ue_methods.ue_mii_upd = NULL; + udav_ue_methods.ue_mii_sts = NULL; + sc->sc_flags |= UDAV_FLAG_LINK; + } + ue->ue_sc = sc; ue->ue_dev = dev; ue->ue_udev = uaa->device; @@ -712,7 +723,8 @@ udav_stop(struct usb_ether *ue) UDAV_LOCK_ASSERT(sc, MA_OWNED); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - sc->sc_flags &= ~UDAV_FLAG_LINK; + if (!(sc->sc_flags & UDAV_FLAG_NO_PHY)) + sc->sc_flags &= ~UDAV_FLAG_LINK; /* * stop all the transfers, if not already stopped: Modified: head/sys/dev/usb/net/if_udavreg.h ============================================================================== --- head/sys/dev/usb/net/if_udavreg.h Sun Jul 15 05:41:43 2012 (r238465) +++ head/sys/dev/usb/net/if_udavreg.h Sun Jul 15 05:49:02 2012 (r238466) @@ -159,6 +159,7 @@ struct udav_softc { int sc_flags; #define UDAV_FLAG_LINK 0x0001 #define UDAV_FLAG_EXT_PHY 0x0040 +#define UDAV_FLAG_NO_PHY 0x0080 }; #define UDAV_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 06:08:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 669351065670; Sun, 15 Jul 2012 06:08:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38FB98FC14; Sun, 15 Jul 2012 06:08:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6F68C6I030040; Sun, 15 Jul 2012 06:08:12 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6F68C4M030039; Sun, 15 Jul 2012 06:08:12 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207150608.q6F68C4M030039@svn.freebsd.org> From: Warner Losh Date: Sun, 15 Jul 2012 06:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238467 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 06:08:12 -0000 Author: imp Date: Sun Jul 15 06:08:11 2012 New Revision: 238467 URL: http://svn.freebsd.org/changeset/base/238467 Log: These were never used, remove them. Deleted: head/sys/arm/at91/hints.at91rm9200 head/sys/arm/at91/hints.at91sam9261 From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 10:19:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CEC2106564A; Sun, 15 Jul 2012 10:19:44 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 364A28FC08; Sun, 15 Jul 2012 10:19:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FAJiQm041100; Sun, 15 Jul 2012 10:19:44 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FAJhis041090; Sun, 15 Jul 2012 10:19:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207151019.q6FAJhis041090@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 10:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238468 - in head: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 10:19:44 -0000 Author: jilles Date: Sun Jul 15 10:19:43 2012 New Revision: 238468 URL: http://svn.freebsd.org/changeset/base/238468 Log: sh: Expand assignment-like words specially for export/readonly/local. Examples: export x=~ now expands the tilde local y=$1 is now safe, even if $1 contains IFS characters or metacharacters. For a word to "look like an assignment", it must start with a name followed by an equals sign, none of which may be quoted. The special treatment applies when the first word (potentially after "command") is "export", "readonly" or "local". There may be quoting characters but no expansions. If "local" is overridden with a function there is no special treatment ("export" and "readonly" cannot be overridden with a function). If things like local arr=(1 2 3) are ever allowed in the future, they cannot call a "local" function. This would either be a run-time error or it would call the builtin. This matches Austin Group bug #351, planned for the next issue of POSIX.1. PR: bin/166771 Added: head/tools/regression/bin/sh/expansion/export2.0 (contents, props changed) head/tools/regression/bin/sh/expansion/export3.0 (contents, props changed) head/tools/regression/bin/sh/expansion/local1.0 (contents, props changed) head/tools/regression/bin/sh/expansion/local2.0 (contents, props changed) head/tools/regression/bin/sh/expansion/readonly1.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/exec.c head/bin/sh/exec.h head/bin/sh/sh.1 Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Jul 15 06:08:11 2012 (r238467) +++ head/bin/sh/eval.c Sun Jul 15 10:19:43 2012 (r238468) @@ -672,6 +672,52 @@ out: result->fd, result->buf, result->nleft, result->jp)); } +static int +mustexpandto(const char *argtext, const char *mask) +{ + for (;;) { + if (*argtext == CTLQUOTEMARK || *argtext == CTLQUOTEEND) { + argtext++; + continue; + } + if (*argtext == CTLESC) + argtext++; + else if (BASESYNTAX[(int)*argtext] == CCTL) + return (0); + if (*argtext != *mask) + return (0); + if (*argtext == '\0') + return (1); + argtext++; + mask++; + } +} + +static int +isdeclarationcmd(struct narg *arg) +{ + int have_command = 0; + + if (arg == NULL) + return (0); + while (mustexpandto(arg->text, "command")) { + have_command = 1; + arg = &arg->next->narg; + if (arg == NULL) + return (0); + /* + * To also allow "command -p" and "command --" as part of + * a declaration command, add code here. + * We do not do this, as ksh does not do it either and it + * is not required by POSIX. + */ + } + return (mustexpandto(arg->text, "export") || + mustexpandto(arg->text, "readonly") || + (mustexpandto(arg->text, "local") && + (have_command || !isfunc("local")))); +} + /* * Check if a builtin can safely be executed in the same process, * even though it should be in a subshell (command substitution). @@ -743,11 +789,12 @@ evalcommand(union node *cmd, int flags, exitstatus = 0; for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) { if (varflag && isassignment(argp->narg.text)) { - expandarg(argp, &varlist, EXP_VARTILDE); + expandarg(argp, varflag == 1 ? &varlist : &arglist, + EXP_VARTILDE); continue; - } + } else if (varflag == 1) + varflag = isdeclarationcmd(&argp->narg) ? 2 : 0; expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); - varflag = 0; } *arglist.lastp = NULL; *varlist.lastp = NULL; Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Sun Jul 15 06:08:11 2012 (r238467) +++ head/bin/sh/exec.c Sun Jul 15 10:19:43 2012 (r238468) @@ -648,6 +648,19 @@ unsetfunc(const char *name) return (0); } + +/* + * Check if a function by a certain name exists. + */ +int +isfunc(const char *name) +{ + struct tblentry *cmdp; + cmdp = cmdlookup(name, 0); + return (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION); +} + + /* * Shared code for the following builtin commands: * type, command -v, command -V Modified: head/bin/sh/exec.h ============================================================================== --- head/bin/sh/exec.h Sun Jul 15 06:08:11 2012 (r238467) +++ head/bin/sh/exec.h Sun Jul 15 10:19:43 2012 (r238468) @@ -72,5 +72,6 @@ void hashcd(void); void changepath(const char *); void defun(const char *, union node *); int unsetfunc(const char *); +int isfunc(const char *); int typecmd_impl(int, char **, int, const char *); void clearcmdentry(void); Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Sun Jul 15 06:08:11 2012 (r238467) +++ head/bin/sh/sh.1 Sun Jul 15 10:19:43 2012 (r238468) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd November 5, 2011 +.Dd July 15, 2012 .Dt SH 1 .Os .Sh NAME @@ -1164,6 +1164,20 @@ Assignments are expanded differently fro tilde expansion is also performed after the equals sign and after any colon and usernames are also terminated by colons, and field splitting and pathname expansion are not performed. +.Pp +This special expansion applies not only to assignments that form a simple +command by themselves or precede a command word, +but also to words passed to the +.Ic export , +.Ic local +or +.Ic readonly +built-in commands that have this form. +For this, the builtin's name must be literal +(not the result of an expansion) +and may optionally be preceded by one or more literal instances of +.Ic command +without options. .Ss Positional Parameters A positional parameter is a parameter denoted by a number greater than zero. The shell sets these initially to the values of its command line Added: head/tools/regression/bin/sh/expansion/export2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/export2.0 Sun Jul 15 10:19:43 2012 (r238468) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +w='@ @' +check() { + [ "$v" = "$w" ] || echo "Expected $w got $v" +} + +export v=$w +check + +HOME=/known/value +check() { + [ "$v" = ~ ] || echo "Expected $HOME got $v" +} + +export v=~ +check + +check() { + [ "$v" = "x:$HOME" ] || echo "Expected x:$HOME got $v" +} + +export v=x:~ +check Added: head/tools/regression/bin/sh/expansion/export3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/export3.0 Sun Jul 15 10:19:43 2012 (r238468) @@ -0,0 +1,30 @@ +# $FreeBSD$ + +w='@ @' +check() { + [ "$v" = "$w" ] || echo "Expected $w got $v" +} + +command export v=$w +check +command command export v=$w +check + +HOME=/known/value +check() { + [ "$v" = ~ ] || echo "Expected $HOME got $v" +} + +command export v=~ +check +command command export v=~ +check + +check() { + [ "$v" = "x:$HOME" ] || echo "Expected x:$HOME got $v" +} + +command export v=x:~ +check +command command export v=x:~ +check Added: head/tools/regression/bin/sh/expansion/local1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/local1.0 Sun Jul 15 10:19:43 2012 (r238468) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +run_test() { + w='@ @' + check() { + [ "$v" = "$w" ] || echo "Expected $w got $v" + } + + local v=$w + check + + HOME=/known/value + check() { + [ "$v" = ~ ] || echo "Expected $HOME got $v" + } + + local v=~ + check + + check() { + [ "$v" = "x:$HOME" ] || echo "Expected x:$HOME got $v" + } + + local v=x:~ + check +} + +run_test Added: head/tools/regression/bin/sh/expansion/local2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/local2.0 Sun Jul 15 10:19:43 2012 (r238468) @@ -0,0 +1,34 @@ +# $FreeBSD$ + +run_test() { + w='@ @' + check() { + [ "$v" = "$w" ] || echo "Expected $w got $v" + } + + command local v=$w + check + command command local v=$w + check + + HOME=/known/value + check() { + [ "$v" = ~ ] || echo "Expected $HOME got $v" + } + + command local v=~ + check + command command local v=~ + check + + check() { + [ "$v" = "x:$HOME" ] || echo "Expected x:$HOME got $v" + } + + command local v=x:~ + check + command command local v=x:~ + check +} + +run_test Added: head/tools/regression/bin/sh/expansion/readonly1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/readonly1.0 Sun Jul 15 10:19:43 2012 (r238468) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +w='@ @' + +v=0 HOME=/known/value +readonly v=~:~/:$w +[ "$v" = "$HOME:$HOME/:$w" ] || echo "Expected $HOME/:$w got $v" From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 10:22:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77566106566C; Sun, 15 Jul 2012 10:22:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 628678FC12; Sun, 15 Jul 2012 10:22:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FAMEwu041246; Sun, 15 Jul 2012 10:22:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FAMEJL041244; Sun, 15 Jul 2012 10:22:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207151022.q6FAMEJL041244@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 10:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238469 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 10:22:14 -0000 Author: jilles Date: Sun Jul 15 10:22:13 2012 New Revision: 238469 URL: http://svn.freebsd.org/changeset/base/238469 Log: sh: Add a simple test for the "local" builtin. Added: head/tools/regression/bin/sh/builtins/local1.0 (contents, props changed) Added: head/tools/regression/bin/sh/builtins/local1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/local1.0 Sun Jul 15 10:22:13 2012 (r238469) @@ -0,0 +1,13 @@ +# $FreeBSD$ +# A commonly used but non-POSIX builtin. + +f() { + local x + x=2 + [ "$x" = 2 ] +} +x=1 +f || exit 3 +[ "$x" = 1 ] || exit 3 +f || exit 3 +[ "$x" = 1 ] || exit 3 From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 10:49:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0E1E1065670; Sun, 15 Jul 2012 10:49:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC1778FC14; Sun, 15 Jul 2012 10:49:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FAnHbZ042781; Sun, 15 Jul 2012 10:49:17 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FAnHNN042778; Sun, 15 Jul 2012 10:49:17 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207151049.q6FAnHNN042778@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 10:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238470 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 10:49:17 -0000 Author: jilles Date: Sun Jul 15 10:49:16 2012 New Revision: 238470 URL: http://svn.freebsd.org/changeset/base/238470 Log: sh: Remove unused variable in_dowait. Modified: head/bin/sh/jobs.c head/bin/sh/jobs.h Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Jul 15 10:22:13 2012 (r238469) +++ head/bin/sh/jobs.c Sun Jul 15 10:49:16 2012 (r238470) @@ -84,7 +84,6 @@ static struct job *jobmru; /* most recen static pid_t initialpgrp; /* pgrp of shell on invocation */ #endif int in_waitcmd = 0; /* are we in waitcmd()? */ -int in_dowait = 0; /* are we in dowait()? */ volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */ static int ttyfd = -1; @@ -1023,14 +1022,12 @@ dowait(int block, struct job *job) int sig; int coredump; - in_dowait++; TRACE(("dowait(%d) called\n", block)); do { pid = waitproc(block, &status); TRACE(("wait returns %d, status=%d\n", (int)pid, status)); } while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) || (pid > 0 && WIFSTOPPED(status) && !iflag)); - in_dowait--; if (pid == -1 && errno == ECHILD && job != NULL) job->state = JOBDONE; if (breakwaitcmd != 0) { Modified: head/bin/sh/jobs.h ============================================================================== --- head/bin/sh/jobs.h Sun Jul 15 10:22:13 2012 (r238469) +++ head/bin/sh/jobs.h Sun Jul 15 10:49:16 2012 (r238470) @@ -84,7 +84,6 @@ enum { extern int job_warning; /* user was warned about stopped jobs */ extern int in_waitcmd; /* are we in waitcmd()? */ -extern int in_dowait; /* are we in dowait()? */ extern volatile sig_atomic_t breakwaitcmd; /* break wait to process traps? */ void setjobctl(int); From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 10:53:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 99779106564A; Sun, 15 Jul 2012 10:53:49 +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 8419B8FC18; Sun, 15 Jul 2012 10:53:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FArnat042995; Sun, 15 Jul 2012 10:53:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FArnqO042991; Sun, 15 Jul 2012 10:53:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207151053.q6FArnqO042991@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 15 Jul 2012 10:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238471 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 10:53:49 -0000 Author: kib Date: Sun Jul 15 10:53:48 2012 New Revision: 238471 URL: http://svn.freebsd.org/changeset/base/238471 Log: Import the DragonFly BSD commit 4f0bc915b65fcf5a23214f6d221d65c80be68ad4 by John Marino , with the following (edited) commit message Date: Sat, 24 Mar 2012 06:40:50 +0100 Subject: [PATCH 1/1] rtld: Implement DT_RUNPATH and -z nodefaultlib DT_RUNPATH is incorrectly being considered as an alias of DT_RPATH. The purpose of DT_RUNPATH is to have two different types of rpath: one that can be overridden by the environment variable LD_LIBRARY_PATH and one that can't. With the currently implementation, LD_LIBRARY_PATH will always trump any embedded rpath or runpath tags. Current path search order by rtld: ================================== LD_LIBRARY_PATH DT_RPATH / DT_RUNPATH (always the same) ldconfig hints file (default: /var/run/ld-elf.so.hints) /usr/lib New path search order by rtld: ============================== DT_RPATH of the calling object if no DT_RUNPATH DT_RPATH of the main binary if no DT_RUNPATH and binary isn't calling obj LD_LIBRARY_PATH DT_RUNPATH ldconfig hints file /usr/lib The new path search matches how the linux runtime loader works. The other major added feature is support for linker flag "-z nodefaultlib". When this flag is passed to the linker, rtld will skip all references to the standard library search path ("/usr/lib" in this case but it could handle more color delimited paths) except in DT_RPATH and DT_RUNPATH. New path search order by rtld with -z nodefaultlib flag set: ============================================================ DT_RPATH of the calling object if no DT_RUNPATH DT_RPATH of the main binary if no DT_RUNPATH and binary isn't calling obj LD_LIBRARY_PATH DT_RUNPATH ldconfig hints file (skips all references to /usr/lib) FreeBSD notes: - we fixed some bugs which were submitted to DragonFly and merged there as commit 1ff8a2bd3eb6e5587174c6a983303ea3a79e0002; - we added LD_LIBRARY_PATH_RPATH environment variable to switch to the previous behaviour of considering DT_RPATH a synonym for DT_RUNPATH; - the FreeBSD default search path is /lib:/usr/lib and not /usr/lib. Reviewed by: kan MFC after: 1 month MFC note: flip the ld_library_path_rpath default value for stable/9 Modified: head/libexec/rtld-elf/rtld.1 head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.1 ============================================================================== --- head/libexec/rtld-elf/rtld.1 Sun Jul 15 10:49:16 2012 (r238470) +++ head/libexec/rtld-elf/rtld.1 Sun Jul 15 10:53:48 2012 (r238471) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2009 +.Dd June 28, 2012 .Dt RTLD 1 .Os .Sh NAME @@ -86,14 +86,39 @@ dynamic linker. After the dynamic linker has finished loading, relocating, and initializing the program and its required shared objects, it transfers control to the entry point of the program. +The following search order is used to locate required shared objects: .Pp -To locate the required shared objects in the file system, -.Nm -may use a -.Dq hints -file prepared by the +.Bl -enum -offset indent -compact +.It +.Dv DT_RPATH +of the referencing object unless that object also contains a +.Dv DT_RUNPATH +tag +.It +.Dv DT_RPATH +of the program unless the referencing object contains a +.Dv DT_RUNPATH +tag +.It +Path indicated by +.Ev LD_LIBRARY_PATH +environment variable +.It +.Dv DT_RUNPATH +of the referencing object +.It +Hints file produced by the .Xr ldconfig 8 -utility. +utility +.It +The +.Pa /lib +and +.Pa /usr/lib +directories, unless the referencing object was linked using the +.Dq Fl z Ar nodefaultlib +option +.El .Pp The .Nm @@ -143,6 +168,20 @@ This variable is unset for set-user-ID a A colon separated list of directories, overriding the default search path for shared libraries. This variable is unset for set-user-ID and set-group-ID programs. +.It Ev LD_LIBRARY_PATH_RPATH +If the variable is specified and has a value starting with +any of \'y\', \'Y\' or \'1\' symbols, the path specified by +.Ev LD_LIBRARY_PATH +variable is allowed to override the path from +.Dv DT_RPATH +for binaries which does not contain +.Dv DT_RUNPATH +tag. +For such binaries, when the variable +.Ev LD_LIBRARY_PATH_RPATH +is set, +.Dq Fl z Ar nodefaultlib +link-time option is ignored as well. .It Ev LD_PRELOAD A list of shared libraries, separated by colons and/or white space, to be linked in before any Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sun Jul 15 10:49:16 2012 (r238470) +++ head/libexec/rtld-elf/rtld.c Sun Jul 15 10:53:48 2012 (r238471) @@ -80,8 +80,9 @@ typedef void * (*path_enum_proc) (const static const char *basename(const char *); static void die(void) __dead2; static void digest_dynamic1(Obj_Entry *, int, const Elf_Dyn **, - const Elf_Dyn **); -static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *); + const Elf_Dyn **, const Elf_Dyn **); +static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *, + const Elf_Dyn *); static void digest_dynamic(Obj_Entry *, int); static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *); static Obj_Entry *dlcheck(void *); @@ -94,7 +95,7 @@ static void errmsg_restore(char *); static char *errmsg_save(void); static void *fill_search_info(const char *, size_t, void *); static char *find_library(const char *, const Obj_Entry *); -static const char *gethints(void); +static const char *gethints(bool); static void init_dag(Obj_Entry *); static void init_rtld(caddr_t, Elf_Auxinfo **); static void initlist_add_neededs(Needed_Entry *, Objlist *); @@ -233,6 +234,8 @@ size_t tls_static_space; /* Static TLS s int tls_dtv_generation = 1; /* Used to detect when dtv size changes */ int tls_max_index = 1; /* Largest module index allocated */ +bool ld_library_path_rpath = false; + /* * Fill in a DoneList with an allocation large enough to hold all of * the currently-loaded objects. Keep this as a macro since it calls @@ -323,6 +326,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ Obj_Entry **preload_tail; Objlist initlist; RtldLockState lockstate; + char *library_path_rpath; int mib[2]; size_t len; @@ -394,7 +398,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ if (unsetenv(LD_ "PRELOAD") || unsetenv(LD_ "LIBMAP") || unsetenv(LD_ "LIBRARY_PATH") || unsetenv(LD_ "LIBMAP_DISABLE") || unsetenv(LD_ "DEBUG") || unsetenv(LD_ "ELF_HINTS_PATH") || - unsetenv(LD_ "LOADFLTR")) { + unsetenv(LD_ "LOADFLTR") || unsetenv(LD_ "LIBRARY_PATH_RPATH")) { _rtld_error("environment corrupt; aborting"); die(); } @@ -406,6 +410,15 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ ld_preload = getenv(LD_ "PRELOAD"); ld_elf_hints_path = getenv(LD_ "ELF_HINTS_PATH"); ld_loadfltr = getenv(LD_ "LOADFLTR") != NULL; + library_path_rpath = getenv(LD_ "LIBRARY_PATH_RPATH"); + if (library_path_rpath != NULL) { + if (library_path_rpath[0] == 'y' || + library_path_rpath[0] == 'Y' || + library_path_rpath[0] == '1') + ld_library_path_rpath = true; + else + ld_library_path_rpath = false; + } dangerous_ld_env = libmap_disable || (libmap_override != NULL) || (ld_library_path != NULL) || (ld_preload != NULL) || (ld_elf_hints_path != NULL) || ld_loadfltr; @@ -828,7 +841,7 @@ die(void) */ static void digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath, - const Elf_Dyn **dyn_soname) + const Elf_Dyn **dyn_soname, const Elf_Dyn **dyn_runpath) { const Elf_Dyn *dynp; Needed_Entry **needed_tail = &obj->needed; @@ -843,6 +856,7 @@ digest_dynamic1(Obj_Entry *obj, int earl *dyn_rpath = NULL; *dyn_soname = NULL; + *dyn_runpath = NULL; obj->bind_now = false; for (dynp = obj->dynamic; dynp->d_tag != DT_NULL; dynp++) { @@ -1009,7 +1023,6 @@ digest_dynamic1(Obj_Entry *obj, int earl break; case DT_RPATH: - case DT_RUNPATH: /* XXX: process separately */ /* * We have to wait until later to process this, because we * might not have gotten the address of the string table yet. @@ -1021,6 +1034,10 @@ digest_dynamic1(Obj_Entry *obj, int earl *dyn_soname = dynp; break; + case DT_RUNPATH: + *dyn_runpath = dynp; + break; + case DT_INIT: obj->init = (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr); break; @@ -1114,6 +1131,8 @@ digest_dynamic1(Obj_Entry *obj, int earl obj->z_nodelete = true; if (dynp->d_un.d_val & DF_1_LOADFLTR) obj->z_loadfltr = true; + if (dynp->d_un.d_val & DF_1_NODEFLIB) + obj->z_nodeflib = true; break; default: @@ -1153,7 +1172,7 @@ digest_dynamic1(Obj_Entry *obj, int earl static void digest_dynamic2(Obj_Entry *obj, const Elf_Dyn *dyn_rpath, - const Elf_Dyn *dyn_soname) + const Elf_Dyn *dyn_soname, const Elf_Dyn *dyn_runpath) { if (obj->z_origin && obj->origin_path == NULL) { @@ -1162,7 +1181,12 @@ digest_dynamic2(Obj_Entry *obj, const El die(); } - if (dyn_rpath != NULL) { + if (dyn_runpath != NULL) { + obj->runpath = (char *)obj->strtab + dyn_runpath->d_un.d_val; + if (obj->z_origin) + obj->runpath = origin_subst(obj->runpath, obj->origin_path); + } + else if (dyn_rpath != NULL) { obj->rpath = (char *)obj->strtab + dyn_rpath->d_un.d_val; if (obj->z_origin) obj->rpath = origin_subst(obj->rpath, obj->origin_path); @@ -1177,9 +1201,10 @@ digest_dynamic(Obj_Entry *obj, int early { const Elf_Dyn *dyn_rpath; const Elf_Dyn *dyn_soname; + const Elf_Dyn *dyn_runpath; - digest_dynamic1(obj, early, &dyn_rpath, &dyn_soname); - digest_dynamic2(obj, dyn_rpath, dyn_soname); + digest_dynamic1(obj, early, &dyn_rpath, &dyn_soname, &dyn_runpath); + digest_dynamic2(obj, dyn_rpath, dyn_soname, dyn_runpath); } /* @@ -1389,43 +1414,71 @@ gnu_hash(const char *s) * loaded shared object, whose library search path will be searched. * * The search order is: + * DT_RPATH in the referencing file _unless_ DT_RUNPATH is present (1) + * DT_RPATH of the main object if DSO without defined DT_RUNPATH (1) * LD_LIBRARY_PATH - * rpath in the referencing file - * ldconfig hints - * /lib:/usr/lib + * DT_RUNPATH in the referencing file + * ldconfig hints (if -z nodefaultlib, filter out default library directories + * from list) + * /lib:/usr/lib _unless_ the referencing file is linked with -z nodefaultlib + * + * (1) Handled in digest_dynamic2 - rpath left NULL if runpath defined. */ static char * find_library(const char *xname, const Obj_Entry *refobj) { char *pathname; char *name; + bool objgiven; + objgiven = refobj != NULL; if (strchr(xname, '/') != NULL) { /* Hard coded pathname */ if (xname[0] != '/' && !trust) { _rtld_error("Absolute pathname required for shared object \"%s\"", xname); return NULL; } - if (refobj != NULL && refobj->z_origin) + if (objgiven && refobj->z_origin) return origin_subst(xname, refobj->origin_path); else return xstrdup(xname); } - if (libmap_disable || (refobj == NULL) || + if (libmap_disable || !objgiven || (name = lm_find(refobj->path, xname)) == NULL) name = (char *)xname; dbg(" Searching for \"%s\"", name); - if ((pathname = search_library_path(name, ld_library_path)) != NULL || - (refobj != NULL && - (pathname = search_library_path(name, refobj->rpath)) != NULL) || - (pathname = search_library_path(name, gethints())) != NULL || - (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL) - return pathname; + /* + * If refobj->rpath != NULL, then refobj->runpath is NULL. Fall + * back to pre-conforming behaviour if user requested so with + * LD_LIBRARY_PATH_RPATH environment variable and ignore -z + * nodeflib. + */ + if (objgiven && refobj->rpath != NULL && ld_library_path_rpath) { + if ((pathname = search_library_path(name, ld_library_path)) != NULL || + (refobj != NULL && + (pathname = search_library_path(name, refobj->rpath)) != NULL) || + (pathname = search_library_path(name, gethints(false))) != NULL || + (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL) + return (pathname); + } else { + if ((objgiven && + (pathname = search_library_path(name, refobj->rpath)) != NULL) || + (objgiven && refobj->runpath == NULL && refobj != obj_main && + (pathname = search_library_path(name, obj_main->rpath)) != NULL) || + (pathname = search_library_path(name, ld_library_path)) != NULL || + (objgiven && + (pathname = search_library_path(name, refobj->runpath)) != NULL) || + (pathname = search_library_path(name, gethints(refobj->z_nodeflib))) + != NULL || + (objgiven && !refobj->z_nodeflib && + (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL)) + return (pathname); + } - if(refobj != NULL && refobj->path != NULL) { + if (objgiven && refobj->path != NULL) { _rtld_error("Shared object \"%s\" not found, required by \"%s\"", name, basename(refobj->path)); } else { @@ -1520,41 +1573,142 @@ find_symdef(unsigned long symnum, const /* * Return the search path from the ldconfig hints file, reading it if - * necessary. Returns NULL if there are problems with the hints file, + * necessary. If nostdlib is true, then the default search paths are + * not added to result. + * + * Returns NULL if there are problems with the hints file, * or if the search path there is empty. */ static const char * -gethints(void) +gethints(bool nostdlib) { - static char *hints; - - if (hints == NULL) { - int fd; + static char *hints, *filtered_path; struct elfhints_hdr hdr; + struct fill_search_info_args sargs, hargs; + struct dl_serinfo smeta, hmeta, *SLPinfo, *hintinfo; + struct dl_serpath *SLPpath, *hintpath; char *p; + unsigned int SLPndx, hintndx, fndx, fcount; + int fd; + size_t flen; + bool skip; - /* Keep from trying again in case the hints file is bad. */ - hints = ""; - - if ((fd = open(ld_elf_hints_path, O_RDONLY)) == -1) - return NULL; - if (read(fd, &hdr, sizeof hdr) != sizeof hdr || - hdr.magic != ELFHINTS_MAGIC || - hdr.version != 1) { - close(fd); - return NULL; + /* First call, read the hints file */ + if (hints == NULL) { + /* Keep from trying again in case the hints file is bad. */ + hints = ""; + + if ((fd = open(ld_elf_hints_path, O_RDONLY)) == -1) + return (NULL); + if (read(fd, &hdr, sizeof hdr) != sizeof hdr || + hdr.magic != ELFHINTS_MAGIC || + hdr.version != 1) { + close(fd); + return (NULL); + } + p = xmalloc(hdr.dirlistlen + 1); + if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || + read(fd, p, hdr.dirlistlen + 1) != + (ssize_t)hdr.dirlistlen + 1) { + free(p); + close(fd); + return (NULL); + } + hints = p; + close(fd); } - p = xmalloc(hdr.dirlistlen + 1); - if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || - read(fd, p, hdr.dirlistlen + 1) != (ssize_t)hdr.dirlistlen + 1) { - free(p); - close(fd); - return NULL; + + /* + * If caller agreed to receive list which includes the default + * paths, we are done. Otherwise, if we still did not + * calculated filtered result, do it now. + */ + if (!nostdlib) + return (hints[0] != '\0' ? hints : NULL); + if (filtered_path != NULL) + goto filt_ret; + + /* + * Obtain the list of all configured search paths, and the + * list of the default paths. + * + * First estimate the size of the results. + */ + smeta.dls_size = __offsetof(struct dl_serinfo, dls_serpath); + smeta.dls_cnt = 0; + hmeta.dls_size = __offsetof(struct dl_serinfo, dls_serpath); + hmeta.dls_cnt = 0; + + sargs.request = RTLD_DI_SERINFOSIZE; + sargs.serinfo = &smeta; + hargs.request = RTLD_DI_SERINFOSIZE; + hargs.serinfo = &hmeta; + + path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &sargs); + path_enumerate(p, fill_search_info, &hargs); + + SLPinfo = xmalloc(smeta.dls_size); + hintinfo = xmalloc(hmeta.dls_size); + + /* + * Next fetch both sets of paths. + */ + sargs.request = RTLD_DI_SERINFO; + sargs.serinfo = SLPinfo; + sargs.serpath = &SLPinfo->dls_serpath[0]; + sargs.strspace = (char *)&SLPinfo->dls_serpath[smeta.dls_cnt]; + + hargs.request = RTLD_DI_SERINFO; + hargs.serinfo = hintinfo; + hargs.serpath = &hintinfo->dls_serpath[0]; + hargs.strspace = (char *)&hintinfo->dls_serpath[hmeta.dls_cnt]; + + path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &sargs); + path_enumerate(p, fill_search_info, &hargs); + + /* + * Now calculate the difference between two sets, by excluding + * standard paths from the full set. + */ + fndx = 0; + fcount = 0; + filtered_path = xmalloc(hdr.dirlistlen + 1); + hintpath = &hintinfo->dls_serpath[0]; + for (hintndx = 0; hintndx < hmeta.dls_cnt; hintndx++, hintpath++) { + skip = false; + SLPpath = &SLPinfo->dls_serpath[0]; + /* + * Check each standard path against current. + */ + for (SLPndx = 0; SLPndx < smeta.dls_cnt; SLPndx++, SLPpath++) { + /* matched, skip the path */ + if (!strcmp(hintpath->dls_name, SLPpath->dls_name)) { + skip = true; + break; + } + } + if (skip) + continue; + /* + * Not matched against any standard path, add the path + * to result. Separate consequtive paths with ':'. + */ + if (fcount > 0) { + filtered_path[fndx] = ':'; + fndx++; + } + fcount++; + flen = strlen(hintpath->dls_name); + strncpy((filtered_path + fndx), hintpath->dls_name, flen); + fndx += flen; } - hints = p; - close(fd); - } - return hints[0] != '\0' ? hints : NULL; + filtered_path[fndx] = '\0'; + + free(SLPinfo); + free(hintinfo); + +filt_ret: + return (filtered_path[0] != '\0' ? filtered_path : NULL); } static void @@ -1600,6 +1754,7 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo * Obj_Entry objtmp; /* Temporary rtld object */ const Elf_Dyn *dyn_rpath; const Elf_Dyn *dyn_soname; + const Elf_Dyn *dyn_runpath; /* * Conjure up an Obj_Entry structure for the dynamic linker. @@ -1616,7 +1771,7 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo * #endif if (RTLD_IS_DYNAMIC()) { objtmp.dynamic = rtld_dynamic(&objtmp); - digest_dynamic1(&objtmp, 1, &dyn_rpath, &dyn_soname); + digest_dynamic1(&objtmp, 1, &dyn_rpath, &dyn_soname, &dyn_runpath); assert(objtmp.needed == NULL); #if !defined(__mips__) /* MIPS has a bogus DT_TEXTREL. */ @@ -1642,7 +1797,7 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo * if (aux_info[AT_OSRELDATE] != NULL) osreldate = aux_info[AT_OSRELDATE]->a_un.a_val; - digest_dynamic2(&obj_rtld, dyn_rpath, dyn_soname); + digest_dynamic2(&obj_rtld, dyn_rpath, dyn_soname, dyn_runpath); /* Replace the path with a dynamically allocated copy. */ obj_rtld.path = xstrdup(PATH_RTLD); @@ -3070,14 +3225,6 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac return (error); } -struct fill_search_info_args { - int request; - unsigned int flags; - Dl_serinfo *serinfo; - Dl_serpath *serpath; - char *strspace; -}; - static void * fill_search_info(const char *dir, size_t dirlen, void *param) { @@ -3087,7 +3234,7 @@ fill_search_info(const char *dir, size_t if (arg->request == RTLD_DI_SERINFOSIZE) { arg->serinfo->dls_cnt ++; - arg->serinfo->dls_size += sizeof(Dl_serpath) + dirlen + 1; + arg->serinfo->dls_size += sizeof(struct dl_serpath) + dirlen + 1; } else { struct dl_serpath *s_entry; @@ -3117,10 +3264,12 @@ do_search_info(const Obj_Entry *obj, int _info.dls_size = __offsetof(struct dl_serinfo, dls_serpath); _info.dls_cnt = 0; - path_enumerate(ld_library_path, fill_search_info, &args); path_enumerate(obj->rpath, fill_search_info, &args); - path_enumerate(gethints(), fill_search_info, &args); - path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args); + path_enumerate(ld_library_path, fill_search_info, &args); + path_enumerate(obj->runpath, fill_search_info, &args); + path_enumerate(gethints(obj->z_nodeflib), fill_search_info, &args); + if (!obj->z_nodeflib) + path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args); if (request == RTLD_DI_SERINFOSIZE) { @@ -3139,20 +3288,26 @@ do_search_info(const Obj_Entry *obj, int args.serpath = &info->dls_serpath[0]; args.strspace = (char *)&info->dls_serpath[_info.dls_cnt]; + args.flags = LA_SER_RUNPATH; + if (path_enumerate(obj->rpath, fill_search_info, &args) != NULL) + return (-1); + args.flags = LA_SER_LIBPATH; if (path_enumerate(ld_library_path, fill_search_info, &args) != NULL) return (-1); args.flags = LA_SER_RUNPATH; - if (path_enumerate(obj->rpath, fill_search_info, &args) != NULL) + if (path_enumerate(obj->runpath, fill_search_info, &args) != NULL) return (-1); args.flags = LA_SER_CONFIG; - if (path_enumerate(gethints(), fill_search_info, &args) != NULL) + if (path_enumerate(gethints(obj->z_nodeflib), fill_search_info, &args) + != NULL) return (-1); args.flags = LA_SER_DEFAULT; - if (path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args) != NULL) + if (!obj->z_nodeflib && + path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args) != NULL) return (-1); return (0); } Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Sun Jul 15 10:49:16 2012 (r238470) +++ head/libexec/rtld-elf/rtld.h Sun Jul 15 10:53:48 2012 (r238471) @@ -222,6 +222,7 @@ typedef struct Struct_Obj_Entry { const Elf_Hashelt *chain_zero_gnu; /* GNU hash table value array (Zeroed) */ char *rpath; /* Search path specified in object */ + char *runpath; /* Search path with different priority */ Needed_Entry *needed; /* Shared objects needed by this one (%) */ Needed_Entry *needed_filtees; Needed_Entry *needed_aux_filtees; @@ -258,6 +259,7 @@ typedef struct Struct_Obj_Entry { bool z_nodelete : 1; /* Do not unload the object and dependencies */ bool z_noopen : 1; /* Do not load on dlopen */ bool z_loadfltr : 1; /* Immediately load filtees */ + bool z_nodeflib : 1; /* Don't search default library path */ bool ref_nodel : 1; /* Refcount increased to prevent dlclose */ bool init_scanned: 1; /* Object is already on init list. */ bool on_fini_list: 1; /* Object is already on fini list. */ @@ -321,6 +323,14 @@ struct Struct_RtldLockState { sigjmp_buf env; }; +struct fill_search_info_args { + int request; + unsigned int flags; + struct dl_serinfo *serinfo; + struct dl_serpath *serpath; + char *strspace; +}; + /* * The pack of arguments and results for the symbol lookup functions. */ From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 10:54:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1E04106585C; Sun, 15 Jul 2012 10:54:11 +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 9272B8FC17; Sun, 15 Jul 2012 10:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FAsBuw043054; Sun, 15 Jul 2012 10:54:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FAsBIk043046; Sun, 15 Jul 2012 10:54:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207151054.q6FAsBIk043046@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 15 Jul 2012 10:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238472 - in head/contrib/gcc/config: arm i386 ia64 mips rs6000 sparc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 10:54:11 -0000 Author: kib Date: Sun Jul 15 10:54:10 2012 New Revision: 238472 URL: http://svn.freebsd.org/changeset/base/238472 Log: Pass --enable-new-dtags to the linker invocation by default. If desired, one can turn off the generation of post-ELF standard dtags by overriding it with --disable-new-dtags after the default switch. Immediate effect of the change is that -rpath path is now stored both in DT_RPATH and DT_RUNPATH tags, which is the right way to provide rpath for dynamic linker supporting DT_RUNPATH per specification. Reviewed by: kan MFC after: 1 month Modified: head/contrib/gcc/config/arm/freebsd.h head/contrib/gcc/config/i386/freebsd.h head/contrib/gcc/config/i386/freebsd64.h head/contrib/gcc/config/ia64/freebsd.h head/contrib/gcc/config/mips/freebsd.h head/contrib/gcc/config/rs6000/freebsd.h head/contrib/gcc/config/sparc/freebsd.h Modified: head/contrib/gcc/config/arm/freebsd.h ============================================================================== --- head/contrib/gcc/config/arm/freebsd.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/arm/freebsd.h Sun Jul 15 10:54:10 2012 (r238472) @@ -50,7 +50,7 @@ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ - %{!static:--hash-style=both} \ + %{!static:--hash-style=both --enable-new-dtags} \ %{symbolic:-Bsymbolic} \ -X %{mbig-endian:-EB} %{mlittle-endian:-EL}" Modified: head/contrib/gcc/config/i386/freebsd.h ============================================================================== --- head/contrib/gcc/config/i386/freebsd.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/i386/freebsd.h Sun Jul 15 10:54:10 2012 (r238472) @@ -49,7 +49,7 @@ Boston, MA 02110-1301, USA. */ %{rdynamic: -export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ - %{!static:--hash-style=both} \ + %{!static:--hash-style=both --enable-new-dtags} \ %{symbolic:-Bsymbolic}" /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h Modified: head/contrib/gcc/config/i386/freebsd64.h ============================================================================== --- head/contrib/gcc/config/i386/freebsd64.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/i386/freebsd64.h Sun Jul 15 10:54:10 2012 (r238472) @@ -54,5 +54,5 @@ Boston, MA 02110-1301, USA. */ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ - %{!static:--hash-style=both} \ + %{!static:--hash-style=both --enable-new-dtags} \ %{symbolic:-Bsymbolic}" Modified: head/contrib/gcc/config/ia64/freebsd.h ============================================================================== --- head/contrib/gcc/config/ia64/freebsd.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/ia64/freebsd.h Sun Jul 15 10:54:10 2012 (r238472) @@ -27,6 +27,7 @@ Boston, MA 02110-1301, USA. */ %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ %{shared:-Bshareable %{h*} %{soname*}} \ + %{!static:--enable-new-dtags} \ %{symbolic:-Bsymbolic} \ %{!shared: \ %{!static: \ Modified: head/contrib/gcc/config/mips/freebsd.h ============================================================================== --- head/contrib/gcc/config/mips/freebsd.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/mips/freebsd.h Sun Jul 15 10:54:10 2012 (r238472) @@ -56,6 +56,7 @@ Boston, MA 02110-1301, USA. */ %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ %{shared:-Bshareable %{h*} %{soname*}} \ + %{!static:--enable-new-dtags} \ %{!shared: \ %{!static: \ %{rdynamic: -export-dynamic} \ Modified: head/contrib/gcc/config/rs6000/freebsd.h ============================================================================== --- head/contrib/gcc/config/rs6000/freebsd.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/rs6000/freebsd.h Sun Jul 15 10:54:10 2012 (r238472) @@ -180,6 +180,7 @@ extern int dot_symbols; %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ %{shared:-Bshareable %{h*} %{soname*}} \ + %{!static:--enable-new-dtags} \ %{!shared: \ %{!static: \ %{rdynamic: -export-dynamic} \ Modified: head/contrib/gcc/config/sparc/freebsd.h ============================================================================== --- head/contrib/gcc/config/sparc/freebsd.h Sun Jul 15 10:53:48 2012 (r238471) +++ head/contrib/gcc/config/sparc/freebsd.h Sun Jul 15 10:54:10 2012 (r238472) @@ -53,7 +53,7 @@ Boston, MA 02110-1301, USA. */ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ - %{!static:--hash-style=both} \ + %{!static:--hash-style=both --enable-new-dtags} \ %{symbolic:-Bsymbolic}" From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 11:04:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 07C8B1065694; Sun, 15 Jul 2012 11:04:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD80E8FC19; Sun, 15 Jul 2012 11:04:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FB4n3c043632; Sun, 15 Jul 2012 11:04:49 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FB4noC043626; Sun, 15 Jul 2012 11:04:49 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207151104.q6FB4noC043626@svn.freebsd.org> From: Michael Tuexen Date: Sun, 15 Jul 2012 11:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238475 - in head/sys: netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:04:50 -0000 Author: tuexen Date: Sun Jul 15 11:04:49 2012 New Revision: 238475 URL: http://svn.freebsd.org/changeset/base/238475 Log: #ifdef INET and INET6 consistently. This also fixes a bug, where it was done wrong. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet/sctp_output.c Sun Jul 15 11:04:49 2012 (r238475) @@ -8432,12 +8432,14 @@ again_one_more_time: } /* now lets add any data within the MTU constraints */ switch (((struct sockaddr *)&net->ro._l_addr)->sa_family) { +#ifdef INET case AF_INET: if (net->mtu > (sizeof(struct ip) + sizeof(struct sctphdr))) omtu = net->mtu - (sizeof(struct ip) + sizeof(struct sctphdr)); else omtu = 0; break; +#endif #ifdef INET6 case AF_INET6: if (net->mtu > (sizeof(struct ip6_hdr) + sizeof(struct sctphdr))) @@ -12165,7 +12167,7 @@ sctp_lower_sosend(struct socket *so, union sctp_sockstore *raddr = (union sctp_sockstore *)addr; switch (raddr->sa.sa_family) { -#if defined(INET) +#ifdef INET case AF_INET: if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); @@ -12175,7 +12177,7 @@ sctp_lower_sosend(struct socket *so, port = raddr->sin.sin_port; break; #endif -#if defined(INET6) +#ifdef INET6 case AF_INET6: if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet/sctp_pcb.c Sun Jul 15 11:04:49 2012 (r238475) @@ -3016,6 +3016,7 @@ continue_anyway: memset(&store_sa, 0, sizeof(store_sa)); switch (addr->sa_family) { +#ifdef INET case AF_INET: { struct sockaddr_in *sin; @@ -3025,6 +3026,8 @@ continue_anyway: sin->sin_port = 0; break; } +#endif +#ifdef INET6 case AF_INET6: { struct sockaddr_in6 *sin6; @@ -3034,6 +3037,7 @@ continue_anyway: sin6->sin6_port = 0; break; } +#endif default: break; } @@ -5195,12 +5199,16 @@ sctp_destination_is_reachable(struct sct } /* NOTE: all "scope" checks are done when local addresses are added */ switch (destaddr->sa_family) { +#ifdef INET6 case AF_INET6: answer = inp->ip_inp.inp.inp_vflag & INP_IPV6; break; +#endif +#ifdef INET case AF_INET: answer = inp->ip_inp.inp.inp_vflag & INP_IPV4; break; +#endif default: /* invalid family, so it's unreachable */ answer = 0; @@ -5291,7 +5299,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb inp->ip_inp.inp.inp_vflag |= INP_IPV6; break; #endif -#ifdef INET6 +#ifdef INET case AF_INET: inp->ip_inp.inp.inp_vflag |= INP_IPV4; break; Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet/sctp_usrreq.c Sun Jul 15 11:04:49 2012 (r238475) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET6) +#ifdef INET6 #endif #include #include Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet/sctputil.c Sun Jul 15 11:04:49 2012 (r238475) @@ -5637,7 +5637,7 @@ found_one: memcpy(from, &sin6, sizeof(struct sockaddr_in6)); } #endif -#if defined(INET6) +#ifdef INET6 { struct sockaddr_in6 lsa6, *from6; @@ -6534,7 +6534,7 @@ sctp_bindx_delete_address(struct sctp_in return; } addr_touse = sa; -#if defined(INET6) +#ifdef INET6 if (sa->sa_family == AF_INET6) { struct sockaddr_in6 *sin6; Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet6/sctp6_usrreq.c Sun Jul 15 11:04:49 2012 (r238475) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET6) +#ifdef INET6 #include #endif #include @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #ifdef IPSEC #include -#if defined(INET6) +#ifdef INET6 #include #endif /* INET6 */ #endif /* IPSEC */ From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 11:18:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 429AA106566B; Sun, 15 Jul 2012 11:18:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DA628FC16; Sun, 15 Jul 2012 11:18:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBIrhg044357; Sun, 15 Jul 2012 11:18:53 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBIqV3044355; Sun, 15 Jul 2012 11:18:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207151118.q6FBIqV3044355@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 11:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238477 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:18:53 -0000 Author: jilles Date: Sun Jul 15 11:18:52 2012 New Revision: 238477 URL: http://svn.freebsd.org/changeset/base/238477 Log: sh: Reset pendingsigs before checking pending traps, not after. Otherwise, a signal arriving at exactly the right moment might not be processed until another signal arrived. Modified: head/bin/sh/trap.c Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Sun Jul 15 11:13:09 2012 (r238476) +++ head/bin/sh/trap.c Sun Jul 15 11:18:52 2012 (r238477) @@ -416,6 +416,7 @@ dotrap(void) in_dotrap++; for (;;) { + pendingsigs = 0; for (i = 1; i < NSIG; i++) { if (gotsig[i]) { gotsig[i] = 0; @@ -467,7 +468,6 @@ dotrap(void) break; } in_dotrap--; - pendingsigs = 0; } From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 11:52:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E90A41065673; Sun, 15 Jul 2012 11:52:24 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D488A8FC0A; Sun, 15 Jul 2012 11:52:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FBqO2P046000; Sun, 15 Jul 2012 11:52:24 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FBqOEc045998; Sun, 15 Jul 2012 11:52:24 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151152.q6FBqOEc045998@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 11:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238483 - head/lib/libc/rpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 11:52:25 -0000 Author: brueffer Date: Sun Jul 15 11:52:24 2012 New Revision: 238483 URL: http://svn.freebsd.org/changeset/base/238483 Log: Jump to the failed label instead of doing cleanup ourselves. Obtained from: DragonFly BSD MFC after: 2 weeks Modified: head/lib/libc/rpc/getnetpath.c Modified: head/lib/libc/rpc/getnetpath.c ============================================================================== --- head/lib/libc/rpc/getnetpath.c Sun Jul 15 11:39:56 2012 (r238482) +++ head/lib/libc/rpc/getnetpath.c Sun Jul 15 11:52:24 2012 (r238483) @@ -99,9 +99,8 @@ setnetpath() return (NULL); } if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) { - free(np_sessionp); syslog (LOG_ERR, "rpc: failed to open " NETCONFIG); - return (NULL); + goto failed; } np_sessionp->valid = NP_VALID; np_sessionp->ncp_list = NULL; From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 14:40:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 723C31065670; Sun, 15 Jul 2012 14:40:50 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2341F8FC14; Sun, 15 Jul 2012 14:40:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FEensZ053148; Sun, 15 Jul 2012 14:40:49 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FEenD6053146; Sun, 15 Jul 2012 14:40:49 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151440.q6FEenD6053146@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 14:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238486 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 14:40:51 -0000 Author: brueffer Date: Sun Jul 15 14:40:49 2012 New Revision: 238486 URL: http://svn.freebsd.org/changeset/base/238486 Log: Fix typo in a message. Obtained from: DragonFly BSD (change 7a817ab191e4898404a9037c55850e47d177308c) MFC after: 3 days Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sun Jul 15 12:13:15 2012 (r238485) +++ head/sys/dev/isp/isp.c Sun Jul 15 14:40:49 2012 (r238486) @@ -2286,7 +2286,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uin goto out; } else if (plp->plogx_status != PLOGX_STATUS_IOCBERR) { isp_prt(isp, ISP_LOGWARN, - "status 0x%x on port login IOCB chanel %d", + "status 0x%x on port login IOCB channel %d", plp->plogx_status, chan); rval = -1; goto out; From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 15:22:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16112106566B; Sun, 15 Jul 2012 15:22:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01A5E8FC0C; Sun, 15 Jul 2012 15:22:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FFMDkj054985; Sun, 15 Jul 2012 15:22:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FFMDKw054983; Sun, 15 Jul 2012 15:22:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207151522.q6FFMDKw054983@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 15:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238488 - head/bin/ps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 15:22:14 -0000 Author: jilles Date: Sun Jul 15 15:22:13 2012 New Revision: 238488 URL: http://svn.freebsd.org/changeset/base/238488 Log: ps: Fix memory leak when showing start/lstart for swapped-out process. Spotted by: scan-build (uqs) Modified: head/bin/ps/print.c Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Sun Jul 15 15:00:28 2012 (r238487) +++ head/bin/ps/print.c Sun Jul 15 15:22:13 2012 (r238488) @@ -387,12 +387,13 @@ started(KINFO *k, VARENT *ve __unused) size_t buflen = 100; char *buf; + if (!k->ki_valid) + return (NULL); + buf = malloc(buflen); if (buf == NULL) errx(1, "malloc failed"); - if (!k->ki_valid) - return (NULL); if (use_ampm < 0) use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0'); then = k->ki_p->ki_start.tv_sec; @@ -415,12 +416,13 @@ lstarted(KINFO *k, VARENT *ve __unused) char *buf; size_t buflen = 100; + if (!k->ki_valid) + return (NULL); + buf = malloc(buflen); if (buf == NULL) errx(1, "malloc failed"); - if (!k->ki_valid) - return (NULL); then = k->ki_p->ki_start.tv_sec; (void)strftime(buf, buflen, "%c", localtime(&then)); return (buf); From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 15:50:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E54C1065670; Sun, 15 Jul 2012 15:50:13 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 090E28FC17; Sun, 15 Jul 2012 15:50:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FFoCKt056168; Sun, 15 Jul 2012 15:50:12 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FFoCMo056166; Sun, 15 Jul 2012 15:50:12 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207151550.q6FFoCMo056166@svn.freebsd.org> From: Christian Brueffer Date: Sun, 15 Jul 2012 15:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238491 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 15:50:13 -0000 Author: brueffer Date: Sun Jul 15 15:50:12 2012 New Revision: 238491 URL: http://svn.freebsd.org/changeset/base/238491 Log: Save a bzero() by using M_ZERO. Obtained from: Dragonfly BSD (change 4faaf07c3d7ddd120deed007370aaf4d90b72ebb) MFC after: 2 weeks Modified: head/sys/fs/smbfs/smbfs_node.c Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:23:31 2012 (r238490) +++ head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:50:12 2012 (r238491) @@ -223,7 +223,7 @@ loop: if (fap == NULL) return ENOENT; - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK); + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); if (error) { free(np, M_SMBNODE); @@ -235,7 +235,6 @@ loop: return (error); } vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; - bzero(np, sizeof(*np)); vp->v_data = np; np->n_vnode = vp; np->n_mount = VFSTOSMBFS(mp); From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 16:04:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A804C106566C; Sun, 15 Jul 2012 16:04:26 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id B86C58FC08; Sun, 15 Jul 2012 16:04:25 +0000 (UTC) Received: by eabm6 with SMTP id m6so1528522eab.13 for ; Sun, 15 Jul 2012 09:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=dJr0Yc3z0Cdi/hTHXKPvkf8CPN9eDy5Xc+VtwAYQy3g=; b=Xr/vWzMczi48W8l6KONE/NNSWnxlAQmqY61BTOzGGTo6Saz/RP2n1dYBzou6z761od OrieDi+nAeMDcuqfytgHRcdU1NGdFnrypsi33lbrpOUTTpobqSHouRHm/szxS8xyY1/1 vM6b2aLEvIfMt5/qXzGcGkH0FMhREkQoTS3tmlyxFjbT9dAnPGMlqyQcDjNK8OWWKvgN iIfqToNTW+8odxLQqw5tMZ+2rhvsFMy8X2GirCpdiZh0xGtuokVxkeInC3Jcnwg818+F O4GjzJ5MiFybZdhvffo4X1esfYVeopYl7a7Bf8Lmz0OSIVk1YZwl56st4RxTi6njcYwN QZ6Q== Received: by 10.14.179.193 with SMTP id h41mr5520492eem.2.1342368259376; Sun, 15 Jul 2012 09:04:19 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id t6sm11592785eeo.17.2012.07.15.09.04.17 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jul 2012 09:04:17 -0700 (PDT) Date: Sun, 15 Jul 2012 18:04:10 +0200 From: Mateusz Guzik To: Christian Brueffer Message-ID: <20120715160410.GA22600@dft-labs.eu> References: <201207151550.q6FFoCMo056166@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201207151550.q6FFoCMo056166@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238491 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 16:04:26 -0000 On Sun, Jul 15, 2012 at 03:50:12PM +0000, Christian Brueffer wrote: > Author: brueffer > Date: Sun Jul 15 15:50:12 2012 > New Revision: 238491 > URL: http://svn.freebsd.org/changeset/base/238491 > > Log: > Save a bzero() by using M_ZERO. > > Obtained from: Dragonfly BSD (change 4faaf07c3d7ddd120deed007370aaf4d90b72ebb) > MFC after: 2 weeks > > Modified: > head/sys/fs/smbfs/smbfs_node.c > > Modified: head/sys/fs/smbfs/smbfs_node.c > ============================================================================== > --- head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:23:31 2012 (r238490) > +++ head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:50:12 2012 (r238491) > @@ -223,7 +223,7 @@ loop: > if (fap == NULL) > return ENOENT; > > - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK); > + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); > error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); > if (error) { > free(np, M_SMBNODE); > @@ -235,7 +235,6 @@ loop: > return (error); > } > vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; > - bzero(np, sizeof(*np)); > vp->v_data = np; > np->n_vnode = vp; > np->n_mount = VFSTOSMBFS(mp); How about moving this malloc right before np is actually used? While here some style(9) fixes. http://people.freebsd.org/~mjg/patches/smbfs_node-malloc.patch Completely untested (even compile-time); I guess the idea is clear. :) -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 16:23:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87C261065674; Sun, 15 Jul 2012 16:23:53 +0000 (UTC) (envelope-from SRS0=dIDz=FQ=FreeBSD.org=brueffer@srs.kundenserver.de) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mx1.freebsd.org (Postfix) with ESMTP id EDCC28FC0C; Sun, 15 Jul 2012 16:23:52 +0000 (UTC) Received: from hd948344f.sedadby.dyn.perspektivbredband.net (hd948344f.sedadby.dyn.perspektivbredband.net [217.72.52.79]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0Lo5Nc-1TW71538My-00gEfU; Sun, 15 Jul 2012 18:23:52 +0200 Message-ID: <5002EE96.2060104@FreeBSD.org> Date: Sun, 15 Jul 2012 18:23:50 +0200 From: Christian Brueffer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Mateusz Guzik References: <201207151550.q6FFoCMo056166@svn.freebsd.org> <20120715160410.GA22600@dft-labs.eu> In-Reply-To: <20120715160410.GA22600@dft-labs.eu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:ntJrFCmH4SHkZS6Z2BSj11SztBHxiAO86bgNnpfhIN9 pYJ4ASILDxf05nCgY/CCuh+QpvGY0YNMgxT1h8xN3EjXjRFnku 8XOD+q+jWAOergx7Bei+yn3dznjYs7gMQd5BcZhjxi5Yt9DI+7 tEX/1wyi0oclqjhjMUl+mJvjEUEjown+9gnqeqIoEp1tsTli5E UjoorYUSV41R+0UWIN12HrgSbX6U+DTINRjINcZ6oIvxyk9Uip E2Hw1kd5a6ZRgtDJPfTTi2n7bGDodALgmdrmFoaN+ewPABvlyl 9WZuSU2UDZvi28KqiEpN13zLHMZ3ATqgdgOBDX0W5m4kDI4QOa v/QZMUMTwSx/BtClQfDJ+rwKnYOHSRYzWSh0rf2VlayjbNOsHp LeaheWd4O2enQ== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238491 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 16:23:53 -0000 On 7/15/12 18:04 , Mateusz Guzik wrote: > On Sun, Jul 15, 2012 at 03:50:12PM +0000, Christian Brueffer wrote: >> Author: brueffer >> Date: Sun Jul 15 15:50:12 2012 >> New Revision: 238491 >> URL: http://svn.freebsd.org/changeset/base/238491 >> >> Log: >> Save a bzero() by using M_ZERO. >> >> Obtained from: Dragonfly BSD (change 4faaf07c3d7ddd120deed007370aaf4d90b72ebb) >> MFC after: 2 weeks >> >> Modified: >> head/sys/fs/smbfs/smbfs_node.c >> >> Modified: head/sys/fs/smbfs/smbfs_node.c >> ============================================================================== >> --- head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:23:31 2012 (r238490) >> +++ head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:50:12 2012 (r238491) >> @@ -223,7 +223,7 @@ loop: >> if (fap == NULL) >> return ENOENT; >> >> - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK); >> + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); >> error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); >> if (error) { >> free(np, M_SMBNODE); >> @@ -235,7 +235,6 @@ loop: >> return (error); >> } >> vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; >> - bzero(np, sizeof(*np)); >> vp->v_data = np; >> np->n_vnode = vp; >> np->n_mount = VFSTOSMBFS(mp); > > How about moving this malloc right before np is actually used? > While here some style(9) fixes. > > http://people.freebsd.org/~mjg/patches/smbfs_node-malloc.patch > > Completely untested (even compile-time); I guess the idea is clear. :) > Looks good to me. Want to give your shiny new commit bit a spin? ;-) If not, I'll handle it. Chris From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 16:26:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A5E81065674; Sun, 15 Jul 2012 16:26:24 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4CBE58FC08; Sun, 15 Jul 2012 16:26:23 +0000 (UTC) Received: by eabm6 with SMTP id m6so1531091eab.13 for ; Sun, 15 Jul 2012 09:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=WGSoQJkC0P/bfXTjRMB5qtXYTri0iQ7HZJBzquGV4Qw=; b=zNUddLGN9NlHrUseNDzWq2BaTVvXLtHQJmkjVpKYLgCBWvpTQgU/xHAMgSLOaHE0XZ NiBYcCe6FempKJ96wvi24ebQE3uq40Sl4fw2mLQoqiFdL22fFarnG7z1FyPv+Xqe/VTR 4ijM3phx+4q63Ttpm6N0VXTS1JR47JuJnwFnvJoK9NLkNNX+q8wdZDFhfttyFqCkgLN4 36LhsNld07cOfn6hr1G3gLuB5VgpJXL/MUNyjsyr0rftjpA9LGETjkmQkFGU4IwcN0Xy xB82jPHGvuJ1UcF0FqjVWgRuOdyGf3hpstodSl5exUeCsLDQixX+WvfYkJ6NTuOzXYnB Bjog== Received: by 10.14.213.133 with SMTP id a5mr5546892eep.4.1342369582370; Sun, 15 Jul 2012 09:26:22 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id h48sm11703563eem.9.2012.07.15.09.26.21 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jul 2012 09:26:21 -0700 (PDT) Date: Sun, 15 Jul 2012 18:26:14 +0200 From: Mateusz Guzik To: Christian Brueffer Message-ID: <20120715162614.GB22600@dft-labs.eu> References: <201207151550.q6FFoCMo056166@svn.freebsd.org> <20120715160410.GA22600@dft-labs.eu> <5002EE96.2060104@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5002EE96.2060104@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238491 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 16:26:24 -0000 On Sun, Jul 15, 2012 at 06:23:50PM +0200, Christian Brueffer wrote: > On 7/15/12 18:04 , Mateusz Guzik wrote: > > On Sun, Jul 15, 2012 at 03:50:12PM +0000, Christian Brueffer wrote: > >> Author: brueffer > >> Date: Sun Jul 15 15:50:12 2012 > >> New Revision: 238491 > >> URL: http://svn.freebsd.org/changeset/base/238491 > >> > >> Log: > >> Save a bzero() by using M_ZERO. > >> > >> Obtained from: Dragonfly BSD (change 4faaf07c3d7ddd120deed007370aaf4d90b72ebb) > >> MFC after: 2 weeks > >> > >> Modified: > >> head/sys/fs/smbfs/smbfs_node.c > >> > >> Modified: head/sys/fs/smbfs/smbfs_node.c > >> ============================================================================== > >> --- head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:23:31 2012 (r238490) > >> +++ head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:50:12 2012 (r238491) > >> @@ -223,7 +223,7 @@ loop: > >> if (fap == NULL) > >> return ENOENT; > >> > >> - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK); > >> + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); > >> error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); > >> if (error) { > >> free(np, M_SMBNODE); > >> @@ -235,7 +235,6 @@ loop: > >> return (error); > >> } > >> vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; > >> - bzero(np, sizeof(*np)); > >> vp->v_data = np; > >> np->n_vnode = vp; > >> np->n_mount = VFSTOSMBFS(mp); > > > > How about moving this malloc right before np is actually used? > > While here some style(9) fixes. > > > > http://people.freebsd.org/~mjg/patches/smbfs_node-malloc.patch > > > > Completely untested (even compile-time); I guess the idea is clear. :) > > > > Looks good to me. Want to give your shiny new commit bit a spin? ;-) > Not this time, I currently have no way to test it. :) > If not, I'll handle it. > Please do. -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 17:44:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D70F106566B; Sun, 15 Jul 2012 17:44:28 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 485EA8FC0A; Sun, 15 Jul 2012 17:44:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FHiSsc061388; Sun, 15 Jul 2012 17:44:28 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FHiSSf061385; Sun, 15 Jul 2012 17:44:28 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201207151744.q6FHiSSf061385@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sun, 15 Jul 2012 17:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238492 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 17:44:28 -0000 Author: melifaro Date: Sun Jul 15 17:44:27 2012 New Revision: 238492 URL: http://svn.freebsd.org/changeset/base/238492 Log: Permit changing MTU in 6to4 relay. This behavior is recommended by RFC 4213 clause 3.2. Sometimes fragmentation is the least evil. For example, some Linux IPVS kernels forwards ICMPv6 checksums to real servers incorrectly. Reviewed by: hrs(previous version) Approved by: kib(mentor) MFC after: 1 week Modified: head/sys/net/if_stf.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Sun Jul 15 15:50:12 2012 (r238491) +++ head/sys/net/if_stf.c Sun Jul 15 17:44:27 2012 (r238492) @@ -793,7 +793,7 @@ stf_rtrequest(cmd, rt, info) struct rt_addrinfo *info; { RT_LOCK_ASSERT(rt); - rt->rt_rmx.rmx_mtu = IPV6_MMTU; + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; } static int @@ -806,7 +806,7 @@ stf_ioctl(ifp, cmd, data) struct ifreq *ifr; struct sockaddr_in6 *sin6; struct in_addr addr; - int error; + int error, mtu; error = 0; switch (cmd) { @@ -840,6 +840,18 @@ stf_ioctl(ifp, cmd, data) error = EAFNOSUPPORT; break; + case SIOCGIFMTU: + break; + + case SIOCSIFMTU: + ifr = (struct ifreq *)data; + mtu = ifr->ifr_mtu; + /* RFC 4213 3.2 ideal world MTU */ + if (mtu < IPV6_MINMTU || mtu > IF_MAXMTU - 20) + return (EINVAL); + ifp->if_mtu = mtu; + break; + default: error = EINVAL; break; From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 18:12:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7161F106566B; Sun, 15 Jul 2012 18:12:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 576348FC0C; Sun, 15 Jul 2012 18:12:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FICAli062918; Sun, 15 Jul 2012 18:12:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FICA26062915; Sun, 15 Jul 2012 18:12:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201207151812.q6FICA26062915@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 15 Jul 2012 18:12:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238493 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 18:12:10 -0000 Author: hselasky Date: Sun Jul 15 18:12:09 2012 New Revision: 238493 URL: http://svn.freebsd.org/changeset/base/238493 Log: Add new USB device ID. PR: usb/169789 MFC after: 1 week Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Sun Jul 15 17:44:27 2012 (r238492) +++ head/sys/dev/usb/serial/u3g.c Sun Jul 15 18:12:09 2012 (r238493) @@ -282,6 +282,8 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(HUAWEI, E143F, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E173, 0), U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), + U3G_DEV(HUAWEI, E3131, 0), + U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Jul 15 17:44:27 2012 (r238492) +++ head/sys/dev/usb/usbdevs Sun Jul 15 18:12:09 2012 (r238493) @@ -1894,6 +1894,8 @@ product HUAWEI E143F 0x143f 3G modem product HUAWEI E1752 0x1446 3G modem product HUAWEI K3765 0x1465 3G modem product HUAWEI E1820 0x14ac E1820 HSPA+ USB Slider +product HUAWEI E3131_INIT 0x14fe 3G modem initial +product HUAWEI E3131 0x1506 3G modem product HUAWEI K3765_INIT 0x1520 K3765 Initial product HUAWEI ETS2055 0x1803 CDMA modem product HUAWEI E173 0x1c05 3G modem From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 19:10:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A23E5106564A; Sun, 15 Jul 2012 19:10:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 890FE8FC0C; Sun, 15 Jul 2012 19:10:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FJA1Re066654; Sun, 15 Jul 2012 19:10:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FJA1A1066653; Sun, 15 Jul 2012 19:10:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207151910.q6FJA1A1066653@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 15 Jul 2012 19:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238498 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 19:10:01 -0000 Author: glebius Date: Sun Jul 15 19:10:00 2012 New Revision: 238498 URL: http://svn.freebsd.org/changeset/base/238498 Log: Use M_NOWAIT while holding the pf giant lock. Modified: head/sys/contrib/pf/net/pf_if.c Modified: head/sys/contrib/pf/net/pf_if.c ============================================================================== --- head/sys/contrib/pf/net/pf_if.c Sun Jul 15 19:05:58 2012 (r238497) +++ head/sys/contrib/pf/net/pf_if.c Sun Jul 15 19:10:00 2012 (r238498) @@ -506,8 +506,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *a if (aw->type != PF_ADDR_DYNIFTL) return (0); #ifdef __FreeBSD__ - /* XXX: revisit! */ - if ((dyn = pool_get(&V_pfi_addr_pl, PR_WAITOK | PR_ZERO)) + if ((dyn = pool_get(&V_pfi_addr_pl, PR_NOWAIT | PR_ZERO)) #else if ((dyn = pool_get(&pfi_addr_pl, PR_WAITOK | PR_LIMITFAIL | PR_ZERO)) #endif From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 20:16:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 492CA106566C; Sun, 15 Jul 2012 20:16:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33A228FC0A; Sun, 15 Jul 2012 20:16:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKGI4r070494; Sun, 15 Jul 2012 20:16:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKGHOi070488; Sun, 15 Jul 2012 20:16:17 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207152016.q6FKGHOi070488@svn.freebsd.org> From: Michael Tuexen Date: Sun, 15 Jul 2012 20:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238501 - in head/sys: netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:16:18 -0000 Author: tuexen Date: Sun Jul 15 20:16:17 2012 New Revision: 238501 URL: http://svn.freebsd.org/changeset/base/238501 Log: Changes which improve compilation if neither INET nor INET6 is defined. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet/sctp_asconf.c Sun Jul 15 20:16:17 2012 (r238501) @@ -2747,13 +2747,14 @@ sctp_process_initack_addresses(struct sc struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; - struct sctp_ipv6addr_param addr_store; #ifdef INET6 + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6; #endif #ifdef INET + struct sctp_ipv4addr_param addr4_store; struct sockaddr_in sin; #endif @@ -2802,7 +2803,7 @@ sctp_process_initack_addresses(struct sc a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr6_store); if (plen != sizeof(struct sctp_ipv6addr_param) || a6p == NULL) { return; @@ -2821,7 +2822,7 @@ sctp_process_initack_addresses(struct sc /* get the entire IPv4 address param */ a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr4_store); if (plen != sizeof(struct sctp_ipv4addr_param) || a4p == NULL) { return; @@ -2899,16 +2900,17 @@ sctp_addr_in_initack(struct mbuf *m, uin { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - struct sctp_ipv6addr_param addr_store; #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; + struct sctp_ipv6addr_param addr4_store; #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; #endif @@ -2954,7 +2956,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr6_store); if (a6p == NULL) { return (0); } @@ -2984,7 +2986,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a4p = (struct sctp_ipv4addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr_store); + (uint8_t *) & addr4_store); if (a4p == NULL) { return (0); } Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet/sctp_output.c Sun Jul 15 20:16:17 2012 (r238501) @@ -3799,6 +3799,7 @@ sctp_get_ect(struct sctp_tcb *stcb) } } +#if defined(INET) || defined(INET6) static void sctp_handle_no_route(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -3843,6 +3844,8 @@ sctp_handle_no_route(struct sctp_tcb *st } } +#endif + static int sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* may be NULL */ @@ -3882,14 +3885,18 @@ sctp_lowlevel_chunk_output(struct sctp_i * interface and smallest_mtu size as well. */ /* Will need ifdefs around this */ - struct mbuf *o_pak; struct mbuf *newm; struct sctphdr *sctphdr; int packet_length; int ret; uint32_t vrf_id; + +#if defined(INET) || defined(INET6) + struct mbuf *o_pak; sctp_route_t *ro = NULL; struct udphdr *udp = NULL; + +#endif uint8_t tos_value; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet/sctp_uio.h Sun Jul 15 20:16:17 2012 (r238501) @@ -1124,10 +1124,10 @@ struct sctpstat { #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) union sctp_sockstore { -#if defined(INET) || !defined(_KERNEL) +#if defined(INET) struct sockaddr_in sin; #endif -#if defined(INET6) || !defined(_KERNEL) +#if defined(INET6) struct sockaddr_in6 sin6; #endif struct sockaddr sa; Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet/sctp_usrreq.c Sun Jul 15 20:16:17 2012 (r238501) @@ -5258,7 +5258,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_BINDX_ADD_ADDR: { struct sctp_getaddresses *addrs; - size_t sz; struct thread *td; td = (struct thread *)p; @@ -5266,8 +5265,7 @@ sctp_setopt(struct socket *so, int optna optsize); #ifdef INET if (addrs->addr->sa_family == AF_INET) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5280,8 +5278,7 @@ sctp_setopt(struct socket *so, int optna #endif #ifdef INET6 if (addrs->addr->sa_family == AF_INET6) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5305,7 +5302,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_BINDX_REM_ADDR: { struct sctp_getaddresses *addrs; - size_t sz; struct thread *td; td = (struct thread *)p; @@ -5313,8 +5309,7 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(addrs, optval, struct sctp_getaddresses, optsize); #ifdef INET if (addrs->addr->sa_family == AF_INET) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; @@ -5327,8 +5322,7 @@ sctp_setopt(struct socket *so, int optna #endif #ifdef INET6 if (addrs->addr->sa_family == AF_INET6) { - sz = sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6); - if (optsize < sz) { + if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet6/sctp6_usrreq.c Sun Jul 15 20:16:17 2012 (r238501) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#ifdef INET6 #include #include #include @@ -1240,3 +1241,5 @@ struct pr_usrreqs sctp6_usrreqs = { .pru_sosend = sctp_sosend, .pru_soreceive = sctp_soreceive }; + +#endif From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 20:29:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1FDEF106564A; Sun, 15 Jul 2012 20:29:49 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AB498FC12; Sun, 15 Jul 2012 20:29:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKTmKf071324; Sun, 15 Jul 2012 20:29:48 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKTmfW071319; Sun, 15 Jul 2012 20:29:48 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201207152029.q6FKTmfW071319@svn.freebsd.org> From: Matthew D Fleming Date: Sun, 15 Jul 2012 20:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238502 - in head/sys: kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:29:49 -0000 Author: mdf Date: Sun Jul 15 20:29:48 2012 New Revision: 238502 URL: http://svn.freebsd.org/changeset/base/238502 Log: Fix a bug with memguard(9) on 32-bit architectures without a VM_KMEM_MAX_SIZE. The code was not taking into account the size of the kernel_map, which the kmem_map is allocated from, so it could produce a sub-map size too large to fit. The simplest solution is to ignore VM_KMEM_MAX entirely and base the memguard map's size off the kernel_map's size, since this is always relevant and always smaller. Found by: Justin Hibbits Modified: head/sys/kern/kern_malloc.c head/sys/vm/memguard.c head/sys/vm/memguard.h head/sys/vm/vm_map.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Sun Jul 15 20:16:17 2012 (r238501) +++ head/sys/kern/kern_malloc.c Sun Jul 15 20:29:48 2012 (r238502) @@ -744,7 +744,7 @@ kmeminit(void *dummy) vm_kmem_size = 2 * mem_size * PAGE_SIZE; #ifdef DEBUG_MEMGUARD - tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); + tmp = memguard_fudge(vm_kmem_size, kernel_map); #else tmp = vm_kmem_size; #endif Modified: head/sys/vm/memguard.c ============================================================================== --- head/sys/vm/memguard.c Sun Jul 15 20:16:17 2012 (r238501) +++ head/sys/vm/memguard.c Sun Jul 15 20:29:48 2012 (r238502) @@ -159,16 +159,18 @@ SYSCTL_ULONG(_vm_memguard, OID_AUTO, fre * the kmem_map. The memguard memory will be a submap. */ unsigned long -memguard_fudge(unsigned long km_size, unsigned long km_max) +memguard_fudge(unsigned long km_size, const struct vm_map *parent_map) { - u_long mem_pgs = cnt.v_page_count; + u_long mem_pgs, parent_size; vm_memguard_divisor = 10; TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); + parent_size = vm_map_max(parent_map) - vm_map_min(parent_map) + + PAGE_SIZE; /* Pick a conservative value if provided value sucks. */ if ((vm_memguard_divisor <= 0) || - ((km_size / vm_memguard_divisor) == 0)) + ((parent_size / vm_memguard_divisor) == 0)) vm_memguard_divisor = 10; /* * Limit consumption of physical pages to @@ -177,21 +179,19 @@ memguard_fudge(unsigned long km_size, un * This prevents memguard's page promotions from completely * using up memory, since most malloc(9) calls are sub-page. */ + mem_pgs = cnt.v_page_count; memguard_physlimit = (mem_pgs / vm_memguard_divisor) * PAGE_SIZE; /* * We want as much KVA as we can take safely. Use at most our - * allotted fraction of kmem_max. Limit this to twice the - * physical memory to avoid using too much memory as pagetable - * pages. - */ - memguard_mapsize = km_max / vm_memguard_divisor; - /* size must be multiple of PAGE_SIZE */ - memguard_mapsize = round_page(memguard_mapsize); - if (memguard_mapsize == 0 || - memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs) + * allotted fraction of the parent map's size. Limit this to + * twice the physical memory to avoid using too much memory as + * pagetable pages (size must be multiple of PAGE_SIZE). + */ + memguard_mapsize = round_page(parent_size / vm_memguard_divisor); + if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs) memguard_mapsize = mem_pgs * 2 * PAGE_SIZE; - if (km_max > 0 && km_size + memguard_mapsize > km_max) - return (km_max); + if (km_size + memguard_mapsize > parent_size) + memguard_mapsize = 0; return (km_size + memguard_mapsize); } Modified: head/sys/vm/memguard.h ============================================================================== --- head/sys/vm/memguard.h Sun Jul 15 20:16:17 2012 (r238501) +++ head/sys/vm/memguard.h Sun Jul 15 20:29:48 2012 (r238502) @@ -35,7 +35,7 @@ struct malloc_type; struct vm_map; #ifdef DEBUG_MEMGUARD -unsigned long memguard_fudge(unsigned long, unsigned long); +unsigned long memguard_fudge(unsigned long, const struct vm_map *); void memguard_init(struct vm_map *); void *memguard_alloc(unsigned long, int); void *memguard_realloc(void *, unsigned long, struct malloc_type *, int); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sun Jul 15 20:16:17 2012 (r238501) +++ head/sys/vm/vm_map.h Sun Jul 15 20:29:48 2012 (r238502) @@ -200,13 +200,13 @@ struct vm_map { #ifdef _KERNEL static __inline vm_offset_t -vm_map_max(vm_map_t map) +vm_map_max(const struct vm_map *map) { return (map->max_offset); } static __inline vm_offset_t -vm_map_min(vm_map_t map) +vm_map_min(const struct vm_map *map) { return (map->min_offset); } From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 20:31:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9C16106564A; Sun, 15 Jul 2012 20:31:46 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 82E068FC08; Sun, 15 Jul 2012 20:31:46 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so9594120pbb.13 for ; Sun, 15 Jul 2012 13:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=K/lYFVD4ZbZPwsoPB9ZFgacBaFHyX2GgVDrzDt5kJZE=; b=SNHnU67tYxcPma/jBjcAh8/giZbyfRTaxivkzf1XmkKc8gwjrbLoO8WHrWTd/RfBLU pLVvMCZ4Txeq/UMFv2l2Sq76IvsKezpipI/NFmHi34zrV3H8SAbbwa4AUEllA1Npq2cf Bz9VOhy8lectr2exF+LjiM/3K6lLZP4RubIbPb+p71nysmXN9OxCnnmzIi6+VEHF0HKS ZNO8EPP4pZUWZ+MxzPlL6/kTq8byn93YcYlGsCu9fQ2GSHDaVL1/ffoA2BZ/Gs8iGUd7 Ed1DY5vyhmesTJ1AZdP08cuHBIvvsCG1Gx/GwHwhkzNFBH/vKQZpmfec67Os/AWAcoTV dMcQ== MIME-Version: 1.0 Received: by 10.68.195.97 with SMTP id id1mr22193844pbc.91.1342384306305; Sun, 15 Jul 2012 13:31:46 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.68.208.168 with HTTP; Sun, 15 Jul 2012 13:31:46 -0700 (PDT) In-Reply-To: <201207152029.q6FKTmfW071319@svn.freebsd.org> References: <201207152029.q6FKTmfW071319@svn.freebsd.org> Date: Sun, 15 Jul 2012 13:31:46 -0700 X-Google-Sender-Auth: FaVLU0NAuDyQ9EA_Qdox1_WwUWU Message-ID: From: mdf@FreeBSD.org To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: Re: svn commit: r238502 - in head/sys: kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:31:46 -0000 On Sun, Jul 15, 2012 at 1:29 PM, Matthew D Fleming wrote: > Author: mdf > Date: Sun Jul 15 20:29:48 2012 > New Revision: 238502 > URL: http://svn.freebsd.org/changeset/base/238502 > > Log: > Fix a bug with memguard(9) on 32-bit architectures without a > VM_KMEM_MAX_SIZE. > > The code was not taking into account the size of the kernel_map, which > the kmem_map is allocated from, so it could produce a sub-map size too > large to fit. The simplest solution is to ignore VM_KMEM_MAX entirely > and base the memguard map's size off the kernel_map's size, since this > is always relevant and always smaller. > > Found by: Justin Hibbits MFC after: 3 days Thanks, matthew From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 20:39:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 994C9106564A; Sun, 15 Jul 2012 20:39:22 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 852308FC08; Sun, 15 Jul 2012 20:39:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKdMZC072015; Sun, 15 Jul 2012 20:39:22 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKdMal072013; Sun, 15 Jul 2012 20:39:22 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207152039.q6FKdMal072013@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 20:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238504 - head/lib/libc/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:39:22 -0000 Author: jilles Date: Sun Jul 15 20:39:21 2012 New Revision: 238504 URL: http://svn.freebsd.org/changeset/base/238504 Log: libc: Remove some unused strings from getaddrinfo(). Modified: head/lib/libc/net/getaddrinfo.c Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Sun Jul 15 20:38:02 2012 (r238503) +++ head/lib/libc/net/getaddrinfo.c Sun Jul 15 20:39:21 2012 (r238504) @@ -155,7 +155,6 @@ struct explore { int e_af; int e_socktype; int e_protocol; - const char *e_protostr; int e_wild; #define WILD_AF(ex) ((ex)->e_wild & 0x01) #define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02) @@ -164,21 +163,21 @@ struct explore { static const struct explore explore[] = { #if 0 - { PF_LOCAL, ANY, ANY, NULL, 0x01 }, + { PF_LOCAL, ANY, ANY, 0x01 }, #endif #ifdef INET6 - { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, - { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, - { PF_INET6, SOCK_STREAM, IPPROTO_SCTP, "sctp", 0x03 }, - { PF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP, "sctp", 0x07 }, - { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 }, -#endif - { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, - { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, - { PF_INET, SOCK_STREAM, IPPROTO_SCTP, "sctp", 0x03 }, - { PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP, "sctp", 0x07 }, - { PF_INET, SOCK_RAW, ANY, NULL, 0x05 }, - { -1, 0, 0, NULL, 0 }, + { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, 0x07 }, + { PF_INET6, SOCK_STREAM, IPPROTO_TCP, 0x07 }, + { PF_INET6, SOCK_STREAM, IPPROTO_SCTP, 0x03 }, + { PF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP, 0x07 }, + { PF_INET6, SOCK_RAW, ANY, 0x05 }, +#endif + { PF_INET, SOCK_DGRAM, IPPROTO_UDP, 0x07 }, + { PF_INET, SOCK_STREAM, IPPROTO_TCP, 0x07 }, + { PF_INET, SOCK_STREAM, IPPROTO_SCTP, 0x03 }, + { PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP, 0x07 }, + { PF_INET, SOCK_RAW, ANY, 0x05 }, + { -1, 0, 0, 0 }, }; #ifdef INET6 From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 20:48:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 188781065686; Sun, 15 Jul 2012 20:48:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 040008FC08; Sun, 15 Jul 2012 20:48:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKmLcO072641; Sun, 15 Jul 2012 20:48:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKmLjE072639; Sun, 15 Jul 2012 20:48:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207152048.q6FKmLjE072639@svn.freebsd.org> From: Adrian Chadd Date: Sun, 15 Jul 2012 20:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238506 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:48:22 -0000 Author: adrian Date: Sun Jul 15 20:48:21 2012 New Revision: 238506 URL: http://svn.freebsd.org/changeset/base/238506 Log: Log the number of handled decsriptors and valid descriptors when hitting RXEOL. Modified: head/sys/dev/ath/if_ath_rx_edma.c Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Sun Jul 15 20:40:10 2012 (r238505) +++ head/sys/dev/ath/if_ath_rx_edma.c Sun Jul 15 20:48:21 2012 (r238506) @@ -428,8 +428,9 @@ ath_edma_recv_proc_queue(struct ath_soft ATH_PCU_LOCK(sc); if (dosched && sc->sc_kickpcu) { CTR0(ATH_KTR_ERR, "ath_edma_recv_proc_queue(): kickpcu"); - device_printf(sc->sc_dev, "%s: handled %d descriptors\n", - __func__, ngood); + device_printf(sc->sc_dev, + "%s: handled npkts %d ngood %d\n", + __func__, npkts, ngood); /* * XXX TODO: what should occur here? Just re-poke and From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 20:51:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A9B50106564A; Sun, 15 Jul 2012 20:51:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B53A8FC14; Sun, 15 Jul 2012 20:51:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FKpgNT072866; Sun, 15 Jul 2012 20:51:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FKpgSK072862; Sun, 15 Jul 2012 20:51:42 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207152051.q6FKpgSK072862@svn.freebsd.org> From: Adrian Chadd Date: Sun, 15 Jul 2012 20:51:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238507 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 20:51:42 -0000 Author: adrian Date: Sun Jul 15 20:51:41 2012 New Revision: 238507 URL: http://svn.freebsd.org/changeset/base/238507 Log: Handle RX Keymiss events. The AR9003 series NICs implement a separate RX error to signal that a Keycache miss occured. The earlier NICs would not set the key index valid bit. I'll dig into the difference between "no key index bit set" and "keycache miss". Modified: head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Sun Jul 15 20:48:21 2012 (r238506) +++ head/sys/dev/ath/if_ath_rx.c Sun Jul 15 20:51:41 2012 (r238507) @@ -534,6 +534,14 @@ ath_rx_pkt(struct ath_softc *sc, struct goto rx_accept; sc->sc_stats.ast_rx_badcrypt++; } + /* + * Similar as above - if the failure was a keymiss + * just punt it up to the upper layers for now. + */ + if (rs->rs_status & HAL_RXERR_KEYMISS) { + sc->sc_stats.ast_rx_keymiss++; + goto rx_accept; + } if (rs->rs_status & HAL_RXERR_MIC) { sc->sc_stats.ast_rx_badmic++; /* Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Sun Jul 15 20:48:21 2012 (r238506) +++ head/sys/dev/ath/if_ath_sysctl.c Sun Jul 15 20:51:41 2012 (r238507) @@ -934,6 +934,8 @@ ath_sysctl_stats_attach(struct ath_softc SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_mcastq_overflow", CTLFLAG_RD, &sc->sc_stats.ast_tx_mcastq_overflow, 0, "Number of multicast frames exceeding maximum mcast queue depth"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_keymiss", CTLFLAG_RD, + &sc->sc_stats.ast_rx_keymiss, 0, ""); /* Attach the RX phy error array */ ath_sysctl_stats_attach_rxphyerr(sc, child); Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Sun Jul 15 20:48:21 2012 (r238506) +++ head/sys/dev/ath/if_athioctl.h Sun Jul 15 20:51:41 2012 (r238507) @@ -161,7 +161,9 @@ struct ath_stats { u_int32_t ast_tx_aggr_ok; /* aggregate TX ok */ u_int32_t ast_tx_aggr_fail; /* aggregate TX failed */ u_int32_t ast_tx_mcastq_overflow; /* multicast queue overflow */ - u_int32_t ast_pad[1]; + u_int32_t ast_rx_keymiss; + + u_int32_t ast_pad[16]; }; #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 21:12:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEED91065670; Sun, 15 Jul 2012 21:12:22 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA7AE8FC08; Sun, 15 Jul 2012 21:12:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FLCMr0074192; Sun, 15 Jul 2012 21:12:22 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FLCM0t074190; Sun, 15 Jul 2012 21:12:22 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207152112.q6FLCM0t074190@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 15 Jul 2012 21:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238508 - head/bin/stty X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 21:12:23 -0000 Author: jilles Date: Sun Jul 15 21:12:22 2012 New Revision: 238508 URL: http://svn.freebsd.org/changeset/base/238508 Log: stty: Mark usage() __dead2. This reduces code size a little and should fix a scan-build warning. Modified: head/bin/stty/extern.h Modified: head/bin/stty/extern.h ============================================================================== --- head/bin/stty/extern.h Sun Jul 15 20:51:41 2012 (r238507) +++ head/bin/stty/extern.h Sun Jul 15 21:12:22 2012 (r238508) @@ -40,6 +40,6 @@ int ksearch(char ***, struct info *); int msearch(char ***, struct info *); void optlist(void); void print(struct termios *, struct winsize *, int, enum FMT); -void usage(void); +void usage(void) __dead2; extern struct cchar cchars1[], cchars2[]; From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 21:20:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43FC3106564A; Sun, 15 Jul 2012 21:20:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 159BE8FC08; Sun, 15 Jul 2012 21:20:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FLKVI5074703; Sun, 15 Jul 2012 21:20:31 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FLKVCn074700; Sun, 15 Jul 2012 21:20:31 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201207152120.q6FLKVCn074700@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 15 Jul 2012 21:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238509 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 21:20:32 -0000 Author: pfg Date: Sun Jul 15 21:20:31 2012 New Revision: 238509 URL: http://svn.freebsd.org/changeset/base/238509 Log: Use libc's strndup() instead of Dtrace's reimplementation. Corresponds partially to OpenSolaris change: PSARC 2010/299 GNU/Linux/BSD compatibility functions 6901783 strndup would be nice MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c Sun Jul 15 21:12:22 2012 (r238508) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c Sun Jul 15 21:20:31 2012 (r238509) @@ -29,23 +29,6 @@ #include #include -#include - -/* - * Create a copy of string s, but only duplicate the first n bytes. - */ -char * -strndup(const char *s, size_t n) -{ - char *s2 = malloc(n + 1); - - if (s2 == NULL) - longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); - - (void) strncpy(s2, s, n); - s2[n] = '\0'; - return (s2); -} /* * Transform string s inline, converting each embedded C escape sequence string Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h Sun Jul 15 21:12:22 2012 (r238508) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h Sun Jul 15 21:20:31 2012 (r238509) @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,14 +19,12 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _DT_STRING_H #define _DT_STRING_H -#pragma ident "%Z%%M% %I% %E% SMI" #include #include @@ -36,7 +33,6 @@ extern "C" { #endif -extern char *strndup(const char *, size_t); extern size_t stresc2chr(char *); extern char *strchr2esc(const char *, size_t); extern const char *strbasename(const char *); From owner-svn-src-head@FreeBSD.ORG Sun Jul 15 21:46:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 588BA1065672; Sun, 15 Jul 2012 21:46:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43DF28FC16; Sun, 15 Jul 2012 21:46:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6FLkK4t076248; Sun, 15 Jul 2012 21:46:20 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6FLkKZB076246; Sun, 15 Jul 2012 21:46:20 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207152146.q6FLkKZB076246@svn.freebsd.org> From: Alan Cox Date: Sun, 15 Jul 2012 21:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238510 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 21:46:20 -0000 Author: alc Date: Sun Jul 15 21:46:19 2012 New Revision: 238510 URL: http://svn.freebsd.org/changeset/base/238510 Log: Correct an off-by-one error in vm_reserv_alloc_contig() that resulted in the last reservation of a multi-reservation allocation not being initialized. Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sun Jul 15 21:20:31 2012 (r238509) +++ head/sys/vm/vm_reserv.c Sun Jul 15 21:46:19 2012 (r238510) @@ -457,7 +457,7 @@ vm_reserv_alloc_contig(vm_object_t objec m += VM_LEVEL_0_NPAGES; first += VM_LEVEL_0_NPAGES; allocpages -= VM_LEVEL_0_NPAGES; - } while (allocpages > VM_LEVEL_0_NPAGES); + } while (allocpages > 0); return (m_ret); /* From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 06:43:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EC7271065763; Mon, 16 Jul 2012 06:43:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D73178FC18; Mon, 16 Jul 2012 06:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G6h5xh011997; Mon, 16 Jul 2012 06:43:05 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G6h5di011993; Mon, 16 Jul 2012 06:43:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207160643.q6G6h5di011993@svn.freebsd.org> From: Michael Tuexen Date: Mon, 16 Jul 2012 06:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238514 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 06:43:06 -0000 Author: tuexen Date: Mon Jul 16 06:43:04 2012 New Revision: 238514 URL: http://svn.freebsd.org/changeset/base/238514 Log: Allow netstat to be build if INET is not defined in the kernel. Thanks to Garrett Cooper for reporting the issue. MFC after: 3 days X-MFC: 238501 Modified: head/usr.bin/netstat/Makefile head/usr.bin/netstat/sctp.c Modified: head/usr.bin/netstat/Makefile ============================================================================== --- head/usr.bin/netstat/Makefile Mon Jul 16 02:10:26 2012 (r238513) +++ head/usr.bin/netstat/Makefile Mon Jul 16 06:43:04 2012 (r238514) @@ -13,6 +13,10 @@ CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC CFLAGS+=-DSCTP +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+=-DINET +.endif + .if ${MK_INET6_SUPPORT} != "no" SRCS+= inet6.c CFLAGS+=-DINET6 Modified: head/usr.bin/netstat/sctp.c ============================================================================== --- head/usr.bin/netstat/sctp.c Mon Jul 16 02:10:26 2012 (r238513) +++ head/usr.bin/netstat/sctp.c Mon Jul 16 06:43:04 2012 (r238514) @@ -107,6 +107,7 @@ struct xraddr_entry { * If numeric_addr has been supplied, give * numeric value, otherwise try for symbolic name. */ +#ifdef INET static char * inetname(struct in_addr *inp) { @@ -146,6 +147,7 @@ inetname(struct in_addr *inp) } return (line); } +#endif #ifdef INET6 static char ntop_buf[INET6_ADDRSTRLEN]; @@ -197,9 +199,11 @@ sctp_print_address(union sctp_sockstore int width; switch (address->sa.sa_family) { +#ifdef INET case AF_INET: sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); break; +#endif #ifdef INET6 case AF_INET6: sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 07:08:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B7CC21065672; Mon, 16 Jul 2012 07:08:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A21848FC14; Mon, 16 Jul 2012 07:08:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G78Yb7013945; Mon, 16 Jul 2012 07:08:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G78YEu013943; Mon, 16 Jul 2012 07:08:34 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207160708.q6G78YEu013943@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 16 Jul 2012 07:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238516 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 07:08:34 -0000 Author: glebius Date: Mon Jul 16 07:08:34 2012 New Revision: 238516 URL: http://svn.freebsd.org/changeset/base/238516 Log: If ip_output() returns EMSGSIZE to tcp_output(), then the latter calls tcp_mtudisc(), which in its turn may call tcp_output(). Under certain conditions (must admit they are very special) an infinite recursion can happen. To avoid recursion we can pass struct route to ip_output() and obtain correct mtu. This allows us not to use tcp_mtudisc() but call tcp_mss_update() directly. PR: kern/155585 Submitted by: Andrey Zonov (original version of patch) Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Mon Jul 16 06:56:46 2012 (r238515) +++ head/sys/netinet/tcp_output.c Mon Jul 16 07:08:34 2012 (r238516) @@ -180,7 +180,7 @@ tcp_output(struct tcpcb *tp) int idle, sendalot; int sack_rxmit, sack_bytes_rxmt; struct sackhole *p; - int tso; + int tso, mtu; struct tcpopt to; #if 0 int maxburst = TCP_MAXBURST; @@ -226,6 +226,7 @@ again: tcp_sack_adjust(tp); sendalot = 0; tso = 0; + mtu = 0; off = tp->snd_nxt - tp->snd_una; sendwin = min(tp->snd_wnd, tp->snd_cwnd); @@ -1209,6 +1210,9 @@ timer: */ #ifdef INET6 if (isipv6) { + struct route_in6 ro; + + bzero(&ro, sizeof(ro)); /* * we separately set hoplimit for every segment, since the * user might want to change the value via setsockopt. @@ -1218,10 +1222,13 @@ timer: ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb, NULL); /* TODO: IPv6 IP6TOS_ECT bit on */ - error = ip6_output(m, - tp->t_inpcb->in6p_outputopts, NULL, - ((so->so_options & SO_DONTROUTE) ? - IP_ROUTETOIF : 0), NULL, NULL, tp->t_inpcb); + error = ip6_output(m, tp->t_inpcb->in6p_outputopts, &ro, + ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), + NULL, NULL, tp->t_inpcb); + + if (error == EMSGSIZE && ro.ro_rt != NULL) + mtu = ro.ro_rt->rt_rmx.rmx_mtu; + RO_RTFREE(&ro); } #endif /* INET6 */ #if defined(INET) && defined(INET6) @@ -1229,6 +1236,9 @@ timer: #endif #ifdef INET { + struct route ro; + + bzero(&ro, sizeof(ro)); ip->ip_len = m->m_pkthdr.len; #ifdef INET6 if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) @@ -1245,9 +1255,13 @@ timer: if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) ip->ip_off |= IP_DF; - error = ip_output(m, tp->t_inpcb->inp_options, NULL, + error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, tp->t_inpcb); + + if (error == EMSGSIZE && ro.ro_rt != NULL) + mtu = ro.ro_rt->rt_rmx.rmx_mtu; + RO_RTFREE(&ro); } #endif /* INET */ if (error) { @@ -1294,21 +1308,18 @@ out: * For some reason the interface we used initially * to send segments changed to another or lowered * its MTU. - * - * tcp_mtudisc() will find out the new MTU and as - * its last action, initiate retransmission, so it - * is important to not do so here. - * * If TSO was active we either got an interface * without TSO capabilits or TSO was turned off. - * Disable it for this connection as too and - * immediatly retry with MSS sized segments generated - * by this function. + * If we obtained mtu from ip_output() then update + * it and try again. */ if (tso) tp->t_flags &= ~TF_TSO; - tcp_mtudisc(tp->t_inpcb, -1); - return (0); + if (mtu != 0) { + tcp_mss_update(tp, -1, mtu, NULL, NULL); + goto again; + } + return (error); case EHOSTDOWN: case EHOSTUNREACH: case ENETDOWN: From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 07:20:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 155261065674; Mon, 16 Jul 2012 07:20:44 +0000 (UTC) (envelope-from samspeed@mail.ru) Received: from fallback1.mail.ru (fallback1.mail.ru [94.100.176.18]) by mx1.freebsd.org (Postfix) with ESMTP id 149448FC16; Mon, 16 Jul 2012 07:20:43 +0000 (UTC) Received: from f159.mail.ru (f159.mail.ru [217.69.128.111]) by fallback1.mail.ru (mPOP.Fallback_MX) with ESMTP id F389673D4D7; Mon, 16 Jul 2012 11:15:30 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=Content-Type:Message-ID:Reply-To:In-Reply-To:References:Date:Mime-Version:Subject:Cc:To:From; bh=DNtZq+BkfOtFyg4TIx55bhCwqq7lWEqJQUdJUWh85AA=; b=KrCrgUN7Ddb11qavXZFMXHJfKcvr8pht8tA3dY9dkcQnIqrnuZ6BekRknhJ+u6dhsMzJvYD6D5msRAcflEal0EGc7mAcKtROxiUUOb/v88vTlHPIl8Y7m2S9gOHTXkYl; Received: from mail by f159.mail.ru with local (envelope-from ) id 1SqfWc-0001Ux-CS; Mon, 16 Jul 2012 11:15:22 +0400 Received: from [85.113.141.24] by e.mail.ru with HTTP; Mon, 16 Jul 2012 11:15:22 +0400 From: =?UTF-8?B?QW5kcmV5IFNtYWdpbg==?= To: =?UTF-8?B?R2xlYiBTbWlybm9mZg==?= Mime-Version: 1.0 X-Mailer: mPOP Web-Mail 2.19 X-Originating-IP: [85.113.141.24] Date: Mon, 16 Jul 2012 11:15:22 +0400 References: <201207160708.q6G78YEu013943@svn.freebsd.org> In-Reply-To: <201207160708.q6G78YEu013943@svn.freebsd.org> X-Priority: Message-ID: <1342422922.364785252@f159.mail.ru> X-Spam: Not detected X-Mras: Ok Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238516 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?UTF-8?B?QW5kcmV5IFNtYWdpbg==?= List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 07:20:44 -0000 VGhhbmsgeW91IHZlcnkgbXVjaCAhISEgCgoKTW9uLCAxNiBKdWwgMjAxMiAwNzowODozNCArMDAw MCAoVVRDKSDQvtGCIEdsZWIgU21pcm5vZmYgPGdsZWJpdXNARnJlZUJTRC5vcmc+OgogCiAgCiAg CkF1dGhvcjogZ2xlYml1cwpEYXRlOiBNb24gSnVsIDE2IDA3OjA4OjM0IDIwMTIKTmV3IFJldmlz aW9uOiAyMzg1MTYKVVJMOiBodHRwOi8vc3ZuLmZyZWVic2Qub3JnL2NoYW5nZXNldC9iYXNlLzIz ODUxNgoKTG9nOgrCoMKgSWYgaXBfb3V0cHV0KCkgcmV0dXJucyBFTVNHU0laRSB0byB0Y3Bfb3V0 cHV0KCksIHRoZW4gdGhlIGxhdHRlciBjYWxscwrCoMKgdGNwX210dWRpc2MoKSwgd2hpY2ggaW4g aXRzIHR1cm4gbWF5IGNhbGwgdGNwX291dHB1dCgpLiBVbmRlciBjZXJ0YWluCsKgwqBjb25kaXRp b25zIChtdXN0IGFkbWl0IHRoZXkgYXJlIHZlcnkgc3BlY2lhbCkgYW4gaW5maW5pdGUgcmVjdXJz aW9uIGNhbgrCoMKgaGFwcGVuLgrCoMKgCsKgwqBUbyBhdm9pZCByZWN1cnNpb24gd2UgY2FuIHBh c3Mgc3RydWN0IHJvdXRlIHRvIGlwX291dHB1dCgpIGFuZCBvYnRhaW4KwqDCoGNvcnJlY3QgbXR1 LiBUaGlzIGFsbG93cyB1cyBub3QgdG8gdXNlIHRjcF9tdHVkaXNjKCkgYnV0IGNhbGwgdGNwX21z c191cGRhdGUoKQrCoMKgZGlyZWN0bHkuCsKgwqAKwqDCoFBSOiBrZXJuLzE1NTU4NQrCoMKgU3Vi bWl0dGVkIGJ5OiBBbmRyZXkgWm9ub3YgPGFuZHJleSB6b25vdi5vcmc+IChvcmlnaW5hbCB2ZXJz aW9uIG9mIHBhdGNoKQoKTW9kaWZpZWQ6CsKgwqBoZWFkL3N5cy9uZXRpbmV0L3RjcF9vdXRwdXQu YwoKTW9kaWZpZWQ6IGhlYWQvc3lzL25ldGluZXQvdGNwX291dHB1dC5jCj09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PQotLS0gaGVhZC9zeXMvbmV0aW5ldC90Y3Bfb3V0cHV0LmMgTW9uIEp1bCAxNiAwNjo1 Njo0NiAyMDEyIChyMjM4NTE1KQorKysgaGVhZC9zeXMvbmV0aW5ldC90Y3Bfb3V0cHV0LmMgTW9u IEp1bCAxNiAwNzowODozNCAyMDEyIChyMjM4NTE2KQpAQCAtMTgwLDcgKzE4MCw3IEBAIHRjcF9v dXRwdXQoc3RydWN0IHRjcGNiICp0cCkKwqAgaW50IGlkbGUsIHNlbmRhbG90OwrCoCBpbnQgc2Fj a19yeG1pdCwgc2Fja19ieXRlc19yeG10OwrCoCBzdHJ1Y3Qgc2Fja2hvbGUgKnA7Ci0gaW50IHRz bzsKKyBpbnQgdHNvLCBtdHU7CsKgIHN0cnVjdCB0Y3BvcHQgdG87CsKgI2lmIDAKwqAgaW50IG1h eGJ1cnN0ID0gVENQX01BWEJVUlNUOwpAQCAtMjI2LDYgKzIyNiw3IEBAIGFnYWluOgrCoCB0Y3Bf c2Fja19hZGp1c3QodHApOwrCoCBzZW5kYWxvdCA9IDA7CsKgIHRzbyA9IDA7CisgbXR1ID0gMDsK wqAgb2ZmID0gdHAtPnNuZF9ueHQgLSB0cC0+c25kX3VuYTsKwqAgc2VuZHdpbiA9IG1pbih0cC0+ c25kX3duZCwgdHAtPnNuZF9jd25kKTsKwqAKQEAgLTEyMDksNiArMTIxMCw5IEBAIHRpbWVyOgrC oCAqLyAKwqAjaWZkZWYgSU5FVDYKwqAgaWYgKGlzaXB2NikgeworIHN0cnVjdCByb3V0ZV9pbjYg cm87CisKKyBiemVybygmcm8sIHNpemVvZihybykpOwrCoCAvKgrCoCAqIHdlIHNlcGFyYXRlbHkg c2V0IGhvcGxpbWl0IGZvciBldmVyeSBzZWdtZW50LCBzaW5jZSB0aGUKwqAgKiB1c2VyIG1pZ2h0 IHdhbnQgdG8gY2hhbmdlIHRoZSB2YWx1ZSB2aWEgc2V0c29ja29wdC4KQEAgLTEyMTgsMTAgKzEy MjIsMTMgQEAgdGltZXI6CsKgIGlwNi0+aXA2X2hsaW0gPSBpbjZfc2VsZWN0aGxpbSh0cC0+dF9p bnBjYiwgTlVMTCk7CsKgCsKgIC8qIFRPRE86IElQdjYgSVA2VE9TX0VDVCBiaXQgb24gKi8gCi0g ZXJyb3IgPSBpcDZfb3V0cHV0KG0sCi0gdHAtPnRfaW5wY2ItPmluNnBfb3V0cHV0b3B0cywgTlVM TCwKLSAoKHNvLT5zb19vcHRpb25zICYgU09fRE9OVFJPVVRFKSA/Ci0gSVBfUk9VVEVUT0lGIDog MCksIE5VTEwsIE5VTEwsIHRwLT50X2lucGNiKTsKKyBlcnJvciA9IGlwNl9vdXRwdXQobSwgdHAt PnRfaW5wY2ItPmluNnBfb3V0cHV0b3B0cywgJnJvLAorICgoc28tPnNvX29wdGlvbnMgJiBTT19E T05UUk9VVEUpID8gSVBfUk9VVEVUT0lGIDogMCksCisgTlVMTCwgTlVMTCwgdHAtPnRfaW5wY2Ip OworCisgaWYgKGVycm9yID09IEVNU0dTSVpFICYmIHJvLnJvX3J0ICE9IE5VTEwpCisgbXR1ID0g cm8ucm9fcnQtPnJ0X3JteC5ybXhfbXR1OworIFJPX1JURlJFRSgmcm8pOwrCoCB9CsKgI2VuZGlm IC8qIElORVQ2ICovIArCoCNpZiBkZWZpbmVkKElORVQpICYmIGRlZmluZWQoSU5FVDYpCkBAIC0x MjI5LDYgKzEyMzYsOSBAQCB0aW1lcjoKwqAjZW5kaWYKwqAjaWZkZWYgSU5FVArCoMKgwqDCoMKg eworIHN0cnVjdCByb3V0ZSBybzsKKworIGJ6ZXJvKCZybywgc2l6ZW9mKHJvKSk7CsKgIGlwLT5p cF9sZW4gPSBtLT5tX3BrdGhkci5sZW47CsKgI2lmZGVmIElORVQ2CsKgIGlmICh0cC0+dF9pbnBj Yi0+aW5wX3ZmbGFnICYgSU5QX0lQVjZQUk9UTykKQEAgLTEyNDUsOSArMTI1NSwxMyBAQCB0aW1l cjoKwqAgaWYgKFZfcGF0aF9tdHVfZGlzY292ZXJ5ICYmIHRwLT50X21heG9wZCA+IFZfdGNwX21p bm1zcykKwqAgaXAtPmlwX29mZiB8PSBJUF9ERjsKwqAKLSBlcnJvciA9IGlwX291dHB1dChtLCB0 cC0+dF9pbnBjYi0+aW5wX29wdGlvbnMsIE5VTEwsCisgZXJyb3IgPSBpcF9vdXRwdXQobSwgdHAt PnRfaW5wY2ItPmlucF9vcHRpb25zLCAmcm8sCsKgICgoc28tPnNvX29wdGlvbnMgJiBTT19ET05U Uk9VVEUpID8gSVBfUk9VVEVUT0lGIDogMCksIDAsCsKgIHRwLT50X2lucGNiKTsKKworIGlmIChl cnJvciA9PSBFTVNHU0laRSAmJiByby5yb19ydCAhPSBOVUxMKQorIG10dSA9IHJvLnJvX3J0LT5y dF9ybXgucm14X210dTsKKyBST19SVEZSRUUoJnJvKTsKwqDCoMKgwqDCoH0KwqAjZW5kaWYgLyog SU5FVCAqLyAKwqAgaWYgKGVycm9yKSB7CkBAIC0xMjk0LDIxICsxMzA4LDE4IEBAIG91dDoKwqAg KiBGb3Igc29tZSByZWFzb24gdGhlIGludGVyZmFjZSB3ZSB1c2VkIGluaXRpYWxseQrCoCAqIHRv IHNlbmQgc2VnbWVudHMgY2hhbmdlZCB0byBhbm90aGVyIG9yIGxvd2VyZWQKwqAgKiBpdHMgTVRV LgotICoKLSAqIHRjcF9tdHVkaXNjKCkgd2lsbCBmaW5kIG91dCB0aGUgbmV3IE1UVSBhbmQgYXMK LSAqIGl0cyBsYXN0IGFjdGlvbiwgaW5pdGlhdGUgcmV0cmFuc21pc3Npb24sIHNvIGl0Ci0gKiBp cyBpbXBvcnRhbnQgdG8gbm90IGRvIHNvIGhlcmUuCi0gKgrCoCAqIElmIFRTTyB3YXMgYWN0aXZl IHdlIGVpdGhlciBnb3QgYW4gaW50ZXJmYWNlCsKgICogd2l0aG91dCBUU08gY2FwYWJpbGl0cyBv ciBUU08gd2FzIHR1cm5lZCBvZmYuCi0gKiBEaXNhYmxlIGl0IGZvciB0aGlzIGNvbm5lY3Rpb24g YXMgdG9vIGFuZAotICogaW1tZWRpYXRseSByZXRyeSB3aXRoIE1TUyBzaXplZCBzZWdtZW50cyBn ZW5lcmF0ZWQKLSAqIGJ5IHRoaXMgZnVuY3Rpb24uCisgKiBJZiB3ZSBvYnRhaW5lZCBtdHUgZnJv bSBpcF9vdXRwdXQoKSB0aGVuIHVwZGF0ZQorICogaXQgYW5kIHRyeSBhZ2Fpbi4KwqAgKi8gCsKg IGlmICh0c28pCsKgIHRwLT50X2ZsYWdzICY9IH5URl9UU087Ci0gdGNwX210dWRpc2ModHAtPnRf aW5wY2IsIC0xKTsKLSByZXR1cm4gKDApOworIGlmIChtdHUgIT0gMCkgeworIHRjcF9tc3NfdXBk YXRlKHRwLCAtMSwgbXR1LCBOVUxMLCBOVUxMKTsKKyBnb3RvIGFnYWluOworIH0KKyByZXR1cm4g KGVycm9yKTsKwqAgY2FzZSBFSE9TVERPV046CsKgIGNhc2UgRUhPU1RVTlJFQUNIOgrCoCBjYXNl IEVORVRET1dOOgpfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f Xwpzdm4tc3JjLWFsbEBmcmVlYnNkLm9yZyBtYWlsaW5nIGxpc3QKaHR0cDovL2xpc3RzLmZyZWVi c2Qub3JnL21haWxtYW4vbGlzdGluZm8vc3ZuLXNyYy1hbGwKVG8gdW5zdWJzY3JpYmUsIHNlbmQg YW55IG1haWwgdG8gInN2bi1zcmMtYWxsLXVuc3Vic2NyaWJlQGZyZWVic2Qub3JnIgogICAgCg== From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 08:30:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99F5B1065800 for ; Mon, 16 Jul 2012 08:30:04 +0000 (UTC) (envelope-from bounces+73574-9504-svn-src-head=freebsd.org@sendgrid.me) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id 43A5E8FC17 for ; Mon, 16 Jul 2012 08:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h= message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=FaKrm5dHPpTcYGAQusunveywHxY=; b=AegcSlw0e8WS/SSh4ieJnDRlFRJy U+/aS+Vb9g3KceMOBivD6Ks5qrid4+rxKtVNuxjkWAmWqi/Zi54SV+Xpl4pQ74sv aXFVPWcmY2Ag+wZBs3EVZjMAkIlYU044wqlx9tRh6vxHk06zMOZ7ZpZxZGd4mE4j onMY7umA2DH9rrw= Received: by 10.41.149.112 with SMTP id f04-09.6680.5003D10B6 Mon, 16 Jul 2012 08:30:03 +0000 (UTC) Received: from mail.tarsnap.com (unknown [10.8.49.124]) by mi3 (SG) with ESMTP id 5003d10b.4500.11758b for ; Mon, 16 Jul 2012 03:30:03 -0500 (CST) Received: (qmail 46038 invoked from network); 16 Jul 2012 08:27:53 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 16 Jul 2012 08:27:53 -0000 Received: (qmail 73436 invoked from network); 16 Jul 2012 08:28:16 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 16 Jul 2012 08:28:16 -0000 Message-ID: <5003D0A0.3050209@freebsd.org> Date: Mon, 16 Jul 2012 01:28:16 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120627 Thunderbird/13.0.1 MIME-Version: 1.0 To: Konstantin Belousov References: <201206301636.q5UGaNCB029813@svn.freebsd.org> In-Reply-To: <201206301636.q5UGaNCB029813@svn.freebsd.org> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Sendgrid-EID: EvYvoie/qnEezyq2t4eRKjDm9X7ZKbCMt75WvXA+XNFOntOwuktqNtCfBKGCD6Mz3hSN4OawXM+shwmEwWyIJB7uFHs+Q6hyO9eYUVyXYyYfGCCG450Cip7Gt7WLApr4TSwnlyYbR4POocRV4Nb5NSIDNS6jPwS6Wr/wrTifqLI= Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237847 - head/usr.bin/killall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 08:30:04 -0000 On 06/30/12 09:36, Konstantin Belousov wrote: > New Revision: 237847 > URL: http://svn.freebsd.org/changeset/base/237847 > > Log: > Once in a month, when the moon is full, killall mistakenly considers > living process as a zombie and refuses to kill it. The cause is that > the code masks ki_stat with SZOMB to compare with SZOMB, but ki_stat > is not a mask. > > Possibly reported by: cperciva For the archives: Judging by the frequency with which I was seeing killall failing to send a signal and the fact I haven't seen it happen since I applied this patch, I'm 99.9999% confident that this was indeed the bug I was running into. Hopefully everybody else is sending signals to specific pids rather than using killall during log rotation like I am. :-) -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 09:17:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 24DD31065677; Mon, 16 Jul 2012 09:17:21 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 96A5E150A87; Mon, 16 Jul 2012 09:17:20 +0000 (UTC) Message-ID: <5003DC20.9020703@FreeBSD.org> Date: Mon, 16 Jul 2012 02:17:20 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120621 Thunderbird/13.0.1 MIME-Version: 1.0 To: Michael Tuexen References: <201207160643.q6G6h5di011993@svn.freebsd.org> In-Reply-To: <201207160643.q6G6h5di011993@svn.freebsd.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238514 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 09:17:21 -0000 Is it my imagination or did this break the build? On 07/15/2012 23:43, Michael Tuexen wrote: > Author: tuexen > Date: Mon Jul 16 06:43:04 2012 > New Revision: 238514 > URL: http://svn.freebsd.org/changeset/base/238514 > > Log: > Allow netstat to be build if INET is not defined in the kernel. > Thanks to Garrett Cooper for reporting the issue. > > MFC after: 3 days > X-MFC: 238501 > > Modified: > head/usr.bin/netstat/Makefile > head/usr.bin/netstat/sctp.c > > Modified: head/usr.bin/netstat/Makefile > ============================================================================== > --- head/usr.bin/netstat/Makefile Mon Jul 16 02:10:26 2012 (r238513) > +++ head/usr.bin/netstat/Makefile Mon Jul 16 06:43:04 2012 (r238514) > @@ -13,6 +13,10 @@ CFLAGS+=-fno-strict-aliasing > CFLAGS+=-DIPSEC > CFLAGS+=-DSCTP > > +.if ${MK_INET_SUPPORT} != "no" > +CFLAGS+=-DINET > +.endif > + > .if ${MK_INET6_SUPPORT} != "no" > SRCS+= inet6.c > CFLAGS+=-DINET6 > > Modified: head/usr.bin/netstat/sctp.c > ============================================================================== > --- head/usr.bin/netstat/sctp.c Mon Jul 16 02:10:26 2012 (r238513) > +++ head/usr.bin/netstat/sctp.c Mon Jul 16 06:43:04 2012 (r238514) > @@ -107,6 +107,7 @@ struct xraddr_entry { > * If numeric_addr has been supplied, give > * numeric value, otherwise try for symbolic name. > */ > +#ifdef INET > static char * > inetname(struct in_addr *inp) > { > @@ -146,6 +147,7 @@ inetname(struct in_addr *inp) > } > return (line); > } > +#endif > > #ifdef INET6 > static char ntop_buf[INET6_ADDRSTRLEN]; > @@ -197,9 +199,11 @@ sctp_print_address(union sctp_sockstore > int width; > > switch (address->sa.sa_family) { > +#ifdef INET > case AF_INET: > sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); > break; > +#endif > #ifdef INET6 > case AF_INET6: > sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); > -- Change is hard. From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 09:35:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9623B106564A; Mon, 16 Jul 2012 09:35:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80CFB8FC12; Mon, 16 Jul 2012 09:35:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G9ZmU6025584; Mon, 16 Jul 2012 09:35:48 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G9ZmIb025581; Mon, 16 Jul 2012 09:35:48 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201207160935.q6G9ZmIb025581@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 16 Jul 2012 09:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238526 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 09:35:48 -0000 Author: hselasky Date: Mon Jul 16 09:35:47 2012 New Revision: 238526 URL: http://svn.freebsd.org/changeset/base/238526 Log: Add new USB device ID. PR: usb/169789 MFC after: 1 week Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Jul 16 09:02:43 2012 (r238525) +++ head/sys/dev/usb/serial/u3g.c Mon Jul 16 09:35:47 2012 (r238526) @@ -359,6 +359,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(QUALCOMM2, MF330, 0), U3G_DEV(QUALCOMM2, SIM5218, 0), U3G_DEV(QUALCOMM2, VW110L, U3GINIT_SCSIEJECT), + U3G_DEV(QUALCOMM2, GOBI2000, 0), U3G_DEV(QUALCOMMINC, AC2726, 0), U3G_DEV(QUALCOMMINC, AC8700, 0), U3G_DEV(QUALCOMMINC, AC8710, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Jul 16 09:02:43 2012 (r238525) +++ head/sys/dev/usb/usbdevs Mon Jul 16 09:35:47 2012 (r238526) @@ -2705,6 +2705,7 @@ product QUALCOMM2 CDMA_MSM 0x3196 CDMA T product QUALCOMM2 AC8700 0x6000 AC8700 product QUALCOMM2 VW110L 0x1000 Vertex Wireless 110L modem product QUALCOMM2 SIM5218 0x9000 SIM5218 +product QUALCOMM2 GOBI2000 0x9204 Qualcomm Gobi 2000 product QUALCOMMINC CDMA_MSM 0x0001 CDMA Technologies MSM modem product QUALCOMMINC E0002 0x0002 3G modem product QUALCOMMINC E0003 0x0003 3G modem From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 09:38:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E87121065672; Mon, 16 Jul 2012 09:38:19 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9E7F8FC08; Mon, 16 Jul 2012 09:38:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6G9cJtN025821; Mon, 16 Jul 2012 09:38:19 GMT (envelope-from pgj@svn.freebsd.org) Received: (from pgj@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6G9cJOL025816; Mon, 16 Jul 2012 09:38:19 GMT (envelope-from pgj@svn.freebsd.org) Message-Id: <201207160938.q6G9cJOL025816@svn.freebsd.org> From: Gabor Pali Date: Mon, 16 Jul 2012 09:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238527 - in head: sys/kern sys/sys usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 09:38:20 -0000 Author: pgj (ports committer) Date: Mon Jul 16 09:38:19 2012 New Revision: 238527 URL: http://svn.freebsd.org/changeset/base/238527 Log: - Add support for displaying process stack memory regions. Approved by: rwatson MFC after: 3 days Modified: head/sys/kern/kern_proc.c head/sys/sys/user.h head/usr.bin/procstat/procstat.1 head/usr.bin/procstat/procstat_vm.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Mon Jul 16 09:35:47 2012 (r238526) +++ head/sys/kern/kern_proc.c Mon Jul 16 09:38:19 2012 (r238527) @@ -2189,6 +2189,10 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_flags |= KVME_FLAG_NEEDS_COPY; if (entry->eflags & MAP_ENTRY_NOCOREDUMP) kve->kve_flags |= KVME_FLAG_NOCOREDUMP; + if (entry->eflags & MAP_ENTRY_GROWS_UP) + kve->kve_flags |= KVME_FLAG_GROWS_UP; + if (entry->eflags & MAP_ENTRY_GROWS_DOWN) + kve->kve_flags |= KVME_FLAG_GROWS_DOWN; last_timestamp = map->timestamp; vm_map_unlock_read(map); Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Mon Jul 16 09:35:47 2012 (r238526) +++ head/sys/sys/user.h Mon Jul 16 09:38:19 2012 (r238527) @@ -413,6 +413,8 @@ struct kinfo_file { #define KVME_FLAG_NEEDS_COPY 0x00000002 #define KVME_FLAG_NOCOREDUMP 0x00000004 #define KVME_FLAG_SUPER 0x00000008 +#define KVME_FLAG_GROWS_UP 0x00000010 +#define KVME_FLAG_GROWS_DOWN 0x00000020 #if defined(__amd64__) #define KINFO_OVMENTRY_SIZE 1168 Modified: head/usr.bin/procstat/procstat.1 ============================================================================== --- head/usr.bin/procstat/procstat.1 Mon Jul 16 09:35:47 2012 (r238526) +++ head/usr.bin/procstat/procstat.1 Mon Jul 16 09:38:19 2012 (r238527) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 23, 2012 +.Dd July 11, 2012 .Dt PROCSTAT 1 .Os .Sh NAME @@ -433,6 +433,10 @@ copy-on-write needs copy .It S one or more superpage mappings are used +.It D +grows down (top-down stack) +.It U +grows up (bottom-up stack) .El .Sh EXIT STATUS .Ex -std Modified: head/usr.bin/procstat/procstat_vm.c ============================================================================== --- head/usr.bin/procstat/procstat_vm.c Mon Jul 16 09:35:47 2012 (r238526) +++ head/usr.bin/procstat/procstat_vm.c Mon Jul 16 09:38:19 2012 (r238527) @@ -72,7 +72,9 @@ procstat_vm(struct kinfo_proc *kipp) printf("%-1s", kve->kve_flags & KVME_FLAG_COW ? "C" : "-"); printf("%-1s", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : "-"); - printf("%-1s ", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); + printf("%-1s", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); + printf("%-1s ", kve->kve_flags & KVME_FLAG_GROWS_UP ? "U" : + kve->kve_flags & KVME_FLAG_GROWS_DOWN ? "D" : "-"); switch (kve->kve_type) { case KVME_TYPE_NONE: str = "--"; From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 10:08:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 647831065670; Mon, 16 Jul 2012 10:08:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by mx1.freebsd.org (Postfix) with ESMTP id 640A88FC1B; Mon, 16 Jul 2012 10:08:50 +0000 (UTC) Received: from [192.168.1.103] (p5481A29D.dip.t-dialin.net [84.129.162.157]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 98D071C0C0BD4; Mon, 16 Jul 2012 12:08:48 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: Michael Tuexen In-Reply-To: <5003DC20.9020703@FreeBSD.org> Date: Mon, 16 Jul 2012 12:08:36 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <476489F5-A114-4DAF-9030-AE35D76EEDD5@FreeBSD.org> References: <201207160643.q6G6h5di011993@svn.freebsd.org> <5003DC20.9020703@FreeBSD.org> To: Doug Barton X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238514 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 10:08:51 -0000 On Jul 16, 2012, at 11:17 AM, Doug Barton wrote: > Is it my imagination or did this break the build? I think it should have fixed the build, which was broken by r238501. Or am I missing something? Best regards Michael >=20 > On 07/15/2012 23:43, Michael Tuexen wrote: >> Author: tuexen >> Date: Mon Jul 16 06:43:04 2012 >> New Revision: 238514 >> URL: http://svn.freebsd.org/changeset/base/238514 >>=20 >> Log: >> Allow netstat to be build if INET is not defined in the kernel. >> Thanks to Garrett Cooper for reporting the issue. >>=20 >> MFC after: 3 days >> X-MFC: 238501 >>=20 >> Modified: >> head/usr.bin/netstat/Makefile >> head/usr.bin/netstat/sctp.c >>=20 >> Modified: head/usr.bin/netstat/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/usr.bin/netstat/Makefile Mon Jul 16 02:10:26 2012 = (r238513) >> +++ head/usr.bin/netstat/Makefile Mon Jul 16 06:43:04 2012 = (r238514) >> @@ -13,6 +13,10 @@ CFLAGS+=3D-fno-strict-aliasing >> CFLAGS+=3D-DIPSEC >> CFLAGS+=3D-DSCTP >>=20 >> +.if ${MK_INET_SUPPORT} !=3D "no" >> +CFLAGS+=3D-DINET >> +.endif >> + >> .if ${MK_INET6_SUPPORT} !=3D "no" >> SRCS+=3D inet6.c >> CFLAGS+=3D-DINET6 >>=20 >> Modified: head/usr.bin/netstat/sctp.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/usr.bin/netstat/sctp.c Mon Jul 16 02:10:26 2012 = (r238513) >> +++ head/usr.bin/netstat/sctp.c Mon Jul 16 06:43:04 2012 = (r238514) >> @@ -107,6 +107,7 @@ struct xraddr_entry { >> * If numeric_addr has been supplied, give >> * numeric value, otherwise try for symbolic name. >> */ >> +#ifdef INET >> static char * >> inetname(struct in_addr *inp) >> { >> @@ -146,6 +147,7 @@ inetname(struct in_addr *inp) >> } >> return (line); >> } >> +#endif >>=20 >> #ifdef INET6 >> static char ntop_buf[INET6_ADDRSTRLEN]; >> @@ -197,9 +199,11 @@ sctp_print_address(union sctp_sockstore=20 >> int width; >>=20 >> switch (address->sa.sa_family) { >> +#ifdef INET >> case AF_INET: >> sprintf(line, "%.*s.", Wflag ? 39 : 16, = inetname(&address->sin.sin_addr)); >> break; >> +#endif >> #ifdef INET6 >> case AF_INET6: >> sprintf(line, "%.*s.", Wflag ? 39 : 16, = inet6name(&address->sin6.sin6_addr)); >>=20 >=20 >=20 > --=20 >=20 > Change is hard. >=20 >=20 >=20 >=20 From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 10:12:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB7A2106564A; Mon, 16 Jul 2012 10:12:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B56E48FC18; Mon, 16 Jul 2012 10:12:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GAC7Z8028556; Mon, 16 Jul 2012 10:12:07 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GAC7pc028553; Mon, 16 Jul 2012 10:12:07 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201207161012.q6GAC7pc028553@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 16 Jul 2012 10:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238529 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 10:12:07 -0000 Author: hselasky Date: Mon Jul 16 10:12:07 2012 New Revision: 238529 URL: http://svn.freebsd.org/changeset/base/238529 Log: Add new USB device ID. PR: usb/169789 Submitted by: Ruslan Bukin MFC after: 1 week Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Jul 16 09:50:29 2012 (r238528) +++ head/sys/dev/usb/serial/u3g.c Mon Jul 16 10:12:07 2012 (r238529) @@ -359,6 +359,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(QUALCOMM2, MF330, 0), U3G_DEV(QUALCOMM2, SIM5218, 0), U3G_DEV(QUALCOMM2, VW110L, U3GINIT_SCSIEJECT), + U3G_DEV(QUALCOMM2, GOBI2000_QDL, 0), U3G_DEV(QUALCOMM2, GOBI2000, 0), U3G_DEV(QUALCOMMINC, AC2726, 0), U3G_DEV(QUALCOMMINC, AC8700, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Jul 16 09:50:29 2012 (r238528) +++ head/sys/dev/usb/usbdevs Mon Jul 16 10:12:07 2012 (r238529) @@ -2705,7 +2705,8 @@ product QUALCOMM2 CDMA_MSM 0x3196 CDMA T product QUALCOMM2 AC8700 0x6000 AC8700 product QUALCOMM2 VW110L 0x1000 Vertex Wireless 110L modem product QUALCOMM2 SIM5218 0x9000 SIM5218 -product QUALCOMM2 GOBI2000 0x9204 Qualcomm Gobi 2000 +product QUALCOMM2 GOBI2000_QDL 0x9204 Qualcomm Gobi 2000 QDL +product QUALCOMM2 GOBI2000 0x9205 Qualcomm Gobi 2000 modem product QUALCOMMINC CDMA_MSM 0x0001 CDMA Technologies MSM modem product QUALCOMMINC E0002 0x0002 3G modem product QUALCOMMINC E0003 0x0003 3G modem From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 15:56:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3B48106566C; Mon, 16 Jul 2012 15:56:40 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7456B8FC0C; Mon, 16 Jul 2012 15:56:40 +0000 (UTC) Received: by obbun3 with SMTP id un3so12121706obb.13 for ; Mon, 16 Jul 2012 08:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=erzAqp3+LGjwfQjpy868lBkeIgosoxoxrvkrjY7VgRU=; b=AZlebJ08JvbkxoISHXtE66XWNwz3OKrQ5JWcSk6NgOKRIRiGxdToyiPan/bsd/Mfaw vRFVdwh5yufUBzVYrEJxlMjHTu3Od3dE0LdLBxLuTeZENDqoWdlIn7sfU78WV3u5C3mF fLi7oakpPoklULSCLsMLrXkDl20gc4x7V3nxjZ6auRTuD2bhaO+RJe1OwslEvkED/0ur rMeCfT+RTv9hedTLR+S4KJWa3yWjDn15jNxafo/6fvVeWui6uT4lmoHD3hMjRJUTSkoj x+SpZSLOQsKKSKVk4OI5E/O241eVqT0PbSTwB5bXJ3tzEbKq3h8W6QiXeSe6FchoHitj 1Ytg== MIME-Version: 1.0 Received: by 10.182.8.6 with SMTP id n6mr16336057oba.39.1342454200090; Mon, 16 Jul 2012 08:56:40 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Mon, 16 Jul 2012 08:56:40 -0700 (PDT) In-Reply-To: <5003DC20.9020703@FreeBSD.org> References: <201207160643.q6G6h5di011993@svn.freebsd.org> <5003DC20.9020703@FreeBSD.org> Date: Mon, 16 Jul 2012 08:56:40 -0700 Message-ID: From: Garrett Cooper To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Michael Tuexen Subject: Re: svn commit: r238514 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 15:56:41 -0000 On Mon, Jul 16, 2012 at 2:17 AM, Doug Barton wrote: > Is it my imagination or did this break the build? Don't think so, but I'm running a buildworld with -DWITHOUT_INET -DWITHOUT_INET6 and -DWITHOUT_INET -DWITH_INET6, just to be sure. Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 16:49:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B571106566C; Mon, 16 Jul 2012 16:49:16 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by mx1.freebsd.org (Postfix) with ESMTP id 0168E8FC0A; Mon, 16 Jul 2012 16:49:16 +0000 (UTC) Received: from [192.168.1.103] (p5481A29D.dip.t-dialin.net [84.129.162.157]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 907301C0B4603; Mon, 16 Jul 2012 18:49:14 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: Michael Tuexen In-Reply-To: Date: Mon, 16 Jul 2012 18:49:13 +0200 Content-Transfer-Encoding: 7bit Message-Id: References: <201207160643.q6G6h5di011993@svn.freebsd.org> <5003DC20.9020703@FreeBSD.org> To: Garrett Cooper X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r238514 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 16:49:16 -0000 On Jul 16, 2012, at 5:56 PM, Garrett Cooper wrote: > On Mon, Jul 16, 2012 at 2:17 AM, Doug Barton wrote: >> Is it my imagination or did this break the build? > > Don't think so, but I'm running a buildworld with -DWITHOUT_INET > -DWITHOUT_INET6 and -DWITHOUT_INET -DWITH_INET6, just to be sure. Please let me know if there are still any issues. I think it should be fixed now (meaning that it compiles (which I broke) and meaning that it actually works (which I fixed). Best regards Michael > Thanks, > -Garrett > From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 16:50:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E660106566B; Mon, 16 Jul 2012 16:50:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 299038FC21; Mon, 16 Jul 2012 16:50:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GGoTRi060574; Mon, 16 Jul 2012 16:50:29 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GGoSCo060571; Mon, 16 Jul 2012 16:50:28 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201207161650.q6GGoSCo060571@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 16 Jul 2012 16:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238533 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 16:50:29 -0000 Author: trasz Date: Mon Jul 16 16:50:28 2012 New Revision: 238533 URL: http://svn.freebsd.org/changeset/base/238533 Log: Add back spare fields reused in r238213. According to Attilio, the rule is to use reuse spares only when MFC-ing, not in CURRENT. Modified: head/sys/geom/geom.h Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Mon Jul 16 11:58:44 2012 (r238532) +++ head/sys/geom/geom.h Mon Jul 16 16:50:28 2012 (r238533) @@ -110,6 +110,7 @@ struct g_class { g_ioctl_t *ioctl; g_provgone_t *providergone; g_resize_t *resize; + void *spare2; /* * The remaining elements are private */ @@ -141,6 +142,7 @@ struct g_geom { g_ioctl_t *ioctl; g_provgone_t *providergone; g_resize_t *resize; + void *spare1; void *softc; unsigned flags; #define G_GEOM_WITHER 1 From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 17:41:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0FA0B106566C; Mon, 16 Jul 2012 17:41:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF82E8FC08; Mon, 16 Jul 2012 17:41:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GHfceh065367; Mon, 16 Jul 2012 17:41:38 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GHfcBH065365; Mon, 16 Jul 2012 17:41:38 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201207161741.q6GHfcBH065365@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 16 Jul 2012 17:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238534 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 17:41:39 -0000 Author: trasz Date: Mon Jul 16 17:41:38 2012 New Revision: 238534 URL: http://svn.freebsd.org/changeset/base/238534 Log: The resize GEOM event has no references, thus cannot be canceled. Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Mon Jul 16 16:50:28 2012 (r238533) +++ head/sys/geom/geom_subr.c Mon Jul 16 17:41:38 2012 (r238534) @@ -615,8 +615,6 @@ g_resize_provider_event(void *arg, int f off_t size; g_topology_assert(); - if (flag == EV_CANCEL) - return; if (g_shutdown) return; From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 17:48:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 00D06106567C; Mon, 16 Jul 2012 17:48:44 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C79CB8FC1C; Mon, 16 Jul 2012 17:48:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GHmhHH066154; Mon, 16 Jul 2012 17:48:43 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GHmhaQ066153; Mon, 16 Jul 2012 17:48:43 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201207161748.q6GHmhaQ066153@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 16 Jul 2012 17:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238535 - head/share/dtrace X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 17:48:44 -0000 Author: gnn Date: Mon Jul 16 17:48:43 2012 New Revision: 238535 URL: http://svn.freebsd.org/changeset/base/238535 Log: Add a script that traces NFS attribute cache accesses. Submitted by: rwatson MFC after: 2 weeks Added: head/share/dtrace/nfsattrstats (contents, props changed) Added: head/share/dtrace/nfsattrstats ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/dtrace/nfsattrstats Mon Jul 16 17:48:43 2012 (r238535) @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Copyright (c) 2012 Robert N. M. Watson +# All rights reserved. +# +# This software was developed at the University of Cambridge Computer +# Laboratory with support from a grant from Google, Inc. +# +# 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$ +# +# This script creates a trace of NFS RPCs, NFS attribute cache +# activity, and NFS access cache activity, along with the system call +# that instigated the activity. Notice that NFS events may happen +# outside of the context of a system call, most likely due to the VM +# system paging from NFS, in which case the system call name is +# reported as "-" + +/usr/sbin/dtrace -n ' +#pragma D option quiet + +dtrace:::BEGIN +{ + printf("probe\targ0\texecutable\tsyscall\n"); +} + +syscall:::entry +{ + + self->syscallname = probefunc; +} + +syscall:::return +{ + + self->syscallname = ""; +} + +nfsclient::: +/self->syscallname != 0 && self->syscallname != ""/ +{ + + printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, + self->syscallname); +} + +nfsclient::: +/self->syscallname == 0 || self->syscallname == ""/ +{ + + printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, + self->syscallname); +} +' From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 18:13:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DA831065672; Mon, 16 Jul 2012 18:13:44 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2963B8FC1A; Mon, 16 Jul 2012 18:13:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GIDi8l068183; Mon, 16 Jul 2012 18:13:44 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GIDhm1068181; Mon, 16 Jul 2012 18:13:43 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207161813.q6GIDhm1068181@svn.freebsd.org> From: Alan Cox Date: Mon, 16 Jul 2012 18:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238536 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 18:13:44 -0000 Author: alc Date: Mon Jul 16 18:13:43 2012 New Revision: 238536 URL: http://svn.freebsd.org/changeset/base/238536 Log: Various improvements to vm_contig_grow_cache(). Most notably, even when it can't sleep, it can still move clean pages from the inactive queue to the cache. Also, when a page is cached, there is no need to restart the scan. The "next" page pointer held by vm_contig_launder() is still valid. Finally, add a comment summarizing what vm_contig_grow_cache() does based upon the value of "tries". MFC after: 3 weeks Modified: head/sys/vm/vm_contig.c Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Mon Jul 16 17:48:43 2012 (r238535) +++ head/sys/vm/vm_contig.c Mon Jul 16 18:13:43 2012 (r238536) @@ -83,7 +83,7 @@ __FBSDID("$FreeBSD$"); #include static int -vm_contig_launder_page(vm_page_t m, vm_page_t *next) +vm_contig_launder_page(vm_page_t m, vm_page_t *next, int tries) { vm_object_t object; vm_page_t m_tmp; @@ -92,7 +92,10 @@ vm_contig_launder_page(vm_page_t m, vm_p int vfslocked; mtx_assert(&vm_page_queue_mtx, MA_OWNED); - vm_page_lock_assert(m, MA_OWNED); + if (!vm_pageout_page_lock(m, next) || m->hold_count != 0) { + vm_page_unlock(m); + return (EAGAIN); + } object = m->object; if (!VM_OBJECT_TRYLOCK(object) && (!vm_pageout_fallback_object_lock(m, next) || m->hold_count != 0)) { @@ -100,7 +103,13 @@ vm_contig_launder_page(vm_page_t m, vm_p VM_OBJECT_UNLOCK(object); return (EAGAIN); } - if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { + if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { + if (tries == 0) { + vm_page_unlock(m); + VM_OBJECT_UNLOCK(object); + return (EAGAIN); + } + vm_page_sleep(m, "vpctw0"); VM_OBJECT_UNLOCK(object); vm_page_lock_queues(); return (EBUSY); @@ -110,7 +119,7 @@ vm_contig_launder_page(vm_page_t m, vm_p pmap_remove_all(m); if (m->dirty != 0) { vm_page_unlock(m); - if ((object->flags & OBJ_DEAD) != 0) { + if (tries == 0 || (object->flags & OBJ_DEAD) != 0) { VM_OBJECT_UNLOCK(object); return (EAGAIN); } @@ -146,34 +155,25 @@ vm_contig_launder_page(vm_page_t m, vm_p vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); - return (0); + return (EAGAIN); } static int -vm_contig_launder(int queue, vm_paddr_t low, vm_paddr_t high) +vm_contig_launder(int queue, int tries, vm_paddr_t low, vm_paddr_t high) { vm_page_t m, next; vm_paddr_t pa; int error; TAILQ_FOREACH_SAFE(m, &vm_page_queues[queue].pl, pageq, next) { - - /* Skip marker pages */ + KASSERT(m->queue == queue, + ("vm_contig_launder: page %p's queue is not %d", m, queue)); if ((m->flags & PG_MARKER) != 0) continue; - pa = VM_PAGE_TO_PHYS(m); if (pa < low || pa + PAGE_SIZE > high) continue; - - if (!vm_pageout_page_lock(m, &next) || m->hold_count != 0) { - vm_page_unlock(m); - continue; - } - KASSERT(m->queue == queue, - ("vm_contig_launder: page %p's queue is not %d", m, queue)); - error = vm_contig_launder_page(m, &next); - vm_page_lock_assert(m, MA_NOTOWNED); + error = vm_contig_launder_page(m, &next, tries); if (error == 0) return (TRUE); if (error == EBUSY) @@ -183,7 +183,15 @@ vm_contig_launder(int queue, vm_paddr_t } /* - * Increase the number of cached pages. + * Increase the number of cached pages. The specified value, "tries", + * determines which categories of pages are cached: + * + * 0: All clean, inactive pages within the specified physical address range + * are cached. Will not sleep. + * 1: The vm_lowmem handlers are called. All inactive pages within + * the specified physical address range are cached. May sleep. + * 2: The vm_lowmem handlers are called. All inactive and active pages + * within the specified physical address range are cached. May sleep. */ void vm_contig_grow_cache(int tries, vm_paddr_t low, vm_paddr_t high) @@ -206,15 +214,16 @@ vm_contig_grow_cache(int tries, vm_paddr } vm_page_lock_queues(); inactl = 0; - inactmax = tries < 1 ? 0 : cnt.v_inactive_count; + inactmax = cnt.v_inactive_count; actl = 0; actmax = tries < 2 ? 0 : cnt.v_active_count; again: - if (inactl < inactmax && vm_contig_launder(PQ_INACTIVE, low, high)) { + if (inactl < inactmax && vm_contig_launder(PQ_INACTIVE, tries, low, + high)) { inactl++; goto again; } - if (actl < actmax && vm_contig_launder(PQ_ACTIVE, low, high)) { + if (actl < actmax && vm_contig_launder(PQ_ACTIVE, tries, low, high)) { actl++; goto again; } From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 20:17:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B9731065673; Mon, 16 Jul 2012 20:17:20 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C5D48FC08; Mon, 16 Jul 2012 20:17:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GKHKr6078815; Mon, 16 Jul 2012 20:17:20 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GKHKrt078811; Mon, 16 Jul 2012 20:17:20 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201207162017.q6GKHKrt078811@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 16 Jul 2012 20:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238537 - in head/sys: cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 20:17:20 -0000 Author: gnn Date: Mon Jul 16 20:17:19 2012 New Revision: 238537 URL: http://svn.freebsd.org/changeset/base/238537 Log: Add support for walltimestamp in DTrace. Submitted by: Fabian Keil MFC after: 2 weeks Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c head/sys/kern/kern_tc.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Mon Jul 16 18:13:43 2012 (r238536) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Mon Jul 16 20:17:19 2012 (r238537) @@ -47,6 +47,8 @@ extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; +extern void dtrace_getnanotime(struct timespec *tsp); + int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t); typedef struct dtrace_invop_hdlr { @@ -461,8 +463,11 @@ dtrace_gethrtime() uint64_t dtrace_gethrestime(void) { - printf("%s(%d): XXX\n",__func__,__LINE__); - return (0); + struct timespec current_time; + + dtrace_getnanotime(¤t_time); + + return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); } /* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */ Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Mon Jul 16 18:13:43 2012 (r238536) +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Mon Jul 16 20:17:19 2012 (r238537) @@ -49,6 +49,8 @@ extern uintptr_t kernelbase; extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; +extern void dtrace_getnanotime(struct timespec *tsp); + int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t); typedef struct dtrace_invop_hdlr { @@ -462,8 +464,11 @@ dtrace_gethrtime() uint64_t dtrace_gethrestime(void) { - printf("%s(%d): XXX\n",__func__,__LINE__); - return (0); + struct timespec current_time; + + dtrace_getnanotime(¤t_time); + + return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); } /* Function to handle DTrace traps during probes. See i386/i386/trap.c */ Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Mon Jul 16 18:13:43 2012 (r238536) +++ head/sys/kern/kern_tc.c Mon Jul 16 20:17:19 2012 (r238537) @@ -122,6 +122,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, static void tc_windup(void); static void cpu_tick_calibrate(int); +void dtrace_getnanotime(struct timespec *tsp); + static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -960,6 +962,24 @@ getmicrotime(struct timeval *tvp) #endif /* FFCLOCK */ /* + * This is a clone of getnanotime and used for walltimestamps. + * The dtrace_ prefix prevents fbt from creating probes for + * it so walltimestamp can be safely used in all fbt probes. + */ +void +dtrace_getnanotime(struct timespec *tsp) +{ + struct timehands *th; + u_int gen; + + do { + th = timehands; + gen = th->th_generation; + *tsp = th->th_nanotime; + } while (gen == 0 || gen != th->th_generation); +} + +/* * System clock currently providing time to the system. Modifiable via sysctl * when the FFCLOCK option is defined. */ From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 20:43:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26293106566B; Mon, 16 Jul 2012 20:43:29 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 110578FC12; Mon, 16 Jul 2012 20:43:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GKhSvC081006; Mon, 16 Jul 2012 20:43:28 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GKhS67081004; Mon, 16 Jul 2012 20:43:28 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201207162043.q6GKhS67081004@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 16 Jul 2012 20:43:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238538 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 20:43:29 -0000 Author: trociny Date: Mon Jul 16 20:43:28 2012 New Revision: 238538 URL: http://svn.freebsd.org/changeset/base/238538 Log: Metaflush on/off values don't need quotes. Reviewed by: pjd MFC after: 3 days Modified: head/sbin/hastd/hast.conf.5 Modified: head/sbin/hastd/hast.conf.5 ============================================================================== --- head/sbin/hastd/hast.conf.5 Mon Jul 16 20:17:19 2012 (r238537) +++ head/sbin/hastd/hast.conf.5 Mon Jul 16 20:43:28 2012 (r238538) @@ -63,7 +63,7 @@ checksum compression timeout exec -metaflush "on" | "off" +metaflush on | off pidfile on { @@ -89,14 +89,14 @@ resource { local timeout exec - metaflush "on" | "off" + metaflush on | off on { # Resource-node section name # Required local - metaflush "on" | "off" + metaflush on | off # Required remote source @@ -106,7 +106,7 @@ resource { name # Required local - metaflush "on" | "off" + metaflush on | off # Required remote source From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 22:07:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D53C31065672; Mon, 16 Jul 2012 22:07:30 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C04538FC14; Mon, 16 Jul 2012 22:07:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GM7Ujl087236; Mon, 16 Jul 2012 22:07:30 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GM7UNS087234; Mon, 16 Jul 2012 22:07:30 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207162207.q6GM7UNS087234@svn.freebsd.org> From: Christian Brueffer Date: Mon, 16 Jul 2012 22:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238539 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 22:07:31 -0000 Author: brueffer Date: Mon Jul 16 22:07:29 2012 New Revision: 238539 URL: http://svn.freebsd.org/changeset/base/238539 Log: Simply error handling by moving the allocation of np down to where it is actually used. While here, improve style a little. Submitted by: mjg MFC after: 2 weeks Modified: head/sys/fs/smbfs/smbfs_node.c Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Mon Jul 16 20:43:28 2012 (r238538) +++ head/sys/fs/smbfs/smbfs_node.c Mon Jul 16 22:07:29 2012 (r238539) @@ -223,17 +223,15 @@ loop: if (fap == NULL) return ENOENT; - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); - if (error) { - free(np, M_SMBNODE); - return error; - } + if (error != 0) + return (error); error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ - if (error != 0) { - free(np, M_SMBNODE); + if (error != 0) return (error); - } + + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); + vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; vp->v_data = np; np->n_vnode = vp; From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 22:10:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0782A106566B; Mon, 16 Jul 2012 22:10:06 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 99F068FC16; Mon, 16 Jul 2012 22:10:04 +0000 (UTC) Received: by lbon10 with SMTP id n10so10063515lbo.13 for ; Mon, 16 Jul 2012 15:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=brT2GhHfnd68e+lZY4eO5GeW7Bn/YhsovJ+BHS3iccc=; b=RIbbfuFidbd95iisNH0jBb6A7tvo6WiyS0rLskMX493beiOMzOO6y22ZU+GQWXbCLe vH3q9g66zcnAdMKI1seniq0YzQZhp4I8kfMj4mxfoe9ra9kFJJCVxAO+eYuL/3JX2/x7 yQ647m3JhH+C1wNhite0geKKIpk5sl5QC1LPAUUzncrGZrsW6M1zc69ESvgMxmgVkiA4 UtssaB6JPFP9wihGE3mgpekTYl105iiGsaYVcB7/dlWatwOPr070lReEJ3aoCaRkQWRA v0ag+wpfCH4eUjyaq4t2ScEh8sTyEU4Zu70x5PglU8ShGqjF8Zb9SOkpGB6HBI2Ip4it XubA== MIME-Version: 1.0 Received: by 10.112.45.4 with SMTP id i4mr97134lbm.79.1342476603469; Mon, 16 Jul 2012 15:10:03 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Mon, 16 Jul 2012 15:10:03 -0700 (PDT) In-Reply-To: <201207162207.q6GM7UNS087234@svn.freebsd.org> References: <201207162207.q6GM7UNS087234@svn.freebsd.org> Date: Mon, 16 Jul 2012 23:10:03 +0100 X-Google-Sender-Auth: BKHfDTcRP7lbli-D1uUwO1hxsK4 Message-ID: From: Attilio Rao To: Christian Brueffer , Mateusz Guzik Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238539 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 22:10:06 -0000 2012/7/16 Christian Brueffer : > Author: brueffer > Date: Mon Jul 16 22:07:29 2012 > New Revision: 238539 > URL: http://svn.freebsd.org/changeset/base/238539 > > Log: > Simply error handling by moving the allocation of np down to where it is > actually used. While here, improve style a little. Too bad that the biggest bug here is still in place. Right now smbfs inserts in the mount list half-constructed vnodes. Maybe you are interested in fixing this? Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 22:15:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A90001065670; Mon, 16 Jul 2012 22:15:30 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 943028FC08; Mon, 16 Jul 2012 22:15:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GMFUuB087942; Mon, 16 Jul 2012 22:15:30 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GMFUql087940; Mon, 16 Jul 2012 22:15:30 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201207162215.q6GMFUql087940@svn.freebsd.org> From: Isabell Long Date: Mon, 16 Jul 2012 22:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238540 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 22:15:30 -0000 Author: issyl0 (doc committer) Date: Mon Jul 16 22:15:30 2012 New Revision: 238540 URL: http://svn.freebsd.org/changeset/base/238540 Log: In ipfw(8), make the text about dynamic rules consistent. PR: docs/120539 Approved by: gabor (mentor) MFC after: 5 days Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Jul 16 22:07:29 2012 (r238539) +++ head/sbin/ipfw/ipfw.8 Mon Jul 16 22:15:30 2012 (r238540) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2012 +.Dd July 16, 2012 .Dt IPFW 8 .Os .Sh NAME @@ -2967,9 +2967,11 @@ This will let the firewall install dynam those connection which start with a regular SYN packet coming from the inside of our network. Dynamic rules are checked when encountering the first -.Cm check-state -or +occurrence of a +.Cm check-state , .Cm keep-state +or +.Cm limit rule. A .Cm check-state From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 22:41:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 9115F1065673; Mon, 16 Jul 2012 22:41:28 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id ED011150D37; Mon, 16 Jul 2012 22:41:27 +0000 (UTC) Message-ID: <50049897.5050002@FreeBSD.org> Date: Mon, 16 Jul 2012 15:41:27 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120621 Thunderbird/13.0.1 MIME-Version: 1.0 To: Michael Tuexen References: <201207160643.q6G6h5di011993@svn.freebsd.org> <5003DC20.9020703@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238514 - head/usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 22:41:28 -0000 On 07/16/2012 09:49, Michael Tuexen wrote: > On Jul 16, 2012, at 5:56 PM, Garrett Cooper wrote: > >> On Mon, Jul 16, 2012 at 2:17 AM, Doug Barton wrote: >>> Is it my imagination or did this break the build? >> >> Don't think so, but I'm running a buildworld with -DWITHOUT_INET >> -DWITHOUT_INET6 and -DWITHOUT_INET -DWITH_INET6, just to be sure. > Please let me know if there are still any issues. I think it should > be fixed now (meaning that it compiles (which I broke) and meaning > that it actually works (which I fixed). I waited a while after your change and the tinderbox was still failing. Not too long after your first mail (responding to me) it stopped failing, so it was probably just a timing issue. Sorry for the noise. Doug -- Change is hard. From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 02:05:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F10F1065670; Tue, 17 Jul 2012 02:05:40 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2068F8FC0A; Tue, 17 Jul 2012 02:05:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H25daT005003; Tue, 17 Jul 2012 02:05:39 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6H25deA004998; Tue, 17 Jul 2012 02:05:39 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201207170205.q6H25deA004998@svn.freebsd.org> From: Kevin Lo Date: Tue, 17 Jul 2012 02:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238542 - in head/share/man: man4 man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 02:05:40 -0000 Author: kevlo Date: Tue Jul 17 02:05:39 2012 New Revision: 238542 URL: http://svn.freebsd.org/changeset/base/238542 Log: Put parenthesis around sizeof args. Modified: head/share/man/man4/gpib.4 head/share/man/man9/ieee80211_node.9 head/share/man/man9/kernel_mount.9 head/share/man/man9/malloc.9 Modified: head/share/man/man4/gpib.4 ============================================================================== --- head/share/man/man4/gpib.4 Tue Jul 17 02:02:40 2012 (r238541) +++ head/share/man/man4/gpib.4 Tue Jul 17 02:05:39 2012 (r238542) @@ -63,7 +63,7 @@ main(int argc, char **argv) { int dmm; unsigned char buf[100]; - char vbuf[sizeof buf * 4]; + char vbuf[sizeof(buf) * 4]; /* DVM */ dmm = ibdev(0, (argc > 1? atoi(argv[1]): 7), 0, @@ -71,7 +71,7 @@ main(int argc, char **argv) if (dmm < 0) errx(1, "ibdev = %d\\n", dmm); ibwrt(dmm, "*IDN?\\r\\n", 7); - ibrd(dmm, buf, sizeof buf - 1); + ibrd(dmm, buf, sizeof(buf) - 1); strvisx(vbuf, buf, ibcnt, VIS_WHITE | VIS_CSTYLE); printf("%s\\n", vbuf); return (0); Modified: head/share/man/man9/ieee80211_node.9 ============================================================================== --- head/share/man/man9/ieee80211_node.9 Tue Jul 17 02:02:40 2012 (r238541) +++ head/share/man/man9/ieee80211_node.9 Tue Jul 17 02:05:39 2012 (r238542) @@ -185,7 +185,7 @@ iwi_node_alloc(struct ieee80211vap *vap, { struct iwi_node *in; - in = malloc(sizeof (struct iwi_node), M_80211_NODE, + in = malloc(sizeof(struct iwi_node), M_80211_NODE, M_NOWAIT | M_ZERO); if (in == NULL) return NULL; Modified: head/share/man/man9/kernel_mount.9 ============================================================================== --- head/share/man/man9/kernel_mount.9 Tue Jul 17 02:02:40 2012 (r238541) +++ head/share/man/man9/kernel_mount.9 Tue Jul 17 02:05:39 2012 (r238542) @@ -153,12 +153,12 @@ msdosfs_cmount(struct mntarg *ma, void * if (data == NULL) return (EINVAL); - error = copyin(data, &args, sizeof args); + error = copyin(data, &args, sizeof(args)); if (error) return (error); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &args.export, sizeof(args.export)); ma = mount_argf(ma, "uid", "%d", args.uid); ma = mount_argf(ma, "gid", "%d", args.gid); ma = mount_argf(ma, "mask", "%d", args.mask); Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Tue Jul 17 02:02:40 2012 (r238541) +++ head/share/man/man9/malloc.9 Tue Jul 17 02:05:39 2012 (r238542) @@ -197,7 +197,7 @@ MALLOC_DEFINE(M_FOOBUF, "foobuffers", "B /* sys/something/foo_subr.c */ \&... -buf = malloc(sizeof *buf, M_FOOBUF, M_NOWAIT); +buf = malloc(sizeof(*buf), M_FOOBUF, M_NOWAIT); .Ed .Pp From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 02:37:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6CAFF106566C; Tue, 17 Jul 2012 02:37:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5762A8FC12; Tue, 17 Jul 2012 02:37:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H2b0Ok007584; Tue, 17 Jul 2012 02:37:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6H2b0Bu007582; Tue, 17 Jul 2012 02:37:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207170237.q6H2b0Bu007582@svn.freebsd.org> From: Alan Cox Date: Tue, 17 Jul 2012 02:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238543 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 02:37:00 -0000 Author: alc Date: Tue Jul 17 02:36:59 2012 New Revision: 238543 URL: http://svn.freebsd.org/changeset/base/238543 Log: Correct vm_page_alloc_contig()'s implementation of VM_ALLOC_NODUMP. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Jul 17 02:05:39 2012 (r238542) +++ head/sys/vm/vm_page.c Tue Jul 17 02:36:59 2012 (r238543) @@ -1684,7 +1684,7 @@ retry: } for (m = m_ret; m < &m_ret[npages]; m++) { m->aflags = 0; - m->flags &= flags; + m->flags = (m->flags | PG_NODUMP) & flags; if ((req & VM_ALLOC_WIRED) != 0) m->wire_count = 1; /* Unmanaged pages don't use "act_count". */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 03:18:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0C31E106564A; Tue, 17 Jul 2012 03:18:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9E9B8FC12; Tue, 17 Jul 2012 03:18:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H3IDLA010828; Tue, 17 Jul 2012 03:18:13 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6H3IDx7010821; Tue, 17 Jul 2012 03:18:13 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201207170318.q6H3IDx7010821@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 17 Jul 2012 03:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238545 - in head/sys/arm: arm at91 econa s3c2xx0 xscale/i8134x xscale/pxa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 03:18:14 -0000 Author: gonzo Date: Tue Jul 17 03:18:12 2012 New Revision: 238545 URL: http://svn.freebsd.org/changeset/base/238545 Log: Move unmask IRQ function call up to nexus device level. FDT-enabled targets were broken after r238043 that relies on device up the hierarchy to properly setup interrupt. nexus device for ARM platforms did job only partially: setting handler but not unmasking interrupt. Unmasking was performed by platform code. Reviewed by: andrew@ Modified: head/sys/arm/arm/nexus.c head/sys/arm/at91/at91.c head/sys/arm/econa/econa.c head/sys/arm/s3c2xx0/s3c24x0.c head/sys/arm/xscale/i8134x/i81342.c head/sys/arm/xscale/pxa/pxa_obio.c Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Tue Jul 17 03:02:11 2012 (r238544) +++ head/sys/arm/arm/nexus.c Tue Jul 17 03:18:12 2012 (r238545) @@ -117,12 +117,16 @@ static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { + int irq; if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; - arm_setup_irqhandler(device_get_nameunit(child), - filt, intr, arg, rman_get_start(res), flags, cookiep); + for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) { + arm_setup_irqhandler(device_get_nameunit(child), + filt, intr, arg, irq, flags, cookiep); + arm_unmask_irq(irq); + } return (0); } Modified: head/sys/arm/at91/at91.c ============================================================================== --- head/sys/arm/at91/at91.c Tue Jul 17 03:02:11 2012 (r238544) +++ head/sys/arm/at91/at91.c Tue Jul 17 03:18:12 2012 (r238545) @@ -397,7 +397,6 @@ at91_setup_intr(device_t dev, device_t c struct resource *ires, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - struct at91_softc *sc = device_get_softc(dev); int error; if (rman_get_start(ires) == AT91_IRQ_SYSTEM && filt == NULL) @@ -407,8 +406,6 @@ at91_setup_intr(device_t dev, device_t c if (error) return (error); - bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IECR, - 1 << rman_get_start(ires)); return (0); } Modified: head/sys/arm/econa/econa.c ============================================================================== --- head/sys/arm/econa/econa.c Tue Jul 17 03:02:11 2012 (r238544) +++ head/sys/arm/econa/econa.c Tue Jul 17 03:18:12 2012 (r238545) @@ -602,8 +602,6 @@ econa_setup_intr(device_t dev, device_t if (error) return (error); - arm_unmask_irq(rman_get_start(ires)); - return (0); } Modified: head/sys/arm/s3c2xx0/s3c24x0.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0.c Tue Jul 17 03:02:11 2012 (r238544) +++ head/sys/arm/s3c2xx0/s3c24x0.c Tue Jul 17 03:18:12 2012 (r238545) @@ -220,7 +220,6 @@ s3c24x0_setup_intr(device_t dev, device_ /* Enable the external interrupt pin */ s3c24x0_enable_ext_intr(irq - S3C24X0_EXTIRQ_MIN); } - arm_unmask_irq(irq); } return (0); } Modified: head/sys/arm/xscale/i8134x/i81342.c ============================================================================== --- head/sys/arm/xscale/i8134x/i81342.c Tue Jul 17 03:02:11 2012 (r238544) +++ head/sys/arm/xscale/i8134x/i81342.c Tue Jul 17 03:18:12 2012 (r238545) @@ -435,7 +435,6 @@ i81342_setup_intr(device_t dev, device_t filt, intr, arg, cookiep); if (error) return (error); - arm_unmask_irq(rman_get_start(ires)); return (0); } Modified: head/sys/arm/xscale/pxa/pxa_obio.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_obio.c Tue Jul 17 03:02:11 2012 (r238544) +++ head/sys/arm/xscale/pxa/pxa_obio.c Tue Jul 17 03:18:12 2012 (r238545) @@ -181,7 +181,6 @@ pxa_setup_intr(device_t dev, device_t ch filter, ithread, arg, cookiep); if (error) return (error); - arm_unmask_irq(rman_get_start(irq)); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 09:31:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E9FA106566B; Tue, 17 Jul 2012 09:31:06 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 093A58FC12; Tue, 17 Jul 2012 09:31:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H9V5Dp037298; Tue, 17 Jul 2012 09:31:05 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6H9V5SR037296; Tue, 17 Jul 2012 09:31:05 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201207170931.q6H9V5SR037296@svn.freebsd.org> From: Jaakko Heinonen Date: Tue, 17 Jul 2012 09:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238546 - head/usr.sbin/lpr/common_source X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 09:31:06 -0000 Author: jh Date: Tue Jul 17 09:31:05 2012 New Revision: 238546 URL: http://svn.freebsd.org/changeset/base/238546 Log: Remove trailing whitespace. MFC after: 2 weeks Modified: head/usr.sbin/lpr/common_source/common.c Modified: head/usr.sbin/lpr/common_source/common.c ============================================================================== --- head/usr.sbin/lpr/common_source/common.c Tue Jul 17 03:18:12 2012 (r238545) +++ head/usr.sbin/lpr/common_source/common.c Tue Jul 17 09:31:05 2012 (r238546) @@ -136,7 +136,7 @@ getq(const struct printer *pp, struct jo /* * Estimate the array size by taking the size of the directory file - * and dividing it by a multiple of the minimum size entry. + * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); @@ -641,7 +641,7 @@ trstat_write(struct printer *pp, tr_send * secs= - seconds it took to transfer the file * bytes= - number of bytes transfered (ie, "bytecount") * bps=e - Bytes/sec (if the transfer was "big enough" - * for this to be useful) + * for this to be useful) * ! top= - type of printer (if the type is defined in * printcap, and if this statline is for sending * a file to that ptr) @@ -719,7 +719,7 @@ trstat_write(struct printer *pp, tr_send if (remspace > 1) { strcpy(eostat, "\n"); } else { - /* probably should back up to just before the final " x=".. */ + /* probably should back up to just before the final " x=".. */ strcpy(statline+STATLINE_SIZE-2, "\n"); } statfile = open(statfname, O_WRONLY|O_APPEND, 0664); @@ -732,7 +732,7 @@ trstat_write(struct printer *pp, tr_send close(statfile); return; -#undef UPD_EOSTAT +#undef UPD_EOSTAT } #include From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 09:34:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED9E1106564A; Tue, 17 Jul 2012 09:34:52 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D86128FC0C; Tue, 17 Jul 2012 09:34:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H9Yqde037622; Tue, 17 Jul 2012 09:34:52 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6H9YqWx037620; Tue, 17 Jul 2012 09:34:52 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201207170934.q6H9YqWx037620@svn.freebsd.org> From: Jaakko Heinonen Date: Tue, 17 Jul 2012 09:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238547 - head/usr.sbin/lpr/common_source X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 09:34:53 -0000 Author: jh Date: Tue Jul 17 09:34:52 2012 New Revision: 238547 URL: http://svn.freebsd.org/changeset/base/238547 Log: Make sure that arraysz is initialized to a value larger than zero. arraysz could get initialized to zero on ZFS because ZFS reports directory sizes differently compared to UFS. PR: bin/169493 Tested by: swills MFC after: 2 weeks Modified: head/usr.sbin/lpr/common_source/common.c Modified: head/usr.sbin/lpr/common_source/common.c ============================================================================== --- head/usr.sbin/lpr/common_source/common.c Tue Jul 17 09:31:05 2012 (r238546) +++ head/usr.sbin/lpr/common_source/common.c Tue Jul 17 09:34:52 2012 (r238547) @@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jo * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); + if (arraysz < 16) + arraysz = 16; queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); if (queue == NULL) goto errdone; From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 13:03:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48D261065674; Tue, 17 Jul 2012 13:03:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BE628FC0C; Tue, 17 Jul 2012 13:03:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HD3lOs055693; Tue, 17 Jul 2012 13:03:47 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HD3lZY055690; Tue, 17 Jul 2012 13:03:47 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201207171303.q6HD3lZY055690@svn.freebsd.org> From: Michael Tuexen Date: Tue, 17 Jul 2012 13:03:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238550 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 13:03:48 -0000 Author: tuexen Date: Tue Jul 17 13:03:47 2012 New Revision: 238550 URL: http://svn.freebsd.org/changeset/base/238550 Log: Fix a refcount bug when freeing an association. While there: Change code to be consistent. Discussed with rrs@. MFC after: 3 days Modified: head/sys/netinet/sctp_pcb.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Tue Jul 17 11:33:24 2012 (r238549) +++ head/sys/netinet/sctp_pcb.c Tue Jul 17 13:03:47 2012 (r238550) @@ -4875,6 +4875,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, /* now clean up any chunks here */ TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { TAILQ_REMOVE(&outs->outqueue, sp, next); + sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { if (so) { /* Still an open socket - report */ @@ -4885,19 +4886,14 @@ sctp_free_assoc(struct sctp_inpcb *inp, sctp_m_freem(sp->data); sp->data = NULL; sp->tail_mbuf = NULL; + sp->length = 0; } } if (sp->net) { sctp_free_remote_addr(sp->net); sp->net = NULL; } - sctp_free_spbufspace(stcb, asoc, sp); - if (sp->holds_key_ref) - sctp_auth_key_release(stcb, sp->auth_keyid, SCTP_SO_LOCKED); - /* Free the zone stuff */ - SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), sp); - SCTP_DECR_STRMOQ_COUNT(); - /* sa_ignore FREED_MEMORY */ + sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); } } /* sa_ignore FREED_MEMORY */ Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Tue Jul 17 11:33:24 2012 (r238549) +++ head/sys/netinet/sctputil.c Tue Jul 17 13:03:47 2012 (r238550) @@ -3774,6 +3774,8 @@ sctp_report_all_outbound(struct sctp_tcb if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; + sp->tail_mbuf = NULL; + sp->length = 0; } } if (sp->net) { @@ -4833,7 +4835,7 @@ sctp_release_pr_sctp_chunk(struct sctp_t /* * Pull any data to free up the SB * and allow sender to "add more" - * whilc we will throw away :-) + * while we will throw away :-) */ sctp_free_spbufspace(stcb, &stcb->asoc, sp); @@ -4841,9 +4843,9 @@ sctp_release_pr_sctp_chunk(struct sctp_t do_wakeup_routine = 1; sp->some_taken = 1; sctp_m_freem(sp->data); - sp->length = 0; sp->data = NULL; sp->tail_mbuf = NULL; + sp->length = 0; } break; } From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 14:03:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 725BD106566B; Tue, 17 Jul 2012 14:03:05 +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 43FF18FC17; Tue, 17 Jul 2012 14:03:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HE35ur060319; Tue, 17 Jul 2012 14:03:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HE35gi060316; Tue, 17 Jul 2012 14:03:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207171403.q6HE35gi060316@svn.freebsd.org> From: Alexander Motin Date: Tue, 17 Jul 2012 14:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238551 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 14:03:05 -0000 Author: mav Date: Tue Jul 17 14:03:04 2012 New Revision: 238551 URL: http://svn.freebsd.org/changeset/base/238551 Log: For Intel Panther/Lynx Point USB 3.0 xHCI controllers enable SuperSpeed USB capability and reroute USB 2.0 ports to the xHCI controller. Reviewed by: hselasky Modified: head/sys/dev/usb/controller/xhci_pci.c head/sys/dev/usb/controller/xhcireg.h Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Tue Jul 17 13:03:47 2012 (r238550) +++ head/sys/dev/usb/controller/xhci_pci.c Tue Jul 17 14:03:04 2012 (r238551) @@ -101,6 +101,8 @@ xhci_pci_match(device_t self) case 0x1e318086: return ("Intel Panther Point USB 3.0 controller"); + case 0x8c318086: + return ("Intel Lynx Point USB 3.0 controller"); default: break; @@ -245,6 +247,7 @@ static int xhci_pci_take_controller(device_t self) { struct xhci_softc *sc = device_get_softc(self); + uint32_t device_id = pci_get_devid(self); uint32_t cparams; uint32_t eecp; uint32_t eec; @@ -285,5 +288,13 @@ xhci_pci_take_controller(device_t self) usb_pause_mtx(NULL, hz / 100); /* wait 10ms */ } } + + /* On Intel chipsets reroute ports from EHCI to XHCI controller. */ + if (device_id == 0x1e318086 /* Panther Point */ || + device_id == 0x8c318086 /* Lynx Point */) { + pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, 0xffffffff, 4); + pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, 0xffffffff, 4); + } + return (0); } Modified: head/sys/dev/usb/controller/xhcireg.h ============================================================================== --- head/sys/dev/usb/controller/xhcireg.h Tue Jul 17 13:03:47 2012 (r238550) +++ head/sys/dev/usb/controller/xhcireg.h Tue Jul 17 14:03:04 2012 (r238551) @@ -34,6 +34,9 @@ #define PCI_USB_REV_3_0 0x30 /* USB 3.0 */ #define PCI_XHCI_FLADJ 0x61 /* RW frame length adjust */ +#define PCI_XHCI_INTEL_XUSB2PR 0xD0 /* Intel USB2 Port Routing */ +#define PCI_XHCI_INTEL_USB3_PSSEN 0xD8 /* Intel USB3 Port SuperSpeed Enable */ + /* XHCI capability registers */ #define XHCI_CAPLENGTH 0x00 /* RO capability */ #define XHCI_RESERVED 0x01 /* Reserved */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 14:36:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752841065678; Tue, 17 Jul 2012 14:36:41 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4B68FC17; Tue, 17 Jul 2012 14:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HEafvM062837; Tue, 17 Jul 2012 14:36:41 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HEafrp062834; Tue, 17 Jul 2012 14:36:41 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201207171436.q6HEafrp062834@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 17 Jul 2012 14:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238552 - in head/sys/cddl/dev/dtrace: amd64 i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 14:36:41 -0000 Author: gnn Date: Tue Jul 17 14:36:40 2012 New Revision: 238552 URL: http://svn.freebsd.org/changeset/base/238552 Log: Change UL to ULL since time is 32 bits. Pointed out by: avg@ MFC after: 2 weeks Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Tue Jul 17 14:03:04 2012 (r238551) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Tue Jul 17 14:36:40 2012 (r238552) @@ -467,7 +467,7 @@ dtrace_gethrestime(void) dtrace_getnanotime(¤t_time); - return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); + return (current_time.tv_sec * 1000000000ULL + current_time.tv_nsec); } /* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */ Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue Jul 17 14:03:04 2012 (r238551) +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue Jul 17 14:36:40 2012 (r238552) @@ -468,7 +468,7 @@ dtrace_gethrestime(void) dtrace_getnanotime(¤t_time); - return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); + return (current_time.tv_sec * 1000000000ULL + current_time.tv_nsec); } /* Function to handle DTrace traps during probes. See i386/i386/trap.c */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 19:57:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AFC2106566B; Tue, 17 Jul 2012 19:57:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B1EA8FC18; Tue, 17 Jul 2012 19:57:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HJvZJT088244; Tue, 17 Jul 2012 19:57:35 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HJvZef088241; Tue, 17 Jul 2012 19:57:35 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201207171957.q6HJvZef088241@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 17 Jul 2012 19:57:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238558 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/tst/common/include cmd/dtrace/test/tst/common/pragma lib/libdtrace/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 19:57:35 -0000 Author: pfg Date: Tue Jul 17 19:57:34 2012 New Revision: 238558 URL: http://svn.freebsd.org/changeset/base/238558 Log: Dtrace: improve handling of library paths. Merge changes from illumos 906 dtrace depends_on pragma should search all library paths, not just the current one 949 dtrace should only include the first instance of a library found on its library path Illumos Revisions: 13353:936a1e45726c 13354:2b2c36a81512 Reference: https://www.illumos.org/issues/906 https://www.illumos.org/issues/949 Tested by: Fabian Keil Obtained from: Illumos MFC after: 3 weeks Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/include/ - copied from r238552, vendor/illumos/dist/cmd/dtrace/test/tst/common/include/ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh - copied unchanged from r238552, vendor/illumos/dist/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh (from r238552, vendor/illumos/dist/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh Tue Jul 17 19:57:34 2012 (r238558, copy of r238552, vendor/illumos/dist/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh) @@ -0,0 +1,76 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2011, Joyent Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Test to catch that we properly look for libraries dependencies in +# our full library parth +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +libdira=${TMPDIR:-/tmp}/libdepa.$$ +libdirb=${TMPDIR:-/tmp}/libdepb.$$ +libdirc=${TMPDIR:-/tmp}/libdepc.$$ +dtrace=$1 + +setup_libs() +{ + mkdir $libdira + mkdir $libdirb + mkdir $libdirc + cat > $libdira/liba.$$.d < $libdirb/libb.$$.d < $libdirb/libc.$$.d < $libdirb/libd.$$.d < $libdirc/libe.$$.d < $libdirc/libf.$$.d <dt_lib_dep); dld != NULL; + dld = dt_list_next(dld)) { + end = strrchr(dld->dtld_library, '/'); + /* dt_lib_depend_add ensures this */ + assert(end != NULL); + if (strcmp(end + 1, dp->d_name) == 0) + break; + } + + if (dld != NULL) { + dt_dprintf("skipping library %s, already processed " + "library with the same name: %s", dp->d_name, + dld->dtld_library); + continue; + } + dtp->dt_filetag = fname; if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) - goto err; + return (-1); /* preserve dt_errno */ rv = dt_compile(dtp, DT_CTX_DPROG, DTRACE_PROBESPEC_NAME, NULL, @@ -2203,7 +2221,7 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons if (rv != NULL && dtp->dt_errno && (dtp->dt_errno != EDT_COMPILER || dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) - goto err; + return (-1); /* preserve dt_errno */ if (dtp->dt_errno) dt_dprintf("error parsing library %s: %s\n", @@ -2214,6 +2232,27 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons } (void) closedir(dirp); + + return (0); +} + +/* + * Perform a topological sorting of all the libraries found across the entire + * dt_lib_path. Once sorted, compile each one in topological order to cache its + * inlines and translators, etc. We silently ignore any missing directories and + * other files found therein. We only fail (and thereby fail dt_load_libs()) if + * we fail to compile a library and the error is something other than #pragma D + * depends_on. Dependency errors are silently ignored to permit a library + * directory to contain libraries which may not be accessible depending on our + * privileges. + */ +static int +dt_load_libs_sort(dtrace_hdl_t *dtp) +{ + dtrace_prog_t *pgp; + FILE *fp; + dt_lib_depend_t *dld; + /* * Finish building the graph containing the library dependencies * and perform a topological sort to generate an ordered list @@ -2274,7 +2313,14 @@ dt_load_libs(dtrace_hdl_t *dtp) dtp->dt_cflags |= DTRACE_C_NOLIBS; - for (dirp = dt_list_next(&dtp->dt_lib_path); + /* + * /usr/lib/dtrace is always at the head of the list. The rest of the + * list is specified in the precedence order the user requested. Process + * everything other than the head first. DTRACE_C_NOLIBS has already + * been spcified so dt_vopen will ensure that there is always one entry + * in dt_lib_path. + */ + for (dirp = dt_list_next(dt_list_next(&dtp->dt_lib_path)); dirp != NULL; dirp = dt_list_next(dirp)) { if (dt_load_libs_dir(dtp, dirp->dir_path) != 0) { dtp->dt_cflags &= ~DTRACE_C_NOLIBS; @@ -2282,6 +2328,16 @@ dt_load_libs(dtrace_hdl_t *dtp) } } + /* Handle /usr/lib/dtrace */ + dirp = dt_list_next(&dtp->dt_lib_path); + if (dt_load_libs_dir(dtp, dirp->dir_path) != 0) { + dtp->dt_cflags &= ~DTRACE_C_NOLIBS; + return (-1); /* errno is set for us */ + } + + if (dt_load_libs_sort(dtp) < 0) + return (-1); /* errno is set for us */ + return (0); } Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Tue Jul 17 19:29:32 2012 (r238557) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Tue Jul 17 19:57:34 2012 (r238558) @@ -21,7 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2011, Joyent Inc. All rights reserved. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,9 +31,13 @@ #if defined(sun) #include #endif +#include #include #include +#include +#include + #include #include #include @@ -201,6 +205,29 @@ dt_pragma_binding(const char *prname, dt dtp->dt_globals->dh_defer = &dt_pragma_apply; } +static void +dt_pragma_depends_finddep(dtrace_hdl_t *dtp, const char *lname, char *lib, + size_t len) +{ + dt_dirpath_t *dirp; + struct stat sbuf; + int found = 0; + + for (dirp = dt_list_next(&dtp->dt_lib_path); dirp != NULL; + dirp = dt_list_next(dirp)) { + (void) snprintf(lib, len, "%s/%s", dirp->dir_path, lname); + + if (stat(lib, &sbuf) == 0) { + found = 1; + break; + } + } + + if (!found) + xyerror(D_PRAGMA_DEPEND, + "failed to find dependency in libpath: %s", lname); +} + /* * The #pragma depends_on directive can be used to express a dependency on a * module, provider or library which if not present will cause processing to @@ -230,16 +257,13 @@ dt_pragma_depends(const char *prname, dt if (yypcb->pcb_cflags & DTRACE_C_CTL) { assert(dtp->dt_filetag != NULL); - /* - * We have the file we are working on in dtp->dt_filetag - * so find that node and add the dependency in. - */ + dt_pragma_depends_finddep(dtp, nnp->dn_string, lib, + sizeof (lib)); + dld = dt_lib_depend_lookup(&dtp->dt_lib_dep, dtp->dt_filetag); assert(dld != NULL); - (void) snprintf(lib, sizeof (lib), "%s%s", - dld->dtld_libpath, nnp->dn_string); if ((dt_lib_depend_add(dtp, &dld->dtld_dependencies, lib)) != 0) { xyerror(D_PRAGMA_DEPEND, @@ -261,8 +285,8 @@ dt_pragma_depends(const char *prname, dt dtp->dt_filetag); assert(dld != NULL); - (void) snprintf(lib, sizeof (lib), "%s%s", - dld->dtld_libpath, nnp->dn_string); + dt_pragma_depends_finddep(dtp, nnp->dn_string, lib, + sizeof (lib)); dld = dt_lib_depend_lookup(&dtp->dt_lib_dep_sorted, lib); assert(dld != NULL); From owner-svn-src-head@FreeBSD.ORG Tue Jul 17 22:16:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A5C51065672; Tue, 17 Jul 2012 22:16:11 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75DD48FC12; Tue, 17 Jul 2012 22:16:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HMGBog001125; Tue, 17 Jul 2012 22:16:11 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6HMGBPb001123; Tue, 17 Jul 2012 22:16:11 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201207172216.q6HMGBPb001123@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 17 Jul 2012 22:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238559 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 22:16:11 -0000 Author: ken Date: Tue Jul 17 22:16:10 2012 New Revision: 238559 URL: http://svn.freebsd.org/changeset/base/238559 Log: Add back spare fields consumed in r237545. It seems that these should only be consumed to maintain backward compatibility in stable, but should not be consumed in head. Submitted by: trasz, attilio (indirectly) Modified: head/sys/geom/geom.h Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Tue Jul 17 19:57:34 2012 (r238558) +++ head/sys/geom/geom.h Tue Jul 17 22:16:10 2012 (r238559) @@ -110,6 +110,7 @@ struct g_class { g_ioctl_t *ioctl; g_provgone_t *providergone; g_resize_t *resize; + void *spare1; void *spare2; /* * The remaining elements are private @@ -142,6 +143,7 @@ struct g_geom { g_ioctl_t *ioctl; g_provgone_t *providergone; g_resize_t *resize; + void *spare0; void *spare1; void *softc; unsigned flags; From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 05:21:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2E9A1065673; Wed, 18 Jul 2012 05:21:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CBE08FC14; Wed, 18 Jul 2012 05:21:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I5LZw3031329; Wed, 18 Jul 2012 05:21:35 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I5LZQY031323; Wed, 18 Jul 2012 05:21:35 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207180521.q6I5LZQY031323@svn.freebsd.org> From: Alan Cox Date: Wed, 18 Jul 2012 05:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238561 - in head/sys: conf mips/mips vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 05:21:35 -0000 Author: alc Date: Wed Jul 18 05:21:34 2012 New Revision: 238561 URL: http://svn.freebsd.org/changeset/base/238561 Log: Move what remains of vm/vm_contig.c into vm/vm_pageout.c, where similar code resides. Rename vm_contig_grow_cache() to vm_pageout_grow_cache(). Reviewed by: kib Deleted: head/sys/vm/vm_contig.c Modified: head/sys/conf/files head/sys/mips/mips/pmap.c head/sys/vm/vm_kern.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pageout.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jul 18 04:52:37 2012 (r238560) +++ head/sys/conf/files Wed Jul 18 05:21:34 2012 (r238561) @@ -3551,7 +3551,6 @@ vm/sg_pager.c standard vm/swap_pager.c standard vm/uma_core.c standard vm/uma_dbg.c standard -vm/vm_contig.c standard vm/memguard.c optional DEBUG_MEMGUARD vm/vm_fault.c standard vm/vm_glue.c standard Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Jul 18 04:52:37 2012 (r238560) +++ head/sys/mips/mips/pmap.c Wed Jul 18 05:21:34 2012 (r238561) @@ -1034,9 +1034,9 @@ pmap_grow_direct_page_cache() { #ifdef __mips_n64 - vm_contig_grow_cache(3, 0, MIPS_XKPHYS_LARGEST_PHYS); + vm_pageout_grow_cache(3, 0, MIPS_XKPHYS_LARGEST_PHYS); #else - vm_contig_grow_cache(3, 0, MIPS_KSEG0_LARGEST_PHYS); + vm_pageout_grow_cache(3, 0, MIPS_KSEG0_LARGEST_PHYS); #endif } Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Wed Jul 18 04:52:37 2012 (r238560) +++ head/sys/vm/vm_kern.c Wed Jul 18 05:21:34 2012 (r238561) @@ -239,7 +239,7 @@ retry: VM_OBJECT_UNLOCK(object); if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { vm_map_unlock(map); - vm_contig_grow_cache(tries, low, high); + vm_pageout_grow_cache(tries, low, high); vm_map_lock(map); VM_OBJECT_LOCK(object); tries++; @@ -313,7 +313,7 @@ retry: VM_OBJECT_UNLOCK(object); if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { vm_map_unlock(map); - vm_contig_grow_cache(tries, low, high); + vm_pageout_grow_cache(tries, low, high); vm_map_lock(map); VM_OBJECT_LOCK(object); tries++; Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Jul 18 04:52:37 2012 (r238560) +++ head/sys/vm/vm_pageout.c Wed Jul 18 05:21:34 2012 (r238561) @@ -209,11 +209,14 @@ int vm_page_max_wired; /* XXX max # of SYSCTL_INT(_vm, OID_AUTO, max_wired, CTLFLAG_RW, &vm_page_max_wired, 0, "System-wide limit to wired page count"); +static boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *); +static boolean_t vm_pageout_launder(int, int, vm_paddr_t, vm_paddr_t); #if !defined(NO_SWAPPING) static void vm_pageout_map_deactivate_pages(vm_map_t, long); static void vm_pageout_object_deactivate_pages(pmap_t, vm_object_t, long); static void vm_req_vmdaemon(int req); #endif +static boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *); static void vm_pageout_page_stats(void); /* @@ -247,7 +250,7 @@ vm_pageout_init_marker(vm_page_t marker, * This function depends on both the lock portion of struct vm_object * and normal struct vm_page being type stable. */ -boolean_t +static boolean_t vm_pageout_fallback_object_lock(vm_page_t m, vm_page_t *next) { struct vm_page marker; @@ -286,7 +289,7 @@ vm_pageout_fallback_object_lock(vm_page_ * * This function depends on normal struct vm_page being type stable. */ -boolean_t +static boolean_t vm_pageout_page_lock(vm_page_t m, vm_page_t *next) { struct vm_page marker; @@ -558,6 +561,138 @@ vm_pageout_flush(vm_page_t *mc, int coun return (numpagedout); } +static boolean_t +vm_pageout_launder(int queue, int tries, vm_paddr_t low, vm_paddr_t high) +{ + struct mount *mp; + struct vnode *vp; + vm_object_t object; + vm_paddr_t pa; + vm_page_t m, m_tmp, next; + int vfslocked; + + vm_page_lock_queues(); + TAILQ_FOREACH_SAFE(m, &vm_page_queues[queue].pl, pageq, next) { + KASSERT(m->queue == queue, + ("vm_pageout_launder: page %p's queue is not %d", m, + queue)); + if ((m->flags & PG_MARKER) != 0) + continue; + pa = VM_PAGE_TO_PHYS(m); + if (pa < low || pa + PAGE_SIZE > high) + continue; + if (!vm_pageout_page_lock(m, &next) || m->hold_count != 0) { + vm_page_unlock(m); + continue; + } + object = m->object; + if (!VM_OBJECT_TRYLOCK(object) && + (!vm_pageout_fallback_object_lock(m, &next) || + m->hold_count != 0)) { + vm_page_unlock(m); + VM_OBJECT_UNLOCK(object); + continue; + } + if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { + if (tries == 0) { + vm_page_unlock(m); + VM_OBJECT_UNLOCK(object); + continue; + } + vm_page_sleep(m, "vpctw0"); + VM_OBJECT_UNLOCK(object); + return (FALSE); + } + vm_page_test_dirty(m); + if (m->dirty == 0) + pmap_remove_all(m); + if (m->dirty != 0) { + vm_page_unlock(m); + if (tries == 0 || (object->flags & OBJ_DEAD) != 0) { + VM_OBJECT_UNLOCK(object); + continue; + } + if (object->type == OBJT_VNODE) { + vm_page_unlock_queues(); + vp = object->handle; + vm_object_reference_locked(object); + VM_OBJECT_UNLOCK(object); + (void)vn_start_write(vp, &mp, V_WAIT); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + VM_OBJECT_LOCK(object); + vm_object_page_clean(object, 0, 0, OBJPC_SYNC); + VM_OBJECT_UNLOCK(object); + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + vm_object_deallocate(object); + vn_finished_write(mp); + return (TRUE); + } else if (object->type == OBJT_SWAP || + object->type == OBJT_DEFAULT) { + vm_page_unlock_queues(); + m_tmp = m; + vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC, + 0, NULL, NULL); + VM_OBJECT_UNLOCK(object); + return (TRUE); + } + } else { + vm_page_cache(m); + vm_page_unlock(m); + } + VM_OBJECT_UNLOCK(object); + } + vm_page_unlock_queues(); + return (FALSE); +} + +/* + * Increase the number of cached pages. The specified value, "tries", + * determines which categories of pages are cached: + * + * 0: All clean, inactive pages within the specified physical address range + * are cached. Will not sleep. + * 1: The vm_lowmem handlers are called. All inactive pages within + * the specified physical address range are cached. May sleep. + * 2: The vm_lowmem handlers are called. All inactive and active pages + * within the specified physical address range are cached. May sleep. + */ +void +vm_pageout_grow_cache(int tries, vm_paddr_t low, vm_paddr_t high) +{ + int actl, actmax, inactl, inactmax; + + if (tries > 0) { + /* + * Decrease registered cache sizes. The vm_lowmem handlers + * may acquire locks and/or sleep, so they can only be invoked + * when "tries" is greater than zero. + */ + EVENTHANDLER_INVOKE(vm_lowmem, 0); + + /* + * We do this explicitly after the caches have been drained + * above. + */ + uma_reclaim(); + } + inactl = 0; + inactmax = cnt.v_inactive_count; + actl = 0; + actmax = tries < 2 ? 0 : cnt.v_active_count; +again: + if (inactl < inactmax && vm_pageout_launder(PQ_INACTIVE, tries, low, + high)) { + inactl++; + goto again; + } + if (actl < actmax && vm_pageout_launder(PQ_ACTIVE, tries, low, high)) { + actl++; + goto again; + } +} + #if !defined(NO_SWAPPING) /* * vm_pageout_object_deactivate_pages Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Wed Jul 18 04:52:37 2012 (r238560) +++ head/sys/vm/vm_pageout.h Wed Jul 18 05:21:34 2012 (r238561) @@ -101,10 +101,8 @@ extern void vm_wait(void); extern void vm_waitpfault(void); #ifdef _KERNEL -boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *); int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *); +void vm_pageout_grow_cache(int, vm_paddr_t, vm_paddr_t); void vm_pageout_oom(int shortage); -boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *); -void vm_contig_grow_cache(int, vm_paddr_t, vm_paddr_t); #endif #endif /* _VM_VM_PAGEOUT_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 05:50:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B82E7106566C; Wed, 18 Jul 2012 05:50:40 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A303A8FC19; Wed, 18 Jul 2012 05:50:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I5oe6f033508; Wed, 18 Jul 2012 05:50:40 GMT (envelope-from avatar@svn.freebsd.org) Received: (from avatar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I5oe3l033506; Wed, 18 Jul 2012 05:50:40 GMT (envelope-from avatar@svn.freebsd.org) Message-Id: <201207180550.q6I5oe3l033506@svn.freebsd.org> From: Tai-hwa Liang Date: Wed, 18 Jul 2012 05:50:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238562 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 05:50:40 -0000 Author: avatar Date: Wed Jul 18 05:50:40 2012 New Revision: 238562 URL: http://svn.freebsd.org/changeset/base/238562 Log: Removing bsd{ar,ranlib} found on my ancient installation. MFC after: 3 weeks Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jul 18 05:21:34 2012 (r238561) +++ head/ObsoleteFiles.inc Wed Jul 18 05:50:40 2012 (r238562) @@ -1358,6 +1358,11 @@ OLD_FILES+=usr/share/man/man2/kse_thr_in OLD_FILES+=usr/share/man/man2/kse_wakeup.2.gz OLD_FILES+=usr/lib32/libkse.so OLD_LIBS+=usr/lib32/libkse.so.3 +# 20080225: bsdar/bsdranlib rename to ar/ranlib +OLD_FILES+=usr/bin/bsdar +OLD_FILES+=usr/bin/bsdranlib +OLD_FILES+=usr/share/man/man1/bsdar.1.gz +OLD_FILES+=usr/share/man/man1/bsdranlib.1.gz # 20080220: geom_lvm rename to geom_linux_lvm OLD_FILES+=usr/share/man/man4/geom_lvm.4.gz # 20080126: oldcard.4 removal From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 05:57:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAAA4106566C; Wed, 18 Jul 2012 05:57:43 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5E688FC0A; Wed, 18 Jul 2012 05:57:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I5vhFA034020; Wed, 18 Jul 2012 05:57:43 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I5vheM034018; Wed, 18 Jul 2012 05:57:43 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201207180557.q6I5vheM034018@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 18 Jul 2012 05:57:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238563 - head/gnu/usr.bin/groff/tmac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 05:57:44 -0000 Author: obrien Date: Wed Jul 18 05:57:42 2012 New Revision: 238563 URL: http://svn.freebsd.org/changeset/base/238563 Log: a ";" tells make we want the shell to be used Submitted by: Simon Gerraty Modified: head/gnu/usr.bin/groff/tmac/Makefile Modified: head/gnu/usr.bin/groff/tmac/Makefile ============================================================================== --- head/gnu/usr.bin/groff/tmac/Makefile Wed Jul 18 05:50:40 2012 (r238562) +++ head/gnu/usr.bin/groff/tmac/Makefile Wed Jul 18 05:57:42 2012 (r238563) @@ -68,7 +68,7 @@ beforeinstall: cd ${.CURDIR}; \ ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR} - cd ${.OBJDIR} + cd ${.OBJDIR}; .for f in ${STRIPFILES} ${SPECIALFILES} ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ $f-s ${DESTDIR}${TMACDIR}/$f From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 07:07:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBA96106564A; Wed, 18 Jul 2012 07:07:54 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B626E8FC15; Wed, 18 Jul 2012 07:07:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I77sG5039468; Wed, 18 Jul 2012 07:07:54 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I77sdO039466; Wed, 18 Jul 2012 07:07:54 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201207180707.q6I77sdO039466@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 18 Jul 2012 07:07:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238564 - head/usr.bin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 07:07:54 -0000 Author: obrien Date: Wed Jul 18 07:07:54 2012 New Revision: 238564 URL: http://svn.freebsd.org/changeset/base/238564 Log: Sort per the comment. Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Wed Jul 18 05:57:42 2012 (r238563) +++ head/usr.bin/Makefile Wed Jul 18 07:07:54 2012 (r238564) @@ -208,10 +208,6 @@ SUBDIR+= at SUBDIR+= atm .endif -.if ${MK_MAN_UTILS} != "no" -SUBDIR+= catman -.endif - .if ${MK_BIND_UTILS} != "no" SUBDIR+= dig SUBDIR+= host @@ -235,6 +231,10 @@ SUBDIR+= calendar _clang= clang .endif +.if ${MK_GROFF} != "no" +SUBDIR+= vgrind +.endif + .if ${MK_HESIOD} != "no" SUBDIR+= hesinfo .endif @@ -245,15 +245,8 @@ _mkcsmapper= mkcsmapper _mkesdb= mkesdb .endif -.if ${MK_GROFF} != "no" -SUBDIR+= vgrind -.endif - -.if ${MK_OPENSSL} != "no" -SUBDIR+= bc -SUBDIR+= chkey -SUBDIR+= dc -SUBDIR+= newkey +.if ${MK_KERBEROS_SUPPORT} != "no" +SUBDIR+= compile_et .endif .if ${MK_LIBTHR} != "no" @@ -264,10 +257,6 @@ SUBDIR+= csup SUBDIR+= locate .endif -.if ${MK_KERBEROS_SUPPORT} != "no" -SUBDIR+= compile_et -.endif - # XXX msgs? .if ${MK_MAIL} != "no" SUBDIR+= biff @@ -281,6 +270,7 @@ SUBDIR+= make .endif .if ${MK_MAN_UTILS} != "no" +SUBDIR+= catman _makewhatis= makewhatis _man= man .endif @@ -295,6 +285,13 @@ SUBDIR+= ypmatch SUBDIR+= ypwhich .endif +.if ${MK_OPENSSL} != "no" +SUBDIR+= bc +SUBDIR+= chkey +SUBDIR+= dc +SUBDIR+= newkey +.endif + .if ${MK_QUOTAS} != "no" SUBDIR+= quota .endif From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 07:26:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B850A106566C; Wed, 18 Jul 2012 07:26:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A1BB8FC08; Wed, 18 Jul 2012 07:26:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I7QL4O040850; Wed, 18 Jul 2012 07:26:21 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I7QLmM040848; Wed, 18 Jul 2012 07:26:21 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201207180726.q6I7QLmM040848@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 18 Jul 2012 07:26:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238565 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 07:26:21 -0000 Author: trasz Date: Wed Jul 18 07:26:20 2012 New Revision: 238565 URL: http://svn.freebsd.org/changeset/base/238565 Log: Add missing free. Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Wed Jul 18 07:07:54 2012 (r238564) +++ head/sys/geom/geom_subr.c Wed Jul 18 07:26:20 2012 (r238565) @@ -621,6 +621,7 @@ g_resize_provider_event(void *arg, int f hh = arg; pp = hh->pp; size = hh->size; + g_free(hh); G_VALID_PROVIDER(pp); g_trace(G_T_TOPOLOGY, "g_resize_provider_event(%p)", pp); From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 08:41:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 31C991065673; Wed, 18 Jul 2012 08:41:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DB4A8FC1D; Wed, 18 Jul 2012 08:41:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8f0gH046739; Wed, 18 Jul 2012 08:41:00 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8f0WC046737; Wed, 18 Jul 2012 08:41:00 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207180841.q6I8f0WC046737@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 18 Jul 2012 08:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238572 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:41:01 -0000 Author: glebius Date: Wed Jul 18 08:41:00 2012 New Revision: 238572 URL: http://svn.freebsd.org/changeset/base/238572 Log: When traversing global in_ifaddr list in the IFP_TO_IA() macro, we need to obtain IN_IFADDR_RLOCK(). Modified: head/sys/netinet/in_var.h Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Wed Jul 18 08:37:08 2012 (r238571) +++ head/sys/netinet/in_var.h Wed Jul 18 08:41:00 2012 (r238572) @@ -161,14 +161,16 @@ do { \ #define IFP_TO_IA(ifp, ia) \ /* struct ifnet *ifp; */ \ /* struct in_ifaddr *ia; */ \ -{ \ +do { \ + IN_IFADDR_RLOCK(); \ for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \ (ia) != NULL && (ia)->ia_ifp != (ifp); \ (ia) = TAILQ_NEXT((ia), ia_link)) \ continue; \ if ((ia) != NULL) \ ifa_ref(&(ia)->ia_ifa); \ -} + IN_IFADDR_RUNLOCK(); \ +} while (0) #endif /* From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 08:58:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F07A106564A; Wed, 18 Jul 2012 08:58:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B1BD8FC0A; Wed, 18 Jul 2012 08:58:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8wUex048162; Wed, 18 Jul 2012 08:58:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8wUYB048160; Wed, 18 Jul 2012 08:58:30 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207180858.q6I8wUYB048160@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 18 Jul 2012 08:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238573 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:58:31 -0000 Author: glebius Date: Wed Jul 18 08:58:30 2012 New Revision: 238573 URL: http://svn.freebsd.org/changeset/base/238573 Log: Plug a reference leak: before doing 'goto again' we need to unref ia->ia_ifa if there is any. Submitted by: Andrey Zonov Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Jul 18 08:41:00 2012 (r238572) +++ head/sys/netinet/ip_output.c Wed Jul 18 08:58:30 2012 (r238573) @@ -124,7 +124,7 @@ ip_output(struct mbuf *m, struct mbuf *o int n; /* scratchpad */ int error = 0; struct sockaddr_in *dst; - struct in_ifaddr *ia = NULL; + struct in_ifaddr *ia; int isbroadcast, sw_csum; struct route iproute; struct rtentry *rte; /* cache for ro->ro_rt */ @@ -198,6 +198,7 @@ ip_output(struct mbuf *m, struct mbuf *o dst = (struct sockaddr_in *)&ro->ro_dst; again: + ia = NULL; /* * If there is a cached route, * check that it is to the same destination @@ -533,8 +534,11 @@ sendit: #endif error = netisr_queue(NETISR_IP, m); goto done; - } else + } else { + if (ia != NULL) + ifa_free(&ia->ia_ifa); goto again; /* Redo the routing table lookup. */ + } } #ifdef IPFIREWALL_FORWARD @@ -564,6 +568,8 @@ sendit: bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in)); m->m_flags |= M_SKIP_FIREWALL; m_tag_delete(m, fwd_tag); + if (ia != NULL) + ifa_free(&ia->ia_ifa); goto again; } #endif /* IPFIREWALL_FORWARD */ From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 09:06:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD72C106564A; Wed, 18 Jul 2012 09:06:07 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B85718FC16; Wed, 18 Jul 2012 09:06:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I967Sh048810; Wed, 18 Jul 2012 09:06:07 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I967M3048808; Wed, 18 Jul 2012 09:06:07 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207180906.q6I967M3048808@svn.freebsd.org> From: Christian Brueffer Date: Wed, 18 Jul 2012 09:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238574 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:06:07 -0000 Author: brueffer Date: Wed Jul 18 09:06:07 2012 New Revision: 238574 URL: http://svn.freebsd.org/changeset/base/238574 Log: Fix a small memory leak in mpssas_get_sata_identify(). The change has been submitted upstream as well. Reviewed by: ken, scottl Obtained from: DragonFly BSD (change df8658e030226dd015cff9749452666d8fe1e87b) MFC after: 5 days Modified: head/sys/dev/mps/mps_sas_lsi.c Modified: head/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- head/sys/dev/mps/mps_sas_lsi.c Wed Jul 18 08:58:30 2012 (r238573) +++ head/sys/dev/mps/mps_sas_lsi.c Wed Jul 18 09:06:07 2012 (r238574) @@ -796,8 +796,10 @@ mpssas_get_sata_identify(struct mps_soft if (!buffer) return ENOMEM; - if ((cm = mps_alloc_command(sc)) == NULL) + if ((cm = mps_alloc_command(sc)) == NULL) { + free(buffer, M_MPT2); return (EBUSY); + } mpi_request = (MPI2_SATA_PASSTHROUGH_REQUEST *)cm->cm_req; bzero(mpi_request,sizeof(MPI2_SATA_PASSTHROUGH_REQUEST)); mpi_request->Function = MPI2_FUNCTION_SATA_PASSTHROUGH; From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 12:11:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5B18E106566C; Wed, 18 Jul 2012 12:11:11 +0000 (UTC) (envelope-from SRS0=YLKP=FT=FreeBSD.org=brueffer@srs.kundenserver.de) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mx1.freebsd.org (Postfix) with ESMTP id DE6878FC15; Wed, 18 Jul 2012 12:11:10 +0000 (UTC) Received: from ip235-179.wireless.lu.se (ip235-179.wireless.lu.se [130.235.235.179]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MXkt1-1TKw2s2MXn-00WpcS; Wed, 18 Jul 2012 14:11:09 +0200 Message-ID: <5006A7DD.9050509@FreeBSD.org> Date: Wed, 18 Jul 2012 14:11:09 +0200 From: Christian Brueffer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: attilio@FreeBSD.org References: <201207162207.q6GM7UNS087234@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Vshiz7BgukA1eHZHCbKTUE1zmWwc0mSn9thh6BwP20/ uXt8jsQvQbvcDwkw3xKtKTzNhF6fEN0+H3Ha4SM3ZJOOJaoIkQ COldzH1HlcHh0yRGHsNVZxZIjT774MqkijHv+sXpRz8vYEm67u TxnZEdYbknrtYalD5M+bj+2qCEg9KwuX8kOT5J5tSSEbqi5Zy6 rYE2nqWnQ7x5uv2JltqALyGmASlNeVGtQrSPi7XWp82sTFBTGf b8PpCYcNIHxNmjlPPPh1iiv3uujfYNBfwekqhaLLh+gKirRINQ E2AWiRGLNkbKd6uXQgLY9OVAfVq0Sh33YXg+xm1Z12RI4R7ZMC isJmN0ESGERScrbB69hUaxieL5VcrQF4sKqw51PH9 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik Subject: Re: svn commit: r238539 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 12:11:11 -0000 On 7/17/12 0:10 , Attilio Rao wrote: > 2012/7/16 Christian Brueffer : >> Author: brueffer >> Date: Mon Jul 16 22:07:29 2012 >> New Revision: 238539 >> URL: http://svn.freebsd.org/changeset/base/238539 >> >> Log: >> Simply error handling by moving the allocation of np down to where it is >> actually used. While here, improve style a little. > > Too bad that the biggest bug here is still in place. > Right now smbfs inserts in the mount list half-constructed vnodes. > Maybe you are interested in fixing this? > I can give it a shot, no promises though. Cheers, Chris From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 12:23:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D0851065674; Wed, 18 Jul 2012 12:23:46 +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 8693B8FC0C; Wed, 18 Jul 2012 12:23:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ICNkAB069934; Wed, 18 Jul 2012 12:23:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ICNkGG069932; Wed, 18 Jul 2012 12:23:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207181223.q6ICNkGG069932@svn.freebsd.org> From: Alexander Motin Date: Wed, 18 Jul 2012 12:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238595 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 12:23:46 -0000 Author: mav Date: Wed Jul 18 12:23:45 2012 New Revision: 238595 URL: http://svn.freebsd.org/changeset/base/238595 Log: Add bunch of new ASC/ASCQ values from T10 site. Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed Jul 18 11:36:59 2012 (r238594) +++ head/sys/cam/scsi/scsi_all.c Wed Jul 18 12:23:45 2012 (r238595) @@ -768,7 +768,7 @@ static struct asc_table_entry asc_table[ * * SCSI ASC/ASCQ Assignments * Numeric Sorted Listing - * as of 7/29/08 + * as of 5/20/12 * * D - DIRECT ACCESS DEVICE (SBC-2) device column key * .T - SEQUENTIAL ACCESS DEVICE (SSC) ------------------- @@ -854,6 +854,12 @@ static struct asc_table_entry asc_table[ /* DT R MAEBKV */ { SST(0x00, 0x1E, SS_RDEF, /* XXX TBD */ "Conflicting SA creation request") }, + /* DT B */ + { SST(0x00, 0x1F, SS_RDEF, /* XXX TBD */ + "Logical unit transitioning to another power condition") }, + /* DT P B */ + { SST(0x00, 0x20, SS_RDEF, /* XXX TBD */ + "Extended copy information available") }, /* D W O BK */ { SST(0x01, 0x00, SS_RDEF, "No index/sector signal") }, @@ -923,6 +929,33 @@ static struct asc_table_entry asc_table[ /* DT R MAEBKV */ { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ "Logical unit not ready, SA creation in progress") }, + /* D B */ + { SST(0x04, 0x14, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, space allocation in progress") }, + /* M */ + { SST(0x04, 0x15, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, robotics disabled") }, + /* M */ + { SST(0x04, 0x16, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, configuration required") }, + /* M */ + { SST(0x04, 0x17, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, calibration required") }, + /* M */ + { SST(0x04, 0x18, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, a door is open") }, + /* M */ + { SST(0x04, 0x19, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, operating in sequential mode") }, + /* DT B */ + { SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, START/STOP UNIT command in progress") }, + /* D B */ + { SST(0x04, 0x1B, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, sanitize in progress") }, + /* DT MAEB */ + { SST(0x04, 0x1C, SS_RDEF, /* XXX TBD */ + "Logical unit not ready, additional power use not yet granted") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -989,6 +1022,12 @@ static struct asc_table_entry asc_table[ /* DTLPWROMAEBKVF */ { SST(0x0B, 0x07, SS_RDEF, /* XXX TBD */ "Warning - degraded power to non-volatile cache") }, + /* DTLPWROMAEBKVF */ + { SST(0x0B, 0x08, SS_RDEF, /* XXX TBD */ + "Warning - power loss expected") }, + /* D */ + { SST(0x0B, 0x09, SS_RDEF, /* XXX TBD */ + "Warning - device statistics notification available") }, /* T R */ { SST(0x0C, 0x00, SS_RDEF, "Write error") }, @@ -1031,6 +1070,9 @@ static struct asc_table_entry asc_table[ /* DTLPWRO AEBKVF */ { SST(0x0C, 0x0D, SS_RDEF, /* XXX TBD */ "Write error - not enough unsolicited data") }, + /* DT W O BK */ + { SST(0x0C, 0x0E, SS_RDEF, /* XXX TBD */ + "Multiple write errors") }, /* R */ { SST(0x0C, 0x0F, SS_RDEF, /* XXX TBD */ "Defects in error window") }, @@ -1076,6 +1118,12 @@ static struct asc_table_entry asc_table[ /* DT W O */ { SST(0x10, 0x03, SS_RDEF, /* XXX TBD */ "Logical block reference tag check failed") }, + /* T */ + { SST(0x10, 0x04, SS_RDEF, /* XXX TBD */ + "Logical block protection error on recovered buffer data") }, + /* T */ + { SST(0x10, 0x05, SS_RDEF, /* XXX TBD */ + "Logical block protection method error") }, /* DT WRO BK */ { SST(0x11, 0x00, SS_FATAL|EIO, "Unrecovered read error") }, @@ -1280,6 +1328,9 @@ static struct asc_table_entry asc_table[ /* DT WRO BK */ { SST(0x1D, 0x00, SS_FATAL, "Miscompare during verify operation") }, + /* D B */ + { SST(0x1D, 0x01, SS_RDEF, /* XXX TBD */ + "Miscomparable verify of unmapped LBA") }, /* D W O BK */ { SST(0x1E, 0x00, SS_NOP | SSQ_PRINT_SENSE, "Recovered ID with ECC correction") }, @@ -1322,6 +1373,9 @@ static struct asc_table_entry asc_table[ /* DT PWROMAEBK */ { SST(0x20, 0x0B, SS_RDEF, /* XXX TBD */ "Access denied - ACL LUN conflict") }, + /* T */ + { SST(0x20, 0x0C, SS_FATAL | EINVAL, + "Illegal command when not in append-only mode") }, /* DT WRO BK */ { SST(0x21, 0x00, SS_FATAL | EINVAL, "Logical block address out of range") }, @@ -1337,6 +1391,39 @@ static struct asc_table_entry asc_table[ /* D */ { SST(0x22, 0x00, SS_FATAL | EINVAL, "Illegal function (use 20 00, 24 00, or 26 00)") }, + /* DT P B */ + { SST(0x23, 0x00, SS_RDEF, /* XXX TBD */ + "Invalid token operation, cause not reportable") }, + /* DT P B */ + { SST(0x23, 0x01, SS_RDEF, /* XXX TBD */ + "Invalid token operation, unsupported token type") }, + /* DT P B */ + { SST(0x23, 0x02, SS_RDEF, /* XXX TBD */ + "Invalid token operation, remote token usage not supported") }, + /* DT P B */ + { SST(0x23, 0x03, SS_RDEF, /* XXX TBD */ + "Invalid token operation, remote ROD token creation not supported") }, + /* DT P B */ + { SST(0x23, 0x04, SS_RDEF, /* XXX TBD */ + "Invalid token operation, token unknown") }, + /* DT P B */ + { SST(0x23, 0x05, SS_RDEF, /* XXX TBD */ + "Invalid token operation, token corrupt") }, + /* DT P B */ + { SST(0x23, 0x06, SS_RDEF, /* XXX TBD */ + "Invalid token operation, token revoked") }, + /* DT P B */ + { SST(0x23, 0x07, SS_RDEF, /* XXX TBD */ + "Invalid token operation, token expired") }, + /* DT P B */ + { SST(0x23, 0x08, SS_RDEF, /* XXX TBD */ + "Invalid token operation, token cancelled") }, + /* DT P B */ + { SST(0x23, 0x09, SS_RDEF, /* XXX TBD */ + "Invalid token operation, token deleted") }, + /* DT P B */ + { SST(0x23, 0x0A, SS_RDEF, /* XXX TBD */ + "Invalid token operation, invalid token length") }, /* DTLPWROMAEBKVF */ { SST(0x24, 0x00, SS_FATAL | EINVAL, "Invalid field in CDB") }, @@ -1445,6 +1532,9 @@ static struct asc_table_entry asc_table[ /* R F */ { SST(0x27, 0x06, SS_RDEF, /* XXX TBD */ "Conditional write protect") }, + /* D B */ + { SST(0x27, 0x07, SS_RDEF, /* XXX TBD */ + "Space allocation failed write protect") }, /* DTLPWROMAEBKVF */ { SST(0x28, 0x00, SS_FATAL | ENXIO, "Not ready to ready change, medium may have changed") }, @@ -1543,6 +1633,9 @@ static struct asc_table_entry asc_table[ /* DT R MAEBKV */ { SST(0x2A, 0x14, SS_RDEF, /* XXX TBD */ "SA creation capabilities data has changed") }, + /* T M V */ + { SST(0x2A, 0x15, SS_RDEF, /* XXX TBD */ + "Medium removal prevention preempted") }, /* DTLPWRO K */ { SST(0x2B, 0x00, SS_RDEF, "Copy cannot execute since host cannot disconnect") }, @@ -1582,6 +1675,9 @@ static struct asc_table_entry asc_table[ /* T */ { SST(0x2C, 0x0B, SS_RDEF, /* XXX TBD */ "Not reserved") }, + /* D */ + { SST(0x2C, 0x0C, SS_RDEF, /* XXX TBD */ + "ORWRITE generation does not match") }, /* T */ { SST(0x2D, 0x00, SS_RDEF, "Overwrite error on update in place") }, @@ -1645,6 +1741,9 @@ static struct asc_table_entry asc_table[ /* M */ { SST(0x30, 0x12, SS_RDEF, /* XXX TBD */ "Incompatible volume qualifier") }, + /* M */ + { SST(0x30, 0x13, SS_RDEF, /* XXX TBD */ + "Cleaning volume expired") }, /* DT WRO BK */ { SST(0x31, 0x00, SS_RDEF, "Medium format corrupted") }, @@ -1654,6 +1753,9 @@ static struct asc_table_entry asc_table[ /* R */ { SST(0x31, 0x02, SS_RDEF, /* XXX TBD */ "Zoned formatting failed due to spare linking") }, + /* D B */ + { SST(0x31, 0x03, SS_RDEF, /* XXX TBD */ + "SANITIZE command failed") }, /* D W O BK */ { SST(0x32, 0x00, SS_RDEF, "No defect spare location available") }, @@ -1702,6 +1804,9 @@ static struct asc_table_entry asc_table[ /* B */ { SST(0x38, 0x06, SS_RDEF, /* XXX TBD */ "ESN - device busy class event") }, + /* D */ + { SST(0x38, 0x07, SS_RDEF, /* XXX TBD */ + "Thin provisioning soft threshold reached") }, /* DTL WROMAE K */ { SST(0x39, 0x00, SS_RDEF, "Saving parameters not supported") }, @@ -1801,6 +1906,9 @@ static struct asc_table_entry asc_table[ /* M */ { SST(0x3B, 0x1B, SS_RDEF, /* XXX TBD */ "Data transfer device inserted") }, + /* T */ + { SST(0x3B, 0x1C, SS_RDEF, /* XXX TBD */ + "Too many logical objects on partition to support operation") }, /* DTLPWROMAE K */ { SST(0x3D, 0x00, SS_RDEF, "Invalid bits in IDENTIFY message") }, @@ -1904,6 +2012,9 @@ static struct asc_table_entry asc_table[ /* DTLPWROMAEBKVF */ { SST(0x44, 0x00, SS_RDEF, "Internal target failure") }, + /* DT P MAEBKVF */ + { SST(0x44, 0x01, SS_RDEF, /* XXX TBD */ + "Persistent reservation information lost") }, /* DT B */ { SST(0x44, 0x71, SS_RDEF, /* XXX TBD */ "ATA device failed set features") }, @@ -1967,6 +2078,27 @@ static struct asc_table_entry asc_table[ /* DT PWROMAEBK */ { SST(0x4B, 0x06, SS_RDEF, /* XXX TBD */ "Initiator response timeout") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x07, SS_RDEF, /* XXX TBD */ + "Connection lost") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x08, SS_RDEF, /* XXX TBD */ + "Data-in buffer overflow - data buffer size") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x09, SS_RDEF, /* XXX TBD */ + "Data-in buffer overflow - data buffer descriptor area") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x0A, SS_RDEF, /* XXX TBD */ + "Data-in buffer error") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x0B, SS_RDEF, /* XXX TBD */ + "Data-out buffer overflow - data buffer size") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x0C, SS_RDEF, /* XXX TBD */ + "Data-out buffer overflow - data buffer descriptor area") }, + /* DT PWROMAEBK F */ + { SST(0x4B, 0x0D, SS_RDEF, /* XXX TBD */ + "Data-out buffer error") }, /* DTLPWROMAEBKVF */ { SST(0x4C, 0x00, SS_RDEF, "Logical unit failed self-configuration") }, @@ -2012,6 +2144,18 @@ static struct asc_table_entry asc_table[ /* T */ { SST(0x53, 0x04, SS_RDEF, /* XXX TBD */ "Medium thread or unthread failure") }, + /* M */ + { SST(0x53, 0x05, SS_RDEF, /* XXX TBD */ + "Volume identifier invalid") }, + /* T */ + { SST(0x53, 0x06, SS_RDEF, /* XXX TBD */ + "Volume identifier missing") }, + /* M */ + { SST(0x53, 0x07, SS_RDEF, /* XXX TBD */ + "Duplicate volume identifier") }, + /* M */ + { SST(0x53, 0x08, SS_RDEF, /* XXX TBD */ + "Element status unknown") }, /* P */ { SST(0x54, 0x00, SS_RDEF, "SCSI to host system interface failure") }, @@ -2048,6 +2192,15 @@ static struct asc_table_entry asc_table[ /* M */ { SST(0x55, 0x0A, SS_RDEF, /* XXX TBD */ "Data currently unavailable") }, + /* DTLPWROMAEBKVF */ + { SST(0x55, 0x0B, SS_RDEF, /* XXX TBD */ + "Insufficient power for operation") }, + /* DT P B */ + { SST(0x55, 0x0C, SS_RDEF, /* XXX TBD */ + "Insufficient reources to create ROD") }, + /* DT P B */ + { SST(0x55, 0x0D, SS_RDEF, /* XXX TBD */ + "Insufficient reources to create ROD token") }, /* R */ { SST(0x57, 0x00, SS_RDEF, "Unable to recover table-of-contents") }, @@ -2354,6 +2507,24 @@ static struct asc_table_entry asc_table[ /* DTLPWRO A K */ { SST(0x5E, 0x04, SS_RDEF, "Standby condition activated by command") }, + /* DTLPWRO A K */ + { SST(0x5E, 0x05, SS_RDEF, + "Idle-B condition activated by timer") }, + /* DTLPWRO A K */ + { SST(0x5E, 0x06, SS_RDEF, + "Idle-B condition activated by command") }, + /* DTLPWRO A K */ + { SST(0x5E, 0x07, SS_RDEF, + "Idle-C condition activated by timer") }, + /* DTLPWRO A K */ + { SST(0x5E, 0x08, SS_RDEF, + "Idle-C condition activated by command") }, + /* DTLPWRO A K */ + { SST(0x5E, 0x09, SS_RDEF, + "Stabdby-Y condition activated by timer") }, + /* DTLPWRO A K */ + { SST(0x5E, 0x0A, SS_RDEF, + "Standby-Y condition activated by command") }, /* B */ { SST(0x5E, 0x41, SS_RDEF, /* XXX TBD */ "Power state change to active") }, From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 12:41:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04D41106566C; Wed, 18 Jul 2012 12:41:10 +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 E4C2B8FC0A; Wed, 18 Jul 2012 12:41:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ICf98Q071587; Wed, 18 Jul 2012 12:41:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ICf9tg071584; Wed, 18 Jul 2012 12:41:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207181241.q6ICf9tg071584@svn.freebsd.org> From: Alexander Motin Date: Wed, 18 Jul 2012 12:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238596 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 12:41:10 -0000 Author: mav Date: Wed Jul 18 12:41:09 2012 New Revision: 238596 URL: http://svn.freebsd.org/changeset/base/238596 Log: Fix some typos in r238595. Reported by: brueffer Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed Jul 18 12:23:45 2012 (r238595) +++ head/sys/cam/scsi/scsi_all.c Wed Jul 18 12:41:09 2012 (r238596) @@ -2197,10 +2197,10 @@ static struct asc_table_entry asc_table[ "Insufficient power for operation") }, /* DT P B */ { SST(0x55, 0x0C, SS_RDEF, /* XXX TBD */ - "Insufficient reources to create ROD") }, + "Insufficient resources to create ROD") }, /* DT P B */ { SST(0x55, 0x0D, SS_RDEF, /* XXX TBD */ - "Insufficient reources to create ROD token") }, + "Insufficient resources to create ROD token") }, /* R */ { SST(0x57, 0x00, SS_RDEF, "Unable to recover table-of-contents") }, @@ -2521,7 +2521,7 @@ static struct asc_table_entry asc_table[ "Idle-C condition activated by command") }, /* DTLPWRO A K */ { SST(0x5E, 0x09, SS_RDEF, - "Stabdby-Y condition activated by timer") }, + "Standby-Y condition activated by timer") }, /* DTLPWRO A K */ { SST(0x5E, 0x0A, SS_RDEF, "Standby-Y condition activated by command") }, From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 15:36:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A2511065680; Wed, 18 Jul 2012 15:36: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 45F038FC19; Wed, 18 Jul 2012 15:36:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IFa41Q084776; Wed, 18 Jul 2012 15:36:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IFa45h084774; Wed, 18 Jul 2012 15:36:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207181536.q6IFa45h084774@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 18 Jul 2012 15:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238597 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 15:36:04 -0000 Author: kib Date: Wed Jul 18 15:36:03 2012 New Revision: 238597 URL: http://svn.freebsd.org/changeset/base/238597 Log: Add stmxcsr. Submitted by: Ed Alley PR: amd64/169927 MFC after: 3 weeks Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Wed Jul 18 12:41:09 2012 (r238596) +++ head/sys/amd64/amd64/fpu.c Wed Jul 18 15:36:03 2012 (r238597) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr)) +#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : : "m" (*(addr))) static __inline void xrstor(char *addr, uint64_t mask) @@ -105,6 +106,7 @@ void fnstsw(caddr_t addr); void fxsave(caddr_t addr); void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); +void stmxcsr(u_int csr); void xrstor(char *addr, uint64_t mask); void xsave(char *addr, uint64_t mask); From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 15:43:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD1351065677; Wed, 18 Jul 2012 15:43:47 +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 B71D48FC08; Wed, 18 Jul 2012 15:43:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IFhlhN085359; Wed, 18 Jul 2012 15:43:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IFhlZh085355; Wed, 18 Jul 2012 15:43:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207181543.q6IFhlZh085355@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 18 Jul 2012 15:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238598 - in head/sys/amd64: amd64 include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 15:43:47 -0000 Author: kib Date: Wed Jul 18 15:43:47 2012 New Revision: 238598 URL: http://svn.freebsd.org/changeset/base/238598 Log: On AMD64, provide siginfo.si_code for floating point errors when error occurs using the SSE math processor. Update comments describing the handling of the exception status bits in coprocessors control words. Remove GET_FPU_CW and GET_FPU_SW macros which were used only once. Prefer to use curpcb to access pcb_save over the longer path of referencing pcb through the thread structure. Based on the submission by: Ed Alley PR: amd64/169927 Reviewed by: bde MFC after: 3 weeks Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/trap.c head/sys/amd64/include/fpu.h Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Wed Jul 18 15:36:03 2012 (r238597) +++ head/sys/amd64/amd64/fpu.c Wed Jul 18 15:43:47 2012 (r238598) @@ -115,9 +115,6 @@ void xsave(char *addr, uint64_t mask); #define start_emulating() load_cr0(rcr0() | CR0_TS) #define stop_emulating() clts() -#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw) -#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw) - CTASSERT(sizeof(struct savefpu) == 512); CTASSERT(sizeof(struct xstate_hdr) == 64); CTASSERT(sizeof(struct savefpu_ymm) == 832); @@ -516,11 +513,15 @@ static char fpetable[128] = { }; /* - * Preserve the FP status word, clear FP exceptions, then generate a SIGFPE. + * Preserve the FP status word, clear FP exceptions for x87, then + * generate a SIGFPE. + * + * Clearing exceptions was necessary mainly to avoid IRQ13 bugs and is + * engraved in our i386 ABI. We now depend on longjmp() restoring a + * usable state. Restoring the state or examining it might fail if we + * didn't clear exceptions. * - * Clearing exceptions is necessary mainly to avoid IRQ13 bugs. We now - * depend on longjmp() restoring a usable state. Restoring the state - * or examining it might fail if we didn't clear exceptions. + * For SSE exceptions, the exceptions are not cleared. * * The error code chosen will be one of the FPE_... macros. It will be * sent as the second argument to old BSD-style signal handlers and as @@ -533,8 +534,9 @@ static char fpetable[128] = { * solution for signals other than SIGFPE. */ int -fputrap() +fputrap_x87(void) { + struct savefpu *pcb_save; u_short control, status; critical_enter(); @@ -545,19 +547,33 @@ fputrap() * wherever they are. */ if (PCPU_GET(fpcurthread) != curthread) { - control = GET_FPU_CW(curthread); - status = GET_FPU_SW(curthread); + pcb_save = PCPU_GET(curpcb)->pcb_save; + control = pcb_save->sv_env.en_cw; + status = pcb_save->sv_env.en_sw; } else { fnstcw(&control); fnstsw(&status); + fnclex(); } - if (PCPU_GET(fpcurthread) == curthread) - fnclex(); critical_exit(); return (fpetable[status & ((~control & 0x3f) | 0x40)]); } +int +fputrap_sse(void) +{ + u_int mxcsr; + + critical_enter(); + if (PCPU_GET(fpcurthread) != curthread) + mxcsr = PCPU_GET(curpcb)->pcb_save->sv_env.en_mxcsr; + else + stmxcsr(&mxcsr); + critical_exit(); + return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]); +} + /* * Implement device not available (DNA) exception * Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Wed Jul 18 15:36:03 2012 (r238597) +++ head/sys/amd64/amd64/trap.c Wed Jul 18 15:43:47 2012 (r238598) @@ -328,7 +328,7 @@ trap(struct trapframe *frame) break; case T_ARITHTRAP: /* arithmetic trap */ - ucode = fputrap(); + ucode = fputrap_x87(); if (ucode == -1) goto userout; i = SIGFPE; @@ -442,7 +442,9 @@ trap(struct trapframe *frame) break; case T_XMMFLT: /* SIMD floating-point exception */ - ucode = 0; /* XXX */ + ucode = fputrap_sse(); + if (ucode == -1) + goto userout; i = SIGFPE; break; } Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Wed Jul 18 15:36:03 2012 (r238597) +++ head/sys/amd64/include/fpu.h Wed Jul 18 15:43:47 2012 (r238598) @@ -62,7 +62,8 @@ int fpusetregs(struct thread *td, struct char *xfpustate, size_t xfpustate_size); int fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size); -int fputrap(void); +int fputrap_sse(void); +int fputrap_x87(void); void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 15:52:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1AFF71065677; Wed, 18 Jul 2012 15:52:10 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05B6F8FC16; Wed, 18 Jul 2012 15:52:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IFq9GC086115; Wed, 18 Jul 2012 15:52:09 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IFq9TP086113; Wed, 18 Jul 2012 15:52:09 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201207181552.q6IFq9TP086113@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 18 Jul 2012 15:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238599 - head/lib/libc/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 15:52:10 -0000 Author: emax Date: Wed Jul 18 15:52:09 2012 New Revision: 238599 URL: http://svn.freebsd.org/changeset/base/238599 Log: Return zero from get_addrselectpolicy() when no source-address-selection policy is installed. MFC after: 1 week Modified: head/lib/libc/net/getaddrinfo.c Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Wed Jul 18 15:43:47 2012 (r238598) +++ head/lib/libc/net/getaddrinfo.c Wed Jul 18 15:52:09 2012 (r238599) @@ -692,6 +692,8 @@ get_addrselectpolicy(struct policyhead * if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) return (0); + if (l == 0) + return (0); if ((buf = malloc(l)) == NULL) return (0); if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) { From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 18:10:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91E8B1065672; Wed, 18 Jul 2012 18:10:28 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CB138FC14; Wed, 18 Jul 2012 18:10:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IIAStD096860; Wed, 18 Jul 2012 18:10:28 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IIASs1096858; Wed, 18 Jul 2012 18:10:28 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201207181810.q6IIASs1096858@svn.freebsd.org> From: Sean Bruno Date: Wed, 18 Jul 2012 18:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238601 - head/sys/dev/aac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 18:10:28 -0000 Author: sbruno Date: Wed Jul 18 18:10:27 2012 New Revision: 238601 URL: http://svn.freebsd.org/changeset/base/238601 Log: On BIO_ERROR, set bio_resid to stop losing data in the error case. Submitted by: Mark Johnston Reviewed by: scottl@freebsd.org MFC after: 2 weeks Modified: head/sys/dev/aac/aac_disk.c Modified: head/sys/dev/aac/aac_disk.c ============================================================================== --- head/sys/dev/aac/aac_disk.c Wed Jul 18 16:13:03 2012 (r238600) +++ head/sys/dev/aac/aac_disk.c Wed Jul 18 18:10:27 2012 (r238601) @@ -334,8 +334,10 @@ aac_biodone(struct bio *bp) { fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - if (bp->bio_flags & BIO_ERROR) + if (bp->bio_flags & BIO_ERROR) { + bp->bio_resid = bp->bio_bcount; disk_err(bp, "hard error", -1, 1); + } biodone(bp); } From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 19:28:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E406B106564A; Wed, 18 Jul 2012 19:28:22 +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 B50B68FC0C; Wed, 18 Jul 2012 19:28:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IJSM6t003203; Wed, 18 Jul 2012 19:28:22 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IJSMgZ003200; Wed, 18 Jul 2012 19:28:22 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201207181928.q6IJSMgZ003200@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 18 Jul 2012 19:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238602 - head/usr.bin/du X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 19:28:23 -0000 Author: des Date: Wed Jul 18 19:28:22 2012 New Revision: 238602 URL: http://svn.freebsd.org/changeset/base/238602 Log: Add -g (gigabyte) flag to complement -k (kilobyte) and -m (megabyte). MFC after: 1 week Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Wed Jul 18 18:10:27 2012 (r238601) +++ head/usr.bin/du/du.1 Wed Jul 18 19:28:22 2012 (r238602) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd December 17, 2011 +.Dd July 18, 2012 .Dt DU 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Nm .Op Fl Aclnx .Op Fl H | L | P -.Op Fl h | k | m +.Op Fl g | h | k | m .Op Fl a | s | d Ar depth .Op Fl B Ar blocksize .Op Fl I Ar mask @@ -63,9 +63,9 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl h, k +.Fl h, k, m and -.Fl m +.Fl g options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -95,13 +95,15 @@ Display a grand total. Display an entry for all files and directories .Ar depth directories deep. +.It Fl g +Display block counts in 1073741824-byte (1 GiB) blocks. .It Fl h .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte. .It Fl k -Display block counts in 1024-byte (1-Kbyte) blocks. +Display block counts in 1024-byte (1 kiB) blocks. .It Fl l If a file has multiple hard links, count its size multiple times. The default behavior of @@ -112,7 +114,7 @@ When the option is specified, the hard link checks are disabled, and these files are counted (and displayed) as many times as they are found. .It Fl m -Display block counts in 1048576-byte (1-Mbyte) blocks. +Display block counts in 1048576-byte (1 MiB) blocks. .It Fl n Ignore files and directories with user .Dq nodump Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Wed Jul 18 18:10:27 2012 (r238601) +++ head/usr.bin/du/du.c Wed Jul 18 19:28:22 2012 (r238602) @@ -109,7 +109,7 @@ main(int argc, char *argv[]) depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrt:x")) != -1) + while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1) switch (ch) { case 'A': Aflag = 1; @@ -156,6 +156,10 @@ main(int argc, char *argv[]) case 'c': cflag = 1; break; + case 'g': + hflag = 0; + blocksize = 1073741824; + break; case 'h': hflag = 1; break; From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 21:30:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C9A98106566B; Wed, 18 Jul 2012 21:30:17 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3D358FC15; Wed, 18 Jul 2012 21:30:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ILUHPr013124; Wed, 18 Jul 2012 21:30:17 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ILUHDx013116; Wed, 18 Jul 2012 21:30:17 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201207182130.q6ILUHDx013116@svn.freebsd.org> From: Joerg Wunsch Date: Wed, 18 Jul 2012 21:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238603 - in head/share/examples: . libusb20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 21:30:17 -0000 Author: joerg Date: Wed Jul 18 21:30:17 2012 New Revision: 238603 URL: http://svn.freebsd.org/changeset/base/238603 Log: Add some examples about how to use FreeBSD's libusb20 in your own code. Added: head/share/examples/libusb20/ head/share/examples/libusb20/Makefile (contents, props changed) head/share/examples/libusb20/README (contents, props changed) head/share/examples/libusb20/aux.c (contents, props changed) head/share/examples/libusb20/aux.h (contents, props changed) head/share/examples/libusb20/bulk.c (contents, props changed) head/share/examples/libusb20/control.c (contents, props changed) Modified: head/share/examples/Makefile Modified: head/share/examples/Makefile ============================================================================== --- head/share/examples/Makefile Wed Jul 18 19:28:22 2012 (r238602) +++ head/share/examples/Makefile Wed Jul 18 21:30:17 2012 (r238603) @@ -20,6 +20,7 @@ LDIRS= BSD_daemon \ ipfw \ jails \ kld \ + libusb20 \ libvgl \ mdoc \ netgraph \ @@ -110,6 +111,12 @@ XFILES= BSD_daemon/FreeBSD.pfa \ kld/syscall/module/syscall.c \ kld/syscall/test/Makefile \ kld/syscall/test/call.c \ + libusb20/Makefile \ + libusb20/README \ + libusb20/aux.c \ + libusb20/aux.h \ + libusb20/bulk.c \ + libusb20/control.c \ libvgl/Makefile \ libvgl/demo.c \ mdoc/POSIX-copyright \ Added: head/share/examples/libusb20/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/libusb20/Makefile Wed Jul 18 21:30:17 2012 (r238603) @@ -0,0 +1,13 @@ +# $FreeBSD$ +TARGETS= bulk control + +all: $(TARGETS) + +bulk: bulk.o aux.o + $(CC) $(CFLAGS) -o bulk bulk.o aux.o -lusb + +control: control.o aux.o + $(CC) $(CFLAGS) -o control control.o aux.o -lusb + +clean: + rm -f $(TARGETS) *.o *~ Added: head/share/examples/libusb20/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/libusb20/README Wed Jul 18 21:30:17 2012 (r238603) @@ -0,0 +1,42 @@ +As I dug my own way through the documentation of libusb 2.0 that ships +with FreeBSD 8+ as the OS'es own USB library API, I noticed there are +only few code examples around under /usr/src (namely, usbconfig +itself). + +The libusb20(3) man page is a starting point, but it's a reference +manual, nothing less, nothing more. Using just a reference, it's not +very easy to start writing your own code based on that. + +So I started writing my own examples, to "get a feeling" about how to +use the library. I covered two typical scenarios which are common for +a number of devices. + +The first one is called "bulk", and uses bulk output (host to device) +and input transfers to talk to an USB device. + +The second one is called "control", and can use both control output +and input transfers, as well as so-called interrupt transfers. The +latter are used for data that are being reported frequently or +repeatedly, like position updates from a pointing device (mouse). +Despite of its name, the host has to poll devices for their interrupt +transfers on each USB frame (i.e., each 1 ms). + +Recommended reading is the USB 3.0 specification (the older 2.0 one +would do as well), to be found under + +http://www.usb.org/developers/docs/ + +as well as documents for individual USB device classes where +appropriate. + +Feel free to be liberal in the licensing of these examples: while the +beer-ware license mandates to keep the license notice, this only +applies to modifications of the original examples itself. For +copy&pasting (even a larger) piece of an example into your own work, I +won't imply you have to reproduce the beer-ware license text there. +Feel free to credit my name in your derived work if you want. + +Dresden, July 2012 +Joerg Wunsch + +# $FreeBSD$ Added: head/share/examples/libusb20/aux.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/libusb20/aux.c Wed Jul 18 21:30:17 2012 (r238603) @@ -0,0 +1,120 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +/* + * Helper functions common to all examples + */ + +#include +#include +#include + +#include +#include + +#include "aux.h" + +/* + * Return a textual description for error "r". + */ +const char * +usb_error(enum libusb20_error r) +{ + const char *msg = "UNKNOWN"; + + switch (r) + { + case LIBUSB20_SUCCESS: + msg = "success"; + break; + + case LIBUSB20_ERROR_IO: + msg = "IO error"; + break; + + case LIBUSB20_ERROR_INVALID_PARAM: + msg = "Invalid parameter"; + break; + + case LIBUSB20_ERROR_ACCESS: + msg = "Access denied"; + break; + + case LIBUSB20_ERROR_NO_DEVICE: + msg = "No such device"; + break; + + case LIBUSB20_ERROR_NOT_FOUND: + msg = "Entity not found"; + break; + + case LIBUSB20_ERROR_BUSY: + msg = "Resource busy"; + break; + + case LIBUSB20_ERROR_TIMEOUT: + msg = "Operation timed out"; + break; + + case LIBUSB20_ERROR_OVERFLOW: + msg = "Overflow"; + break; + + case LIBUSB20_ERROR_PIPE: + msg = "Pipe error"; + break; + + case LIBUSB20_ERROR_INTERRUPTED: + msg = "System call interrupted"; + break; + + case LIBUSB20_ERROR_NO_MEM: + msg = "Insufficient memory"; + break; + + case LIBUSB20_ERROR_NOT_SUPPORTED: + msg = "Operation not supported"; + break; + + case LIBUSB20_ERROR_OTHER: + msg = "Other error"; + break; + } + + return msg; +} + +/* + * Print "len" bytes from "buf" in hex, followed by an ASCII + * representation (somewhat resembling the output of hd(1)). + */ +void +print_formatted(uint8_t *buf, uint32_t len) +{ + int i, j; + + for (j = 0; j < len; j += 16) + { + printf("%02x: ", j); + + for (i = 0; i < 16 && i + j < len; i++) + printf("%02x ", buf[i + j]); + printf(" "); + for (i = 0; i < 16 && i + j < len; i++) + { + uint8_t c = buf[i + j]; + if(c >= ' ' && c <= '~') + printf("%c", (char)c); + else + putchar('.'); + } + putchar('\n'); + } +} Added: head/share/examples/libusb20/aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/libusb20/aux.h Wed Jul 18 21:30:17 2012 (r238603) @@ -0,0 +1,15 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +#include +#include + +const char *usb_error(enum libusb20_error r); +void print_formatted(uint8_t *buf, uint32_t len); Added: head/share/examples/libusb20/bulk.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/libusb20/bulk.c Wed Jul 18 21:30:17 2012 (r238603) @@ -0,0 +1,243 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +/* + * Simple demo program to illustrate the handling of FreeBSD's + * libusb20. + * + * Issues a bulk output, and then requests a bulk input. + */ + +/* + * Examples: + * Just list all VID:PID pairs + * ./bulk + * + * Say "hello" to an Atmel JTAGICEmkII. + * ./bulk -o 2 -i 0x82 -v 0x03eb -p 0x2103 0x1b 0 0 1 0 0 0 0x0e 1 0xf3 0x97 + * + * Return the INQUIRY data of an USB mass storage device. + * (It's best to have the umass(4) driver unloaded while doing such + * experiments, and perform a "usbconfig reset" for the device if it + * gets stuck.) + * ./bulk -v 0x5e3 -p 0x723 -i 0x81 -o 2 0x55 0x53 0x42 0x43 1 2 3 4 31 12 0x80 0x24 0 0 0 0x12 0 0 0 36 0 0 0 0 0 0 0 0 0 0 + */ + + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "aux.h" + +/* + * If you want to see the details of the internal datastructures + * in the debugger, unifdef the following. + */ +#ifdef DEBUG +# include +# include "/usr/src/lib/libusb/libusb20_int.h" +#endif + +#define BUFLEN 64 + +#define TIMEOUT 5000 /* 5 s */ + +int in_ep, out_ep; /* endpoints */ +uint8_t out_buf[BUFLEN]; +uint16_t out_len; + +static void +doit(struct libusb20_device *dev) +{ + int rv; + + /* + * Open the device, allocating memory for two possible (bulk or + * interrupt) transfers. + * + * If only control transfers are intended (via + * libusb20_dev_request_sync()), transfer_max can be given as 0. + */ + if ((rv = libusb20_dev_open(dev, 2)) != 0) + { + fprintf(stderr, "libusb20_dev_open: %s\n", usb_error(rv)); + return; + } + + /* + * If the device has more than one configuration, select the desired + * one here. + */ + if ((rv = libusb20_dev_set_config_index(dev, 0)) != 0) + { + fprintf(stderr, "libusb20_dev_set_config_index: %s\n", usb_error(rv)); + return; + } + + /* + * Two transfers have been requested in libusb20_dev_open() above; + * obtain the corresponding transfer struct pointers. + */ + struct libusb20_transfer *xfr_out = libusb20_tr_get_pointer(dev, 0); + struct libusb20_transfer *xfr_in = libusb20_tr_get_pointer(dev, 1); + + if (xfr_in == NULL || xfr_out == NULL) + { + fprintf(stderr, "libusb20_tr_get_pointer: %s\n", usb_error(rv)); + return; + } + + /* + * Open both transfers, the "out" one for the write endpoint, the + * "in" one for the read endpoint (ep | 0x80). + */ + if ((rv = libusb20_tr_open(xfr_out, 0, 1, out_ep)) != 0) + { + fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv)); + return; + } + if ((rv = libusb20_tr_open(xfr_in, 0, 1, in_ep)) != 0) + { + fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv)); + return; + } + + uint8_t in_buf[BUFLEN]; + uint32_t rlen; + + if (out_len > 0) + { + if ((rv = libusb20_tr_bulk_intr_sync(xfr_out, out_buf, out_len, &rlen, TIMEOUT)) + != 0) + { + fprintf(stderr, "libusb20_tr_bulk_intr_sync (OUT): %s\n", usb_error(rv)); + } + printf("sent %d bytes\n", rlen); + } + + if ((rv = libusb20_tr_bulk_intr_sync(xfr_in, in_buf, BUFLEN, &rlen, TIMEOUT)) + != 0) + { + fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", usb_error(rv)); + } + printf("received %d bytes\n", rlen); + if (rlen > 0) + print_formatted(in_buf, rlen); + + libusb20_tr_close(xfr_out); + libusb20_tr_close(xfr_in); + + libusb20_dev_close(dev); +} + +static void +usage(void) +{ + fprintf(stderr, + "Usage ./usb -i -o -v -p [ ...\n]"); + exit(EX_USAGE); +} + +int +main(int argc, char **argv) +{ + unsigned int vid = UINT_MAX, pid = UINT_MAX; /* impossible VID:PID */ + int c; + + while ((c = getopt(argc, argv, "i:o:p:v:")) != -1) + switch (c) + { + case 'i': + in_ep = strtol(optarg, NULL, 0); + break; + + case 'o': + out_ep = strtol(optarg, NULL, 0); + break; + + case 'p': + pid = strtol(optarg, NULL, 0); + break; + + case 'v': + vid = strtol(optarg, NULL, 0); + break; + + default: + usage(); + break; + } + argc -= optind; + argv += optind; + + if (vid != UINT_MAX || pid != UINT_MAX) + { + if (in_ep == 0 || out_ep == 0) + { + usage(); + } + if ((in_ep & 0x80) == 0) + { + fprintf(stderr, "IN_EP must have bit 7 set\n"); + return (EX_USAGE); + } + + if (argc > 0) + { + for (out_len = 0; argc > 0 && out_len < BUFLEN; out_len++, argc--) + { + unsigned n = strtoul(argv[out_len], 0, 0); + if (n > 255) + fprintf(stderr, + "Warning: data #%d 0x%0x > 0xff, truncating\n", + out_len, n); + out_buf[out_len] = (uint8_t)n; + } + out_len++; + if (argc > 0) + fprintf(stderr, + "Data count exceeds maximum of %d, ignoring %d elements\n", + BUFLEN, optind); + } + } + + struct libusb20_backend *be; + struct libusb20_device *dev; + + if ((be = libusb20_be_alloc_default()) == NULL) + { + perror("libusb20_be_alloc()"); + return 1; + } + + dev = NULL; + while ((dev = libusb20_be_device_foreach(be, dev)) != NULL) + { + struct LIBUSB20_DEVICE_DESC_DECODED *ddp = + libusb20_dev_get_device_desc(dev); + + printf("Found device %s (VID:PID = 0x%04x:0x%04x)\n", + libusb20_dev_get_desc(dev), + ddp->idVendor, ddp->idProduct); + + if (ddp->idVendor == vid && ddp->idProduct == pid) + doit(dev); + } + + libusb20_be_free(be); + return 0; +} Added: head/share/examples/libusb20/control.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/libusb20/control.c Wed Jul 18 21:30:17 2012 (r238603) @@ -0,0 +1,414 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +/* + * Simple demo program to illustrate the handling of FreeBSD's + * libusb20. + * + * XXX + */ + +/* + * Examples: + * Just list all VID:PID pairs + * ./control + * + * Standard device request GET_STATUS, report two bytes of status + * (bit 0 in the first byte returned is the "self powered" bit) + * ./control -v 0x3eb -p 0x2103 in std dev get_status 0 0 2 + * + * Request input reports through the interrupt pipe from a mouse + * device (move the mouse around after issuing the command): + * ./control -v 0x093a -p 0x2516 -i 0x81 + * + */ + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +/* + * If you want to see the details of the internal datastructures + * in the debugger, unifdef the following. + */ +#ifdef DEBUG +# include "/usr/src/lib/libusb/libusb20_int.h" +#endif + +#define BUFLEN 64 + +#define TIMEOUT 5000 /* 5 s */ + +int intr_ep; /* endpoints */ +struct LIBUSB20_CONTROL_SETUP_DECODED setup; + +uint8_t out_buf[BUFLEN]; +uint16_t out_len; + +bool do_request; + +static void +doit(struct libusb20_device *dev) +{ + int rv; + + if (do_request) + printf("doit(): bmRequestType 0x%02x, bRequest 0x%02x, wValue 0x%04x, wIndex 0x%04x, wLength 0x%04x\n", + setup.bmRequestType, + setup.bRequest, + setup.wValue, + setup.wIndex, + setup.wLength); + + /* + * Open the device, allocating memory for two possible (bulk or + * interrupt) transfers. + * + * If only control transfers are intended (via + * libusb20_dev_request_sync()), transfer_max can be given as 0. + */ + if ((rv = libusb20_dev_open(dev, 1)) != 0) + { + fprintf(stderr, "libusb20_dev_open: %s\n", usb_error(rv)); + return; + } + + /* + * If the device has more than one configuration, select the desired + * one here. + */ + if ((rv = libusb20_dev_set_config_index(dev, 0)) != 0) + { + fprintf(stderr, "libusb20_dev_set_config_index: %s\n", usb_error(rv)); + return; + } + + uint8_t *data = 0; + uint16_t actlen; + + if ((setup.bmRequestType & 0x80) != 0) + { + /* this is an IN request, allocate a buffer */ + data = malloc(setup.wLength); + if (data == 0) + { + fprintf(stderr, + "Out of memory allocating %u bytes of reply buffer\n", + setup.wLength); + return; + } + } + else + data = out_buf; + + if (do_request) + { + if ((rv = libusb20_dev_request_sync(dev, &setup, data, + &actlen, + TIMEOUT, + 0 /* flags */)) != 0) + { + fprintf(stderr, + "libusb20_dev_request_sync: %s\n", usb_error(rv)); + } + printf("sent %d bytes\n", actlen); + if ((setup.bmRequestType & 0x80) != 0) + { + print_formatted(data, (uint32_t)setup.wLength); + free(data); + } + } + + if (intr_ep != 0) + { + /* + * One transfer has been requested in libusb20_dev_open() above; + * obtain the corresponding transfer struct pointer. + */ + struct libusb20_transfer *xfr_intr = libusb20_tr_get_pointer(dev, 0); + + if (xfr_intr == NULL) + { + fprintf(stderr, "libusb20_tr_get_pointer: %s\n", usb_error(rv)); + return; + } + + /* + * Open the interrupt transfer. + */ + if ((rv = libusb20_tr_open(xfr_intr, 0, 1, intr_ep)) != 0) + { + fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv)); + return; + } + + uint8_t in_buf[BUFLEN]; + uint32_t rlen; + + if ((rv = libusb20_tr_bulk_intr_sync(xfr_intr, in_buf, BUFLEN, &rlen, TIMEOUT)) + != 0) + { + fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", usb_error(rv)); + } + printf("received %d bytes\n", rlen); + if (rlen > 0) + print_formatted(in_buf, rlen); + + libusb20_tr_close(xfr_intr); + } + + libusb20_dev_close(dev); +} + +static void +usage(void) +{ + fprintf(stderr, + "Usage ./usb [-i ] -v -p [dir type rcpt req wValue wIndex wLength [ ...]]\n"); + exit(EX_USAGE); +} + +static const char *reqnames[] = +{ + "get_status", + "clear_feature", + "res1", + "set_feature", + "res2", + "set_address", + "get_descriptor", + "set_descriptor", + "get_configuration", + "set_configuration", + "get_interface", + "set_interface", + "synch_frame", +}; + +static int +get_req(const char *reqname) +{ + size_t i; + size_t l = strlen(reqname); + + for (i = 0; + i < sizeof reqnames / sizeof reqnames[0]; + i++) + if (strncasecmp(reqname, reqnames[i], l) == 0) + return i; + + return strtoul(reqname, 0, 0); +} + + +static int +parse_req(int argc, char **argv) +{ + int idx; + uint8_t rt = 0; + + for (idx = 0; argc != 0 && idx <= 6; argc--, idx++) + switch (idx) + { + case 0: + /* dir[ection]: i[n] | o[ut] */ + if (*argv[idx] == 'i') + rt |= 0x80; + else if (*argv[idx] == 'o') + /* nop */; + else + { + fprintf(stderr, "request direction must be \"in\" or \"out\" (got %s)\n", + argv[idx]); + return -1; + } + break; + + case 1: + /* type: s[tandard] | c[lass] | v[endor] */ + if (*argv[idx] == 's') + /* nop */; + else if (*argv[idx] == 'c') + rt |= 0x20; + else if (*argv[idx] == 'v') + rt |= 0x40; + else + { + fprintf(stderr, + "request type must be one of \"standard\", \"class\", or \"vendor\" (got %s)\n", + argv[idx]); + return -1; + } + break; + + case 2: + /* rcpt: d[evice], i[nterface], e[ndpoint], o[ther] */ + if (*argv[idx] == 'd') + /* nop */; + else if (*argv[idx] == 'i') + rt |= 1; + else if (*argv[idx] == 'e') + rt |= 2; + else if (*argv[idx] == 'o') + rt |= 3; + else + { + fprintf(stderr, + "recipient must be one of \"device\", \"interface\", \"endpoint\", or \"other\" (got %s)\n", + argv[idx]); + return -1; + } + setup.bmRequestType = rt; + break; + + case 3: + setup.bRequest = get_req(argv[idx]); + break; + + case 4: + setup.wValue = strtoul(argv[idx], 0, 0); + break; + + case 5: + setup.wIndex = strtoul(argv[idx], 0, 0); + break; + + case 6: + setup.wLength = strtoul(argv[idx], 0, 0); + break; + } + + return argc; +} + + +int +main(int argc, char **argv) +{ + unsigned int vid = UINT_MAX, pid = UINT_MAX; /* impossible VID:PID */ + int c; + + /* + * Initialize setup struct. This step is required, and initializes + * internal fields in the struct. + * + * All the "public" fields are named exactly the way as the USB + * standard describes them, namely: + * + * setup.bmRequestType: bitmask, bit 7 is direction + * bits 6/5 is request type + * (standard, class, vendor) + * bits 4..0 is recipient + * (device, interface, endpoint, + * other) + * setup.bRequest: the request itself (see get_req() for standard + * requests, or specific value) + * setup.wValue: a 16-bit value + * setup.wIndex: another 16-bit value + * setup.wLength: length of associated data transfer, direction + * depends on bit 7 of bmRequestType + */ + LIBUSB20_INIT(LIBUSB20_CONTROL_SETUP, &setup); + + while ((c = getopt(argc, argv, "i:p:v:")) != -1) + switch (c) + { + case 'i': + intr_ep = strtol(optarg, NULL, 0); + break; + + case 'p': + pid = strtol(optarg, NULL, 0); + break; + + case 'v': + vid = strtol(optarg, NULL, 0); + break; + + default: + usage(); + break; + } + argc -= optind; + argv += optind; + + if (vid != UINT_MAX || pid != UINT_MAX) + { + if (intr_ep != 0 && (intr_ep & 0x80) == 0) + { + fprintf(stderr, "Interrupt endpoint must be of type IN\n"); + usage(); + } + + if (argc > 0) + { + do_request = true; + + int rv = parse_req(argc, argv); + if (rv < 0) + return EX_USAGE; + argc = rv; + + if (argc > 0) + { + for (out_len = 0; argc > 0 && out_len < BUFLEN; out_len++, argc--) + { + unsigned n = strtoul(argv[out_len], 0, 0); + if (n > 255) + fprintf(stderr, + "Warning: data #%d 0x%0x > 0xff, truncating\n", + out_len, n); + out_buf[out_len] = (uint8_t)n; + } + out_len++; + if (argc > 0) + fprintf(stderr, + "Data count exceeds maximum of %d, ignoring %d elements\n", + BUFLEN, optind); + } + } + } + + struct libusb20_backend *be; + struct libusb20_device *dev; + + if ((be = libusb20_be_alloc_default()) == NULL) + { + perror("libusb20_be_alloc()"); + return 1; + } + + dev = NULL; + while ((dev = libusb20_be_device_foreach(be, dev)) != NULL) + { + struct LIBUSB20_DEVICE_DESC_DECODED *ddp = + libusb20_dev_get_device_desc(dev); + + printf("Found device %s (VID:PID = 0x%04x:0x%04x)\n", + libusb20_dev_get_desc(dev), + ddp->idVendor, ddp->idProduct); + + if (ddp->idVendor == vid && ddp->idProduct == pid) + doit(dev); + } + + libusb20_be_free(be); + return 0; +} From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 21:47:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E770106564A; Wed, 18 Jul 2012 21:47:51 +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 498678FC14; Wed, 18 Jul 2012 21:47:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ILlp4h014432; Wed, 18 Jul 2012 21:47:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ILlpZQ014430; Wed, 18 Jul 2012 21:47:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207182147.q6ILlpZQ014430@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 18 Jul 2012 21:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238604 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 21:47:51 -0000 Author: kib Date: Wed Jul 18 21:47:50 2012 New Revision: 238604 URL: http://svn.freebsd.org/changeset/base/238604 Log: Do not restart scan of the inactive queue when non-inactive page is found. Rather, we shall not find such pages on inactive queue at all. Requested and reviewed by: alc MFC after: 2 weeks Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Jul 18 21:30:17 2012 (r238603) +++ head/sys/vm/vm_pageout.c Wed Jul 18 21:47:50 2012 (r238604) @@ -921,7 +921,6 @@ vm_pageout_scan(int pass) maxlaunder = 10000; vm_page_lock_queues(); queues_locked = TRUE; -rescan0: addl_page_shortage = addl_page_shortage_init; maxscan = cnt.v_inactive_count; @@ -930,12 +929,9 @@ rescan0: m = next) { KASSERT(queues_locked, ("unlocked queues")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); + KASSERT(m->queue == PQ_INACTIVE, ("Inactive queue %p", m)); cnt.v_pdpages++; - - if (m->queue != PQ_INACTIVE) - goto rescan0; - next = TAILQ_NEXT(m, pageq); /* From owner-svn-src-head@FreeBSD.ORG Wed Jul 18 23:01:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B2CF106566C; Wed, 18 Jul 2012 23:01:24 +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 369248FC0A; Wed, 18 Jul 2012 23:01:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IN1OeF019858; Wed, 18 Jul 2012 23:01:24 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IN1OGn019856; Wed, 18 Jul 2012 23:01:24 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201207182301.q6IN1OGn019856@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 18 Jul 2012 23:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238605 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 23:01:24 -0000 Author: des Date: Wed Jul 18 23:01:23 2012 New Revision: 238605 URL: http://svn.freebsd.org/changeset/base/238605 Log: Move -n ${_jail} before ${_flags} so that any -n options in ${_flags} will override ours instead of the other way around. Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Wed Jul 18 21:47:50 2012 (r238604) +++ head/etc/rc.d/jail Wed Jul 18 23:01:23 2012 (r238605) @@ -641,7 +641,7 @@ jail_start() i=$((i + 1)) done - eval ${_setfib} jail ${_flags} -n ${_jail} -i ${_rootdir} ${_hostname} \ + eval ${_setfib} jail -n ${_jail} ${_flags} -i ${_rootdir} ${_hostname} \ \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \ Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CB1F1065670; Wed, 18 Jul 2012 23:32:13 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 680F58FC14; Wed, 18 Jul 2012 23:32:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6INWDGA021985; Wed, 18 Jul 2012 23:32:13 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6INWDrd021983; Wed, 18 Jul 2012 23:32:13 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201207182332.q6INWDrd021983@svn.freebsd.org> From: Glen Barber Date: Wed, 18 Jul 2012 23:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238606 - head/usr.sbin/wpa/hostapd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 23:32:13 -0000 Author: gjb (doc,ports committer) Date: Wed Jul 18 23:32:12 2012 New Revision: 238606 URL: http://svn.freebsd.org/changeset/base/238606 Log: Xref mwl(4) and rum(4) in hostapd(8). MFC after: 3 days Modified: head/usr.sbin/wpa/hostapd/hostapd.8 Modified: head/usr.sbin/wpa/hostapd/hostapd.8 ============================================================================== --- head/usr.sbin/wpa/hostapd/hostapd.8 Wed Jul 18 23:01:23 2012 (r238605) +++ head/usr.sbin/wpa/hostapd/hostapd.8 Wed Jul 18 23:32:12 2012 (r238606) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2007 +.Dd July 18, 2012 .Dt HOSTAPD 8 .Os .Sh NAME @@ -111,7 +111,9 @@ Store PID in .Xr ath 4 , .Xr ipw 4 , .Xr iwi 4 , +.Xr mwl 4 , .Xr ral 4 , +.Xr rum 4 , .Xr run 4 , .Xr ural 4 , .Xr wi 4 , From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 02:25:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E673106564A; Thu, 19 Jul 2012 02:25:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F52A8FC0A; Thu, 19 Jul 2012 02:25:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6J2PF3F034023; Thu, 19 Jul 2012 02:25:15 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6J2PEKA034011; Thu, 19 Jul 2012 02:25:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207190225.q6J2PEKA034011@svn.freebsd.org> From: Adrian Chadd Date: Thu, 19 Jul 2012 02:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238607 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 02:25:15 -0000 Author: adrian Date: Thu Jul 19 02:25:14 2012 New Revision: 238607 URL: http://svn.freebsd.org/changeset/base/238607 Log: Break out the TX descriptor link field into HAL methods. The DMA FIFO chips (AR93xx and later) differ slightly to th elegacy chips: * The RX DMA descriptors don't have a ds_link field; * The TX DMA descriptors have a ds_link field however at a different offset. This is a reimplementation based on what the reference driver and ath9k does. A subsequent commit will enable it in the TX and beacon paths. Obtained from: Linux ath9k, Qualcomm Atheros Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ah.h Thu Jul 19 02:25:14 2012 (r238607) @@ -1084,6 +1084,12 @@ struct ath_hal { void __ahdecl(*ah_reqTxIntrDesc)(struct ath_hal *, struct ath_desc*); HAL_BOOL __ahdecl(*ah_getTxCompletionRates)(struct ath_hal *, const struct ath_desc *ds, int *rates, int *tries); + void __ahdecl(*ah_setTxDescLink)(struct ath_hal *ah, void *ds, + uint32_t link); + void __ahdecl(*ah_getTxDescLink)(struct ath_hal *ah, void *ds, + uint32_t *link); + void __ahdecl(*ah_getTxDescLinkPtr)(struct ath_hal *ah, void *ds, + uint32_t **linkptr); /* Receive Functions */ uint32_t __ahdecl(*ah_getRxDP)(struct ath_hal*, HAL_RX_QUEUE); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Thu Jul 19 02:25:14 2012 (r238607) @@ -179,6 +179,12 @@ extern void ar5210GetTxIntrQueue(struct extern void ar5210IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *); extern HAL_BOOL ar5210GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *, int *rates, int *tries); +extern void ar5210SetTxDescLink(struct ath_hal *ah, void *ds, + uint32_t link); +extern void ar5210GetTxDescLink(struct ath_hal *ah, void *ds, + uint32_t *link); +extern void ar5210GetTxDescLinkPtr(struct ath_hal *ah, void *ds, + uint32_t **linkptr); extern uint32_t ar5210GetRxDP(struct ath_hal *, HAL_RX_QUEUE); extern void ar5210SetRxDP(struct ath_hal *, uint32_t rxdp, HAL_RX_QUEUE); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Thu Jul 19 02:25:14 2012 (r238607) @@ -75,6 +75,9 @@ static const struct ath_hal_private ar52 .ah_getTxIntrQueue = ar5210GetTxIntrQueue, .ah_reqTxIntrDesc = ar5210IntrReqTxDesc, .ah_getTxCompletionRates = ar5210GetTxCompletionRates, + .ah_setTxDescLink = ar5210SetTxDescLink, + .ah_getTxDescLink = ar5210GetTxDescLink, + .ah_getTxDescLinkPtr = ar5210GetTxDescLinkPtr, /* RX Functions */ .ah_getRxDP = ar5210GetRxDP, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c Thu Jul 19 02:25:14 2012 (r238607) @@ -630,3 +630,36 @@ ar5210GetTxCompletionRates(struct ath_ha { return AH_FALSE; } + +/* + * Set the TX descriptor link pointer + */ +void +ar5210SetTxDescLink(struct ath_hal *ah, void *ds, uint32_t link) +{ + struct ar5210_desc *ads = AR5210DESC(ds); + + ads->ds_link = link; +} + +/* + * Get the TX descriptor link pointer + */ +void +ar5210GetTxDescLink(struct ath_hal *ah, void *ds, uint32_t *link) +{ + struct ar5210_desc *ads = AR5210DESC(ds); + + *link = ads->ds_link; +} + +/* + * Get a pointer to the TX descriptor link pointer + */ +void +ar5210GetTxDescLinkPtr(struct ath_hal *ah, void *ds, uint32_t **linkptr) +{ + struct ar5210_desc *ads = AR5210DESC(ds); + + *linkptr = &ads->ds_link; +} Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Thu Jul 19 02:25:14 2012 (r238607) @@ -204,6 +204,12 @@ extern void ar5211GetTxIntrQueue(struct extern void ar5211IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *); extern HAL_BOOL ar5211GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int *rates, int *tries); +extern void ar5211SetTxDescLink(struct ath_hal *ah, void *ds, + uint32_t link); +extern void ar5211GetTxDescLink(struct ath_hal *ah, void *ds, + uint32_t *link); +extern void ar5211GetTxDescLinkPtr(struct ath_hal *ah, void *ds, + uint32_t **linkptr); extern uint32_t ar5211GetRxDP(struct ath_hal *, HAL_RX_QUEUE); extern void ar5211SetRxDP(struct ath_hal *, uint32_t rxdp, HAL_RX_QUEUE); Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Thu Jul 19 02:25:14 2012 (r238607) @@ -75,6 +75,9 @@ static const struct ath_hal_private ar52 .ah_getTxIntrQueue = ar5211GetTxIntrQueue, .ah_reqTxIntrDesc = ar5211IntrReqTxDesc, .ah_getTxCompletionRates = ar5211GetTxCompletionRates, + .ah_setTxDescLink = ar5211SetTxDescLink, + .ah_getTxDescLink = ar5211GetTxDescLink, + .ah_getTxDescLinkPtr = ar5211GetTxDescLinkPtr, /* RX Functions */ .ah_getRxDP = ar5211GetRxDP, Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c Thu Jul 19 02:25:14 2012 (r238607) @@ -671,3 +671,27 @@ ar5211GetTxCompletionRates(struct ath_ha return AH_FALSE; } + +void +ar5211SetTxDescLink(struct ath_hal *ah, void *ds, uint32_t link) +{ + struct ar5211_desc *ads = AR5211DESC(ds); + + ads->ds_link = link; +} + +void +ar5211GetTxDescLink(struct ath_hal *ah, void *ds, uint32_t *link) +{ + struct ar5211_desc *ads = AR5211DESC(ds); + + *link = ads->ds_link; +} + +void +ar5211GetTxDescLinkPtr(struct ath_hal *ah, void *ds, uint32_t **linkptr) +{ + struct ar5211_desc *ads = AR5211DESC(ds); + + *linkptr = &ads->ds_link; +} Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Jul 19 02:25:14 2012 (r238607) @@ -602,6 +602,12 @@ extern void ar5212GetTxIntrQueue(struct extern void ar5212IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *); extern HAL_BOOL ar5212GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int *rates, int *tries); +extern void ar5212SetTxDescLink(struct ath_hal *ah, void *ds, + uint32_t link); +extern void ar5212GetTxDescLink(struct ath_hal *ah, void *ds, + uint32_t *link); +extern void ar5212GetTxDescLinkPtr(struct ath_hal *ah, void *ds, + uint32_t **linkptr); extern const HAL_RATE_TABLE *ar5212GetRateTable(struct ath_hal *, u_int mode); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Thu Jul 19 02:25:14 2012 (r238607) @@ -71,6 +71,9 @@ static const struct ath_hal_private ar52 .ah_getTxIntrQueue = ar5212GetTxIntrQueue, .ah_reqTxIntrDesc = ar5212IntrReqTxDesc, .ah_getTxCompletionRates = ar5212GetTxCompletionRates, + .ah_setTxDescLink = ar5212SetTxDescLink, + .ah_getTxDescLink = ar5212GetTxDescLink, + .ah_getTxDescLinkPtr = ar5212GetTxDescLinkPtr, /* RX Functions */ .ah_getRxDP = ar5212GetRxDP, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c Thu Jul 19 02:25:14 2012 (r238607) @@ -971,3 +971,27 @@ ar5212GetTxCompletionRates(struct ath_ha return AH_TRUE; } + +void +ar5212SetTxDescLink(struct ath_hal *ah, void *ds, uint32_t link) +{ + struct ar5212_desc *ads = AR5212DESC(ds); + + ads->ds_link = link; +} + +void +ar5212GetTxDescLink(struct ath_hal *ah, void *ds, uint32_t *link) +{ + struct ar5212_desc *ads = AR5212DESC(ds); + + *link = ads->ds_link; +} + +void +ar5212GetTxDescLinkPtr(struct ath_hal *ah, void *ds, uint32_t **linkptr) +{ + struct ar5212_desc *ads = AR5212DESC(ds); + + *linkptr = &ads->ds_link; +} Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Wed Jul 18 23:32:12 2012 (r238606) +++ head/sys/dev/ath/if_athvar.h Thu Jul 19 02:25:14 2012 (r238607) @@ -1067,6 +1067,12 @@ void ath_intr(void *); ((*(_ah)->ah_getTxIntrQueue)((_ah), (_txqs))) #define ath_hal_gettxcompletionrates(_ah, _ds, _rates, _tries) \ ((*(_ah)->ah_getTxCompletionRates)((_ah), (_ds), (_rates), (_tries))) +#define ath_hal_settxdesclink(_ah, _ds, _link) \ + ((*(_ah)->ah_setTxDescLink)((_ah), (_ds), (_link))) +#define ath_hal_gettxdesclink(_ah, _ds, _link) \ + ((*(_ah)->ah_getTxDescLink)((_ah), (_ds), (_link))) +#define ath_hal_gettxdesclinkptr(_ah, _ds, _linkptr) \ + ((*(_ah)->ah_getTxDescLinkPtr)((_ah), (_ds), (_linkptr))) #define ath_hal_setupfirsttxdesc(_ah, _ds, _aggrlen, _flags, _txpower, \ _txr0, _txtr0, _antm, _rcr, _rcd) \ From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 03:18:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 900A1106564A; Thu, 19 Jul 2012 03:18:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B4848FC15; Thu, 19 Jul 2012 03:18:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6J3IGfO037985; Thu, 19 Jul 2012 03:18:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6J3IGqG037983; Thu, 19 Jul 2012 03:18:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207190318.q6J3IGqG037983@svn.freebsd.org> From: Adrian Chadd Date: Thu, 19 Jul 2012 03:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238608 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 03:18:16 -0000 Author: adrian Date: Thu Jul 19 03:18:15 2012 New Revision: 238608 URL: http://svn.freebsd.org/changeset/base/238608 Log: Use HAL_NUM_RX_QUEUES rather than a magic constant. Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Jul 19 02:25:14 2012 (r238607) +++ head/sys/dev/ath/if_athvar.h Thu Jul 19 03:18:15 2012 (r238608) @@ -410,7 +410,7 @@ struct ath_softc { uint32_t sc_bssidmask; /* bssid mask */ struct ath_rx_methods sc_rx; - struct ath_rx_edma sc_rxedma[2]; /* HP/LP queues */ + struct ath_rx_edma sc_rxedma[HAL_NUM_RX_QUEUES]; /* HP/LP queues */ int sc_rx_statuslen; int sc_tx_desclen; int sc_tx_statuslen; From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 03:51:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5377B106564A; Thu, 19 Jul 2012 03:51:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 349228FC0A; Thu, 19 Jul 2012 03:51:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6J3pHul040249; Thu, 19 Jul 2012 03:51:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6J3pG9f040246; Thu, 19 Jul 2012 03:51:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207190351.q6J3pG9f040246@svn.freebsd.org> From: Adrian Chadd Date: Thu, 19 Jul 2012 03:51:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238609 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 03:51:17 -0000 Author: adrian Date: Thu Jul 19 03:51:16 2012 New Revision: 238609 URL: http://svn.freebsd.org/changeset/base/238609 Log: Convert the TX path to use the new HAL methods for accessing the TX descriptor link pointers. This is required for the AR93xx and later chipsets. The RX path is slightly different - the legacy RX path directly accesses ath_desc->ds_link for now, however this isn't at all done for EDMA (FIFO) RX. Now, for those performing a little software archeology here: This is all a bit sub-optimal. "struct ath_desc" is only really relevant for the pre-AR93xx NICs - where ds_link and ds_data is always in the same location. The AR93xx and later NICs have different descriptor layouts altogether. Now, for AR93xx and later NICs, you should never directly reference ds_link and ds_data, as: * the RX descriptors don't have either - the data is _after_ the RX descriptor. They're just one large buffer. There's also no need for a per-descriptor RX buffer size as they're all fixed sizes. * the TX descriptors have 4 buffer and 4 length fields _and_ a link pointer. Each frame takes up one TX FIFO pointer, but it can contain multiple subframes (either multiple frames in a buffer, and/or multiple frames in an aggregate/RIFS burst.) * .. so, when TX frames are queued to a hardware queue, the link pointer is ONLY for buffers in that frame/aggregate. The next frame starts in a new FIFO pointer. * Finally, descriptor completion status is in a different ring. I'll write something up about that when its time to do so. This was inspired by Linux ath9k and the reference driver but is a reimplementation. Obtained from: Linux ath9k, Qualcomm Atheros Modified: head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Thu Jul 19 03:18:15 2012 (r238608) +++ head/sys/dev/ath/if_ath_beacon.c Thu Jul 19 03:51:16 2012 (r238609) @@ -277,14 +277,15 @@ ath_beacon_setup(struct ath_softc *sc, s flags = HAL_TXDESC_NOACK; if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol) { - ds->ds_link = bf->bf_daddr; /* self-linked */ + /* self-linked descriptor */ + ath_hal_settxdesclink(sc->sc_ah, ds, bf->bf_daddr); flags |= HAL_TXDESC_VEOL; /* * Let hardware handle antenna switching. */ antenna = sc->sc_txantenna; } else { - ds->ds_link = 0; + ath_hal_settxdesclink(sc->sc_ah, ds, 0); /* * Switch antenna every 4 beacons. * XXX assumes two antenna @@ -405,8 +406,10 @@ ath_beacon_proc(void *arg, int pending) if (vap != NULL && vap->iv_state >= IEEE80211_S_RUN) { bf = ath_beacon_generate(sc, vap); if (bf != NULL) { + /* XXX should do this using the ds */ *bflink = bf->bf_daddr; - bflink = &bf->bf_desc->ds_link; + ath_hal_gettxdesclinkptr(sc->sc_ah, + bf->bf_desc, &bflink); } } } Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Thu Jul 19 03:18:15 2012 (r238608) +++ head/sys/dev/ath/if_ath_tx.c Thu Jul 19 03:51:16 2012 (r238609) @@ -310,9 +310,10 @@ ath_tx_chaindesclist(struct ath_softc *s for (i = 0; i < bf->bf_nseg; i++, ds++) { ds->ds_data = bf->bf_segs[i].ds_addr; if (i == bf->bf_nseg - 1) - ds->ds_link = 0; + ath_hal_settxdesclink(ah, ds, 0); else - ds->ds_link = bf->bf_daddr + sizeof(*ds) * (i + 1); + ath_hal_settxdesclink(ah, ds, + bf->bf_daddr + sizeof(*ds) * (i + 1)); ath_hal_filltxdesc(ah, ds , bf->bf_segs[i].ds_len /* segment length */ , i == 0 /* first segment */ @@ -350,9 +351,10 @@ ath_tx_chaindesclist_subframe(struct ath for (i = 0; i < bf->bf_nseg; i++, ds++) { ds->ds_data = bf->bf_segs[i].ds_addr; if (i == bf->bf_nseg - 1) - ds->ds_link = 0; + ath_hal_settxdesclink(ah, ds, 0); else - ds->ds_link = bf->bf_daddr + sizeof(*ds) * (i + 1); + ath_hal_settxdesclink(ah, ds, + bf->bf_daddr + sizeof(*ds) * (i + 1)); /* * This performs the setup for an aggregate frame. @@ -414,7 +416,8 @@ ath_tx_setds_11n(struct ath_softc *sc, s * to the beginning descriptor of this frame. */ if (bf_prev != NULL) - bf_prev->bf_lastds->ds_link = bf->bf_daddr; + ath_hal_settxdesclink(sc->sc_ah, bf_prev->bf_lastds, + bf->bf_daddr); /* Save a copy so we can link the next descriptor in */ bf_prev = bf; @@ -482,7 +485,7 @@ ath_tx_handoff_mcast(struct ath_softc *s *txq->axq_link = bf->bf_daddr; } ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); - txq->axq_link = &bf->bf_lastds->ds_link; + ath_hal_gettxdesclinkptr(sc->sc_ah, bf->bf_lastds, &txq->axq_link); } /* @@ -616,7 +619,7 @@ ath_tx_handoff_hw(struct ath_softc *sc, #endif /* IEEE80211_SUPPORT_TDMA */ if (bf->bf_state.bfs_aggr) txq->axq_aggr_depth++; - txq->axq_link = &bf->bf_lastds->ds_link; + ath_hal_gettxdesclinkptr(ah, bf->bf_lastds, &txq->axq_link); ath_hal_txstart(ah, txq->axq_qnum); } } @@ -645,7 +648,7 @@ ath_txq_restart_dma(struct ath_softc *sc return; ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); - txq->axq_link = &bf_last->bf_lastds->ds_link; + ath_hal_gettxdesclinkptr(ah, bf->bf_lastds, &txq->axq_link); ath_hal_txstart(ah, txq->axq_qnum); } From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 05:34:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1AF9106564A; Thu, 19 Jul 2012 05:34:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCB858FC0A; Thu, 19 Jul 2012 05:34:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6J5YJHl047457; Thu, 19 Jul 2012 05:34:19 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6J5YJm5047455; Thu, 19 Jul 2012 05:34:19 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207190534.q6J5YJm5047455@svn.freebsd.org> From: Alan Cox Date: Thu, 19 Jul 2012 05:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238610 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 05:34:19 -0000 Author: alc Date: Thu Jul 19 05:34:19 2012 New Revision: 238610 URL: http://svn.freebsd.org/changeset/base/238610 Log: Don't unnecessarily set PGA_REFERENCED in pmap_enter(). Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Jul 19 03:51:16 2012 (r238609) +++ head/sys/amd64/amd64/pmap.c Thu Jul 19 05:34:19 2012 (r238610) @@ -3576,13 +3576,9 @@ validate: if ((origpte & PG_V) != 0) { invlva = FALSE; origpte = pte_load_store(pte, newpte); - if ((origpte & PG_A) != 0) { - if ((origpte & PG_MANAGED) != 0) - vm_page_aflag_set(om, PGA_REFERENCED); - if (opa != pa || ((origpte & PG_NX) == 0 && - (newpte & PG_NX) != 0)) - invlva = TRUE; - } + if ((origpte & PG_A) != 0 && (opa != pa || + ((origpte & PG_NX) == 0 && (newpte & PG_NX) != 0))) + invlva = TRUE; if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { if ((origpte & PG_MANAGED) != 0) vm_page_dirty(om); @@ -3590,6 +3586,8 @@ validate: invlva = TRUE; } if (opa != pa && (origpte & PG_MANAGED) != 0) { + if ((origpte & PG_A) != 0) + vm_page_aflag_set(om, PGA_REFERENCED); CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); pmap_pvh_free(&om->md, pmap, va); if ((om->aflags & PGA_WRITEABLE) != 0 && From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 08:56:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 979F6106564A; Thu, 19 Jul 2012 08:56:31 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82EAB8FC0C; Thu, 19 Jul 2012 08:56:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6J8uVj3061640; Thu, 19 Jul 2012 08:56:31 GMT (envelope-from zeising@svn.freebsd.org) Received: (from zeising@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6J8uVBR061638; Thu, 19 Jul 2012 08:56:31 GMT (envelope-from zeising@svn.freebsd.org) Message-Id: <201207190856.q6J8uVBR061638@svn.freebsd.org> From: Niclas Zeising Date: Thu, 19 Jul 2012 08:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238612 - head/usr.sbin/ipfwpcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 08:56:31 -0000 Author: zeising (ports committer) Date: Thu Jul 19 08:56:30 2012 New Revision: 238612 URL: http://svn.freebsd.org/changeset/base/238612 Log: Update my e-mail to my FreeBSD one. Approved by: joel (mentor) Modified: head/usr.sbin/ipfwpcap/ipfwpcap.8 Modified: head/usr.sbin/ipfwpcap/ipfwpcap.8 ============================================================================== --- head/usr.sbin/ipfwpcap/ipfwpcap.8 Thu Jul 19 08:42:31 2012 (r238611) +++ head/usr.sbin/ipfwpcap/ipfwpcap.8 Thu Jul 19 08:56:30 2012 (r238612) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006 Niclas Zeising +.\" Copyright (c) 2006 Niclas Zeising .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -129,4 +129,4 @@ utility first appeared in was written by .An P. Kern Aq pkern@cns.utoronto.ca . This manual page was written by -.An Niclas Zeising Aq niclas.zeising@gmail.com . +.An Niclas Zeising Aq zeising@FreeBSD.org . From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 10:22:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8804310656AB; Thu, 19 Jul 2012 10:22:55 +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 597B68FC0A; Thu, 19 Jul 2012 10:22:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JAMtSs068162; Thu, 19 Jul 2012 10:22:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JAMtbw068159; Thu, 19 Jul 2012 10:22:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207191022.q6JAMtbw068159@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 19 Jul 2012 10:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238614 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 10:22:55 -0000 Author: kib Date: Thu Jul 19 10:22:54 2012 New Revision: 238614 URL: http://svn.freebsd.org/changeset/base/238614 Log: Implement F_DUPFD_CLOEXEC command for fcntl(2), specified by SUSv4. PR: standards/169962 Submitted by: Jukka A. Ukkonen MFC after: 1 week Modified: head/sys/kern/kern_descrip.c head/sys/sys/fcntl.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jul 19 09:32:59 2012 (r238613) +++ head/sys/kern/kern_descrip.c Thu Jul 19 10:22:54 2012 (r238614) @@ -113,6 +113,7 @@ static uma_zone_t file_zone; /* Flags for do_dup() */ #define DUP_FIXED 0x1 /* Force fixed allocation */ #define DUP_FCNTL 0x2 /* fcntl()-style errors */ +#define DUP_CLOEXEC 0x4 /* Atomically set FD_CLOEXEC. */ static int closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, int holdleaders); @@ -479,6 +480,12 @@ kern_fcntl(struct thread *td, int fd, in error = do_dup(td, DUP_FCNTL, fd, tmp, td->td_retval); break; + case F_DUPFD_CLOEXEC: + tmp = arg; + error = do_dup(td, DUP_FCNTL | DUP_CLOEXEC, fd, tmp, + td->td_retval); + break; + case F_DUP2FD: tmp = arg; error = do_dup(td, DUP_FIXED, fd, tmp, td->td_retval); @@ -895,6 +902,10 @@ do_dup(struct thread *td, int flags, int * Duplicate the source descriptor. */ fdp->fd_ofiles[new] = fp; + if ((flags & DUP_CLOEXEC) != 0) + fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] | UF_EXCLOSE; + else + fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] & ~UF_EXCLOSE; fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; if (new > fdp->fd_lastfile) fdp->fd_lastfile = new; Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Thu Jul 19 09:32:59 2012 (r238613) +++ head/sys/sys/fcntl.h Thu Jul 19 10:22:54 2012 (r238614) @@ -225,6 +225,9 @@ typedef __pid_t pid_t; #define F_SETLK_REMOTE 14 /* debugging support for remote locks */ #define F_READAHEAD 15 /* read ahead */ #define F_RDAHEAD 16 /* Darwin compatible read ahead */ +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ +#endif /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 10:23:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A98281065674; Thu, 19 Jul 2012 10:23:59 +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 95A758FC1B; Thu, 19 Jul 2012 10:23:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JANxoG068269; Thu, 19 Jul 2012 10:23:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JANxiZ068267; Thu, 19 Jul 2012 10:23:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207191023.q6JANxiZ068267@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 19 Jul 2012 10:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238615 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 10:23:59 -0000 Author: kib Date: Thu Jul 19 10:23:59 2012 New Revision: 238615 URL: http://svn.freebsd.org/changeset/base/238615 Log: Document F_DUPFD_CLOEXEC. Also provide some wording changes for F_DUPFD to make it less confusing, at least for me. MFC after: 1 week Modified: head/lib/libc/sys/fcntl.2 Modified: head/lib/libc/sys/fcntl.2 ============================================================================== --- head/lib/libc/sys/fcntl.2 Thu Jul 19 10:22:54 2012 (r238614) +++ head/lib/libc/sys/fcntl.2 Thu Jul 19 10:23:59 2012 (r238615) @@ -28,7 +28,7 @@ .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd January 28, 2012 +.Dd July 18, 2012 .Dt FCNTL 2 .Os .Sh NAME @@ -54,7 +54,7 @@ Depending on the value of .Fn fcntl can take an additional third argument .Fa "int arg" . -.Bl -tag -width F_GETOWNX +.Bl -tag -width F_DUPFD_CLOEXEC .It Dv F_DUPFD Return a new descriptor as follows: .Pp @@ -73,11 +73,22 @@ Same access mode (read, write or read/wr Same file status flags (i.e., both file descriptors share the same file status flags). .It -The close-on-exec flag associated with the new file descriptor -is set to remain open across +The close-on-exec flag +.Dv FD_CLOEXEC +associated with the new file descriptor is cleared, so the file descriptor is +to remain open across .Xr execve 2 system calls. .El +.It Dv F_DUPFD_CLOEXEC +Like +.Dv F_DUPFD , +but the +.Dv FD_CLOEXEC +flag associated with the new file descriptor is set, so the file descriptor +is closed when +.Xr execve 2 +system call executes. .It Dv F_DUP2FD It is functionally equivalent to .Bd -literal -offset indent From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 11:15:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 509AF1065695; Thu, 19 Jul 2012 11:15:54 +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 3BFB58FC1B; Thu, 19 Jul 2012 11:15:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JBFsOJ075302; Thu, 19 Jul 2012 11:15:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JBFsmf075300; Thu, 19 Jul 2012 11:15:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207191115.q6JBFsmf075300@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 19 Jul 2012 11:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238617 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 11:15:54 -0000 Author: kib Date: Thu Jul 19 11:15:53 2012 New Revision: 238617 URL: http://svn.freebsd.org/changeset/base/238617 Log: Fix several reads beyond the mapped first page of the binary in the ELF parser. Specifically, do not allow note reader and interpreter path comparision in the brandelf code to read past end of the page. This may happen if specially crafter ELF image is activated. Submitted by: Lukasz Wojcik MFC after: 3 days Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Thu Jul 19 10:28:29 2012 (r238616) +++ head/sys/kern/imgact_elf.c Thu Jul 19 11:15:53 2012 (r238617) @@ -83,7 +83,7 @@ __FBSDID("$FreeBSD$"); static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, - const char *interp, int32_t *osrel); + const char *interp, int interp_name_len, int32_t *osrel); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry, size_t pagesize); static int __elfN(load_section)(struct image_params *imgp, vm_offset_t offset, @@ -254,7 +254,7 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry static Elf_Brandinfo * __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, - int32_t *osrel) + int interp_name_len, int32_t *osrel) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi; @@ -300,7 +300,10 @@ __elfN(get_brandinfo)(struct image_param if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) continue; if (hdr->e_machine == bi->machine && - strcmp(interp, bi->interp_path) == 0) + /* ELF image p_filesz includes terminating zero */ + strlen(bi->interp_path) + 1 == interp_name_len && + strncmp(interp, bi->interp_path, interp_name_len) + == 0) return (bi); } } @@ -722,7 +725,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i u_long seg_size, seg_addr; u_long addr, baddr, et_dyn_addr, entry = 0, proghdr = 0; int32_t osrel = 0; - int error = 0, i, n; + int error = 0, i, n, interp_name_len = 0; const char *interp = NULL, *newinterp = NULL; Elf_Brandinfo *brand_info; char *path; @@ -763,9 +766,11 @@ __CONCAT(exec_, __elfN(imgact))(struct i case PT_INTERP: /* Path to interpreter */ if (phdr[i].p_filesz > MAXPATHLEN || - phdr[i].p_offset + phdr[i].p_filesz > PAGE_SIZE) + phdr[i].p_offset >= PAGE_SIZE || + phdr[i].p_offset + phdr[i].p_filesz >= PAGE_SIZE) return (ENOEXEC); interp = imgp->image_header + phdr[i].p_offset; + interp_name_len = phdr[i].p_filesz; break; case PT_GNU_STACK: if (__elfN(nxstack)) @@ -775,7 +780,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i } } - brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel); + brand_info = __elfN(get_brandinfo)(imgp, interp, interp_name_len, + &osrel); if (brand_info == NULL) { uprintf("ELF binary type \"%u\" not known.\n", hdr->e_ident[EI_OSABI]); @@ -1562,6 +1568,7 @@ __elfN(parse_notes)(struct image_params int i; if (pnote == NULL || pnote->p_offset >= PAGE_SIZE || + pnote->p_filesz > PAGE_SIZE || pnote->p_offset + pnote->p_filesz >= PAGE_SIZE) return (FALSE); @@ -1569,15 +1576,17 @@ __elfN(parse_notes)(struct image_params note_end = (const Elf_Note *)(imgp->image_header + pnote->p_offset + pnote->p_filesz); for (i = 0; i < 100 && note >= note0 && note < note_end; i++) { - if (!aligned(note, Elf32_Addr)) + if (!aligned(note, Elf32_Addr) || (const char *)note_end - + (const char *)note < sizeof(Elf_Note)) return (FALSE); if (note->n_namesz != checknote->hdr.n_namesz || note->n_descsz != checknote->hdr.n_descsz || note->n_type != checknote->hdr.n_type) goto nextnote; note_name = (const char *)(note + 1); - if (strncmp(checknote->vendor, note_name, - checknote->hdr.n_namesz) != 0) + if (note_name + checknote->hdr.n_namesz >= + (const char *)note_end || strncmp(checknote->vendor, + note_name, checknote->hdr.n_namesz) != 0) goto nextnote; /* From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 11:18:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 61BBC106566B; Thu, 19 Jul 2012 11:18:42 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D2D28FC12; Thu, 19 Jul 2012 11:18:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JBIgmn075539; Thu, 19 Jul 2012 11:18:42 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JBIgW6075537; Thu, 19 Jul 2012 11:18:42 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201207191118.q6JBIgW6075537@svn.freebsd.org> From: Joerg Wunsch Date: Thu, 19 Jul 2012 11:18:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238618 - head/etc/mtree X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 11:18:42 -0000 Author: joerg Date: Thu Jul 19 11:18:41 2012 New Revision: 238618 URL: http://svn.freebsd.org/changeset/base/238618 Log: Add share/examples/libusb20 to the list of directories. Modified: head/etc/mtree/BSD.usr.dist Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Thu Jul 19 11:15:53 2012 (r238617) +++ head/etc/mtree/BSD.usr.dist Thu Jul 19 11:18:41 2012 (r238618) @@ -271,6 +271,8 @@ .. .. .. + libusb20 + .. libvgl .. mdoc From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 13:36:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B358106566B; Thu, 19 Jul 2012 13:36:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id B73488FC12; Thu, 19 Jul 2012 13:36:23 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:10e7:52d2:303f:862c] (unknown [IPv6:2001:7b8:3a7:0:10e7:52d2:303f:862c]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 00E6E5C37; Thu, 19 Jul 2012 15:36:22 +0200 (CEST) Message-ID: <50080D5A.9040807@FreeBSD.org> Date: Thu, 19 Jul 2012 15:36:26 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Dag-Erling Smorgrav References: <201207181928.q6IJSMgZ003200@svn.freebsd.org> In-Reply-To: <201207181928.q6IJSMgZ003200@svn.freebsd.org> X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238602 - head/usr.bin/du X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 13:36:24 -0000 On 2012-07-18 21:28, Dag-Erling Smorgrav wrote: > Author: des > Date: Wed Jul 18 19:28:22 2012 > New Revision: 238602 > URL: http://svn.freebsd.org/changeset/base/238602 > > Log: > Add -g (gigabyte) flag to complement -k (kilobyte) and -m (megabyte). Too bad -t is already taken. :) From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 14:43:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8B03106564A; Thu, 19 Jul 2012 14:43:46 +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 935498FC15; Thu, 19 Jul 2012 14:43:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JEhk7h090634; Thu, 19 Jul 2012 14:43:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JEhksd090632; Thu, 19 Jul 2012 14:43:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201207191443.q6JEhksd090632@svn.freebsd.org> From: Marius Strobl Date: Thu, 19 Jul 2012 14:43:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238621 - head/sys/dev/sym X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 14:43:46 -0000 Author: marius Date: Thu Jul 19 14:43:46 2012 New Revision: 238621 URL: http://svn.freebsd.org/changeset/base/238621 Log: Revert the use of BUS_DMA_ALLOCNOW when creating the DMA tag for user data introduced in r236061. Using that flag doesn't make that much sense on this case as the DMA maps using it are also created during sym_pci_attach(). Moreover, due to the maxsegsz parameter used, doing so may exhaust the bounce pages pool on architectures requiring bounce pages. [1] While at it, use a slightly more appropriate maxsegsz parameter. PR: 169526 Submitted by: Mike Watters [1] MFC after: 3 days Modified: head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Thu Jul 19 13:00:31 2012 (r238620) +++ head/sys/dev/sym/sym_hipd.c Thu Jul 19 14:43:46 2012 (r238621) @@ -8537,8 +8537,8 @@ sym_pci_attach(device_t dev) */ if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, - BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { + BUS_SPACE_MAXSIZE_32BIT, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, + 0, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; } From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 15:36:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D76410656D0; Thu, 19 Jul 2012 15:36:37 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 486C88FC0A; Thu, 19 Jul 2012 15:36:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JFab0Z094469; Thu, 19 Jul 2012 15:36:37 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JFabOR094467; Thu, 19 Jul 2012 15:36:37 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201207191536.q6JFabOR094467@svn.freebsd.org> From: Maksim Yevmenkin Date: Thu, 19 Jul 2012 15:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 15:36:37 -0000 Author: emax Date: Thu Jul 19 15:36:36 2012 New Revision: 238622 URL: http://svn.freebsd.org/changeset/base/238622 Log: Allow to specify no source-address-selection policy MFC after: 1 week Modified: head/etc/rc.d/ip6addrctl Modified: head/etc/rc.d/ip6addrctl ============================================================================== --- head/etc/rc.d/ip6addrctl Thu Jul 19 14:43:46 2012 (r238621) +++ head/etc/rc.d/ip6addrctl Thu Jul 19 15:36:36 2012 (r238622) @@ -83,6 +83,9 @@ ip6addrctl_start() # Backward compatibility when ipv6_prefer=NO ip6addrctl_prefer_ipv4 ;; + [Nn][Oo][Nn][Ee]) + ip6addrctl flush >/dev/null 2>&1 + ;; *) warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \ " \"ipv4_prefer\" is used instead." From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 19:09:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF1C21065673; Thu, 19 Jul 2012 19:09:13 +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 995748FC0A; Thu, 19 Jul 2012 19:09:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JJ9DeO011574; Thu, 19 Jul 2012 19:09:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JJ9D6Z011568; Thu, 19 Jul 2012 19:09:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207191909.q6JJ9D6Z011568@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 19 Jul 2012 19:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238623 - in head/sys/amd64: amd64 include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 19:09:13 -0000 Author: kib Date: Thu Jul 19 19:09:12 2012 New Revision: 238623 URL: http://svn.freebsd.org/changeset/base/238623 Log: Introduce curpcb magic variable, similar to curthread, which is MD amd64. It is implemented as __pure2 inline with non-volatile asm read from pcpu, which allows a compiler to cache its results. Convert most PCPU_GET(pcb) and curthread->td_pcb accesses into curpcb. Note that __curthread() uses magic value 0 as an offsetof(struct pcpu, pc_curthread). It seems to be done this way due to machine/pcpu.h needs to be processed before sys/pcpu.h, because machine/pcpu.h contributes machine-depended fields to the struct pcpu definition. As result, machine/pcpu.h cannot use struct pcpu yet. The __curpcb() also uses a magic constant instead of offsetof(struct pcpu, pc_curpcb) for the same reason. The constants are now defined as symbols and CTASSERTs are added to ensure that future KBI changes do not break the code. Requested and reviewed by: bde MFC after: 3 weeks Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/trap.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/include/pcpu.h Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Jul 19 15:36:36 2012 (r238622) +++ head/sys/amd64/amd64/fpu.c Thu Jul 19 19:09:12 2012 (r238623) @@ -327,7 +327,7 @@ fpuexit(struct thread *td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { stop_emulating(); - fpusave(PCPU_GET(curpcb)->pcb_save); + fpusave(curpcb->pcb_save); start_emulating(); PCPU_SET(fpcurthread, 0); } @@ -547,7 +547,7 @@ fputrap_x87(void) * wherever they are. */ if (PCPU_GET(fpcurthread) != curthread) { - pcb_save = PCPU_GET(curpcb)->pcb_save; + pcb_save = curpcb->pcb_save; control = pcb_save->sv_env.en_cw; status = pcb_save->sv_env.en_sw; } else { @@ -567,7 +567,7 @@ fputrap_sse(void) critical_enter(); if (PCPU_GET(fpcurthread) != curthread) - mxcsr = PCPU_GET(curpcb)->pcb_save->sv_env.en_mxcsr; + mxcsr = curpcb->pcb_save->sv_env.en_mxcsr; else stmxcsr(&mxcsr); critical_exit(); @@ -609,7 +609,7 @@ fpudna(void) * Record new context early in case frstor causes a trap. */ PCPU_SET(fpcurthread, curthread); - pcb = PCPU_GET(curpcb); + pcb = curpcb; fpu_clean_state(); @@ -970,7 +970,7 @@ fpu_kern_thread(u_int flags) { struct pcb *pcb; - pcb = PCPU_GET(curpcb); + pcb = curpcb; KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb), @@ -987,5 +987,5 @@ is_fpu_kern_thread(u_int flags) if ((curthread->td_pflags & TDP_KTHREAD) == 0) return (0); - return ((PCPU_GET(curpcb)->pcb_flags & PCB_KERNFPU) != 0); + return ((curpcb->pcb_flags & PCB_KERNFPU) != 0); } Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Jul 19 15:36:36 2012 (r238622) +++ head/sys/amd64/amd64/machdep.c Thu Jul 19 19:09:12 2012 (r238623) @@ -996,7 +996,7 @@ exec_setregs(struct thread *td, struct i pcb->pcb_dr3 = 0; pcb->pcb_dr6 = 0; pcb->pcb_dr7 = 0; - if (pcb == PCPU_GET(curpcb)) { + if (pcb == curpcb) { /* * Clear the debug registers on the running * CPU, otherwise they will end up affecting Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Thu Jul 19 15:36:36 2012 (r238622) +++ head/sys/amd64/amd64/trap.c Thu Jul 19 19:09:12 2012 (r238623) @@ -520,9 +520,8 @@ trap(struct trapframe *frame) frame->tf_rip = (long)fsbase_load_fault; goto out; } - if (PCPU_GET(curpcb)->pcb_onfault != NULL) { - frame->tf_rip = - (long)PCPU_GET(curpcb)->pcb_onfault; + if (curpcb->pcb_onfault != NULL) { + frame->tf_rip = (long)curpcb->pcb_onfault; goto out; } break; @@ -708,7 +707,7 @@ trap_pfault(frame, usermode) * it normally, and panic immediately. */ if (!usermode && (td->td_intr_nesting_level != 0 || - PCPU_GET(curpcb)->pcb_onfault == NULL)) { + curpcb->pcb_onfault == NULL)) { trap_fatal(frame, eva); return (-1); } @@ -764,8 +763,8 @@ trap_pfault(frame, usermode) nogo: if (!usermode) { if (td->td_intr_nesting_level == 0 && - PCPU_GET(curpcb)->pcb_onfault != NULL) { - frame->tf_rip = (long)PCPU_GET(curpcb)->pcb_onfault; + curpcb->pcb_onfault != NULL) { + frame->tf_rip = (long)curpcb->pcb_onfault; return (0); } trap_fatal(frame, eva); Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Thu Jul 19 15:36:36 2012 (r238622) +++ head/sys/amd64/amd64/vm_machdep.c Thu Jul 19 19:09:12 2012 (r238623) @@ -90,6 +90,10 @@ static u_int cpu_reset_proxyid; static volatile u_int cpu_reset_proxy_active; #endif +CTASSERT((struct thread **)OFFSETOF_CURTHREAD == + &((struct pcpu *)NULL)->pc_curthread); +CTASSERT((struct pcb **)OFFSETOF_CURPCB == &((struct pcpu *)NULL)->pc_curpcb); + struct savefpu * get_pcb_user_save_td(struct thread *td) { Modified: head/sys/amd64/include/pcpu.h ============================================================================== --- head/sys/amd64/include/pcpu.h Thu Jul 19 15:36:36 2012 (r238622) +++ head/sys/amd64/include/pcpu.h Thu Jul 19 19:09:12 2012 (r238623) @@ -216,16 +216,29 @@ extern struct pcpu *pcpup; #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) +#define OFFSETOF_CURTHREAD 0 static __inline __pure2 struct thread * __curthread(void) { struct thread *td; - __asm("movq %%gs:0,%0" : "=r" (td)); + __asm("movq %%gs:%1,%0" : "=r" (td) + : "m" (*(char *)OFFSETOF_CURTHREAD)); return (td); } #define curthread (__curthread()) +#define OFFSETOF_CURPCB 32 +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movq %%gs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB)); + return (pcb); +} +#define curpcb (__curpcb()) + #define IS_BSP() (PCPU_GET(cpuid) == 0) #else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */ From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 19:15:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E833106566B; Thu, 19 Jul 2012 19:15:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 609AE8FC1C; Thu, 19 Jul 2012 19:15:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JJFmXo012062; Thu, 19 Jul 2012 19:15:48 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JJFmLQ012059; Thu, 19 Jul 2012 19:15:48 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201207191915.q6JJFmLQ012059@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 19 Jul 2012 19:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238624 - head/lib/libedit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 19:15:48 -0000 Author: pfg Date: Thu Jul 19 19:15:47 2012 New Revision: 238624 URL: http://svn.freebsd.org/changeset/base/238624 Log: Merge more cosmetical changes from NetBSD's libedit. makelist: change tr '[a-z]' '[A-Z]' to tr '[:lower:]' '[:upper:]' so that POSIX systems work proerly regardsless of environment variable settings. tokenizer.c: pass lint on _LP64 Obtained from: NetBSD MFC after: 2 weeks Modified: head/lib/libedit/makelist head/lib/libedit/tokenizer.c Modified: head/lib/libedit/makelist ============================================================================== --- head/lib/libedit/makelist Thu Jul 19 19:09:12 2012 (r238623) +++ head/lib/libedit/makelist Thu Jul 19 19:15:47 2012 (r238624) @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: makelist,v 1.10 2005/08/08 14:04:49 christos Exp $ +# $NetBSD: makelist,v 1.11 2005/10/22 16:45:03 christos Exp $ # $FreeBSD$ # # Copyright (c) 1992, 1993 @@ -141,7 +141,7 @@ case $FLAG in # -fh) cat $FILES | $AWK '/el_action_t/ { print $3 }' | \ - sort | LC_ALL=C tr 'a-z' 'A-Z' | $AWK ' + sort | LC_ALL=C tr '[:lower:]' '[:upper:]' | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n"); Modified: head/lib/libedit/tokenizer.c ============================================================================== --- head/lib/libedit/tokenizer.c Thu Jul 19 19:09:12 2012 (r238623) +++ head/lib/libedit/tokenizer.c Thu Jul 19 19:15:47 2012 (r238624) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $ + * $NetBSD: tokenizer.c,v 1.15 2009/02/15 21:55:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -198,7 +198,7 @@ tok_line(Tokenizer *tok, const LineInfo ptr = ""; if (ptr == line->cursor) { cc = tok->argc; - co = tok->wptr - tok->wstart; + co = (int)(tok->wptr - tok->wstart); } switch (*ptr) { case '\'': @@ -417,7 +417,7 @@ tok_line(Tokenizer *tok, const LineInfo tok_line_outok: if (cc == -1 && co == -1) { cc = tok->argc; - co = tok->wptr - tok->wstart; + co = (int)(tok->wptr - tok->wstart); } if (cursorc != NULL) *cursorc = cc; From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 20:21:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FB36106564A; Thu, 19 Jul 2012 20:21:44 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id E3FF58FC15; Thu, 19 Jul 2012 20:21:43 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 902134AA; Thu, 19 Jul 2012 22:21:33 +0200 (CEST) Date: Thu, 19 Jul 2012 22:19:20 +0200 From: Pawel Jakub Dawidek To: Konstantin Belousov Message-ID: <20120719201920.GF1401@garage.freebsd.pl> References: <201207191022.q6JAMtbw068159@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="udcq9yAoWb9A4FsZ" Content-Disposition: inline In-Reply-To: <201207191022.q6JAMtbw068159@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238614 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 20:21:44 -0000 --udcq9yAoWb9A4FsZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 19, 2012 at 10:22:55AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Thu Jul 19 10:22:54 2012 > New Revision: 238614 > URL: http://svn.freebsd.org/changeset/base/238614 >=20 > Log: > Implement F_DUPFD_CLOEXEC command for fcntl(2), specified by SUSv4. > =20 > PR: standards/169962 > Submitted by: Jukka A. Ukkonen > MFC after: 1 week [...] > + if ((flags & DUP_CLOEXEC) !=3D 0) > + fdp->fd_ofileflags[new] =3D fdp->fd_ofileflags[old] | UF_EXCLOSE; > + else > + fdp->fd_ofileflags[new] =3D fdp->fd_ofileflags[old] & ~UF_EXCLOSE; > fdp->fd_ofileflags[new] =3D fdp->fd_ofileflags[old] &~ UF_EXCLOSE; It seems that you forgot to remove the line above, which results in always removing the UF_EXCLOSE flag. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --udcq9yAoWb9A4FsZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlAIa8cACgkQForvXbEpPzQT+ACff5pFhQ1rCede2YIgNlVFIy+j VTQAoLDRG4Esp9To5eohNFX0bdzNOC1X =RSPm -----END PGP SIGNATURE----- --udcq9yAoWb9A4FsZ-- From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 20:38:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB722106564A; Thu, 19 Jul 2012 20:38: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 B6E528FC15; Thu, 19 Jul 2012 20:38:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JKc4kh020564; Thu, 19 Jul 2012 20:38:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JKc4VP020562; Thu, 19 Jul 2012 20:38:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207192038.q6JKc4VP020562@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 19 Jul 2012 20:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238627 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 20:38:04 -0000 Author: kib Date: Thu Jul 19 20:38:03 2012 New Revision: 238627 URL: http://svn.freebsd.org/changeset/base/238627 Log: Remove line which was accidentally kept in r238614. Submitted by: pjd Pointy hat to: kib MFC after: 1 week Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jul 19 20:05:31 2012 (r238626) +++ head/sys/kern/kern_descrip.c Thu Jul 19 20:38:03 2012 (r238627) @@ -906,7 +906,6 @@ do_dup(struct thread *td, int flags, int fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] | UF_EXCLOSE; else fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] & ~UF_EXCLOSE; - fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; if (new > fdp->fd_lastfile) fdp->fd_lastfile = new; *retval = new; From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 22:33:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EFBB106564A; Thu, 19 Jul 2012 22:33:14 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19E438FC14; Thu, 19 Jul 2012 22:33:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JMXD7t029245; Thu, 19 Jul 2012 22:33:13 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JMXDvn029242; Thu, 19 Jul 2012 22:33:13 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201207192233.q6JMXDvn029242@svn.freebsd.org> From: Devin Teske Date: Thu, 19 Jul 2012 22:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238628 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 22:33:14 -0000 Author: dteske Date: Thu Jul 19 22:33:13 2012 New Revision: 238628 URL: http://svn.freebsd.org/changeset/base/238628 Log: Fix syntax errors (s/:=/:-/). Reviewed by: emaste (mentor) Approved by: emaste (mentor) MFC after: 3 days Modified: head/etc/rc.d/bgfsck head/etc/rc.d/named Modified: head/etc/rc.d/bgfsck ============================================================================== --- head/etc/rc.d/bgfsck Thu Jul 19 20:38:03 2012 (r238627) +++ head/etc/rc.d/bgfsck Thu Jul 19 22:33:13 2012 (r238628) @@ -17,7 +17,7 @@ stop_cmd=":" bgfsck_start() { if [ -z "${rc_force}" ]; then - background_fsck_delay=${background_fsck_delay:=0} + background_fsck_delay=${background_fsck_delay:-0} else background_fsck_delay=0 fi Modified: head/etc/rc.d/named ============================================================================== --- head/etc/rc.d/named Thu Jul 19 20:38:03 2012 (r238627) +++ head/etc/rc.d/named Thu Jul 19 22:33:13 2012 (r238628) @@ -173,7 +173,7 @@ named_prestart() warn 'named_pidfile: now determined from the conf file' fi - command_args="-u ${named_uid:=root}" + command_args="-u ${named_uid:-root}" if [ ! "$named_conf" = '/etc/namedb/named.conf' ]; then case "$named_flags" in From owner-svn-src-head@FreeBSD.ORG Thu Jul 19 22:41:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E36F2106566B; Thu, 19 Jul 2012 22:41:00 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEF888FC17; Thu, 19 Jul 2012 22:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JMf0Gu029810; Thu, 19 Jul 2012 22:41:00 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6JMf0M2029807; Thu, 19 Jul 2012 22:41:00 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201207192241.q6JMf0M2029807@svn.freebsd.org> From: Devin Teske Date: Thu, 19 Jul 2012 22:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238629 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 22:41:01 -0000 Author: dteske Date: Thu Jul 19 22:41:00 2012 New Revision: 238629 URL: http://svn.freebsd.org/changeset/base/238629 Log: Revert SVN r238628 (mistake). Modified: head/etc/rc.d/named Modified: head/etc/rc.d/named ============================================================================== --- head/etc/rc.d/named Thu Jul 19 22:33:13 2012 (r238628) +++ head/etc/rc.d/named Thu Jul 19 22:41:00 2012 (r238629) @@ -173,7 +173,7 @@ named_prestart() warn 'named_pidfile: now determined from the conf file' fi - command_args="-u ${named_uid:-root}" + command_args="-u ${named_uid:=root}" if [ ! "$named_conf" = '/etc/namedb/named.conf' ]; then case "$named_flags" in From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 00:47:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2DC8106566B; Fri, 20 Jul 2012 00:47:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D8428FC15; Fri, 20 Jul 2012 00:47:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K0lOKx039070; Fri, 20 Jul 2012 00:47:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K0lOU3039068; Fri, 20 Jul 2012 00:47:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200047.q6K0lOU3039068@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 00:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238630 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 00:47:24 -0000 Author: adrian Date: Fri Jul 20 00:47:23 2012 New Revision: 238630 URL: http://svn.freebsd.org/changeset/base/238630 Log: Prepare for (re)using this header file in userland. Remove the inlined code from the header file if it's compiled in userland. It's not required and it shouldn't be there in the first place. Modified: head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Thu Jul 19 22:41:00 2012 (r238629) +++ head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 20 00:47:23 2012 (r238630) @@ -101,6 +101,9 @@ struct sample_node { int packets_since_sample[NUM_PACKET_SIZE_BINS]; unsigned sample_tt[NUM_PACKET_SIZE_BINS]; }; + +#ifdef _KERNEL + #define ATH_NODE_SAMPLE(an) ((struct sample_node *)&(an)[1]) #define IS_RATE_DEFINED(sn, rix) (((sn)->ratemask & (1<<(rix))) != 0) @@ -225,4 +228,7 @@ static unsigned calc_usecs_unicast_packe } return tt; } + +#endif /* _KERNEL */ + #endif /* _DEV_ATH_RATE_SAMPLE_H */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:11:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CA3B106564A; Fri, 20 Jul 2012 01:11:54 +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 267348FC0C; Fri, 20 Jul 2012 01:11:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1Bsjg040757; Fri, 20 Jul 2012 01:11:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1Brc2040755; Fri, 20 Jul 2012 01:11:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201207200111.q6K1Brc2040755@svn.freebsd.org> From: Xin LI Date: Fri, 20 Jul 2012 01:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238631 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:11:54 -0000 Author: delphij Date: Fri Jul 20 01:11:53 2012 New Revision: 238631 URL: http://svn.freebsd.org/changeset/base/238631 Log: Import an updated version of moduli(5) manual page from OpenBSD. MFC after: 1 month Modified: head/share/man/man5/moduli.5 Modified: head/share/man/man5/moduli.5 ============================================================================== --- head/share/man/man5/moduli.5 Fri Jul 20 00:47:23 2012 (r238630) +++ head/share/man/man5/moduli.5 Fri Jul 20 01:11:53 2012 (r238631) @@ -1,159 +1,125 @@ -.\" $OpenBSD: moduli.5,v 1.3 2001/06/24 18:50:52 provos Exp $ +.\" $OpenBSD: moduli.5,v 1.16 2011/11/28 08:46:27 eric Exp $ .\" -.\" Copyright 1997, 2000 William Allen Simpson -.\" All rights reserved. +.\" Copyright (c) 2008 Damien Miller .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software designed by William Allen Simpson. -.\" 4. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .\" $FreeBSD$ .\" -.Dd July 28, 1997 +.Dd July 19, 2012 .Dt MODULI 5 .Os .Sh NAME .Nm moduli -.Nd system moduli file +.Nd Diffie-Hellman moduli .Sh DESCRIPTION The -.Nm -file contains the system-wide Diffie-Hellman prime moduli for the -.Xr photurisd 8 -and +.Pa /etc/ssh/moduli +file contains prime numbers and generators for use by .Xr sshd 8 -programs. +in the Diffie-Hellman Group Exchange key exchange method. .Pp -Each line in this file contains the following fields: -.Va Time , Type , Tests , Tries , Size , Generator , -and -.Va Modulus . -The fields are separated by white space (tab or blank). -.Bl -tag -width indent -.It Va Time Pq Vt yyyymmddhhmmss -Specifies the system time that the line was appended to the file. -The value 00000000000000 means unknown (historic). -.\"The file is sorted in ascending order. -.It Va Type Pq Vt decimal -Specifies the internal structure of the prime modulus. +New moduli may be generated with +.Xr ssh-keygen 1 +using a two-step process. +An initial +.Em candidate generation +pass, using +.Ic ssh-keygen -G , +calculates numbers that are likely to be useful. +A second +.Em primality testing +pass, using +.Ic ssh-keygen -T , +provides a high degree of assurance that the numbers are prime and are +safe for use in Diffie-Hellman operations by +.Xr sshd 8 . +This +.Nm +format is used as the output from each pass. .Pp -.Bl -tag -width indent -compact -.It 0 -unknown; -often learned from peer during protocol operation, -and saved for later analysis. -.It 1 -unstructured; -a common large number. -.It 2 -safe (p = 2q + 1); -meets basic structural requirements. -.It 3 -Schnorr. -.It 4 -Sophie-Germaine (q = (p-1)/2); -usually generated in the process of testing safe or strong primes. -.It 5 -strong; -useful for RSA public key generation. -.El -.It Xo -.Va Tests Pq Vt decimal -(bit field) -.Xc -Specifies the methods used in checking for primality. -Usually, more than one test is used. +The file consists of newline-separated records, one per modulus, +containing seven space-separated fields. +These fields are as follows: +.Bl -tag -width Description -offset indent +.It timestamp +The time that the modulus was last processed as YYYYMMDDHHMMSS. +.It type +Decimal number specifying the internal structure of the prime modulus. +Supported types are: .Pp -.Bl -tag -width indent -compact +.Bl -tag -width 0x00 -compact .It 0 -not tested; -often learned from peer during protocol operation, -and saved for later analysis. -.It 1 -composite; -failed one or more tests. -In this case, the highest bit specifies the test that failed. +Unknown, not tested. .It 2 -sieve; -checked for division by a range of smaller primes. +"Safe" prime; (p-1)/2 is also prime. .It 4 -Miller-Rabin. -.It 8 -Jacobi. -.It 16 -Elliptic Curve. +Sophie Germain; 2p+1 is also prime. .El -.It Va Tries Pq Vt decimal -Depends on the value of the highest valid Test bit, -where the method specified is: .Pp -.Bl -tag -width indent -compact -.It 0 -not tested -(always zero). -.It 1 -composite -(irrelevant). -.It 2 -sieve; -number of primes sieved. -Commonly on the order of 32,000,000. -.It 4 -Miller-Rabin; -number of M-R iterations. -Commonly on the order of 32 to 64. -.It 8 -Jacobi; -unknown -(always zero). -.It 16 -Elliptic Curve; -unused -(always zero). -.El -.It Va Size Pq Vt decimal -Specifies the number of significant bits. -.It Va Generator Pq Vt "hex string" -Specifies the best generator for a Diffie-Hellman exchange. -0 = unknown or variable, -2, 3, 5, etc. -.It Va Modulus Pq Vt "hex string" -The prime modulus. +Moduli candidates initially produced by +.Xr ssh-keygen 1 +are Sophie Germain primes (type 4). +Further primality testing with +.Xr ssh-keygen 1 +produces safe prime moduli (type 2) that are ready for use in +.Xr sshd 8 . +Other types are not used by OpenSSH. +.It tests +Decimal number indicating the type of primality tests that the number +has been subjected to represented as a bitmask of the following values: +.Pp +.Bl -tag -width 0x00 -compact +.It 0x00 +Not tested. +.It 0x01 +Composite number \(en not prime. +.It 0x02 +Sieve of Eratosthenes. +.It 0x04 +Probabilistic Miller-Rabin primality tests. .El .Pp -The file is searched for moduli that meet the appropriate -.Va Time , Size -and -.Va Generator -criteria. -When more than one meet the criteria, -the selection should be weighted toward newer moduli, -without completely disqualifying older moduli. -.Sh FILES -.Bl -tag -width ".Pa /etc/ssh/moduli" -compact -.It Pa /etc/ssh/moduli +The +.Xr ssh-keygen 1 +moduli candidate generation uses the Sieve of Eratosthenes (flag 0x02). +Subsequent +.Xr ssh-keygen 1 +primality tests are Miller-Rabin tests (flag 0x04). +.It trials +Decimal number indicating the number of primality trials +that have been performed on the modulus. +.It size +Decimal number indicating the size of the prime in bits. +.It generator +The recommended generator for use with this modulus (hexadecimal). +.It modulus +The modulus itself in hexadecimal. .El +.Pp +When performing Diffie-Hellman Group Exchange, +.Xr sshd 8 +first estimates the size of the modulus required to produce enough +Diffie-Hellman output to sufficiently key the selected symmetric cipher. +.Xr sshd 8 +then randomly selects a modulus from +.Fa /etc/ssh/moduli +that best meets the size requirement. .Sh SEE ALSO -.Xr photurisd 8 , +.Xr ssh-keygen 1 , .Xr sshd 8 +.Rs +.%R RFC 4419 +.%T "Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol" +.%D 2006 +.Re From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:27:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A463106564A; Fri, 20 Jul 2012 01:27:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F04418FC0C; Fri, 20 Jul 2012 01:27:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1RKXL041910; Fri, 20 Jul 2012 01:27:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1RKca041907; Fri, 20 Jul 2012 01:27:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200127.q6K1RKca041907@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 01:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238632 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:27:21 -0000 Author: adrian Date: Fri Jul 20 01:27:20 2012 New Revision: 238632 URL: http://svn.freebsd.org/changeset/base/238632 Log: Create an ioctl API for fetching the current rate control information. Modified: head/sys/dev/ath/if_athioctl.h head/sys/dev/ath/if_athrate.h Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Fri Jul 20 01:11:53 2012 (r238631) +++ head/sys/dev/ath/if_athioctl.h Fri Jul 20 01:27:20 2012 (r238632) @@ -186,6 +186,40 @@ struct ath_diag { #define SIOCGATHDIAG _IOWR('i', 138, struct ath_diag) #define SIOCGATHPHYERR _IOWR('i', 140, struct ath_diag) + +/* + * The rate control ioctl has to support multiple potential rate + * control classes. For now, instead of trying to support an + * abstraction for this in the API, let's just use a TLV + * representation for the payload and let userspace sort it out. + */ +struct ath_rateioctl_tlv { + uint16_t tlv_id; + uint16_t tlv_len; /* length excluding TLV header */ +}; + +/* + * This is purely the six byte MAC address. + */ +#define ATH_RATE_TLV_MACADDR 0xaab0 + +/* + * This is the sample node statistics structure. + * More in ath_rate/sample/sample.h. + */ +#define ATH_RATE_TLV_SAMPLENODE 0xaab2 + +struct ath_rateioctl { + char if_name[IFNAMSIZ]; /* if name */ + union { + uint8_t macaddr[IEEE80211_ADDR_LEN]; + uint64_t pad; + } is_u; + uint32_t len; + caddr_t buf; +}; +#define SIOCGATHNODERATESTATS _IOWR('i', 149, struct ath_rateioctl) + /* * Radio capture format. */ Modified: head/sys/dev/ath/if_athrate.h ============================================================================== --- head/sys/dev/ath/if_athrate.h Fri Jul 20 01:11:53 2012 (r238631) +++ head/sys/dev/ath/if_athrate.h Fri Jul 20 01:27:20 2012 (r238632) @@ -150,4 +150,16 @@ struct ath_buf; void ath_rate_tx_complete(struct ath_softc *, struct ath_node *, const struct ath_rc_series *, const struct ath_tx_status *, int pktlen, int nframes, int nbad); + +/* + * Fetch the global rate control statistics. + */ +int ath_rate_fetch_stats(struct ath_softc *sc, struct ath_rateioctl *rs); + +/* + * Fetch the per-node statistics. + */ +int ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, + struct ath_rateioctl *rs); + #endif /* _ATH_RATECTRL_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:36:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFECE1065674; Fri, 20 Jul 2012 01:36:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9A898FC14; Fri, 20 Jul 2012 01:36:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1a3k1042549; Fri, 20 Jul 2012 01:36:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1a3Yu042544; Fri, 20 Jul 2012 01:36:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200136.q6K1a3Yu042544@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 01:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238633 - in head/sys/dev/ath/ath_rate: amrr onoe sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:36:03 -0000 Author: adrian Date: Fri Jul 20 01:36:02 2012 New Revision: 238633 URL: http://svn.freebsd.org/changeset/base/238633 Log: Add a per-node rate control routine for each rate control module. For now, the only module implement is 'sample', and that's only partially implemented. The main issue here with reusing this structure in userland is that it uses 'rix' everywhere, which requires the userland code to have access to the current HAL rate table. For now, this is a very large work in progress. Specific details: * The rate control information is per-node at the moment and wrapped in a TLV, to ease parsing and backwards compatibility. * .. but so I can be slack for now, the userland statistics are just a copy of the kernel-land sample node state. * However, for now use a temporary copy and change the rix entries to dot11rate entries to make it slightly easier to eyeball. Problems: * The actual rate information table is unfortunately indexed by rix and it doesn't contain a rate code. So the userland side of this currently has no way to extract out a mapping. TODO: * Add a TLV payload to dump out the rate control table mapping so 'rix' can be turned into a dot11 / MCS rate. * .. then remove the temporary copy. Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c head/sys/dev/ath/ath_rate/onoe/onoe.c head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c ============================================================================== --- head/sys/dev/ath/ath_rate/amrr/amrr.c Fri Jul 20 01:27:20 2012 (r238632) +++ head/sys/dev/ath/ath_rate/amrr/amrr.c Fri Jul 20 01:36:02 2012 (r238633) @@ -421,6 +421,14 @@ ath_rate_ctl(void *arg, struct ieee80211 } } +static int +ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, + struct ath_rateioctl *re) +{ + + return (EINVAL); +} + static void ath_rate_sysctlattach(struct ath_softc *sc) { Modified: head/sys/dev/ath/ath_rate/onoe/onoe.c ============================================================================== --- head/sys/dev/ath/ath_rate/onoe/onoe.c Fri Jul 20 01:27:20 2012 (r238632) +++ head/sys/dev/ath/ath_rate/onoe/onoe.c Fri Jul 20 01:36:02 2012 (r238633) @@ -407,6 +407,14 @@ ath_rate_sysctlattach(struct ath_softc * "rate control: # good periods before raising rate"); } +static int +ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, + struct ath_rateioctl *re) +{ + + return (EINVAL); +} + struct ath_ratectrl * ath_rate_attach(struct ath_softc *sc) { Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Fri Jul 20 01:27:20 2012 (r238632) +++ head/sys/dev/ath/ath_rate/sample/sample.c Fri Jul 20 01:36:02 2012 (r238633) @@ -105,8 +105,6 @@ __FBSDID("$FreeBSD$"); static void ath_rate_ctl_reset(struct ath_softc *, struct ieee80211_node *); -static const int packet_size_bins[NUM_PACKET_SIZE_BINS] = { 250, 1600 }; - static __inline int size_to_bin(int size) { @@ -128,12 +126,6 @@ size_to_bin(int size) return NUM_PACKET_SIZE_BINS-1; } -static __inline int -bin_to_size(int index) -{ - return packet_size_bins[index]; -} - void ath_rate_node_init(struct ath_softc *sc, struct ath_node *an) { @@ -1198,6 +1190,79 @@ ath_rate_ctl_reset(struct ath_softc *sc, #undef DOT11RATE } +/* + * Fetch the statistics for the given node. + * + * The ieee80211 node must be referenced and unlocked, however the ath_node + * must be locked. + * + * The main difference here is that we convert the rate indexes + * to 802.11 rates, or the userland output won't make much sense + * as it has no access to the rix table. + */ +int +ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an, + struct ath_rateioctl *rs) +{ + struct sample_node *sn = ATH_NODE_SAMPLE(an); + const HAL_RATE_TABLE *rt = sc->sc_currates; + struct ath_rateioctl_tlv av; + struct sample_node *ts; + int y; + + ATH_NODE_LOCK_ASSERT(an); + + /* + * Ensure there's enough space for the statistics. + */ + if (rs->len < + sizeof(struct ath_rateioctl_tlv) + + sizeof(struct sample_node)) + return (EINVAL); + + /* + * Take a temporary copy of the sample node state so we can + * modify it before we copy it. + */ + ts = malloc(sizeof(struct sample_node), M_TEMP, M_WAITOK | M_ZERO); + if (ts == NULL) + return (ENOMEM); + memcpy(ts, sn, sizeof(struct sample_node)); + + /* Convert rix -> 802.11 rate codes */ + ts->static_rix = dot11rate(rt, sn->static_rix); + for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { + /* + * For non-11n rates, clear the high bit - that + * means "basic rate" and will confuse things. + * + * For 11n rates, set the high bit. + */ + ts->current_rix[y] = dot11rate(rt, sn->current_rix[y]); + ts->current_sample_rix[y] = + dot11rate(rt, sn->current_sample_rix[y]); + ts->last_sample_rix[y] = + dot11rate(rt, sn->last_sample_rix[y]); + } + + /* + * Assemble the TLV. + */ + av.tlv_id = ATH_RATE_TLV_SAMPLENODE; + av.tlv_len = sizeof(struct sample_node); + copyout(&av, rs->buf, sizeof(struct ath_rateioctl_tlv)); + + /* + * Copy the statistics over to the provided buffer. + */ + copyout(ts, rs->buf + sizeof(struct ath_rateioctl_tlv), + sizeof(struct sample_node)); + + free(ts, M_TEMP); + + return (0); +} + static void sample_stats(void *arg, struct ieee80211_node *ni) { Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 20 01:27:20 2012 (r238632) +++ head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 20 01:36:02 2012 (r238633) @@ -79,6 +79,14 @@ struct txschedule { */ #define NUM_PACKET_SIZE_BINS 2 +static const int packet_size_bins[NUM_PACKET_SIZE_BINS] = { 250, 1600 }; + +static inline int +bin_to_size(int index) +{ + return packet_size_bins[index]; +} + /* per-node state */ struct sample_node { int static_rix; /* rate index of fixed tx rate */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:36:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E19C4106564A; Fri, 20 Jul 2012 01:36:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCFFC8FC18; Fri, 20 Jul 2012 01:36:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1akoP042628; Fri, 20 Jul 2012 01:36:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1ak54042626; Fri, 20 Jul 2012 01:36:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200136.q6K1ak54042626@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 01:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238634 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:36:47 -0000 Author: adrian Date: Fri Jul 20 01:36:46 2012 New Revision: 238634 URL: http://svn.freebsd.org/changeset/base/238634 Log: Enable the basic node-based rate control statistics via an ioctl(). Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Jul 20 01:36:02 2012 (r238633) +++ head/sys/dev/ath/if_ath.c Fri Jul 20 01:36:46 2012 (r238634) @@ -4925,6 +4925,43 @@ ath_watchdog(void *arg) callout_schedule(&sc->sc_wd_ch, hz); } +/* + * Fetch the rate control statistics for the given node. + */ +static int +ath_ioctl_ratestats(struct ath_softc *sc, struct ath_rateioctl *rs) +{ + struct ath_node *an; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211_node *ni; + int error = 0; + + /* Perform a lookup on the given node */ + ni = ieee80211_find_node(&ic->ic_sta, rs->is_u.macaddr); + if (ni == NULL) { + error = EINVAL; + goto bad; + } + + /* Lock the ath_node */ + an = ATH_NODE(ni); + ATH_NODE_LOCK(an); + + /* Fetch the rate control stats for this node */ + error = ath_rate_fetch_node_stats(sc, an, rs); + + /* No matter what happens here, just drop through */ + + /* Unlock the ath_node */ + ATH_NODE_UNLOCK(an); + + /* Unref the node */ + ieee80211_node_decref(ni); + +bad: + return (error); +} + #ifdef ATH_DIAGAPI /* * Diagnostic interface to the HAL. This is used by various @@ -5073,6 +5110,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, error = ath_ioctl_phyerr(sc,(struct ath_diag*) ifr); break; #endif + case SIOCGATHNODERATESTATS: + error = ath_ioctl_ratestats(sc, (struct ath_rateioctl *) ifr); + break; case SIOCGIFADDR: error = ether_ioctl(ifp, cmd, data); break; From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:38:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD950106566B; Fri, 20 Jul 2012 01:38:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8FDA8FC14; Fri, 20 Jul 2012 01:38:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1c36n042756; Fri, 20 Jul 2012 01:38:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1c3eL042754; Fri, 20 Jul 2012 01:38:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200138.q6K1c3eL042754@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 01:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238635 - head/tools/tools/ath/athratestats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:38:04 -0000 Author: adrian Date: Fri Jul 20 01:38:03 2012 New Revision: 238635 URL: http://svn.freebsd.org/changeset/base/238635 Log: Implement a first cut of the 'sample' rate statistics userland utility. This outputs almost exactly the same information as the kernel sysctl does, however the rix -> rate mapping isn't yet available as a TLV. Added: head/tools/tools/ath/athratestats/ head/tools/tools/ath/athratestats/Makefile (contents, props changed) head/tools/tools/ath/athratestats/main.c (contents, props changed) Added: head/tools/tools/ath/athratestats/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athratestats/Makefile Fri Jul 20 01:38:03 2012 (r238635) @@ -0,0 +1,27 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal +.PATH: ${.CURDIR}/../../../../sys/dev/ath/ + +PROG= athratestats + +SRCS= main.c + +CLEANFILES+= opt_ah.h + +.include <../Makefile.inc> + +CFLAGS+=-DATH_SUPPORT_ANI -g -ggdb +CFLAGS+=-DATH_SUPPORT_TDMA + +opt_ah.h: + echo "#define AH_DEBUG 1" > opt_ah.h + echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h + echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h + +ah_osdep.h: + echo 'typedef void *HAL_SOFTC;' >ah_osdep.h + echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h + echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h + +.include Added: head/tools/tools/ath/athratestats/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athratestats/main.c Fri Jul 20 01:38:03 2012 (r238635) @@ -0,0 +1,200 @@ +/*- + * Copyright (c) 2012, Adrian Chadd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#include "opt_ah.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ah.h" +#include "ah_desc.h" +#include "net80211/ieee80211_ioctl.h" +#include "net80211/ieee80211_radiotap.h" +#include "if_athioctl.h" +#include "if_athrate.h" + +#include "ath_rate/sample/sample.h" + +struct ath_ratestats { + int s; + struct ath_rateioctl re; +}; + +static void +ath_sample_stats(struct ath_ratestats *r, uint8_t *buf) +{ + struct sample_node *sn = (void *) buf; + uint32_t mask; + int rix, y; + + printf("static_rix (%d) ratemask 0x%x\n", + sn->static_rix, + sn->ratemask); + + for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { + printf("[%4u] cur rix %d since switch: packets %d ticks %u\n", + bin_to_size(y), + sn->current_rix[y], + sn->packets_since_switch[y], + sn->ticks_since_switch[y]); + + printf("[%4u] last sample (%d) cur sample (%d) " + "packets sent %d\n", + bin_to_size(y), + sn->last_sample_rix[y], + sn->current_sample_rix[y], + sn->packets_sent[y]); + + printf("[%4u] packets since sample %d sample tt %u\n", + bin_to_size(y), + sn->packets_since_sample[y], + sn->sample_tt[y]); + } + for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) { + if ((mask & 1) == 0) + continue; + for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { + if (sn->stats[y][rix].total_packets == 0) + continue; + printf("[%2u:%4u] %8ju:%-8ju (%3d%%) " + "(EWMA %3d.%1d%%) T %8ju F %4d avg %5u last %u\n", + rix, + bin_to_size(y), + (uintmax_t) sn->stats[y][rix].total_packets, + (uintmax_t) sn->stats[y][rix].packets_acked, + (int) ((sn->stats[y][rix].packets_acked * 100ULL) / + sn->stats[y][rix].total_packets), + sn->stats[y][rix].ewma_pct / 10, + sn->stats[y][rix].ewma_pct % 10, + (uintmax_t) sn->stats[y][rix].tries, + sn->stats[y][rix].successive_failures, + sn->stats[y][rix].average_tx_time, + sn->stats[y][rix].last_tx); + } + } +} + +static void +ath_setifname(struct ath_ratestats *r, const char *ifname) +{ + + strncpy(r->re.if_name, ifname, sizeof (r->re.if_name)); +} + +static void +ath_setsta(struct ath_ratestats *r, const char *mac) +{ + + memcpy(&r->re.is_u.macaddr, mac, sizeof(r->re.is_u.macaddr)); +} + +static void +ath_rate_ioctl(struct ath_ratestats *r) +{ + printf("ether: %x:%x:%x:%x:%x:%x\n", + r->re.is_u.macaddr[0], + r->re.is_u.macaddr[1], + r->re.is_u.macaddr[2], + r->re.is_u.macaddr[3], + r->re.is_u.macaddr[4], + r->re.is_u.macaddr[5]); + if (ioctl(r->s, SIOCGATHNODERATESTATS, &r->re) < 0) + err(1, "ioctl"); +} + +#define STATS_BUF_SIZE 4096 +int +main(int argc, const char *argv[]) +{ + struct ath_ratestats r; + struct ether_addr *e; + uint8_t *buf; + struct ath_rateioctl_tlv *av; + + buf = calloc(1, STATS_BUF_SIZE); + if (buf == NULL) + err(1, "calloc"); + + bzero(&r, sizeof(r)); + r.s = socket(AF_INET, SOCK_DGRAM, 0); + if (r.s < 0) { + err(1, "socket"); + } + /* XXX error check */ + ath_setifname(&r, "ath0"); + + e = ether_aton(argv[1]); + + /* caddr_t ? */ + r.re.buf = buf; + r.re.len = STATS_BUF_SIZE; + + ath_setsta(&r, e->octet); + ath_rate_ioctl(&r); + + /* + * Ensure the TLV entry in question is actually the sample + * rate TLV. + */ + av = (struct ath_rateioctl_tlv *) buf; + + if (av->tlv_id != ATH_RATE_TLV_SAMPLENODE) { + fprintf(stderr, "unexpected rate control TLV (got 0x%x, " + "expected 0x%x\n", + av->tlv_id, + ATH_RATE_TLV_SAMPLENODE); + exit(127); + } + if (av->tlv_len != sizeof(struct sample_node)) { + fprintf(stderr, "unexpected TLV len (got %d bytes, " + "expected %d bytes\n", + av->tlv_len, + sizeof(struct sample_node)); + exit(127); + } + + ath_sample_stats(&r, buf + sizeof(struct ath_rateioctl_tlv)); +} + From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:41:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F0026106564A; Fri, 20 Jul 2012 01:41:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB4228FC0A; Fri, 20 Jul 2012 01:41:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1fIdu043027; Fri, 20 Jul 2012 01:41:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1fIG2043025; Fri, 20 Jul 2012 01:41:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200141.q6K1fIG2043025@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 01:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238636 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:41:19 -0000 Author: adrian Date: Fri Jul 20 01:41:18 2012 New Revision: 238636 URL: http://svn.freebsd.org/changeset/base/238636 Log: Bump this up to match what the HAL is at now. Modified: head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 20 01:38:03 2012 (r238635) +++ head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 20 01:41:18 2012 (r238636) @@ -90,7 +90,7 @@ bin_to_size(int index) /* per-node state */ struct sample_node { int static_rix; /* rate index of fixed tx rate */ -#define SAMPLE_MAXRATES 32 /* NB: corresponds to hal info[32] */ +#define SAMPLE_MAXRATES 64 /* NB: corresponds to hal info[32] */ uint32_t ratemask; /* bit mask of valid rate indices */ const struct txschedule *sched; /* tx schedule table */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 01:56:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D253106566C; Fri, 20 Jul 2012 01:56:15 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 377BF8FC08; Fri, 20 Jul 2012 01:56:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K1uFYQ044199; Fri, 20 Jul 2012 01:56:15 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K1uEfB044197; Fri, 20 Jul 2012 01:56:15 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200156.q6K1uEfB044197@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 01:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238637 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 01:56:15 -0000 Author: davidxu Date: Fri Jul 20 01:56:14 2012 New Revision: 238637 URL: http://svn.freebsd.org/changeset/base/238637 Log: Don't forget to release a thread reference count, replace _thr_ref_add() with _thr_find_thread(), so reference count is no longer needed. MFC after: 3 days Modified: head/lib/libthr/thread/thr_setschedparam.c Modified: head/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_setschedparam.c Fri Jul 20 01:41:18 2012 (r238636) +++ head/lib/libthr/thread/thr_setschedparam.c Fri Jul 20 01:56:14 2012 (r238637) @@ -70,9 +70,8 @@ _pthread_setschedparam(pthread_t pthread curthread->attr.prio = param->sched_priority; } THR_UNLOCK(curthread); - } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) - == 0) { - THR_THREAD_LOCK(curthread, pthread); + } else if ((ret = _thr_find_thread(curthread, pthread, + /*include dead*/0)) == 0) { if (pthread->attr.sched_policy == policy && (policy == SCHED_OTHER || pthread->attr.prio == param->sched_priority)) { @@ -88,7 +87,6 @@ _pthread_setschedparam(pthread_t pthread pthread->attr.prio = param->sched_priority; } THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); } return (ret); } From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 02:17:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A3AE106564A; Fri, 20 Jul 2012 02:17:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748058FC16; Fri, 20 Jul 2012 02:17:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K2HnmP045907; Fri, 20 Jul 2012 02:17:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K2HnaF045904; Fri, 20 Jul 2012 02:17:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200217.q6K2HnaF045904@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 02:17:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238638 - in head/sys/dev/ath: . ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 02:17:49 -0000 Author: adrian Date: Fri Jul 20 02:17:48 2012 New Revision: 238638 URL: http://svn.freebsd.org/changeset/base/238638 Log: Introduce a rate table TLV so rate table statistics consumers know how to map rix -> rate code. Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Fri Jul 20 01:56:14 2012 (r238637) +++ head/sys/dev/ath/ath_rate/sample/sample.c Fri Jul 20 02:17:48 2012 (r238638) @@ -1207,8 +1207,9 @@ ath_rate_fetch_node_stats(struct ath_sof struct sample_node *sn = ATH_NODE_SAMPLE(an); const HAL_RATE_TABLE *rt = sc->sc_currates; struct ath_rateioctl_tlv av; - struct sample_node *ts; + struct ath_rateioctl_rt *tv; int y; + int o = 0; ATH_NODE_LOCK_ASSERT(an); @@ -1217,48 +1218,61 @@ ath_rate_fetch_node_stats(struct ath_sof */ if (rs->len < sizeof(struct ath_rateioctl_tlv) + - sizeof(struct sample_node)) + sizeof(struct ath_rateioctl_rt) + + sizeof(struct ath_rateioctl_tlv) + + sizeof(struct sample_node)) { + device_printf(sc->sc_dev, "%s: len=%d, too short\n", + __func__, + rs->len); return (EINVAL); + } /* * Take a temporary copy of the sample node state so we can * modify it before we copy it. */ - ts = malloc(sizeof(struct sample_node), M_TEMP, M_WAITOK | M_ZERO); - if (ts == NULL) + tv = malloc(sizeof(struct ath_rateioctl_rt), M_TEMP, + M_NOWAIT | M_ZERO); + if (tv == NULL) { return (ENOMEM); - memcpy(ts, sn, sizeof(struct sample_node)); + } - /* Convert rix -> 802.11 rate codes */ - ts->static_rix = dot11rate(rt, sn->static_rix); - for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { - /* - * For non-11n rates, clear the high bit - that - * means "basic rate" and will confuse things. - * - * For 11n rates, set the high bit. - */ - ts->current_rix[y] = dot11rate(rt, sn->current_rix[y]); - ts->current_sample_rix[y] = - dot11rate(rt, sn->current_sample_rix[y]); - ts->last_sample_rix[y] = - dot11rate(rt, sn->last_sample_rix[y]); + /* + * Populate the rate table mapping TLV. + */ + tv->nentries = rt->rateCount; + for (y = 0; y < rt->rateCount; y++) { + tv->ratecode[y] = rt->info[y].dot11Rate & IEEE80211_RATE_VAL; + if (rt->info[y].phy == IEEE80211_T_HT) + tv->ratecode[y] |= IEEE80211_RATE_MCS; } + o = 0; + /* + * First TLV - rate code mapping + */ + av.tlv_id = ATH_RATE_TLV_RATETABLE; + av.tlv_len = sizeof(struct ath_rateioctl_rt); + copyout(&av, rs->buf + o, sizeof(struct ath_rateioctl_tlv)); + o += sizeof(struct ath_rateioctl_tlv); + copyout(tv, rs->buf + o, sizeof(struct ath_rateioctl_rt)); + o += sizeof(struct ath_rateioctl_rt); + /* - * Assemble the TLV. + * Second TLV - sample node statistics */ av.tlv_id = ATH_RATE_TLV_SAMPLENODE; av.tlv_len = sizeof(struct sample_node); - copyout(&av, rs->buf, sizeof(struct ath_rateioctl_tlv)); + copyout(&av, rs->buf + o, sizeof(struct ath_rateioctl_tlv)); + o += sizeof(struct ath_rateioctl_tlv); /* * Copy the statistics over to the provided buffer. */ - copyout(ts, rs->buf + sizeof(struct ath_rateioctl_tlv), - sizeof(struct sample_node)); + copyout(sn, rs->buf + o, sizeof(struct sample_node)); + o += sizeof(struct sample_node); - free(ts, M_TEMP); + free(tv, M_TEMP); return (0); } Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Fri Jul 20 01:56:14 2012 (r238637) +++ head/sys/dev/ath/if_athioctl.h Fri Jul 20 02:17:48 2012 (r238638) @@ -204,6 +204,18 @@ struct ath_rateioctl_tlv { #define ATH_RATE_TLV_MACADDR 0xaab0 /* + * The rate control modules may decide to push a mapping table + * of rix -> net80211 ratecode as part of the update. + */ +#define ATH_RATE_TLV_RATETABLE_NENTRIES 64 +struct ath_rateioctl_rt { + uint16_t nentries; + uint16_t pad[1]; + uint8_t ratecode[ATH_RATE_TLV_RATETABLE_NENTRIES]; +}; +#define ATH_RATE_TLV_RATETABLE 0xaab1 + +/* * This is the sample node statistics structure. * More in ath_rate/sample/sample.h. */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 02:18:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C4D21065675; Fri, 20 Jul 2012 02:18:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 464628FC0C; Fri, 20 Jul 2012 02:18:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K2IlZs046009; Fri, 20 Jul 2012 02:18:47 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K2Ilf0046007; Fri, 20 Jul 2012 02:18:47 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200218.q6K2Ilf0046007@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 02:18:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238639 - head/tools/tools/ath/athratestats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 02:18:48 -0000 Author: adrian Date: Fri Jul 20 02:18:47 2012 New Revision: 238639 URL: http://svn.freebsd.org/changeset/base/238639 Log: Use the rate control table to display the rate rather than the rix, making the output of this program much more meaningful. Modified: head/tools/tools/ath/athratestats/main.c Modified: head/tools/tools/ath/athratestats/main.c ============================================================================== --- head/tools/tools/ath/athratestats/main.c Fri Jul 20 02:17:48 2012 (r238638) +++ head/tools/tools/ath/athratestats/main.c Fri Jul 20 02:18:47 2012 (r238639) @@ -62,10 +62,31 @@ struct ath_ratestats { struct ath_rateioctl re; }; +static inline int +dot11rate(struct ath_rateioctl_rt *rt, int rix) +{ + + if (rt->ratecode[rix] & IEEE80211_RATE_MCS) + return rt->ratecode[rix] & ~(IEEE80211_RATE_MCS); + else + return (rt->ratecode[rix] / 2); +} + +static const char * +dot11str(struct ath_rateioctl_rt *rt, int rix) +{ + if (rix == -1) + return ""; + else if (rt->ratecode[rix] & IEEE80211_RATE_MCS) + return "MCS"; + else + return " Mb"; +} + static void -ath_sample_stats(struct ath_ratestats *r, uint8_t *buf) +ath_sample_stats(struct ath_ratestats *r, struct ath_rateioctl_rt *rt, + struct sample_node *sn) { - struct sample_node *sn = (void *) buf; uint32_t mask; int rix, y; @@ -74,17 +95,21 @@ ath_sample_stats(struct ath_ratestats *r sn->ratemask); for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { - printf("[%4u] cur rix %d since switch: packets %d ticks %u\n", + printf("[%4u] cur rate %d %s since switch: " + "packets %d ticks %u\n", bin_to_size(y), - sn->current_rix[y], + dot11rate(rt, sn->current_rix[y]), + dot11str(rt, sn->current_rix[y]), sn->packets_since_switch[y], sn->ticks_since_switch[y]); - printf("[%4u] last sample (%d) cur sample (%d) " + printf("[%4u] last sample (%d %s) cur sample (%d %s) " "packets sent %d\n", bin_to_size(y), - sn->last_sample_rix[y], - sn->current_sample_rix[y], + dot11rate(rt, sn->last_sample_rix[y]), + dot11str(rt, sn->last_sample_rix[y]), + dot11rate(rt, sn->current_sample_rix[y]), + dot11str(rt, sn->current_sample_rix[y]), sn->packets_sent[y]); printf("[%4u] packets since sample %d sample tt %u\n", @@ -98,9 +123,10 @@ ath_sample_stats(struct ath_ratestats *r for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { if (sn->stats[y][rix].total_packets == 0) continue; - printf("[%2u:%4u] %8ju:%-8ju (%3d%%) " + printf("[%2u %s:%4u] %8ju:%-8ju (%3d%%) " "(EWMA %3d.%1d%%) T %8ju F %4d avg %5u last %u\n", - rix, + dot11rate(rt, rix), + dot11str(rt, rix), bin_to_size(y), (uintmax_t) sn->stats[y][rix].total_packets, (uintmax_t) sn->stats[y][rix].packets_acked, @@ -144,7 +170,7 @@ ath_rate_ioctl(struct ath_ratestats *r) err(1, "ioctl"); } -#define STATS_BUF_SIZE 4096 +#define STATS_BUF_SIZE 8192 int main(int argc, const char *argv[]) { @@ -152,6 +178,8 @@ main(int argc, const char *argv[]) struct ether_addr *e; uint8_t *buf; struct ath_rateioctl_tlv *av; + struct sample_node *sn = NULL; + struct ath_rateioctl_rt *rt = NULL; buf = calloc(1, STATS_BUF_SIZE); if (buf == NULL) @@ -175,11 +203,28 @@ main(int argc, const char *argv[]) ath_rate_ioctl(&r); /* - * Ensure the TLV entry in question is actually the sample - * rate TLV. + * For now, hard-code the TLV order and contents. Ew! */ av = (struct ath_rateioctl_tlv *) buf; + if (av->tlv_id != ATH_RATE_TLV_RATETABLE) { + fprintf(stderr, "unexpected rate control TLV (got 0x%x, " + "expected 0x%x\n", + av->tlv_id, + ATH_RATE_TLV_RATETABLE); + exit(127); + } + if (av->tlv_len != sizeof(struct ath_rateioctl_rt)) { + fprintf(stderr, "unexpected TLV len (got %d bytes, " + "expected %d bytes\n", + av->tlv_len, + sizeof(struct ath_rateioctl_rt)); + exit(127); + } + rt = (void *) (buf + sizeof(struct ath_rateioctl_tlv)); + /* Next */ + av = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + + sizeof(struct ath_rateioctl_rt)); if (av->tlv_id != ATH_RATE_TLV_SAMPLENODE) { fprintf(stderr, "unexpected rate control TLV (got 0x%x, " "expected 0x%x\n", @@ -194,7 +239,10 @@ main(int argc, const char *argv[]) sizeof(struct sample_node)); exit(127); } + sn = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + + sizeof(struct ath_rateioctl_rt) + + sizeof(struct ath_rateioctl_tlv)); - ath_sample_stats(&r, buf + sizeof(struct ath_rateioctl_tlv)); + ath_sample_stats(&r, rt, sn); } From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 03:00:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19AE7106564A; Fri, 20 Jul 2012 03:00:42 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEB378FC0C; Fri, 20 Jul 2012 03:00:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K30fcH049030; Fri, 20 Jul 2012 03:00:41 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K30f7c049028; Fri, 20 Jul 2012 03:00:41 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200300.q6K30f7c049028@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 03:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238640 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 03:00:42 -0000 Author: davidxu Date: Fri Jul 20 03:00:41 2012 New Revision: 238640 URL: http://svn.freebsd.org/changeset/base/238640 Log: Eliminate duplicated code. Modified: head/lib/libthr/thread/thr_setschedparam.c Modified: head/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_setschedparam.c Fri Jul 20 02:18:47 2012 (r238639) +++ head/lib/libthr/thread/thr_setschedparam.c Fri Jul 20 03:00:41 2012 (r238640) @@ -54,39 +54,25 @@ _pthread_setschedparam(pthread_t pthread int ret; if (pthread == curthread) { + pthread = curthread; THR_LOCK(curthread); - if (curthread->attr.sched_policy == policy && - (policy == SCHED_OTHER || - curthread->attr.prio == param->sched_priority)) { - pthread->attr.prio = param->sched_priority; - THR_UNLOCK(curthread); - return (0); - } - ret = _thr_setscheduler(curthread->tid, policy, param); - if (ret == -1) - ret = errno; - else { - curthread->attr.sched_policy = policy; - curthread->attr.prio = param->sched_priority; - } - THR_UNLOCK(curthread); } else if ((ret = _thr_find_thread(curthread, pthread, - /*include dead*/0)) == 0) { - if (pthread->attr.sched_policy == policy && - (policy == SCHED_OTHER || - pthread->attr.prio == param->sched_priority)) { - pthread->attr.prio = param->sched_priority; - THR_THREAD_UNLOCK(curthread, pthread); - return (0); - } - ret = _thr_setscheduler(pthread->tid, policy, param); - if (ret == -1) - ret = errno; - else { - pthread->attr.sched_policy = policy; - pthread->attr.prio = param->sched_priority; - } + /*include dead*/0)) != 0) + return (ret); + if (pthread->attr.sched_policy == policy && + (policy == SCHED_OTHER || + pthread->attr.prio == param->sched_priority)) { + pthread->attr.prio = param->sched_priority; THR_THREAD_UNLOCK(curthread, pthread); + return (0); } + ret = _thr_setscheduler(pthread->tid, policy, param); + if (ret == -1) + ret = errno; + else { + pthread->attr.sched_policy = policy; + pthread->attr.prio = param->sched_priority; + } + THR_THREAD_UNLOCK(curthread, pthread); return (ret); } From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 03:16:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 642B1106564A; Fri, 20 Jul 2012 03:16:53 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF3D8FC16; Fri, 20 Jul 2012 03:16:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K3GrcU050710; Fri, 20 Jul 2012 03:16:53 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K3Grn9050708; Fri, 20 Jul 2012 03:16:53 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200316.q6K3Grn9050708@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 03:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238641 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 03:16:53 -0000 Author: davidxu Date: Fri Jul 20 03:16:52 2012 New Revision: 238641 URL: http://svn.freebsd.org/changeset/base/238641 Log: Eliminate duplicated code. Modified: head/lib/libthr/thread/thr_setprio.c Modified: head/lib/libthr/thread/thr_setprio.c ============================================================================== --- head/lib/libthr/thread/thr_setprio.c Fri Jul 20 03:00:41 2012 (r238640) +++ head/lib/libthr/thread/thr_setprio.c Fri Jul 20 03:16:52 2012 (r238641) @@ -46,37 +46,22 @@ _pthread_setprio(pthread_t pthread, int param.sched_priority = prio; if (pthread == curthread) { + pthread = curthread; THR_LOCK(curthread); - if (curthread->attr.sched_policy == SCHED_OTHER || - curthread->attr.prio == prio) { - curthread->attr.prio = prio; - ret = 0; - } else { - ret = _thr_setscheduler(curthread->tid, - curthread->attr.sched_policy, ¶m); - if (ret == -1) - ret = errno; - else - curthread->attr.prio = prio; - } - THR_UNLOCK(curthread); - } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) - == 0) { - THR_THREAD_LOCK(curthread, pthread); - if (pthread->attr.sched_policy == SCHED_OTHER || - pthread->attr.prio == prio) { + } else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) + return (ret); + if (pthread->attr.sched_policy == SCHED_OTHER || + pthread->attr.prio == prio) { + pthread->attr.prio = prio; + ret = 0; + } else { + ret = _thr_setscheduler(pthread->tid, + pthread->attr.sched_policy, ¶m); + if (ret == -1) + ret = errno; + else pthread->attr.prio = prio; - ret = 0; - } else { - ret = _thr_setscheduler(pthread->tid, - curthread->attr.sched_policy, ¶m); - if (ret == -1) - ret = errno; - else - pthread->attr.prio = prio; - } - THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); } + THR_THREAD_UNLOCK(curthread, pthread); return (ret); } From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 03:22:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37550106566B; Fri, 20 Jul 2012 03:22:18 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2159F8FC15; Fri, 20 Jul 2012 03:22:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K3MHXX051117; Fri, 20 Jul 2012 03:22:17 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K3MHMQ051114; Fri, 20 Jul 2012 03:22:17 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200322.q6K3MHMQ051114@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 03:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238642 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 03:22:18 -0000 Author: davidxu Date: Fri Jul 20 03:22:17 2012 New Revision: 238642 URL: http://svn.freebsd.org/changeset/base/238642 Log: Don't assign same value. Modified: head/lib/libthr/thread/thr_setprio.c head/lib/libthr/thread/thr_setschedparam.c Modified: head/lib/libthr/thread/thr_setprio.c ============================================================================== --- head/lib/libthr/thread/thr_setprio.c Fri Jul 20 03:16:52 2012 (r238641) +++ head/lib/libthr/thread/thr_setprio.c Fri Jul 20 03:22:17 2012 (r238642) @@ -45,10 +45,9 @@ _pthread_setprio(pthread_t pthread, int int ret; param.sched_priority = prio; - if (pthread == curthread) { - pthread = curthread; + if (pthread == curthread) THR_LOCK(curthread); - } else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) + else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) return (ret); if (pthread->attr.sched_policy == SCHED_OTHER || pthread->attr.prio == prio) { Modified: head/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_setschedparam.c Fri Jul 20 03:16:52 2012 (r238641) +++ head/lib/libthr/thread/thr_setschedparam.c Fri Jul 20 03:22:17 2012 (r238642) @@ -53,10 +53,9 @@ _pthread_setschedparam(pthread_t pthread struct pthread *curthread = _get_curthread(); int ret; - if (pthread == curthread) { - pthread = curthread; + if (pthread == curthread) THR_LOCK(curthread); - } else if ((ret = _thr_find_thread(curthread, pthread, + else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0) return (ret); if (pthread->attr.sched_policy == policy && From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 03:27:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D241B1065670; Fri, 20 Jul 2012 03:27:07 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC4138FC14; Fri, 20 Jul 2012 03:27:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K3R7ob051493; Fri, 20 Jul 2012 03:27:07 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K3R70e051491; Fri, 20 Jul 2012 03:27:07 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200327.q6K3R70e051491@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 03:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238643 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 03:27:07 -0000 Author: davidxu Date: Fri Jul 20 03:27:07 2012 New Revision: 238643 URL: http://svn.freebsd.org/changeset/base/238643 Log: Eliminate duplicated code. Modified: head/lib/libthr/thread/thr_getschedparam.c Modified: head/lib/libthr/thread/thr_getschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_getschedparam.c Fri Jul 20 03:22:17 2012 (r238642) +++ head/lib/libthr/thread/thr_getschedparam.c Fri Jul 20 03:27:07 2012 (r238643) @@ -53,25 +53,16 @@ _pthread_getschedparam(pthread_t pthread if (policy == NULL || param == NULL) return (EINVAL); - if (pthread == curthread) { - /* - * Avoid searching the thread list when it is the current - * thread. - */ + /* + * Avoid searching the thread list when it is the current + * thread. + */ + if (pthread == curthread) THR_LOCK(curthread); - *policy = curthread->attr.sched_policy; - param->sched_priority = curthread->attr.prio; - THR_UNLOCK(curthread); - ret = 0; - } - /* Find the thread in the list of active threads. */ - else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) - == 0) { - THR_THREAD_LOCK(curthread, pthread); - *policy = pthread->attr.sched_policy; - param->sched_priority = pthread->attr.prio; - THR_THREAD_UNLOCK(curthread, pthread); - _thr_ref_delete(curthread, pthread); - } + else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) + return (ret); + *policy = pthread->attr.sched_policy; + param->sched_priority = pthread->attr.prio; + THR_THREAD_UNLOCK(curthread, pthread); return (ret); } From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 03:37:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 961AC106566B; Fri, 20 Jul 2012 03:37:20 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 802308FC18; Fri, 20 Jul 2012 03:37:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K3bKUb052231; Fri, 20 Jul 2012 03:37:20 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K3bKN3052229; Fri, 20 Jul 2012 03:37:20 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200337.q6K3bKN3052229@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 03:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238644 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 03:37:20 -0000 Author: davidxu Date: Fri Jul 20 03:37:19 2012 New Revision: 238644 URL: http://svn.freebsd.org/changeset/base/238644 Log: Simplify code by replacing _thr_ref_add() with _thr_find_thread(). Modified: head/lib/libthr/thread/thr_info.c Modified: head/lib/libthr/thread/thr_info.c ============================================================================== --- head/lib/libthr/thread/thr_info.c Fri Jul 20 03:27:07 2012 (r238643) +++ head/lib/libthr/thread/thr_info.c Fri Jul 20 03:37:19 2012 (r238644) @@ -51,16 +51,12 @@ _pthread_set_name_np(pthread_t thread, c if (thr_set_name(thread->tid, name)) ret = errno; } else { - if (_thr_ref_add(curthread, thread, 0) == 0) { - THR_THREAD_LOCK(curthread, thread); + if ((ret=_thr_find_thread(curthread, thread, 0)) == 0) { if (thread->state != PS_DEAD) { if (thr_set_name(thread->tid, name)) ret = errno; } THR_THREAD_UNLOCK(curthread, thread); - _thr_ref_delete(curthread, thread); - } else { - ret = ESRCH; } } #if 0 From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 05:47:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B3DD4106566C; Fri, 20 Jul 2012 05:47:12 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7FE8FC0A; Fri, 20 Jul 2012 05:47:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K5lCdc061611; Fri, 20 Jul 2012 05:47:12 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K5lCBJ061608; Fri, 20 Jul 2012 05:47:12 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200547.q6K5lCBJ061608@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 05:47:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238645 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 05:47:12 -0000 Author: davidxu Date: Fri Jul 20 05:47:12 2012 New Revision: 238645 URL: http://svn.freebsd.org/changeset/base/238645 Log: Don't forget to initialize return value. Modified: head/lib/libthr/thread/thr_getschedparam.c Modified: head/lib/libthr/thread/thr_getschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_getschedparam.c Fri Jul 20 03:37:19 2012 (r238644) +++ head/lib/libthr/thread/thr_getschedparam.c Fri Jul 20 05:47:12 2012 (r238645) @@ -48,7 +48,7 @@ _pthread_getschedparam(pthread_t pthread struct sched_param *param) { struct pthread *curthread = _get_curthread(); - int ret; + int ret = 0; if (policy == NULL || param == NULL) return (EINVAL); From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 06:11:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EE781065673; Fri, 20 Jul 2012 06:11:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C8DF8FC08; Fri, 20 Jul 2012 06:11:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K6BRb9063370; Fri, 20 Jul 2012 06:11:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K6BRFk063368; Fri, 20 Jul 2012 06:11:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200611.q6K6BRFk063368@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 06:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238646 - head/tools/tools/ath/athratestats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 06:11:27 -0000 Author: adrian Date: Fri Jul 20 06:11:26 2012 New Revision: 238646 URL: http://svn.freebsd.org/changeset/base/238646 Log: Tidy things up substantially: * remove some debugging; * introduce command line arguments; * introduce support for non-ath0 interfaces. Modified: head/tools/tools/ath/athratestats/main.c Modified: head/tools/tools/ath/athratestats/main.c ============================================================================== --- head/tools/tools/ath/athratestats/main.c Fri Jul 20 05:47:12 2012 (r238645) +++ head/tools/tools/ath/athratestats/main.c Fri Jul 20 06:11:26 2012 (r238646) @@ -57,6 +57,12 @@ #include "ath_rate/sample/sample.h" +/* + * This needs to be big enough to fit the two TLVs, the rate table + * and the rate statistics table for a single node. + */ +#define STATS_BUF_SIZE 8192 + struct ath_ratestats { int s; struct ath_rateioctl re; @@ -159,20 +165,13 @@ ath_setsta(struct ath_ratestats *r, cons static void ath_rate_ioctl(struct ath_ratestats *r) { - printf("ether: %x:%x:%x:%x:%x:%x\n", - r->re.is_u.macaddr[0], - r->re.is_u.macaddr[1], - r->re.is_u.macaddr[2], - r->re.is_u.macaddr[3], - r->re.is_u.macaddr[4], - r->re.is_u.macaddr[5]); + if (ioctl(r->s, SIOCGATHNODERATESTATS, &r->re) < 0) err(1, "ioctl"); } -#define STATS_BUF_SIZE 8192 int -main(int argc, const char *argv[]) +main(int argc, char *argv[]) { struct ath_ratestats r; struct ether_addr *e; @@ -180,6 +179,33 @@ main(int argc, const char *argv[]) struct ath_rateioctl_tlv *av; struct sample_node *sn = NULL; struct ath_rateioctl_rt *rt = NULL; + char const *ifname = NULL, *macaddr = NULL; + int c; + int do_all = 0; + + ifname = getenv("ATH"); + if (ifname == NULL) + ifname = "ath0"; + + while ((c = getopt(argc, argv, "ahi:m:")) != -1) { + switch (c) { + case 'a': + do_all = 1; + break; + case 'i': + ifname = optarg; + break; + case 'm': + macaddr = optarg; + break; + + default: + errx(1, + "usage: %s [-h] [-i ifname] [-a] [-m macaddr]\n", + argv[0]); + /* NOTREACHED */ + } + } buf = calloc(1, STATS_BUF_SIZE); if (buf == NULL) @@ -191,11 +217,17 @@ main(int argc, const char *argv[]) err(1, "socket"); } /* XXX error check */ - ath_setifname(&r, "ath0"); + ath_setifname(&r, ifname); - e = ether_aton(argv[1]); + if (macaddr == NULL) { + errx(1, "%s: macaddress wasn't supplied and no -a given\n", + argv[0]); + /* NOTREACHED */ + } + e = ether_aton(macaddr); + if (e == NULL) + err(1, "ether_aton"); - /* caddr_t ? */ r.re.buf = buf; r.re.len = STATS_BUF_SIZE; From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 06:44:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81BEC106564A; Fri, 20 Jul 2012 06:44:19 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 405A28FC0A; Fri, 20 Jul 2012 06:44:18 +0000 (UTC) Received: by bkcje9 with SMTP id je9so3214038bkc.13 for ; Thu, 19 Jul 2012 23:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=1nODGaEx/2cio5ZYxNW7JXNZyy6EVypPFcc93pGj6FA=; b=IMzNqQql4iV2+M07Fajpe44YV3tshMGNAeUjg0yuuLGHLzpLWTdkd6SrcEhqj/iz5e cAVroRmXyuL25n6pjOTxOBNt80OrPytsKrScj/RMiJjc13S4OmX8BHKZSfb943wWu78B j+mcy/I1VlcWSyH02GQ1luXpZvVFKQ1rqtLdnRjBNz20Ym6i3DaYAI9nesD5ejVi+LKz aGbZ0QbscFE6umiZGN6yizaeNUsV0Haxh1xCbEib6Tq8H2u2jhR9KQiSa1zCxWUxsTJo 9LSZnkPAnNwkghf5xN5L9MK0CNImbiPO7CL6rHNii4U0QyH0cwt5GZ2IRRmy9fIKoa7z dm+A== Received: by 10.204.148.72 with SMTP id o8mr2126164bkv.103.1342766657230; Thu, 19 Jul 2012 23:44:17 -0700 (PDT) MIME-Version: 1.0 Sender: utisoft@gmail.com Received: by 10.204.49.87 with HTTP; Thu, 19 Jul 2012 23:43:47 -0700 (PDT) In-Reply-To: <50080D5A.9040807@FreeBSD.org> References: <201207181928.q6IJSMgZ003200@svn.freebsd.org> <50080D5A.9040807@FreeBSD.org> From: Chris Rees Date: Fri, 20 Jul 2012 07:43:47 +0100 X-Google-Sender-Auth: inHq8srAAb8YIR16yWWkwnMygVg Message-ID: To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r238602 - head/usr.bin/du X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 06:44:19 -0000 On 19 July 2012 14:36, Dimitry Andric wrote: > On 2012-07-18 21:28, Dag-Erling Smorgrav wrote: >> Author: des >> Date: Wed Jul 18 19:28:22 2012 >> New Revision: 238602 >> URL: http://svn.freebsd.org/changeset/base/238602 >> >> Log: >> Add -g (gigabyte) flag to complement -k (kilobyte) and -m (megabyte). > > Too bad -t is already taken. :) -T is not however-- POLA issue or no big deal? Chris From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 07:17:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B5CC106564A; Fri, 20 Jul 2012 07:17:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 166728FC1B; Fri, 20 Jul 2012 07:17:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K7HO92068096; Fri, 20 Jul 2012 07:17:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K7HOrC068094; Fri, 20 Jul 2012 07:17:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200717.q6K7HOrC068094@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 07:17:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238648 - head/tools/tools/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 07:17:25 -0000 Author: adrian Date: Fri Jul 20 07:17:24 2012 New Revision: 238648 URL: http://svn.freebsd.org/changeset/base/238648 Log: Add the new athratestats tool. Modified: head/tools/tools/ath/Makefile Modified: head/tools/tools/ath/Makefile ============================================================================== --- head/tools/tools/ath/Makefile Fri Jul 20 06:50:57 2012 (r238647) +++ head/tools/tools/ath/Makefile Fri Jul 20 07:17:24 2012 (r238648) @@ -3,6 +3,6 @@ SUBDIR= arcode athdebug athdecode athkey athpoke athprom athrd athregs SUBDIR+= athstats ath_prom_read athradar athaggrstats SUBDIR+= ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print -SUBDIR+= athsurvey +SUBDIR+= athsurvey athratestats .include From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 07:38:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B5A6E1065674; Fri, 20 Jul 2012 07:38:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87B518FC12; Fri, 20 Jul 2012 07:38:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K7cC6c069615; Fri, 20 Jul 2012 07:38:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K7cCJE069613; Fri, 20 Jul 2012 07:38:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200738.q6K7cCJE069613@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 07:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238650 - head/tools/tools/ath/athratestats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 07:38:12 -0000 Author: adrian Date: Fri Jul 20 07:38:11 2012 New Revision: 238650 URL: http://svn.freebsd.org/changeset/base/238650 Log: Add missing SRCS. Modified: head/tools/tools/ath/athratestats/Makefile Modified: head/tools/tools/ath/athratestats/Makefile ============================================================================== --- head/tools/tools/ath/athratestats/Makefile Fri Jul 20 07:22:37 2012 (r238649) +++ head/tools/tools/ath/athratestats/Makefile Fri Jul 20 07:38:11 2012 (r238650) @@ -5,7 +5,7 @@ PROG= athratestats -SRCS= main.c +SRCS= main.c opt_ah.h ah_osdep.h CLEANFILES+= opt_ah.h From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 07:49:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33010106566B; Fri, 20 Jul 2012 07:49:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D7B48FC08; Fri, 20 Jul 2012 07:49:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K7nQlH070554; Fri, 20 Jul 2012 07:49:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K7nQci070552; Fri, 20 Jul 2012 07:49:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207200749.q6K7nQci070552@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Jul 2012 07:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238651 - head/tools/tools/ath/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 07:49:27 -0000 Author: adrian Date: Fri Jul 20 07:49:26 2012 New Revision: 238651 URL: http://svn.freebsd.org/changeset/base/238651 Log: Add a needed #include due to my recent change. Modified: head/tools/tools/ath/common/diag.h Modified: head/tools/tools/ath/common/diag.h ============================================================================== --- head/tools/tools/ath/common/diag.h Fri Jul 20 07:38:11 2012 (r238650) +++ head/tools/tools/ath/common/diag.h Fri Jul 20 07:49:26 2012 (r238651) @@ -38,6 +38,7 @@ #include #include +#include #include "if_athioctl.h" struct statshandler { From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 08:31:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A9798106564A; Fri, 20 Jul 2012 08:31:37 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C34F8FC0C; Fri, 20 Jul 2012 08:31:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K8Vbev073666; Fri, 20 Jul 2012 08:31:37 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K8Vb9U073664; Fri, 20 Jul 2012 08:31:37 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201207200831.q6K8Vb9U073664@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 20 Jul 2012 08:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238652 - head/bin/cat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 08:31:37 -0000 Author: jh Date: Fri Jul 20 08:31:36 2012 New Revision: 238652 URL: http://svn.freebsd.org/changeset/base/238652 Log: style(9). Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Fri Jul 20 07:49:26 2012 (r238651) +++ head/bin/cat/cat.c Fri Jul 20 08:31:36 2012 (r238652) @@ -58,11 +58,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include static int bflag, eflag, nflag, sflag, tflag, vflag; static int rval; @@ -77,16 +77,20 @@ static void raw_cat(int); static int udom_open(const char *path, int flags); #endif -/* Memory strategy threshold, in pages: if physmem is larger then this, use a - * large buffer */ -#define PHYSPAGES_THRESHOLD (32*1024) - -/* Maximum buffer size in bytes - do not allow it to grow larger than this */ -#define BUFSIZE_MAX (2*1024*1024) - -/* Small (default) buffer size in bytes. It's inefficient for this to be - * smaller than MAXPHYS */ -#define BUFSIZE_SMALL (MAXPHYS) +/* + * Memory strategy threshold, in pages: if physmem is larger than this, + * use a large buffer. + */ +#define PHYSPAGES_THRESHOLD (32 * 1024) + +/* Maximum buffer size in bytes - do not allow it to grow larger than this. */ +#define BUFSIZE_MAX (2 * 1024 * 1024) + +/* + * Small (default) buffer size in bytes. It's inefficient for this to be + * smaller than MAXPHYS. + */ +#define BUFSIZE_SMALL (MAXPHYS) int main(int argc, char *argv[]) @@ -144,13 +148,12 @@ usage(void) static void scanfiles(char *argv[], int cooked) { - int i = 0; + int fd, i; char *path; FILE *fp; + i = 0; while ((path = argv[i]) != NULL || i == 0) { - int fd; - if (path == NULL || strcmp(path, "-") == 0) { filename = "stdin"; fd = STDIN_FILENO; @@ -261,12 +264,12 @@ raw_cat(int rfd) if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) > PHYSPAGES_THRESHOLD) - bsize = MIN(BUFSIZE_MAX, MAXPHYS*8); + bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8); else bsize = BUFSIZE_SMALL; } else - bsize = MAX(sbuf.st_blksize, - (blksize_t)sysconf(_SC_PAGESIZE)); + bsize = MAX(sbuf.st_blksize, + (blksize_t)sysconf(_SC_PAGESIZE)); if ((buf = malloc(bsize)) == NULL) err(1, "malloc() failure of IO buffer"); } @@ -327,7 +330,7 @@ udom_open(const char *path, int flags) break; } } - return(fd); + return (fd); } #endif From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 08:33:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 995AE106566B; Fri, 20 Jul 2012 08:33:24 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 847038FC14; Fri, 20 Jul 2012 08:33:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K8XOQw073839; Fri, 20 Jul 2012 08:33:24 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K8XOow073837; Fri, 20 Jul 2012 08:33:24 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201207200833.q6K8XOow073837@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 20 Jul 2012 08:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238653 - head/bin/cat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 08:33:24 -0000 Author: jh Date: Fri Jul 20 08:33:23 2012 New Revision: 238653 URL: http://svn.freebsd.org/changeset/base/238653 Log: Use proper error message when fstat(2) fails on stdout. PR: bin/159746 Submitted by: Alex K. Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Fri Jul 20 08:31:36 2012 (r238652) +++ head/bin/cat/cat.c Fri Jul 20 08:33:23 2012 (r238653) @@ -260,7 +260,7 @@ raw_cat(int rfd) wfd = fileno(stdout); if (buf == NULL) { if (fstat(wfd, &sbuf)) - err(1, "%s", filename); + err(1, "stdout"); if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) > PHYSPAGES_THRESHOLD) From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 10:13:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A77DF1065673; Fri, 20 Jul 2012 10:13:13 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 62D948FC22; Fri, 20 Jul 2012 10:13:13 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id C12DA6422; Fri, 20 Jul 2012 12:13:12 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 91D2E8156; Fri, 20 Jul 2012 12:13:12 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Chris Rees References: <201207181928.q6IJSMgZ003200@svn.freebsd.org> <50080D5A.9040807@FreeBSD.org> Date: Fri, 20 Jul 2012 12:13:12 +0200 In-Reply-To: (Chris Rees's message of "Fri, 20 Jul 2012 07:43:47 +0100") Message-ID: <86k3xyd9l3.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r238602 - head/usr.bin/du X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 10:13:13 -0000 Chris Rees writes: > Dimitry Andric writes: > > Dag-Erling Smorgrav writes: > > > Log: > > > Add -g (gigabyte) flag to complement -k (kilobyte) and -m (megabyte= ). > > Too bad -t is already taken. :) > -T is not however-- POLA issue or no big deal? I doubt there's much use for it at the moment. Let's talk again in a couple of years' time :) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 16:56:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7627B1065670; Fri, 20 Jul 2012 16:56:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60D278FC08; Fri, 20 Jul 2012 16:56:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KGuZlE017265; Fri, 20 Jul 2012 16:56:35 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6KGuZVw017263; Fri, 20 Jul 2012 16:56:35 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201207201656.q6KGuZVw017263@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 20 Jul 2012 16:56:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238656 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 16:56:35 -0000 Author: trasz Date: Fri Jul 20 16:56:34 2012 New Revision: 238656 URL: http://svn.freebsd.org/changeset/base/238656 Log: Make ZVOL resizing ('zfs set volsize') properly resize the GEOM provider. Sponsored by: FreeBSD Foundation Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Jul 20 09:49:50 2012 (r238655) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Jul 20 16:56:34 2012 (r238656) @@ -177,15 +177,9 @@ zvol_size_changed(zvol_state_t *zv) pp = zv->zv_provider; if (pp == NULL) return; - if (zv->zv_volsize == pp->mediasize) - return; - /* - * Changing provider size is not really supported by GEOM, but it - * should be safe when provider is closed. - */ - if (zv->zv_total_opens > 0) - return; - pp->mediasize = zv->zv_volsize; + g_topology_lock(); + g_resize_provider(pp, zv->zv_volsize); + g_topology_unlock(); #endif /* !sun */ } From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 17:51:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4B42106566C; Fri, 20 Jul 2012 17:51:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF2EB8FC1C; Fri, 20 Jul 2012 17:51:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KHpKXR022212; Fri, 20 Jul 2012 17:51:20 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6KHpKiQ022210; Fri, 20 Jul 2012 17:51:20 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201207201751.q6KHpKiQ022210@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 20 Jul 2012 17:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238657 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 17:51:20 -0000 Author: trasz Date: Fri Jul 20 17:51:20 2012 New Revision: 238657 URL: http://svn.freebsd.org/changeset/base/238657 Log: Make it possible to resize opened partitions. Sponsored by: FreeBSD Foundation Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Jul 20 16:56:34 2012 (r238656) +++ head/sys/geom/part/g_part.c Fri Jul 20 17:51:20 2012 (r238657) @@ -1257,6 +1257,7 @@ g_part_ctl_resize(struct gctl_req *req, struct sbuf *sb; quad_t end; int error; + off_t mediasize; gp = gpp->gpp_geom; G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); @@ -1301,8 +1302,11 @@ g_part_ctl_resize(struct gctl_req *req, pp = entry->gpe_pp; if ((g_debugflags & 16) == 0 && (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) { - gctl_error(req, "%d", EBUSY); - return (EBUSY); + if (entry->gpe_end - entry->gpe_start + 1 > gpp->gpp_size) { + /* Deny shrinking of an opened partition. */ + gctl_error(req, "%d", EBUSY); + return (EBUSY); + } } error = G_PART_RESIZE(table, entry, gpp); @@ -1315,8 +1319,9 @@ g_part_ctl_resize(struct gctl_req *req, entry->gpe_modified = 1; /* update mediasize of changed provider */ - pp->mediasize = (entry->gpe_end - entry->gpe_start + 1) * + mediasize = (entry->gpe_end - entry->gpe_start + 1) * pp->sectorsize; + g_resize_provider(pp, mediasize); /* Provide feedback if so requested. */ if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { From owner-svn-src-head@FreeBSD.ORG Fri Jul 20 23:56:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A44E5106566B; Fri, 20 Jul 2012 23:56:24 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 850248FC16; Fri, 20 Jul 2012 23:56:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KNuOf8054917; Fri, 20 Jul 2012 23:56:24 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6KNuOpq054914; Fri, 20 Jul 2012 23:56:24 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201207202356.q6KNuOpq054914@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 20 Jul 2012 23:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238660 - head/share/dtrace X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 23:56:24 -0000 Author: gnn Date: Fri Jul 20 23:56:23 2012 New Revision: 238660 URL: http://svn.freebsd.org/changeset/base/238660 Log: Add a new script, hotopen, which shows what uid is opening files on a per second basis. While here clean up the Makefile as well. MFC after: 1 week Added: head/share/dtrace/hotopen (contents, props changed) Modified: head/share/dtrace/Makefile Modified: head/share/dtrace/Makefile ============================================================================== --- head/share/dtrace/Makefile Fri Jul 20 21:09:36 2012 (r238659) +++ head/share/dtrace/Makefile Fri Jul 20 23:56:23 2012 (r238660) @@ -12,9 +12,9 @@ SUBDIR= ${_toolkit} _toolkit= toolkit .endif -SCRIPTS= nfsclienttime +SCRIPTS= nfsclienttime hotopen -SCRIPTSDIR= ${SHAREDIR}/dtrace/ +SCRIPTSDIR= ${SHAREDIR}/dtrace NO_OBJ= Added: head/share/dtrace/hotopen ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/dtrace/hotopen Fri Jul 20 23:56:23 2012 (r238660) @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright (c) 2012 George V. Neville-Neil +# All rights reserved. +# +# This software was developed at the University of Cambridge Computer +# Laboratory with support from a grant from Google, Inc. +# +# 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$ +# +# The hotopen D script periodically outputs table of which UIDs +# are opening files. This is a very quick way to find out if +# a paritcular user is thrashing a system with rapid calls to +# open/close. +# +# Usage: hotopen +# + +/usr/sbin/dtrace -n ' +#pragma D option quiet +BEGIN +{ + printf("Files opened per UID in the last second.\n"); +} + +syscall::open:entry +{ + @files[uid] = count(); + output = 1; +} + +tick-1sec +/output != 0/ +{ + printf("%-20Y \n", walltimestamp); + printa("uid %d\tcount %@d\n", @files, @files); + trunc(@files); + output = 0; +} +' From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 07:14:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49B3A1065672; Sat, 21 Jul 2012 07:14:53 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 350698FC18; Sat, 21 Jul 2012 07:14:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6L7ErT7098851; Sat, 21 Jul 2012 07:14:53 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6L7ErGs098849; Sat, 21 Jul 2012 07:14:53 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201207210714.q6L7ErGs098849@svn.freebsd.org> From: "George V. Neville-Neil" Date: Sat, 21 Jul 2012 07:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238665 - head/share/dtrace X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 07:14:53 -0000 Author: gnn Date: Sat Jul 21 07:14:52 2012 New Revision: 238665 URL: http://svn.freebsd.org/changeset/base/238665 Log: Remove copy/pasteo in the copyright notice. Modified: head/share/dtrace/hotopen Modified: head/share/dtrace/hotopen ============================================================================== --- head/share/dtrace/hotopen Sat Jul 21 04:15:38 2012 (r238664) +++ head/share/dtrace/hotopen Sat Jul 21 07:14:52 2012 (r238665) @@ -3,9 +3,6 @@ # Copyright (c) 2012 George V. Neville-Neil # All rights reserved. # -# This software was developed at the University of Cambridge Computer -# Laboratory with support from a grant from Google, Inc. -# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 08:19:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FC771065679; Sat, 21 Jul 2012 08:19:44 +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 0A2078FC1E; Sat, 21 Jul 2012 08:19:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6L8JhBj005314; Sat, 21 Jul 2012 08:19:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6L8JhLe005312; Sat, 21 Jul 2012 08:19:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207210819.q6L8JhLe005312@svn.freebsd.org> From: Alexander Motin Date: Sat, 21 Jul 2012 08:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238666 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 08:19:44 -0000 Author: mav Date: Sat Jul 21 08:19:43 2012 New Revision: 238666 URL: http://svn.freebsd.org/changeset/base/238666 Log: Fix typo in bzero length argument during sense fetching. For me it at least fixed CD burning in PIO mode. MFC after: 3 days Modified: head/sys/dev/ata/ata-all.c Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Sat Jul 21 07:14:52 2012 (r238665) +++ head/sys/dev/ata/ata-all.c Sat Jul 21 08:19:43 2012 (r238666) @@ -1532,7 +1532,7 @@ ata_cam_request_sense(device_t dev, stru ch->requestsense = 1; - bzero(request, sizeof(&request)); + bzero(request, sizeof(*request)); request->dev = NULL; request->parent = dev; request->unit = ccb->ccb_h.target_id; From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 13:02:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9641106566C; Sat, 21 Jul 2012 13:02:12 +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 A398B8FC0A; Sat, 21 Jul 2012 13:02:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LD2CPb035570; Sat, 21 Jul 2012 13:02:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LD2Crb035566; Sat, 21 Jul 2012 13:02:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207211302.q6LD2Crb035566@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 13:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238667 - in head: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 13:02:12 -0000 Author: kib Date: Sat Jul 21 13:02:11 2012 New Revision: 238667 URL: http://svn.freebsd.org/changeset/base/238667 Log: (Incomplete) fixes for symbols visibility issues and style in fcntl.h. Append '__' prefix to the tag of struct oflock, and put it under BSD namespace. Structure is needed both by libc and kernel, thus cannot be hidden under #ifdef _KERNEL. Move a set of non-standard F_* and O_* constants into BSD namespace. SUSv4 explicitely allows implemenation to pollute F_* and O_* names after fcntl.h is included, but it costs us nothing to adhere to the specification if exact POSIX compliance level is requested by user code. Change some spaces after #define to tabs. Noted by and discussed with: bde MFC after: 1 week Modified: head/lib/libc/sys/fcntl.c head/sys/kern/kern_descrip.c head/sys/sys/fcntl.h Modified: head/lib/libc/sys/fcntl.c ============================================================================== --- head/lib/libc/sys/fcntl.c Sat Jul 21 08:19:43 2012 (r238666) +++ head/lib/libc/sys/fcntl.c Sat Jul 21 13:02:11 2012 (r238667) @@ -41,7 +41,7 @@ __fcntl_compat(int fd, int cmd, ...) { va_list args; long arg; - struct oflock ofl; + struct __oflock ofl; struct flock *flp; int res; Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jul 21 08:19:43 2012 (r238666) +++ head/sys/kern/kern_descrip.c Sat Jul 21 13:02:11 2012 (r238667) @@ -367,7 +367,7 @@ int sys_fcntl(struct thread *td, struct fcntl_args *uap) { struct flock fl; - struct oflock ofl; + struct __oflock ofl; intptr_t arg; int error; int cmd; Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Sat Jul 21 08:19:43 2012 (r238666) +++ head/sys/sys/fcntl.h Sat Jul 21 13:02:11 2012 (r238667) @@ -111,7 +111,7 @@ typedef __pid_t pid_t; #if __BSD_VISIBLE /* Attempt to bypass buffer cache */ -#define O_DIRECT 0x00010000 +#define O_DIRECT 0x00010000 #endif /* Defined by POSIX Extended API Set Part 2 */ @@ -213,18 +213,22 @@ typedef __pid_t pid_t; #define F_SETFL 4 /* set file status flags */ #if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 #define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ -#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ +#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ #endif +#if __BSD_VISIBLE #define F_OGETLK 7 /* get record locking information */ #define F_OSETLK 8 /* set record locking information */ #define F_OSETLKW 9 /* F_SETLK; wait if blocked */ #define F_DUP2FD 10 /* duplicate file descriptor to arg */ +#endif #define F_GETLK 11 /* get record locking information */ #define F_SETLK 12 /* set record locking information */ #define F_SETLKW 13 /* F_SETLK; wait if blocked */ +#if __BSD_VISIBLE #define F_SETLK_REMOTE 14 /* debugging support for remote locks */ #define F_READAHEAD 15 /* read ahead */ #define F_RDAHEAD 16 /* Darwin compatible read ahead */ +#endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 #define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ #endif @@ -236,14 +240,16 @@ typedef __pid_t pid_t; #define F_RDLCK 1 /* shared or read lock */ #define F_UNLCK 2 /* unlock */ #define F_WRLCK 3 /* exclusive or write lock */ +#if __BSD_VISIBLE #define F_UNLCKSYS 4 /* purge locks for a given system ID */ #define F_CANCEL 5 /* cancel an async lock request */ +#endif #ifdef _KERNEL #define F_WAIT 0x010 /* Wait until lock is granted */ #define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ #define F_POSIX 0x040 /* Use POSIX semantics for lock */ #define F_REMOTE 0x080 /* Lock owner is remote NFS client */ -#define F_NOINTR 0x100 /* Ignore signals when waiting */ +#define F_NOINTR 0x100 /* Ignore signals when waiting */ #endif /* @@ -259,18 +265,19 @@ struct flock { int l_sysid; /* remote system id or zero for local */ }; +#if __BSD_VISIBLE /* * Old advisory file segment locking data type, * before adding l_sysid. */ -struct oflock { +struct __oflock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ }; - +#endif #if __BSD_VISIBLE /* lock operations for flock(2) */ From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 13:05:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D622106566B; Sat, 21 Jul 2012 13:05:35 +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 2D8778FC14; Sat, 21 Jul 2012 13:05:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LD5ZIn035938; Sat, 21 Jul 2012 13:05:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LD5YiC035936; Sat, 21 Jul 2012 13:05:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207211305.q6LD5YiC035936@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 13:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238668 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 13:05:35 -0000 Author: kib Date: Sat Jul 21 13:05:34 2012 New Revision: 238668 URL: http://svn.freebsd.org/changeset/base/238668 Log: Stop clearing x87 exceptions in the #MF handler on amd64. If user code understands FPU hardware enough to catch SIGFPE and unmask exceptions in control word, then it may as well properly handle return from SIGFPE without causing an infinite loop of #MF exceptions due to faulting instruction restart, when needed. Clearing exceptions causes information loss for handlers which do understand FPU hardware, and struct siginfo si_code member cannot be considered adequate replacement for en_sw content due to translation. Supposed reason for clearing the exceptions, which is IRQ13 handling oddities, were never applicable to amd64. Note: this change will be merged to i386 kernel as well, since we do not support IRQ13 delivery of #MF notifications for some time. Requested by: bde MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Sat Jul 21 13:02:11 2012 (r238667) +++ head/sys/amd64/amd64/fpu.c Sat Jul 21 13:05:34 2012 (r238668) @@ -513,25 +513,21 @@ static char fpetable[128] = { }; /* - * Preserve the FP status word, clear FP exceptions for x87, then - * generate a SIGFPE. + * Read the FP status and control words, then generate si_code value + * for SIGFPE. The error code chosen will be one of the + * FPE_... macros. It will be sent as the second argument to old + * BSD-style signal handlers and as "siginfo_t->si_code" (second + * argument) to SA_SIGINFO signal handlers. * - * Clearing exceptions was necessary mainly to avoid IRQ13 bugs and is - * engraved in our i386 ABI. We now depend on longjmp() restoring a - * usable state. Restoring the state or examining it might fail if we - * didn't clear exceptions. + * Some time ago, we cleared the x87 exceptions with FNCLEX there. + * Clearing exceptions was necessary mainly to avoid IRQ13 bugs. The + * usermode code which understands the FPU hardware enough to enable + * the exceptions, can also handle clearing the exception state in the + * handler. The only consequence of not clearing the exception is the + * rethrow of the SIGFPE on return from the signal handler and + * reexecution of the corresponding instruction. * - * For SSE exceptions, the exceptions are not cleared. - * - * The error code chosen will be one of the FPE_... macros. It will be - * sent as the second argument to old BSD-style signal handlers and as - * "siginfo_t->si_code" (second argument) to SA_SIGINFO signal handlers. - * - * XXX the FP state is not preserved across signal handlers. So signal - * handlers cannot afford to do FP unless they preserve the state or - * longjmp() out. Both preserving the state and longjmp()ing may be - * destroyed by IRQ13 bugs. Clearing FP exceptions is not an acceptable - * solution for signals other than SIGFPE. + * For XMM traps, the exceptions were never cleared. */ int fputrap_x87(void) @@ -553,7 +549,6 @@ fputrap_x87(void) } else { fnstcw(&control); fnstsw(&status); - fnclex(); } critical_exit(); From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 13:06:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 244261065673; Sat, 21 Jul 2012 13:06:38 +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 E9DE58FC17; Sat, 21 Jul 2012 13:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LD6bTT036081; Sat, 21 Jul 2012 13:06:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LD6bn1036079; Sat, 21 Jul 2012 13:06:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207211306.q6LD6bn1036079@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 13:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238669 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 13:06:38 -0000 Author: kib Date: Sat Jul 21 13:06:37 2012 New Revision: 238669 URL: http://svn.freebsd.org/changeset/base/238669 Log: The PT_I386_{GET,SET}XMMREGS and PT_{GET,SET}XSTATE operate on the stopped threads. Implementation assumes that the thread's FPU context is spilled into the PCB due to stop. This is mostly true, except when FPU state for the thread is not initialized. Then the requests operate on the garbage state which is currently left in the PCB, causing confusion. The situation is indeed observed after a signal delivery and before #NM fault on execution of any FPU instruction in the signal handler, since sendsig(9) drops FPU state for current thread, clearing PCB_FPUINITDONE. When inspecting context state for the signal handler, debugger sees the FPU state of the main program context instead of the clear state supposed to be provided to handler. Fix this by forcing clean FPU state in PCB user FPU save area by performing getfpuregs(9) before accessing user FPU save area in ptrace_machdep.c. Note: this change will be merged to i386 kernel as well, where it is much more important, since e.g. gdb on i386 uses PT_I386_GETXMMREGS to inspect FPU context on CPUs that support SSE. Amd64 version of gdb uses PT_GETFPREGS to inspect both 64 and 32 bit processes, which does not exhibit the bug. Reported by: bde MFC after: 1 week Modified: head/sys/amd64/amd64/ptrace_machdep.c Modified: head/sys/amd64/amd64/ptrace_machdep.c ============================================================================== --- head/sys/amd64/amd64/ptrace_machdep.c Sat Jul 21 13:05:34 2012 (r238668) +++ head/sys/amd64/amd64/ptrace_machdep.c Sat Jul 21 13:06:37 2012 (r238669) @@ -50,6 +50,7 @@ cpu_ptrace_xstate(struct thread *td, int switch (req) { case PT_GETXSTATE: + fpugetregs(td); savefpu = (char *)(get_pcb_user_save_td(td) + 1); error = copyout(savefpu, addr, cpu_max_ext_state_size - sizeof(struct savefpu)); @@ -62,8 +63,10 @@ cpu_ptrace_xstate(struct thread *td, int } savefpu = malloc(data, M_TEMP, M_WAITOK); error = copyin(addr, savefpu, data); - if (error == 0) + if (error == 0) { + fpugetregs(td); error = fpusetxstate(td, savefpu, data); + } free(savefpu, M_TEMP); break; @@ -89,11 +92,13 @@ cpu32_ptrace(struct thread *td, int req, switch (req) { case PT_I386_GETXMMREGS: + fpugetregs(td); error = copyout(get_pcb_user_save_td(td), addr, sizeof(*fpstate)); break; case PT_I386_SETXMMREGS: + fpugetregs(td); fpstate = get_pcb_user_save_td(td); error = copyin(addr, fpstate, sizeof(*fpstate)); fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 13:29:20 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D417C106566B; Sat, 21 Jul 2012 13:29:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 4F2B38FC0C; Sat, 21 Jul 2012 13:29:20 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q6LDTHTb002264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 21 Jul 2012 23:29:18 +1000 Date: Sat, 21 Jul 2012 23:29:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov In-Reply-To: <201207211305.q6LD5YiC035936@svn.freebsd.org> Message-ID: <20120721232459.J2515@besplex.bde.org> References: <201207211305.q6LD5YiC035936@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238668 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 13:29:20 -0000 On Sat, 21 Jul 2012, Konstantin Belousov wrote: > Log: > Stop clearing x87 exceptions in the #MF handler on amd64. If user code > understands FPU hardware enough to catch SIGFPE and unmask exceptions > in control word, then it may as well properly handle return from > SIGFPE without causing an infinite loop of #MF exceptions due to > faulting instruction restart, when needed. > > Clearing exceptions causes information loss for handlers which do > understand FPU hardware, and struct siginfo si_code member cannot be > considered adequate replacement for en_sw content due to translation. > > Supposed reason for clearing the exceptions, which is IRQ13 handling > oddities, were never applicable to amd64. > > Note: this change will be merged to i386 kernel as well, since we do > not support IRQ13 delivery of #MF notifications for some time. > > Requested by: bde > MFC after: 1 week Thanks. The comment formatting has lost its constent 2-space sentence breaks. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 13:47:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E38F106566B; Sat, 21 Jul 2012 13:47:38 +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 D47DC8FC14; Sat, 21 Jul 2012 13:47:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LDlbrT040176; Sat, 21 Jul 2012 13:47:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LDlbBr040173; Sat, 21 Jul 2012 13:47:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207211347.q6LDlbBr040173@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 13:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238670 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 13:47:38 -0000 Author: kib Date: Sat Jul 21 13:47:37 2012 New Revision: 238670 URL: http://svn.freebsd.org/changeset/base/238670 Log: Stop caching curpcb in the local variable. Requested by: bde MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Sat Jul 21 13:06:37 2012 (r238669) +++ head/sys/amd64/amd64/fpu.c Sat Jul 21 13:47:37 2012 (r238670) @@ -582,7 +582,6 @@ static int err_count = 0; void fpudna(void) { - struct pcb *pcb; critical_enter(); if (PCPU_GET(fpcurthread) == curthread) { @@ -604,11 +603,10 @@ fpudna(void) * Record new context early in case frstor causes a trap. */ PCPU_SET(fpcurthread, curthread); - pcb = curpcb; fpu_clean_state(); - if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) { + if ((curpcb->pcb_flags & PCB_FPUINITDONE) == 0) { /* * This is the first time this thread has used the FPU or * the PCB doesn't contain a clean FPU state. Explicitly @@ -619,17 +617,17 @@ fpudna(void) * fpu_initialstate, to ignite the XSAVEOPT * tracking engine. */ - bcopy(fpu_initialstate, pcb->pcb_save, cpu_max_ext_state_size); - fpurestore(pcb->pcb_save); - if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) - fldcw(pcb->pcb_initial_fpucw); - if (PCB_USER_FPU(pcb)) - set_pcb_flags(pcb, + bcopy(fpu_initialstate, curpcb->pcb_save, cpu_max_ext_state_size); + fpurestore(curpcb->pcb_save); + if (curpcb->pcb_initial_fpucw != __INITIAL_FPUCW__) + fldcw(curpcb->pcb_initial_fpucw); + if (PCB_USER_FPU(curpcb)) + set_pcb_flags(curpcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); else - set_pcb_flags(pcb, PCB_FPUINITDONE); + set_pcb_flags(curpcb, PCB_FPUINITDONE); } else - fpurestore(pcb->pcb_save); + fpurestore(curpcb->pcb_save); critical_exit(); } @@ -963,16 +961,14 @@ fpu_kern_leave(struct thread *td, struct int fpu_kern_thread(u_int flags) { - struct pcb *pcb; - pcb = curpcb; KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); - KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb), + KASSERT(curpcb->pcb_save == get_pcb_user_save_pcb(curpcb), ("mangled pcb_save")); - KASSERT(PCB_USER_FPU(pcb), ("recursive call")); + KASSERT(PCB_USER_FPU(curpcb), ("recursive call")); - set_pcb_flags(pcb, PCB_KERNFPU); + set_pcb_flags(curpcb, PCB_KERNFPU); return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 13:53:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 632461065673; Sat, 21 Jul 2012 13:53:01 +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 4E4DB8FC16; Sat, 21 Jul 2012 13:53:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LDr1u4040821; Sat, 21 Jul 2012 13:53:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LDr1AK040819; Sat, 21 Jul 2012 13:53:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207211353.q6LDr1AK040819@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 13:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238671 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 13:53:01 -0000 Author: kib Date: Sat Jul 21 13:53:00 2012 New Revision: 238671 URL: http://svn.freebsd.org/changeset/base/238671 Log: Constently use 2-space sentence breaks. Submitted by: bde MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Sat Jul 21 13:47:37 2012 (r238670) +++ head/sys/amd64/amd64/fpu.c Sat Jul 21 13:53:00 2012 (r238671) @@ -515,7 +515,7 @@ static char fpetable[128] = { /* * Read the FP status and control words, then generate si_code value * for SIGFPE. The error code chosen will be one of the - * FPE_... macros. It will be sent as the second argument to old + * FPE_... macros. It will be sent as the second argument to old * BSD-style signal handlers and as "siginfo_t->si_code" (second * argument) to SA_SIGINFO signal handlers. * @@ -523,7 +523,7 @@ static char fpetable[128] = { * Clearing exceptions was necessary mainly to avoid IRQ13 bugs. The * usermode code which understands the FPU hardware enough to enable * the exceptions, can also handle clearing the exception state in the - * handler. The only consequence of not clearing the exception is the + * handler. The only consequence of not clearing the exception is the * rethrow of the SIGFPE on return from the signal handler and * reexecution of the corresponding instruction. * From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 14:07:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C268C106566C; Sat, 21 Jul 2012 14:07:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC4F68FC12; Sat, 21 Jul 2012 14:07:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LE7hFh042320; Sat, 21 Jul 2012 14:07:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LE7h9P042318; Sat, 21 Jul 2012 14:07:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207211407.q6LE7h9P042318@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 21 Jul 2012 14:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238672 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 14:07:43 -0000 Author: glebius Date: Sat Jul 21 14:07:43 2012 New Revision: 238672 URL: http://svn.freebsd.org/changeset/base/238672 Log: Fix typo in comment, should be MHz here. Submitted by: Daan Vreeken Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sat Jul 21 13:53:00 2012 (r238671) +++ head/sys/dev/sdhci/sdhci.c Sat Jul 21 14:07:43 2012 (r238672) @@ -364,7 +364,7 @@ sdhci_lower_frequency(device_t dev) /* * Some SD/MMC cards don't work with the default base - * clock frequency of 200MHz. Lower it to 50Hz. + * clock frequency of 200MHz. Lower it to 50MHz. */ pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x01, 1); pci_write_config(dev, SDHC_PCI_BASE_FREQ, 50, 1); From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 14:59:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7ADCE1065678; Sat, 21 Jul 2012 14:59:44 +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 4CAE98FC14; Sat, 21 Jul 2012 14:59:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LExixc047651; Sat, 21 Jul 2012 14:59:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LExiNl047649; Sat, 21 Jul 2012 14:59:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207211459.q6LExiNl047649@svn.freebsd.org> From: Alexander Motin Date: Sat, 21 Jul 2012 14:59:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238673 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 14:59:44 -0000 Author: mav Date: Sat Jul 21 14:59:43 2012 New Revision: 238673 URL: http://svn.freebsd.org/changeset/base/238673 Log: Use 16bit PIO instead of 32bit in case of misaligned buffer. It fixes kernel panic during CD write with cdrecord on sparc64. Modified: head/sys/dev/ata/ata-lowlevel.c Modified: head/sys/dev/ata/ata-lowlevel.c ============================================================================== --- head/sys/dev/ata/ata-lowlevel.c Sat Jul 21 14:07:43 2012 (r238672) +++ head/sys/dev/ata/ata-lowlevel.c Sat Jul 21 14:59:43 2012 (r238673) @@ -836,23 +836,21 @@ static void ata_pio_read(struct ata_request *request, int length) { struct ata_channel *ch = device_get_softc(request->parent); + uint8_t *addr; int size = min(request->transfersize, length); int resid; uint8_t buf[2]; - if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) { - ATA_IDX_INSW_STRM(ch, ATA_DATA, - (void*)((uintptr_t)request->data+request->donecount), - size / sizeof(int16_t)); + addr = (uint8_t *)request->data + request->donecount; + if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t)) || + ((uintptr_t)addr % sizeof(int32_t))) { + ATA_IDX_INSW_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int16_t)); if (size & 1) { ATA_IDX_INSW_STRM(ch, ATA_DATA, (void*)buf, 1); - ((uint8_t *)request->data + request->donecount + - (size & ~1))[0] = buf[0]; + (addr + (size & ~1))[0] = buf[0]; } } else - ATA_IDX_INSL_STRM(ch, ATA_DATA, - (void*)((uintptr_t)request->data+request->donecount), - size / sizeof(int32_t)); + ATA_IDX_INSL_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int32_t)); if (request->transfersize < length) { device_printf(request->parent, "WARNING - %s read data overrun %d>%d\n", @@ -867,23 +865,21 @@ static void ata_pio_write(struct ata_request *request, int length) { struct ata_channel *ch = device_get_softc(request->parent); + uint8_t *addr; int size = min(request->transfersize, length); int resid; uint8_t buf[2]; - if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t))) { - ATA_IDX_OUTSW_STRM(ch, ATA_DATA, - (void*)((uintptr_t)request->data+request->donecount), - size / sizeof(int16_t)); + addr = (uint8_t *)request->data + request->donecount; + if (ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t)) || + ((uintptr_t)addr % sizeof(int32_t))) { + ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int16_t)); if (size & 1) { - buf[0] = ((uint8_t *)request->data + request->donecount + - (size & ~1))[0]; + buf[0] = (addr + (size & ~1))[0]; ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (void*)buf, 1); } } else - ATA_IDX_OUTSL_STRM(ch, ATA_DATA, - (void*)((uintptr_t)request->data+request->donecount), - size / sizeof(int32_t)); + ATA_IDX_OUTSL_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int32_t)); if (request->transfersize < length) { device_printf(request->parent, "WARNING - %s write data underrun %d>%d\n", From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 15:30:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 177311065672; Sat, 21 Jul 2012 15:30:26 +0000 (UTC) Date: Sat, 21 Jul 2012 15:30:26 +0000 From: Alexey Dokuchaev To: Gleb Smirnoff Message-ID: <20120721153026.GA8640@FreeBSD.org> References: <201207211407.q6LE7h9P042318@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201207211407.q6LE7h9P042318@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238672 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 15:30:26 -0000 On Sat, Jul 21, 2012 at 02:07:43PM +0000, Gleb Smirnoff wrote: > Author: glebius > Date: Sat Jul 21 14:07:43 2012 > New Revision: 238672 > URL: http://svn.freebsd.org/changeset/base/238672 > > Log: > Fix typo in comment, should be MHz here. That's nice, but... > @@ -364,7 +364,7 @@ sdhci_lower_frequency(device_t dev) > > /* > * Some SD/MMC cards don't work with the default base > - * clock frequency of 200MHz. Lower it to 50Hz. > + * clock frequency of 200MHz. Lower it to 50MHz. ... Why losing 2-space break after a sentence (per what we are generally adhering and AFAIR is suggested by Chicago Style Guide)? ./danfe From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 17:59:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A847106564A; Sat, 21 Jul 2012 17:59:53 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1FFD68FC14; Sat, 21 Jul 2012 17:59:53 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so8832554pbb.13 for ; Sat, 21 Jul 2012 10:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=5Rj8miJwL4JcaBA3ApCQVsRgAubuT7LzAgMv/PGKnQ0=; b=UI9GT6FeFLXs26f77AykOBDxH1fv6F27eiJkeUnf7oRiP+K0FZibyiGEfu67ekzMBp aAG0ClwTVxKxKHVl6DjAbBU6M/k3zWBQY92107V/WnO5Ll4tcjLCTtok626KpJo2Z+c5 nnJ4QKe6G+gkVBut4IS2mBcngVpKUoClwn7uBrGk2oKo5RNOsA7GkNslqOw54V9EzmVD a9c7wPiHgxNLsmIXClGdHQAtinVDGhh+Bdlh4tkRtYp3K1NqmVmJrZsEQA4slgd32Vi/ qcCoh1JkzbilTf3UuYiP2RC17uCNE/QDlOx8gka+gclS4pnWlIHW4ZmYEYJef5v2I3vu BI0g== MIME-Version: 1.0 Received: by 10.68.220.193 with SMTP id py1mr23705061pbc.4.1342893592888; Sat, 21 Jul 2012 10:59:52 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.191.138 with HTTP; Sat, 21 Jul 2012 10:59:52 -0700 (PDT) In-Reply-To: References: <201207121211.q6CCBWTD006484@svn.freebsd.org> Date: Sat, 21 Jul 2012 10:59:52 -0700 X-Google-Sender-Auth: Mn87foCZw9K8vbQzbeCK8DS-VHs Message-ID: From: Adrian Chadd To: Eitan Adler Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org Subject: Re: svn commit: r238396 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 17:59:53 -0000 On 12 July 2012 21:39, Eitan Adler wrote: > On 12 July 2012 05:11, Gavin Atkinson wrote: >> Author: gavin >> Date: Thu Jul 12 12:11:32 2012 >> New Revision: 238396 >> URL: http://svn.freebsd.org/changeset/base/238396 >> >> Log: >> Update for new core team. Looks like this file was not updated two years >> ago for the last core team. > > Perhaps we can make a wiki page of "pages that need to change on core > team change?" ? Anything like that should likely be turned into a small shell script and automated. :) Adrian From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 18:16:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B287106566B; Sat, 21 Jul 2012 18:16:58 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id BD2568FC16; Sat, 21 Jul 2012 18:16:57 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so8850423pbb.13 for ; Sat, 21 Jul 2012 11:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=ogsL4OVVXRBv1EoSOsiCXytc2ct0xf8+D7OLFJjzIZA=; b=h4AEAUWJEftNzRSV0a3+t8qOBbtXmtnQsQ0cNKq1j8YQM5JAEU/vcXJE5EchvaL0td yWDS60ii1Obo45Pv76dDzp62VLFE4vfBU0qxioy5YyfdHdfqSf3DBeL9JtfCtgU5h9yo oUxmr0+QVD7JZD6RMqJ12QlUq+QDOGITaQU5420E6XSxeicGKBNvII19QTitATFBJtg2 oQ5iWXpISmrTaEJ9BBqUtTkq7hkFAzLLFQrv2/p7Xx6kkqYlytyHeuwWnGYkuVSLEBcl BOyKInVFYk37UWntyM2nFsNsfkQijH62au3agsH7KqSYzOKh5cb1IC49ggv+eX5Vt9mC CUhw== Received: by 10.68.196.228 with SMTP id ip4mr23007228pbc.82.1342894617560; Sat, 21 Jul 2012 11:16:57 -0700 (PDT) Received: from fuji-wireless.local (c-24-19-191-56.hsd1.wa.comcast.net. [24.19.191.56]) by mx.google.com with ESMTPS id rg10sm6418132pbc.54.2012.07.21.11.16.54 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 Jul 2012 11:16:55 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: Garrett Cooper In-Reply-To: Date: Sat, 21 Jul 2012 11:17:22 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201207121211.q6CCBWTD006484@svn.freebsd.org> To: Adrian Chadd X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , Eitan Adler , src-committers@freebsd.org Subject: Re: svn commit: r238396 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 18:16:58 -0000 On Jul 21, 2012, at 10:59 AM, Adrian Chadd wrote: > On 12 July 2012 21:39, Eitan Adler wrote: >> On 12 July 2012 05:11, Gavin Atkinson wrote: >>> Author: gavin >>> Date: Thu Jul 12 12:11:32 2012 >>> New Revision: 238396 >>> URL: http://svn.freebsd.org/changeset/base/238396 >>>=20 >>> Log: >>> Update for new core team. Looks like this file was not updated two = years >>> ago for the last core team. >>=20 >> Perhaps we can make a wiki page of "pages that need to change on core >> team change?" ? >=20 > Anything like that should likely be turned into a small shell script > and automated. :) It happens so infrequently that writing up a process document = and having it be part of the "new core inauguration" should be enough I = would think. My 2 cents, -Garrett= From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 21:39:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C36561065670; Sat, 21 Jul 2012 21:39:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE3298FC14; Sat, 21 Jul 2012 21:39:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LLd2M8088260; Sat, 21 Jul 2012 21:39:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LLd2Z7088258; Sat, 21 Jul 2012 21:39:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207212139.q6LLd2Z7088258@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 21:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238675 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 21:39:02 -0000 Author: kib Date: Sat Jul 21 21:39:02 2012 New Revision: 238675 URL: http://svn.freebsd.org/changeset/base/238675 Log: MFamd64 r238669: Force clean FPU state in PCB user FPU save area for PT_I386_{GET,SET}XMMREGS. Reported by: bde MFC after: 1 week Modified: head/sys/i386/i386/ptrace_machdep.c Modified: head/sys/i386/i386/ptrace_machdep.c ============================================================================== --- head/sys/i386/i386/ptrace_machdep.c Sat Jul 21 19:46:14 2012 (r238674) +++ head/sys/i386/i386/ptrace_machdep.c Sat Jul 21 21:39:02 2012 (r238675) @@ -54,10 +54,12 @@ cpu_ptrace(struct thread *td, int req, v fpstate = &td->td_pcb->pcb_user_save.sv_xmm; switch (req) { case PT_GETXMMREGS: + npxgetregs(td); error = copyout(fpstate, addr, sizeof(*fpstate)); break; case PT_SETXMMREGS: + npxgetregs(td); error = copyin(addr, fpstate, sizeof(*fpstate)); fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; break; From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 21:39:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3C7F1065780; Sat, 21 Jul 2012 21:39:23 +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 CFDB58FC17; Sat, 21 Jul 2012 21:39:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LLdNlD088327; Sat, 21 Jul 2012 21:39:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LLdN8U088325; Sat, 21 Jul 2012 21:39:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207212139.q6LLdN8U088325@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 21:39:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238676 - head/sys/i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 21:39:24 -0000 Author: kib Date: Sat Jul 21 21:39:23 2012 New Revision: 238676 URL: http://svn.freebsd.org/changeset/base/238676 Log: MFamd64 r238597: Add stmxcsr. MFC after: 3 weeks Modified: head/sys/i386/isa/npx.c Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Sat Jul 21 21:39:02 2012 (r238675) +++ head/sys/i386/isa/npx.c Sat Jul 21 21:39:23 2012 (r238676) @@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$"); #ifdef CPU_ENABLE_SSE #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) +#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : : "m" (*(addr))) #endif #else /* !(__GNUCLIKE_ASM && !lint) */ @@ -113,6 +114,7 @@ void frstor(caddr_t addr); #ifdef CPU_ENABLE_SSE void fxsave(caddr_t addr); void fxrstor(caddr_t addr); +void stmxcsr(u_int csr); #endif #endif /* __GNUCLIKE_ASM && !lint */ From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 21:49:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 589E5106564A; Sat, 21 Jul 2012 21:49: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 29CDC8FC12; Sat, 21 Jul 2012 21:49:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LLn6Jq089384; Sat, 21 Jul 2012 21:49:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LLn5HA089382; Sat, 21 Jul 2012 21:49:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207212149.q6LLn5HA089382@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 21:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238677 - head/sys/i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 21:49:06 -0000 Author: kib Date: Sat Jul 21 21:49:05 2012 New Revision: 238677 URL: http://svn.freebsd.org/changeset/base/238677 Log: MFamd64 r238668: Stop clearing x87 exceptions in the #MF handler. Requested by: bde MFC after: 1 week Modified: head/sys/i386/isa/npx.c Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Sat Jul 21 21:39:23 2012 (r238676) +++ head/sys/i386/isa/npx.c Sat Jul 21 21:49:05 2012 (r238677) @@ -583,21 +583,21 @@ static char fpetable[128] = { }; /* - * Preserve the FP status word, clear FP exceptions, then generate a SIGFPE. + * Read the FP status and control words, then generate si_code value + * for SIGFPE. The error code chosen will be one of the + * FPE_... macros. It will be sent as the second argument to old + * BSD-style signal handlers and as "siginfo_t->si_code" (second + * argument) to SA_SIGINFO signal handlers. * - * Clearing exceptions is necessary mainly to avoid IRQ13 bugs. We now - * depend on longjmp() restoring a usable state. Restoring the state - * or examining it might fail if we didn't clear exceptions. + * Some time ago, we cleared the x87 exceptions with FNCLEX there. + * Clearing exceptions was necessary mainly to avoid IRQ13 bugs. The + * usermode code which understands the FPU hardware enough to enable + * the exceptions, can also handle clearing the exception state in the + * handler. The only consequence of not clearing the exception is the + * rethrow of the SIGFPE on return from the signal handler and + * reexecution of the corresponding instruction. * - * The error code chosen will be one of the FPE_... macros. It will be - * sent as the second argument to old BSD-style signal handlers and as - * "siginfo_t->si_code" (second argument) to SA_SIGINFO signal handlers. - * - * XXX the FP state is not preserved across signal handlers. So signal - * handlers cannot afford to do FP unless they preserve the state or - * longjmp() out. Both preserving the state and longjmp()ing may be - * destroyed by IRQ13 bugs. Clearing FP exceptions is not an acceptable - * solution for signals other than SIGFPE. + * For XMM traps, the exceptions were never cleared. */ int npxtrap() @@ -623,9 +623,6 @@ npxtrap() fnstcw(&control); fnstsw(&status); } - - if (PCPU_GET(fpcurthread) == curthread) - fnclex(); critical_exit(); return (fpetable[status & ((~control & 0x3f) | 0x40)]); } From owner-svn-src-head@FreeBSD.ORG Sat Jul 21 21:52:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8294A1065670; Sat, 21 Jul 2012 21:52:49 +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 645D38FC1F; Sat, 21 Jul 2012 21:52:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6LLqn7l089840; Sat, 21 Jul 2012 21:52:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6LLqnIn089836; Sat, 21 Jul 2012 21:52:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207212152.q6LLqnIn089836@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jul 2012 21:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238678 - in head/sys/i386: i386 include isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2012 21:52:49 -0000 Author: kib Date: Sat Jul 21 21:52:48 2012 New Revision: 238678 URL: http://svn.freebsd.org/changeset/base/238678 Log: MFCamd64 r238598: Provide siginfo.si_code for floating point errors when error occurs using the SSE math processor. MFC after: 3 weeks Modified: head/sys/i386/i386/trap.c head/sys/i386/include/npx.h head/sys/i386/isa/npx.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Jul 21 21:49:05 2012 (r238677) +++ head/sys/i386/i386/trap.c Sat Jul 21 21:52:48 2012 (r238678) @@ -369,7 +369,7 @@ trap(struct trapframe *frame) case T_ARITHTRAP: /* arithmetic trap */ #ifdef DEV_NPX - ucode = npxtrap(); + ucode = npxtrap_x87(); if (ucode == -1) goto userout; #else @@ -532,7 +532,13 @@ trap(struct trapframe *frame) break; case T_XMMFLT: /* SIMD floating-point exception */ - ucode = 0; /* XXX */ +#if defined(DEV_NPX) && !defined(CPU_DISABLE_SSE) && defined(I686_CPU) + ucode = npxtrap_sse(); + if (ucode == -1) + goto userout; +#else + ucode = 0; +#endif i = SIGFPE; break; } Modified: head/sys/i386/include/npx.h ============================================================================== --- head/sys/i386/include/npx.h Sat Jul 21 21:49:05 2012 (r238677) +++ head/sys/i386/include/npx.h Sat Jul 21 21:52:48 2012 (r238678) @@ -55,7 +55,8 @@ int npxgetregs(struct thread *td); void npxinit(void); void npxsave(union savefpu *addr); void npxsetregs(struct thread *td, union savefpu *addr); -int npxtrap(void); +int npxtrap_x87(void); +int npxtrap_sse(void); void npxuserinited(struct thread *); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Sat Jul 21 21:49:05 2012 (r238677) +++ head/sys/i386/isa/npx.c Sat Jul 21 21:52:48 2012 (r238678) @@ -600,12 +600,13 @@ static char fpetable[128] = { * For XMM traps, the exceptions were never cleared. */ int -npxtrap() +npxtrap_x87(void) { u_short control, status; if (!hw_float) { - printf("npxtrap: fpcurthread = %p, curthread = %p, hw_float = %d\n", + printf( + "npxtrap_x87: fpcurthread = %p, curthread = %p, hw_float = %d\n", PCPU_GET(fpcurthread), curthread, hw_float); panic("npxtrap from nowhere"); } @@ -627,6 +628,28 @@ npxtrap() return (fpetable[status & ((~control & 0x3f) | 0x40)]); } +#ifdef CPU_ENABLE_SSE +int +npxtrap_sse(void) +{ + u_int mxcsr; + + if (!hw_float) { + printf( + "npxtrap_sse: fpcurthread = %p, curthread = %p, hw_float = %d\n", + PCPU_GET(fpcurthread), curthread, hw_float); + panic("npxtrap from nowhere"); + } + critical_enter(); + if (PCPU_GET(fpcurthread) != curthread) + mxcsr = curthread->td_pcb->pcb_save->sv_xmm.sv_env.en_mxcsr; + else + stmxcsr(&mxcsr); + critical_exit(); + return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]); +} +#endif + /* * Implement device not available (DNA) exception *