From 54873b4cd6c691e7135ac9647afc5d54875d8a2c Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Thu, 11 Nov 2010 20:18:33 +0000 Subject: [PATCH 01/28] Add a GPIO driver for the Gateworks Cambria platform. The external gpio pins are connected to a PLD on the i2c bus, unfortunatley this device does not conform by failing to send an ack after each byte written. The iicbb driver will abort the transfer when the address is not ack'd and it would introduce a lot of churn to be able to pass a flag down to iicbb_start/iicbb_write. Instead we do bad things by grabbing the iicbus but then doing our own bit banging. --- sys/arm/conf/CAMBRIA | 4 + sys/arm/conf/CAMBRIA.hints | 4 + sys/arm/xscale/ixp425/cambria_gpio.c | 471 +++++++++++++++++++++++++++ sys/arm/xscale/ixp425/files.avila | 1 + sys/dev/gpio/gpiobus.c | 2 +- sys/dev/gpio/gpioc.c | 2 +- 6 files changed, 482 insertions(+), 2 deletions(-) create mode 100644 sys/arm/xscale/ixp425/cambria_gpio.c diff --git a/sys/arm/conf/CAMBRIA b/sys/arm/conf/CAMBRIA index 174a7c785a8f..ed16ed83fab1 100644 --- a/sys/arm/conf/CAMBRIA +++ b/sys/arm/conf/CAMBRIA @@ -90,6 +90,10 @@ device ad7418 # AD7418 on I2C bus device cambria_fled # Font Panel LED on I2C bus device cambria_led # 8-LED latch +device gpio +device gpioled +device cambria_gpio # GPIO pins on J11 + device ata device atadisk # ATA disk drives device avila_ata # Gateworks CF/IDE support diff --git a/sys/arm/conf/CAMBRIA.hints b/sys/arm/conf/CAMBRIA.hints index 6a1f889349d2..f727c367ff99 100644 --- a/sys/arm/conf/CAMBRIA.hints +++ b/sys/arm/conf/CAMBRIA.hints @@ -54,6 +54,10 @@ hint.fled.0.addr=0x5a # Octal LED Latch hint.led_cambria.0.at="ixp0" +# GPIO pins +hint.gpio_cambria.0.at="iicbus0" +hint.gpio_cambria.0.addr=0x56 + # Analog Devices AD7418 temperature sensor hint.ad7418.0.at="iicbus0" hint.ad7418.0.addr=0x50 diff --git a/sys/arm/xscale/ixp425/cambria_gpio.c b/sys/arm/xscale/ixp425/cambria_gpio.c new file mode 100644 index 000000000000..89b07d852b7a --- /dev/null +++ b/sys/arm/xscale/ixp425/cambria_gpio.c @@ -0,0 +1,471 @@ +/*- + * Copyright (c) 2010, Andrew Thompson + * 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 unmodified, 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. + */ + +/* + * GPIO driver for Gateworks Cambria + * + * Note: + * The Cambria PLD does not set the i2c ack bit after each write, if we used the + * regular iicbus interface it would abort the xfer after the address byte + * times out and not write our latch. To get around this we grab the iicbus and + * then do our own bit banging. This is a comprimise to changing all the iicbb + * device methods to allow a flag to be passed down and is similir to how Linux + * does it. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "iicbb_if.h" +#include "gpio_if.h" + +#define IIC_M_WR 0 /* write operation */ +#define PLD_ADDR 0xac /* slave address */ + +#define I2C_DELAY 10 + +#define GPIO_CONF_CLR(sc, reg, mask) \ + GPIO_CONF_WRITE_4(sc, reg, GPIO_CONF_READ_4(sc, reg) &~ (mask)) +#define GPIO_CONF_SET(sc, reg, mask) \ + GPIO_CONF_WRITE_4(sc, reg, GPIO_CONF_READ_4(sc, reg) | (mask)) + +#define GPIO_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define GPIO_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +#define GPIO_PINS 5 +struct cambria_gpio_softc { + device_t sc_dev; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_gpio_ioh; + struct mtx sc_mtx; + struct gpio_pin sc_pins[GPIO_PINS]; + uint8_t sc_latch; +}; + +struct cambria_gpio_pin { + const char *name; + int pin; + int flags; +}; + +extern struct ixp425_softc *ixp425_softc; + +static struct cambria_gpio_pin cambria_gpio_pins[GPIO_PINS] = { + { "GPIO0", 0, GPIO_PIN_OUTPUT }, + { "GPIO1", 1, GPIO_PIN_OUTPUT }, + { "GPIO2", 2, GPIO_PIN_OUTPUT }, + { "GPIO3", 3, GPIO_PIN_OUTPUT }, + { "GPIO4", 4, GPIO_PIN_OUTPUT }, +}; + +/* + * Helpers + */ +static int cambria_gpio_read(struct cambria_gpio_softc *, uint32_t, unsigned int *); +static int cambria_gpio_write(struct cambria_gpio_softc *); + +/* + * Driver stuff + */ +static int cambria_gpio_probe(device_t dev); +static int cambria_gpio_attach(device_t dev); +static int cambria_gpio_detach(device_t dev); + +/* + * GPIO interface + */ +static int cambria_gpio_pin_max(device_t dev, int *maxpin); +static int cambria_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps); +static int cambria_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t + *flags); +static int cambria_gpio_pin_getname(device_t dev, uint32_t pin, char *name); +static int cambria_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags); +static int cambria_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value); +static int cambria_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val); +static int cambria_gpio_pin_toggle(device_t dev, uint32_t pin); + +static int +i2c_getsda(struct cambria_gpio_softc *sc) +{ + uint32_t reg; + + mtx_lock(&Giant); + GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); + + reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR); + mtx_unlock(&Giant); + return (reg & GPIO_I2C_SDA_BIT); +} + +static void +i2c_setsda(struct cambria_gpio_softc *sc, int val) +{ + + mtx_lock(&Giant); + GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR, GPIO_I2C_SDA_BIT); + if (val) + GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); + else + GPIO_CONF_CLR(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); + mtx_unlock(&Giant); + DELAY(I2C_DELAY); +} + +static void +i2c_setscl(struct cambria_gpio_softc *sc, int val) +{ + + mtx_lock(&Giant); + GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR, GPIO_I2C_SCL_BIT); + if (val) + GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SCL_BIT); + else + GPIO_CONF_CLR(sc, IXP425_GPIO_GPOER, GPIO_I2C_SCL_BIT); + mtx_unlock(&Giant); + DELAY(I2C_DELAY); +} + +static void +i2c_sendstart(struct cambria_gpio_softc *sc) +{ + i2c_setsda(sc, 1); + i2c_setscl(sc, 1); + i2c_setsda(sc, 0); + i2c_setscl(sc, 0); +} + +static void +i2c_sendstop(struct cambria_gpio_softc *sc) +{ + i2c_setscl(sc, 1); + i2c_setsda(sc, 1); + i2c_setscl(sc, 0); + i2c_setsda(sc, 0); +} + +static void +i2c_sendbyte(struct cambria_gpio_softc *sc, u_char data) +{ + int i; + + for (i=7; i>=0; i--) { + i2c_setsda(sc, data & (1<=0; i--) + { + i2c_setscl(sc, 1); + if (i2c_getsda(sc)) + data |= (1<sc_dev; + int error; + + error = iicbus_request_bus(device_get_parent(dev), dev, + IIC_DONTWAIT); + if (error) + return (error); + + i2c_sendstart(sc); + i2c_sendbyte(sc, PLD_ADDR | LSB); + *val = (i2c_readbyte(sc) & (1 << pin)) != 0; + i2c_sendstop(sc); + + iicbus_release_bus(device_get_parent(dev), dev); + + return (0); +} + +static int +cambria_gpio_write(struct cambria_gpio_softc *sc) +{ + device_t dev = sc->sc_dev; + int error; + + error = iicbus_request_bus(device_get_parent(dev), dev, + IIC_DONTWAIT); + if (error) + return (error); + + i2c_sendstart(sc); + i2c_sendbyte(sc, PLD_ADDR & ~LSB); + i2c_sendbyte(sc, sc->sc_latch); + i2c_sendstop(sc); + + iicbus_release_bus(device_get_parent(dev), dev); + + return (0); +} + +static int +cambria_gpio_pin_max(device_t dev, int *maxpin) +{ + + *maxpin = GPIO_PINS - 1; + return (0); +} + +static int +cambria_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + + if (pin >= GPIO_PINS) + return (EINVAL); + + *caps = sc->sc_pins[pin].gp_caps; + return (0); +} + +static int +cambria_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + + if (pin >= GPIO_PINS) + return (EINVAL); + + *flags = sc->sc_pins[pin].gp_flags; + return (0); +} + +static int +cambria_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + + if (pin >= GPIO_PINS) + return (EINVAL); + + memcpy(name, sc->sc_pins[pin].gp_name, GPIOMAXNAME); + return (0); +} + +static int +cambria_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + int error; + + if (pin >= GPIO_PINS) + return (EINVAL); + + /* Filter out unwanted flags */ + if ((flags &= sc->sc_pins[pin].gp_caps) != flags) + return (EINVAL); + + /* Can't mix input/output together */ + if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) + return (EINVAL); + + GPIO_LOCK(sc); + sc->sc_pins[pin].gp_flags = flags; + + sc->sc_latch |= (1 << pin); + error = cambria_gpio_write(sc); + GPIO_UNLOCK(sc); + + return (error); +} + +static int +cambria_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + int error; + + if (pin >= GPIO_PINS || sc->sc_pins[pin].gp_flags != GPIO_PIN_OUTPUT) + return (EINVAL); + + GPIO_LOCK(sc); + if (value) + sc->sc_latch |= (1 << pin); + else + sc->sc_latch &= ~(1 << pin); + error = cambria_gpio_write(sc); + GPIO_UNLOCK(sc); + + return (error); +} + +static int +cambria_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + int error = 0; + + if (pin >= GPIO_PINS) + return (EINVAL); + + GPIO_LOCK(sc); + if (sc->sc_pins[pin].gp_flags == GPIO_PIN_OUTPUT) + *val = (sc->sc_latch & (1 << pin)) ? 1 : 0; + else + error = cambria_gpio_read(sc, pin, val); + GPIO_UNLOCK(sc); + + return (error); +} + +static int +cambria_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + int error; + + if (pin >= GPIO_PINS || sc->sc_pins[pin].gp_flags != GPIO_PIN_OUTPUT) + return (EINVAL); + + GPIO_LOCK(sc); + sc->sc_latch ^= (1 << pin); + error = cambria_gpio_write(sc); + GPIO_UNLOCK(sc); + + return (error); +} + +static int +cambria_gpio_probe(device_t dev) +{ + + device_set_desc(dev, "Gateworks Cambria GPIO driver"); + return (0); +} + +static int +cambria_gpio_attach(device_t dev) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + int pin; + + sc->sc_dev = dev; + sc->sc_iot = ixp425_softc->sc_iot; + sc->sc_gpio_ioh = ixp425_softc->sc_gpio_ioh; + + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + + for (pin = 0; pin < GPIO_PINS; pin++) { + struct cambria_gpio_pin *p = &cambria_gpio_pins[pin]; + + strncpy(sc->sc_pins[pin].gp_name, p->name, GPIOMAXNAME); + sc->sc_pins[pin].gp_pin = pin; + sc->sc_pins[pin].gp_caps = GPIO_PIN_INPUT|GPIO_PIN_OUTPUT; + sc->sc_pins[pin].gp_flags = 0; + cambria_gpio_pin_setflags(dev, pin, p->flags); + } + + device_add_child(dev, "gpioc", device_get_unit(dev)); + device_add_child(dev, "gpiobus", device_get_unit(dev)); + return (bus_generic_attach(dev)); +} + +static int +cambria_gpio_detach(device_t dev) +{ + struct cambria_gpio_softc *sc = device_get_softc(dev); + + KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized")); + + bus_generic_detach(dev); + + mtx_destroy(&sc->sc_mtx); + + return(0); +} + +static device_method_t cambria_gpio_methods[] = { + DEVMETHOD(device_probe, cambria_gpio_probe), + DEVMETHOD(device_attach, cambria_gpio_attach), + DEVMETHOD(device_detach, cambria_gpio_detach), + + /* GPIO protocol */ + DEVMETHOD(gpio_pin_max, cambria_gpio_pin_max), + DEVMETHOD(gpio_pin_getname, cambria_gpio_pin_getname), + DEVMETHOD(gpio_pin_getflags, cambria_gpio_pin_getflags), + DEVMETHOD(gpio_pin_getcaps, cambria_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_setflags, cambria_gpio_pin_setflags), + DEVMETHOD(gpio_pin_get, cambria_gpio_pin_get), + DEVMETHOD(gpio_pin_set, cambria_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, cambria_gpio_pin_toggle), + {0, 0}, +}; + +static driver_t cambria_gpio_driver = { + "gpio_cambria", + cambria_gpio_methods, + sizeof(struct cambria_gpio_softc), +}; +static devclass_t cambria_gpio_devclass; +extern devclass_t gpiobus_devclass, gpioc_devclass; +extern driver_t gpiobus_driver, gpioc_driver; + +DRIVER_MODULE(gpio_cambria, iicbus, cambria_gpio_driver, cambria_gpio_devclass, 0, 0); +DRIVER_MODULE(gpiobus, gpio_cambria, gpiobus_driver, gpiobus_devclass, 0, 0); +DRIVER_MODULE(gpioc, gpio_cambria, gpioc_driver, gpioc_devclass, 0, 0); +MODULE_VERSION(gpio_cambria, 1); +MODULE_DEPEND(gpio_cambria, iicbus, 1, 1, 1); diff --git a/sys/arm/xscale/ixp425/files.avila b/sys/arm/xscale/ixp425/files.avila index 38b93296256b..5008e0910a12 100644 --- a/sys/arm/xscale/ixp425/files.avila +++ b/sys/arm/xscale/ixp425/files.avila @@ -6,4 +6,5 @@ arm/xscale/ixp425/avila_gpio.c optional avila_gpio arm/xscale/ixp425/cambria_exp_space.c standard arm/xscale/ixp425/cambria_fled.c optional cambria_fled arm/xscale/ixp425/cambria_led.c optional cambria_led +arm/xscale/ixp425/cambria_gpio.c optional cambria_gpio arm/xscale/ixp425/ixdp425_pci.c optional pci diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 3a044fd75f4c..d9736949596d 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -481,7 +481,7 @@ static device_method_t gpiobus_methods[] = { { 0, 0 } }; -static driver_t gpiobus_driver = { +driver_t gpiobus_driver = { "gpiobus", gpiobus_methods, sizeof(struct gpiobus_softc) diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c index e92326e196a2..6a4c0c91938d 100644 --- a/sys/dev/gpio/gpioc.c +++ b/sys/dev/gpio/gpioc.c @@ -188,7 +188,7 @@ static device_method_t gpioc_methods[] = { { 0, 0 } }; -static driver_t gpioc_driver = { +driver_t gpioc_driver = { "gpioc", gpioc_methods, sizeof(struct gpioc_softc) From 9f0c8034d805598c91af90934b59269860eefc96 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 11 Nov 2010 21:36:52 +0000 Subject: [PATCH 02/28] Remove some unneeded spaces from the __sym_compat() macro, since newer versions of gas are more fussy about spaces surrounding '@' signs in versioned symbol names. --- lib/libc/include/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h index 13c1d2043e76..769454002788 100644 --- a/lib/libc/include/compat.h +++ b/lib/libc/include/compat.h @@ -36,7 +36,7 @@ #define __LIBC_COMPAT_H__ #define __sym_compat(sym,impl,verid) \ - .symver impl , sym @ verid + .symver impl, sym@verid __sym_compat(__semctl, freebsd7___semctl, FBSD_1.0); __sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0); From a37e14e1d8c7ae6ee55a4c7433b8ca0847f278d5 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Thu, 11 Nov 2010 21:53:46 +0000 Subject: [PATCH 03/28] Fix style. Submitted by: bde --- sys/kern/kern_proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ad4e8d9c3477..9cfbc2011ca8 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -784,10 +784,10 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime); PROC_SUNLOCK(p); calccru(p, &kp->ki_childutime, &kp->ki_childstime); - - /* Some callers want child-times in a single value */ + /* Some callers want child times in a single value. */ kp->ki_childtime = kp->ki_childstime; timevaladd(&kp->ki_childtime, &kp->ki_childutime); + tp = NULL; if (p->p_pgrp) { kp->ki_pgid = p->p_pgrp->pg_id; From 4db362f078d756476433b818a60ecdc86906c159 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Thu, 11 Nov 2010 22:21:30 +0000 Subject: [PATCH 04/28] Vendor import of xz (stripped) Git revision: e45929260cd902036efd40c5610a8d0a50d5712b Release: 5.0.0 Approved by: delphij (mentor) --- ChangeLog | 111 +++++ TODO | 17 +- po/cs.po | 298 +++++------ po/de.po | 267 ++++------ po/it.po | 271 ++++------ po/xz.pot | 736 ++++++++++++++++++++++++++++ src/common/sysdefs.h | 5 + src/liblzma/api/lzma.h | 4 +- src/liblzma/api/lzma/base.h | 45 +- src/liblzma/api/lzma/bcj.h | 4 +- src/liblzma/api/lzma/block.h | 4 +- src/liblzma/api/lzma/container.h | 26 +- src/liblzma/api/lzma/filter.h | 51 +- src/liblzma/api/lzma/hardware.h | 3 +- src/liblzma/api/lzma/index.h | 28 +- src/liblzma/api/lzma/index_hash.h | 2 +- src/liblzma/api/lzma/lzma.h | 50 +- src/liblzma/api/lzma/stream_flags.h | 8 +- src/liblzma/api/lzma/version.h | 8 +- src/liblzma/api/lzma/vli.h | 31 +- src/liblzma/common/common.c | 14 + src/liblzma/common/filter_encoder.c | 2 + src/liblzma/common/filter_encoder.h | 4 +- src/liblzma/common/index.c | 2 +- src/liblzma/common/index_decoder.c | 1 + src/liblzma/common/index_encoder.c | 1 + src/liblzma/lzma/lzma2_decoder.c | 1 - src/liblzma/lzma/lzma_decoder.c | 4 +- src/liblzma/lzma/lzma_encoder.c | 2 +- src/xz/message.c | 45 +- src/xz/message.h | 6 +- src/xz/signals.c | 8 +- 32 files changed, 1377 insertions(+), 682 deletions(-) create mode 100644 po/xz.pot diff --git a/ChangeLog b/ChangeLog index c42458decf3c..66775f3b68a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,114 @@ +commit e45929260cd902036efd40c5610a8d0a50d5712b +Author: Lasse Collin +Date: Sat Oct 23 17:25:52 2010 +0300 + + Build: Fix mydist rule when .git doesn't exist. + +commit 6e1326fcdf6b6209949be57cfe3ad4b781b65168 +Author: Lasse Collin +Date: Sat Oct 23 14:15:35 2010 +0300 + + Add NEWS for 5.0.0. + +commit b667a3ef6338a2c1db7b7706b1f6c99ea392221c +Author: Lasse Collin +Date: Sat Oct 23 14:02:53 2010 +0300 + + Bump version to 5.0.0 and liblzma version-info to 5:0:0. + +commit 8c947e9291691629714dafb4536c718b6cc24fbd +Author: Lasse Collin +Date: Sat Oct 23 12:30:54 2010 +0300 + + liblzma: Make lzma_code() check the reserved members in lzma_stream. + + If any of the reserved members in lzma_stream are non-zero + or non-NULL, LZMA_OPTIONS_ERROR is returned. It is possible + that a new feature in the future is indicated by just setting + a reserved member to some other value, so the old liblzma + version need to catch it as an unsupported feature. + +commit e61d85e082743ebd2dd0ff28fc0a82482ede0538 +Author: Lasse Collin +Date: Sat Oct 23 12:26:33 2010 +0300 + + Windows: Use MinGW's stdio functions. + + The non-standard ones from msvcrt.dll appear to work + most of the time with XZ Utils, but there are some + corner cases where things may go very wrong. So it's + good to use the better replacements provided by + MinGW(-w64) runtime. + +commit 23e23f1dc029146714c9a98313ab3ea93d71a2fc +Author: Lasse Collin +Date: Sat Oct 23 12:21:32 2010 +0300 + + liblzma: Use 512 as INDEX_GROUP_SIZE. + + This lets compiler use shifting instead of 64-bit division. + +commit 613939fc82603b75b59eee840871a05bc8dd08e0 +Author: Lasse Collin +Date: Sat Oct 23 12:20:11 2010 +0300 + + liblzma: A few ABI tweaks to reserve space in structures. + +commit 68b83f252df3d27480a9f6f03445d16f6506fef1 +Author: Lasse Collin +Date: Thu Oct 21 23:16:11 2010 +0300 + + xz: Make sure that message_strm() can never return NULL. + +commit d09c5753e33ff96ee57edb6d1e98e34041203695 +Author: Lasse Collin +Date: Thu Oct 21 23:06:31 2010 +0300 + + liblzma: Update the comments in the API headers. + + Adding support for LZMA_FINISH for Index encoding and + decoding needed tiny additions to the relevant .c files too. + +commit 33c1c0e102eb529588503b8beea0903a45488fad +Author: Lasse Collin +Date: Tue Oct 19 12:08:30 2010 +0300 + + Update INSTALL.generic. + +commit 0076e03641f201c4b77dddd5a6db5880be19a78c +Author: Lasse Collin +Date: Tue Oct 19 11:44:37 2010 +0300 + + Clean up a few FIXMEs and TODOs. + + lzma_chunk_size() was commented out because it is + currently useless. + +commit ce34ec4f54ff8b753da236f371ad8dd23c8135c9 +Author: Lasse Collin +Date: Tue Oct 19 10:21:08 2010 +0300 + + Update docs. + +commit f0fa880d247e73264d2c04fe31fb3412318a0026 +Author: Lasse Collin +Date: Tue Oct 12 15:13:30 2010 +0300 + + xz: Avoid raise() also on OpenVMS. + + This is similar to DOS/DJGPP that killing the program + with a signal will print a backtrace or a similar message. + +commit ac462b1c47c451f5c62e428306314c4bdad8ae7f +Author: Lasse Collin +Date: Mon Oct 11 21:26:19 2010 +0300 + + xz: Avoid SA_RESTART for portability reasons. + + SA_RESTART is not as portable as I had hoped. It's missing + at least from OpenVMS, QNX, and DJGPP). Luckily we can do + fine without SA_RESTART. + commit d52b411716a614c202e89ba732492efb9916cd3f Author: Lasse Collin Date: Sun Oct 10 17:58:58 2010 +0300 diff --git a/TODO b/TODO index 9fac1b341956..55fc47556030 100644 --- a/TODO +++ b/TODO @@ -18,15 +18,20 @@ Known bugs XZ Utils compress some files significantly worse than LZMA Utils. This is due to faster compression presets used by XZ Utils, and - can be worked around by using "xz --extreme". However, the presets - need some tweaking and maybe this issue can be minimized without - making the typical case too much slower. + can often be worked around by using "xz --extreme". With some files + --extreme isn't enough though: it's most likely with files that + compress extremely well, so going from compression ratio of 0.003 + to 0.004 means big relative increase in the compressed file size. xz doesn't quote unprintable characters when it displays file names given on the command line. tuklib_exit() doesn't block signals => EINTR is possible. + SIGTSTP is not handled. If xz is stopped, the estimated remaining + time and calculated (de)compression speed won't make sense in the + progress indicator (xz --verbose). + Missing features ---------------- @@ -41,11 +46,13 @@ Missing features Buffer-to-buffer coding could use less RAM (especially when decompressing LZMA1 or LZMA2). - I/O library is not implemented. It will possibly be named libzzf. + I/O library is not implemented (similar to gzopen() in zlib). + It will be a separate library that supports uncompressed, .gz, + .bz2, .lzma, and .xz files. lzma_strerror() to convert lzma_ret to human readable form? This is tricky, because the same error codes are used with - slightly different meanings. + slightly different meanings, and this cannot be fixed anymore. Documentation diff --git a/po/cs.po b/po/cs.po index a60a96f3b34f..5bebf6e4661f 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: xz-utils\n" "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n" -"POT-Creation-Date: 2010-09-17 18:33+0200\n" +"POT-Creation-Date: 2010-10-23 17:48+0300\n" "PO-Revision-Date: 2010-09-17 18:54+0200\n" "Last-Translator: Marek Černocký \n" "Language-Team: Czech \n" @@ -30,8 +30,7 @@ msgstr "%s: Neznámý typ kontroly integrity" #: src/xz/args.c:382 msgid "Only one file can be specified with `--files' or `--files0'." -msgstr "" -"Spolu s přepínači „--files“ nebo „--files0“ může být zadán pouze jeden soubor" +msgstr "Spolu s přepínači „--files“ nebo „--files0“ může být zadán pouze jeden soubor" #: src/xz/args.c:445 #, c-format @@ -52,8 +51,7 @@ msgstr "Použití přednastavení v režimu raw je nevhodné." #: src/xz/coder.c:131 msgid "The exact options of the presets may vary between software versions." -msgstr "" -"Přesné volby u přednastavení se mohou lišit mezi různými verzemi softwaru." +msgstr "Přesné volby u přednastavení se mohou lišit mezi různými verzemi softwaru." #: src/xz/coder.c:157 msgid "The .lzma format supports only the LZMA1 filter" @@ -74,12 +72,8 @@ msgstr "Dekomprimace bude vyžadovat %s MiB paměti." #: src/xz/coder.c:247 #, c-format -msgid "" -"Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the " -"memory usage limit of %s MiB" -msgstr "" -"Přizpůsobit velikost slovníku LZMA%c z %s MiB na %s MiB, tak aby nebylo " -"překročeno omezení použitelné paměti %s MiB" +msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB" +msgstr "Přizpůsobit velikost slovníku LZMA%c z %s MiB na %s MiB, tak aby nebylo překročeno omezení použitelné paměti %s MiB" #. TRANSLATORS: When compression or decompression finishes, #. and xz is going to remove the source file, xz first checks @@ -159,8 +153,7 @@ msgstr "%s: Selhalo zavření souboru: %s" #: src/xz/file_io.c:762 src/xz/file_io.c:946 #, c-format msgid "%s: Seeking failed when trying to create a sparse file: %s" -msgstr "" -"%s: Selhalo nastavení pozice při pokusu o vytvoření záložního souboru: %s" +msgstr "%s: Selhalo nastavení pozice při pokusu o vytvoření záložního souboru: %s" #: src/xz/file_io.c:821 #, c-format @@ -319,12 +312,10 @@ msgstr " Zarovnání proudu: %s\n" #: src/xz/list.c:693 msgid "" " Streams:\n" -" Stream Blocks CompOffset UncompOffset CompSize " -"UncompSize Ratio Check Padding" +" Stream Blocks CompOffset UncompOffset CompSize UncompSize Ratio Check Padding" msgstr "" " Proudy:\n" -" Proud Bloky KomprPozice NekomprPozice KomprVelikost " -"NekomprVelikost Poměr Kontrola Zarovnání" +" Proud Bloky KomprPozice NekomprPozice KomprVelikost NekomprVelikost Poměr Kontrola Zarovnání" #. TRANSLATORS: The second line is column headings. All #. except Check are right aligned; Check is left aligned. @@ -332,12 +323,10 @@ msgstr "" #, c-format msgid "" " Blocks:\n" -" Stream Block CompOffset UncompOffset TotalSize " -"UncompSize Ratio Check" +" Stream Block CompOffset UncompOffset TotalSize UncompSize Ratio Check" msgstr "" " Bloky:\n" -" Proud Blok KomprPozice NekomprPozice CelkVelikost " -"NekomprVelikost Poměr Kontrola" +" Proud Blok KomprPozice NekomprPozice CelkVelikost NekomprVelikost Poměr Kontrola" #. TRANSLATORS: These are additional column headings #. for the most verbose listing mode. CheckVal @@ -408,78 +397,69 @@ msgstr "%s: Neočekávaný konec vstupu při čtení názvů souborů" #: src/xz/main.c:120 #, c-format -msgid "" -"%s: Null character found when reading filenames; maybe you meant to use `--" -"files0' instead of `--files'?" -msgstr "" -"%s: Byl nalezen nulový znak při čtení názvů souborů; nechtěli jste náhodou " -"použít „--files0“ místo „--files“?" +msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?" +msgstr "%s: Byl nalezen nulový znak při čtení názvů souborů; nechtěli jste náhodou použít „--files0“ místo „--files“?" #: src/xz/main.c:174 msgid "Compression and decompression with --robot are not supported yet." msgstr "Komprimace a dekomprimace s přepínačem --robot není zatím podporovaná." #: src/xz/main.c:231 -msgid "" -"Cannot read data from standard input when reading filenames from standard " -"input" -msgstr "" -"Ze standardního vstupu nelze číst data, když se ze standardního vstupu " -"načítají názvy souborů" +msgid "Cannot read data from standard input when reading filenames from standard input" +msgstr "Ze standardního vstupu nelze číst data, když se ze standardního vstupu načítají názvy souborů" -#: src/xz/message.c:800 src/xz/message.c:844 +#: src/xz/message.c:792 src/xz/message.c:842 msgid "Internal error (bug)" msgstr "Interní chyba" -#: src/xz/message.c:807 +#: src/xz/message.c:799 msgid "Cannot establish signal handlers" msgstr "Nelze ustanovit ovladač signálu" -#: src/xz/message.c:816 +#: src/xz/message.c:808 msgid "No integrity check; not verifying file integrity" msgstr "Žádná kontrola integrity; integrita souboru se nebude ověřovat" -#: src/xz/message.c:819 +#: src/xz/message.c:811 msgid "Unsupported type of integrity check; not verifying file integrity" -msgstr "" -"Nepodporovaný typ kontroly integrity; integrita souboru se nebude ověřovat" +msgstr "Nepodporovaný typ kontroly integrity; integrita souboru se nebude ověřovat" -#: src/xz/message.c:826 +#: src/xz/message.c:818 msgid "Memory usage limit reached" msgstr "Dosaženo omezení použitelné paměti" -#: src/xz/message.c:829 +#: src/xz/message.c:821 msgid "File format not recognized" msgstr "Formát souboru nebyl rozpoznán" -#: src/xz/message.c:832 +#: src/xz/message.c:824 msgid "Unsupported options" msgstr "Nepodporovaná volba" -#: src/xz/message.c:835 +#: src/xz/message.c:827 msgid "Compressed data is corrupt" msgstr "Komprimovaná data jsou poškozená" -#: src/xz/message.c:838 +#: src/xz/message.c:830 msgid "Unexpected end of input" msgstr "Neočekávaný konec vstupu" -#: src/xz/message.c:886 +#: src/xz/message.c:881 #, c-format msgid "%s MiB of memory is required. The limit is %s." msgstr "Je vyžadováno %s MiB paměti. Limit je %s." -#: src/xz/message.c:1053 +#: src/xz/message.c:1048 #, c-format msgid "%s: Filter chain: %s\n" msgstr "%s: Omezující filtr: %s\n" -#: src/xz/message.c:1063 +#: src/xz/message.c:1058 #, c-format msgid "Try `%s --help' for more information." msgstr "Zkuste „%s --help“ pro více informací" -#: src/xz/message.c:1089 +#: src/xz/message.c:1084 #, c-format msgid "" "Usage: %s [OPTION]... [FILE]...\n" @@ -490,18 +470,15 @@ msgstr "" "Komprimuje nebo dekomprimuje SOUBORy ve formátu xz.\n" "\n" -#: src/xz/message.c:1096 -msgid "" -"Mandatory arguments to long options are mandatory for short options too.\n" -msgstr "" -"Povinné argumenty pro dlouhé přepínače jsou povinné rovněž pro krátké " -"přepínače.\n" +#: src/xz/message.c:1091 +msgid "Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "Povinné argumenty pro dlouhé přepínače jsou povinné rovněž pro krátké přepínače.\n" -#: src/xz/message.c:1100 +#: src/xz/message.c:1095 msgid " Operation mode:\n" msgstr "Operační režim:\n" -#: src/xz/message.c:1103 +#: src/xz/message.c:1098 msgid "" " -z, --compress force compression\n" " -d, --decompress force decompression\n" @@ -513,7 +490,7 @@ msgstr "" " -t, --test testovat integritu komprimovaného souboru\n" " -l, --list vypsat informace o souborech .xz" -#: src/xz/message.c:1109 +#: src/xz/message.c:1104 msgid "" "\n" " Operation modifiers:\n" @@ -521,39 +498,33 @@ msgstr "" "\n" "Modifikátory operací:\n" -#: src/xz/message.c:1112 +#: src/xz/message.c:1107 msgid "" " -k, --keep keep (don't delete) input files\n" " -f, --force force overwrite of output file and (de)compress links\n" " -c, --stdout write to standard output and don't delete input files" msgstr "" " -k, --keep zachovat (nemazat) vstupní soubory\n" -" -f, --force vynutit přepis výstupního souboru a de/komprimovat " -"odkazy\n" -" -c, --stdout zapisovat na standardní výstup a nemazat vstupní " -"soubory" +" -f, --force vynutit přepis výstupního souboru a de/komprimovat odkazy\n" +" -c, --stdout zapisovat na standardní výstup a nemazat vstupní soubory" -#: src/xz/message.c:1118 +#: src/xz/message.c:1113 msgid "" " --no-sparse do not create sparse files when decompressing\n" " -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n" " --files[=FILE] read filenames to process from FILE; if FILE is\n" " omitted, filenames are read from the standard input;\n" -" filenames must be terminated with the newline " -"character\n" +" filenames must be terminated with the newline character\n" " --files0[=FILE] like --files but use the null character as terminator" msgstr "" " --no-sparse nevytvářet při dekomprimaci záložní soubory\n" " -S, --suffix=.PRIP použít u komprimovaných souborů příponu „.PRIP“\n" -" --files[=SOUBOR] číst názvy souborů, které se mají zpracovat, ze " -"SOUBORu;\n" -" pokud není SOUBOR zadán, čte se ze standardního " -"vstupu;\n" +" --files[=SOUBOR] číst názvy souborů, které se mají zpracovat, ze SOUBORu;\n" +" pokud není SOUBOR zadán, čte se ze standardního vstupu;\n" " názvy souborů musí být zakončeny znakem nového řádku\n" -" --files0[=SOUBOR] stejné jako --files, ale použít k zakončování nulový " -"znak" +" --files0[=SOUBOR] stejné jako --files, ale použít k zakončování nulový znak" -#: src/xz/message.c:1126 +#: src/xz/message.c:1121 msgid "" "\n" " Basic file format and compression options:\n" @@ -561,7 +532,7 @@ msgstr "" "\n" "Základní přepínače pro formát souboru a komprimaci:\n" -#: src/xz/message.c:1128 +#: src/xz/message.c:1123 msgid "" " -F, --format=FMT file format to encode or decode; possible values are\n" " `auto' (default), `xz', `lzma', and `raw'\n" @@ -570,76 +541,62 @@ msgid "" msgstr "" " -F, --format=FORMÁT formát souboru k zakódování nebo dekódování; možné\n" " hodnoty jsou „auto“ (výchozí), „xz“, „lzma“ a „raw“\n" -" -C, --check=KONTROLA typ kontroly integrity: „none“ (používejte s " -"rozmyslem),\n" +" -C, --check=KONTROLA typ kontroly integrity: „none“ (používejte s rozmyslem),\n" " „crc32“, „crc64“ (výchozí) nebo „sha256“" -#: src/xz/message.c:1135 +#: src/xz/message.c:1130 msgid "" -" -0 ... -9 compression preset; default is 6; take compressor " -"*and*\n" -" decompressor memory usage into account before using " -"7-9!" +" -0 ... -9 compression preset; default is 6; take compressor *and*\n" +" decompressor memory usage into account before using 7-9!" msgstr "" -" -0 .. -9 přednastavení komprimace; výchozí je 6; než " -"použijete\n" -" hodnoty 7 – 9, vezměte do úvahy množství použité " -"paměti" +" -0 .. -9 přednastavení komprimace; výchozí je 6; než použijete\n" +" hodnoty 7 – 9, vezměte do úvahy množství použité paměti" -#: src/xz/message.c:1139 +#: src/xz/message.c:1134 msgid "" -" -e, --extreme try to improve compression ratio by using more CPU " -"time;\n" +" -e, --extreme try to improve compression ratio by using more CPU time;\n" " does not affect decompressor memory requirements" msgstr "" " -e, --extreme zkusit zlepšit poměr komprimace využitím více času\n" " procesoru; nemá vliv na paměťové nároky dekomprimace" -#: src/xz/message.c:1144 +#: src/xz/message.c:1139 #, no-c-format msgid "" " --memlimit-compress=LIMIT\n" " --memlimit-decompress=LIMIT\n" " -M, --memlimit=LIMIT\n" -" set memory usage limit for compression, " -"decompression,\n" +" set memory usage limit for compression, decompression,\n" " or both; LIMIT is in bytes, % of RAM, or 0 for defaults" msgstr "" " --memlimit-compress=LIMIT\n" " --memlimit-decompress=LIMIT\n" " -M, --memlimit=LIMIT\n" " nastaví omezení použitelné paměti pro komprimaci,\n" -" dekomprimaci nebo obojí; LIMIT je v bajtech, % z " -"paměti\n" +" dekomprimaci nebo obojí; LIMIT je v bajtech, % z paměti\n" " RAM nebo 0 pro výchozí" -#: src/xz/message.c:1151 +#: src/xz/message.c:1146 msgid "" -" --no-adjust if compression settings exceed the memory usage " -"limit,\n" -" give an error instead of adjusting the settings " -"downwards" +" --no-adjust if compression settings exceed the memory usage limit,\n" +" give an error instead of adjusting the settings downwards" msgstr "" -" --no-adjust pokud nastavení komprimace přesáhne omezení " -"použitelné\n" +" --no-adjust pokud nastavení komprimace přesáhne omezení použitelné\n" " paměti, předat chybu namísto snížení nastavení" -#: src/xz/message.c:1157 +#: src/xz/message.c:1152 msgid "" "\n" " Custom filter chain for compression (alternative for using presets):" msgstr "" "\n" -"Vlastní omezující filtr pro komprimaci (alternativa k použití " -"přednastavených):" +"Vlastní omezující filtr pro komprimaci (alternativa k použití přednastavených):" -#: src/xz/message.c:1166 +#: src/xz/message.c:1161 msgid "" "\n" -" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero " -"or\n" -" --lzma2[=OPTS] more of the following options (valid values; " -"default):\n" +" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" +" --lzma2[=OPTS] more of the following options (valid values; default):\n" " preset=PRE reset options to a preset (0-9[e])\n" " dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n" " lc=NUM number of literal context bits (0-4; 3)\n" @@ -647,33 +604,24 @@ msgid "" " pb=NUM number of position bits (0-4; 2)\n" " mode=MODE compression mode (fast, normal; normal)\n" " nice=NUM nice length of a match (2-273; 64)\n" -" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; " -"bt4)\n" -" depth=NUM maximum search depth; 0=automatic " -"(default)" +" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n" +" depth=NUM maximum search depth; 0=automatic (default)" msgstr "" "\n" -" --lzma1[=VOLBY] LZMA1 nebo LZMA2; VOLBY je čárkou oddělovaný seznam " -"žádné\n" -" --lzma2[=VOLBY] nebo více následujících voleb (platné hodnoty; " -"výchozí):\n" -" preset=PŘE změnit volby na PŘEdnastavené (0 – 9" -"[e])\n" -" dict=POČ velikost slovníku (4 KiB – 1536 MiB; 8 " -"MiB)\n" -" lc=POČ počet kontextových bitů literálu (0 – 4; " -"3)\n" -" lp=POČ počet pozičních bitů literálu (0 – 4; " -"0)\n" +" --lzma1[=VOLBY] LZMA1 nebo LZMA2; VOLBY je čárkou oddělovaný seznam žádné\n" +" --lzma2[=VOLBY] nebo více následujících voleb (platné hodnoty; výchozí):\n" +" preset=PŘE změnit volby na PŘEdnastavené (0 – 9[e])\n" +" dict=POČ velikost slovníku (4 KiB – 1536 MiB; 8 MiB)\n" +" lc=POČ počet kontextových bitů literálu (0 – 4; 3)\n" +" lp=POČ počet pozičních bitů literálu (0 – 4; 0)\n" " pb=POČ počet pozičních bitů (0 – 4; 2)\n" " mode=REŽIM režim komprimace (fast, normal; normal)\n" " nice=NUM příznivá délka shody (2 – 273; 64)\n" -" mf=NÁZEV hledání shod (hc3, hc4, bt2, bt3, bt4; " -"bt4)\n" +" mf=NÁZEV hledání shod (hc3, hc4, bt2, bt3, bt4; bt4)\n" " depth=POČ maximální hloubka prohledávání;\n" " 0 = automaticky (výchozí)" -#: src/xz/message.c:1181 +#: src/xz/message.c:1176 msgid "" "\n" " --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n" @@ -695,7 +643,7 @@ msgstr "" " Platné volby pro všechny filtry BCJ:\n" " start=POČ počáteční posun pro převody (výchozí=0)" -#: src/xz/message.c:1193 +#: src/xz/message.c:1188 msgid "" "\n" " --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" @@ -704,11 +652,10 @@ msgid "" msgstr "" "\n" " --delta[=VOLBY] Filtr Delta; platné VOLBY (platné hodnoty; výchozí):\n" -" dist=POČ vzdálenost mezi bajty, které jsou " -"odečítány\n" +" dist=POČ vzdálenost mezi bajty, které jsou odečítány\n" " jeden od druhého (1 – 256; 1)" -#: src/xz/message.c:1201 +#: src/xz/message.c:1196 msgid "" "\n" " Other options:\n" @@ -716,79 +663,71 @@ msgstr "" "\n" " Ostatní přepínače:\n" -#: src/xz/message.c:1204 +#: src/xz/message.c:1199 msgid "" -" -q, --quiet suppress warnings; specify twice to suppress errors " -"too\n" +" -q, --quiet suppress warnings; specify twice to suppress errors too\n" " -v, --verbose be verbose; specify twice for even more verbose" msgstr "" -" -q, --quiet potlačit varování; zadáním dvakrát, potlačíte i " -"chyby\n" +" -q, --quiet potlačit varování; zadáním dvakrát, potlačíte i chyby\n" " -v, --verbose podrobnější zprávy; zadáním dvakrát, budou ještě\n" " podrobnější" -#: src/xz/message.c:1209 +#: src/xz/message.c:1204 msgid " -Q, --no-warn make warnings not affect the exit status" msgstr " -Q, --no-warn způsobí, že varování neovlivní stav ukončení" -#: src/xz/message.c:1211 -msgid "" -" --robot use machine-parsable messages (useful for scripts)" +#: src/xz/message.c:1206 +msgid " --robot use machine-parsable messages (useful for scripts)" msgstr "" " --robot použít strojově analyzovatelné zprávy (užitečné pro\n" " skripty)" -#: src/xz/message.c:1214 +#: src/xz/message.c:1209 msgid "" -" --info-memory display the total amount of RAM and the currently " -"active\n" +" --info-memory display the total amount of RAM and the currently active\n" " memory usage limits, and exit" msgstr "" -" --info-memory zobrazit celkové množství paměti RAM a současné " -"aktivní\n" +" --info-memory zobrazit celkové množství paměti RAM a současné aktivní\n" " omezení použitelné paměti a skončit" -#: src/xz/message.c:1217 +#: src/xz/message.c:1212 msgid "" " -h, --help display the short help (lists only the basic options)\n" " -H, --long-help display this long help and exit" msgstr "" -" -h, --help zobrazit krátkou nápovědu (vypíše jen základní " -"přepínače)\n" +" -h, --help zobrazit krátkou nápovědu (vypíše jen základní přepínače)\n" " -H, --long-help zobrazit tuto úplnou nápovědu a skončit" -#: src/xz/message.c:1221 +#: src/xz/message.c:1216 msgid "" " -h, --help display this short help and exit\n" " -H, --long-help display the long help (lists also the advanced options)" msgstr "" " -h, --help zobrazit tuto zkrácenou nápovědu a skončit\n" -" -H, --long-help zobrazit úplnou nápovědu (vypíše i pokročilé " -"přepínače)" +" -H, --long-help zobrazit úplnou nápovědu (vypíše i pokročilé přepínače)" -#: src/xz/message.c:1226 +#: src/xz/message.c:1221 msgid " -V, --version display the version number and exit" msgstr " -V, --version zobrazit číslo verze a skončit" -#: src/xz/message.c:1228 +#: src/xz/message.c:1223 msgid "" "\n" "With no FILE, or when FILE is -, read standard input.\n" msgstr "" "\n" -"Pokud SOUBOR není zadán nebo pokud je -, bude se číst ze standardního " -"vstupu.\n" +"Pokud SOUBOR není zadán nebo pokud je -, bude se číst ze standardního vstupu.\n" #. TRANSLATORS: This message indicates the bug reporting address #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the email or WWW #. address for translation bugs. Thanks. -#: src/xz/message.c:1234 +#: src/xz/message.c:1229 #, c-format msgid "Report bugs to <%s> (in English or Finnish).\n" msgstr "Chyby hlaste na <%s> (v angličtině nebo finštině).\n" -#: src/xz/message.c:1236 +#: src/xz/message.c:1231 #, c-format msgid "%s home page: <%s>\n" msgstr "Domovská stránka %s: <%s>\n" @@ -824,11 +763,8 @@ msgstr "Vybraný vyhledávač shod vyžaduje minimálně nice=%" #: src/xz/suffix.c:79 src/xz/suffix.c:164 #, c-format -msgid "" -"%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" -msgstr "" -"%s: S přepínačem --format=raw je vyžadován --sufix=.PRIP, vyjma zápisu do " -"standardního výstupu" +msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" +msgstr "%s: S přepínačem --format=raw je vyžadován --sufix=.PRIP, vyjma zápisu do standardního výstupu" #: src/xz/suffix.c:99 #, c-format @@ -857,9 +793,7 @@ msgstr "%s: Neplatná jednotka s předponou" #: src/xz/util.c:105 msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)." -msgstr "" -"Platné jednotky s předponami jsou „KiB“ (2^10 B), „MiB“ (2^20 B) a " -"„GiB“ (2^30 B)." +msgstr "Platné jednotky s předponami jsou „KiB“ (2^10 B), „MiB“ (2^20 B) a „GiB“ (2^30 B)." #: src/xz/util.c:122 #, c-format @@ -893,49 +827,37 @@ msgstr "Neznámá chyba" #~ msgstr "%s MiB (%s bajtů)\n" #~ msgid "" -#~ " -e, --extreme use more CPU time when encoding to increase " -#~ "compression\n" +#~ " -e, --extreme use more CPU time when encoding to increase compression\n" #~ " ratio without increasing memory usage of the decoder" #~ msgstr "" -#~ " -e, --extreme využít více procesorového času pro kódování, čímž " -#~ "se\n" -#~ " zvýší kompresní poměr bez zvýšení paměti použité " -#~ "kodérem" +#~ " -e, --extreme využít více procesorového času pro kódování, čímž se\n" +#~ " zvýší kompresní poměr bez zvýšení paměti použité kodérem" #~ msgid "" -#~ " -M, --memory=NUM use roughly NUM bytes of memory at maximum; 0 " -#~ "indicates\n" +#~ " -M, --memory=NUM use roughly NUM bytes of memory at maximum; 0 indicates\n" #~ " the default setting, which is 40 % of total RAM" #~ msgstr "" -#~ " -M, --memory=POČ použít zhruba POČ bajtů paměti jako maximum; 0 " -#~ "znamená\n" -#~ " výchozí nastavení, což je 40% celkového množství " -#~ "paměti" +#~ " -M, --memory=POČ použít zhruba POČ bajtů paměti jako maximum; 0 znamená\n" +#~ " výchozí nastavení, což je 40% celkového množství paměti" #~ msgid "" #~ "\n" -#~ " --subblock[=OPTS] Subblock filter; valid OPTS (valid values; " -#~ "default):\n" +#~ " --subblock[=OPTS] Subblock filter; valid OPTS (valid values; default):\n" #~ " size=NUM number of bytes of data per subblock\n" #~ " (1 - 256Mi; 4Ki)\n" -#~ " rle=NUM run-length encoder chunk size (0-256; " -#~ "0)" +#~ " rle=NUM run-length encoder chunk size (0-256; 0)" #~ msgstr "" #~ "\n" -#~ " --subblock[=VOLBY] Subblokový filtr; platné VOLBY (platné hodnoty; " -#~ "výchozí):\n" +#~ " --subblock[=VOLBY] Subblokový filtr; platné VOLBY (platné hodnoty; výchozí):\n" #~ " size=POČ počet bajtů dat na subblok\n" #~ " (1 - 256 Mi; 4 Ki)\n" -#~ " rle=POČ velikost dávky pro kodér run-length " -#~ "(0-256; 0)" +#~ " rle=POČ velikost dávky pro kodér run-length (0-256; 0)" #~ msgid "" -#~ "On this system and configuration, this program will use a maximum of " -#~ "roughly\n" +#~ "On this system and configuration, this program will use a maximum of roughly\n" #~ "%s MiB RAM and " #~ msgstr "" -#~ "Na tomto systému a s tímto nastavením použije tento program maximum ze " -#~ "zhruba\n" +#~ "Na tomto systému a s tímto nastavením použije tento program maximum ze zhruba\n" #~ "%s MiB RAM a " #~ msgid "" diff --git a/po/de.po b/po/de.po index d88b8cd8a5ec..2cf17c636ac8 100644 --- a/po/de.po +++ b/po/de.po @@ -6,10 +6,11 @@ msgid "" msgstr "" "Project-Id-Version: XZ Utils 4.999.9beta\n" "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n" -"POT-Creation-Date: 2010-09-11 17:07+0200\n" +"POT-Creation-Date: 2010-10-23 17:48+0300\n" "PO-Revision-Date: 2010-09-07 20:27+0200\n" "Last-Translator: \n" "Language-Team: German\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -27,8 +28,7 @@ msgstr "%s: Integritäts-Check Typ nicht unterstützt" #: src/xz/args.c:382 msgid "Only one file can be specified with `--files' or `--files0'." -msgstr "" -"Nur ein file kann als Argument für --files oder --files0 angegeben werden." +msgstr "Nur ein file kann als Argument für --files oder --files0 angegeben werden." #: src/xz/args.c:445 #, c-format @@ -41,8 +41,7 @@ msgstr "Maximal vier Filter möglich" #: src/xz/coder.c:108 msgid "Memory usage limit is too low for the given filter setup." -msgstr "" -"Das Speicher Limit ist zu niedrig für die gegebene Filter Konfiguration." +msgstr "Das Speicher Limit ist zu niedrig für die gegebene Filter Konfiguration." #: src/xz/coder.c:129 msgid "Using a preset in raw mode is discouraged." @@ -50,9 +49,7 @@ msgstr "Verwendung der Voreinstellung im raw Modus wird nicht empfohlen." #: src/xz/coder.c:131 msgid "The exact options of the presets may vary between software versions." -msgstr "" -"Die genauen Optionen der Voreinstellung können zwischen Software Versionen " -"variieren." +msgstr "Die genauen Optionen der Voreinstellung können zwischen Software Versionen variieren." #: src/xz/coder.c:157 msgid "The .lzma format supports only the LZMA1 filter" @@ -73,12 +70,8 @@ msgstr "Dekompression wird %s MiB Speicher brauchen." #: src/xz/coder.c:247 #, c-format -msgid "" -"Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the " -"memory usage limit of %s MiB" -msgstr "" -"Passte LZMA%c Wörterbuch Größe von %s MiB to %s MiB an, um nicht das " -"Speicher Nutzungslimit von %s MiB zu übersteigen" +msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB" +msgstr "Passte LZMA%c Wörterbuch Größe von %s MiB to %s MiB an, um nicht das Speicher Nutzungslimit von %s MiB zu übersteigen" #. TRANSLATORS: When compression or decompression finishes, #. and xz is going to remove the source file, xz first checks @@ -93,8 +86,7 @@ msgstr "" #: src/xz/file_io.c:137 #, c-format msgid "%s: File seems to have been moved, not removing" -msgstr "" -"%s: Datei scheint umbenannt worden zu sein, daher wird sie nicht gelöscht" +msgstr "%s: Datei scheint umbenannt worden zu sein, daher wird sie nicht gelöscht" #: src/xz/file_io.c:144 src/xz/file_io.c:590 #, c-format @@ -149,8 +141,7 @@ msgstr "%s: Eingabedatei hat mehr als einen hard link, überspringe" #: src/xz/file_io.c:714 #, c-format msgid "Error restoring the O_APPEND flag to standard output: %s" -msgstr "" -"Fehler beim Wiederherstellen des O_APPEND flags bei Standard Output: %s" +msgstr "Fehler beim Wiederherstellen des O_APPEND flags bei Standard Output: %s" #: src/xz/file_io.c:726 #, c-format @@ -160,8 +151,7 @@ msgstr "%s: Fehler beim Schießen der Datei: %s" #: src/xz/file_io.c:762 src/xz/file_io.c:946 #, c-format msgid "%s: Seeking failed when trying to create a sparse file: %s" -msgstr "" -"%s: Positionierungsfehler beim Versuch eine sparse Datei zu erzeugen: %s" +msgstr "%s: Positionierungsfehler beim Versuch eine sparse Datei zu erzeugen: %s" #: src/xz/file_io.c:821 #, c-format @@ -212,7 +202,7 @@ msgstr "Kein" #. but the Check ID is known (here 2). This and other "Unknown-N" #. strings are used in tables, so the width must not exceed ten #. columns with a fixed-width font. It's OK to omit the dash if -#. you need space for one extra letter. +#. you need space for one extra letter, but don't use spaces. #: src/xz/list.c:69 msgid "Unknown-2" msgstr "Unbek.2" @@ -320,12 +310,10 @@ msgstr " Strom Auffüllung: %s\n" #: src/xz/list.c:693 msgid "" " Streams:\n" -" Stream Blocks CompOffset UncompOffset CompSize " -"UncompSize Ratio Check Padding" +" Stream Blocks CompOffset UncompOffset CompSize UncompSize Ratio Check Padding" msgstr "" " Ströme:\n" -" Strom Blöcke KompOffset UnkompOffset KompGröße " -"UnkompGröße Verh. Check Auffüllung" +" Strom Blöcke KompOffset UnkompOffset KompGröße UnkompGröße Verh. Check Auffüllung" #. TRANSLATORS: The second line is column headings. All #. except Check are right aligned; Check is left aligned. @@ -333,12 +321,10 @@ msgstr "" #, c-format msgid "" " Blocks:\n" -" Stream Block CompOffset UncompOffset TotalSize " -"UncompSize Ratio Check" +" Stream Block CompOffset UncompOffset TotalSize UncompSize Ratio Check" msgstr "" " Blöcke:\n" -" Strom Block KompOffset UnkompOffset TotalGröße " -"UnkompGröße Verh. Check" +" Strom Block KompOffset UnkompOffset TotalGröße UnkompGröße Verh. Check" #. TRANSLATORS: These are additional column headings #. for the most verbose listing mode. CheckVal @@ -390,8 +376,7 @@ msgstr " Anzahl Dateien: %s\n" #: src/xz/list.c:1072 msgid "--list works only on .xz files (--format=xz or --format=auto)" -msgstr "" -"--list funktioniert nur mit .xz Dateien (--format=xz oder --format=auto)" +msgstr "--list funktioniert nur mit .xz Dateien (--format=xz oder --format=auto)" #: src/xz/list.c:1078 msgid "--list does not support reading from standard input" @@ -409,79 +394,69 @@ msgstr "%s: Unerwartetes Ende beim Lesen der Dateinamen" #: src/xz/main.c:120 #, c-format -msgid "" -"%s: Null character found when reading filenames; maybe you meant to use `--" -"files0' instead of `--files'?" -msgstr "" -"%s: Null Charakter gefunden beim Lesen der Dateinamen; Meinten Sie `--" -"files0' statt `--files'?" +msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?" +msgstr "%s: Null Charakter gefunden beim Lesen der Dateinamen; Meinten Sie `--files0' statt `--files'?" #: src/xz/main.c:174 msgid "Compression and decompression with --robot are not supported yet." msgstr "Kompression und Dekompression mit --robot ist noch nicht unterstützt." #: src/xz/main.c:231 -msgid "" -"Cannot read data from standard input when reading filenames from standard " -"input" -msgstr "" -"Lesen der Standardeingabe ist nicht möglich, wenn die Dateinamen auch von " -"der Standardeingabe gelesen werden" +msgid "Cannot read data from standard input when reading filenames from standard input" +msgstr "Lesen der Standardeingabe ist nicht möglich, wenn die Dateinamen auch von der Standardeingabe gelesen werden" -#: src/xz/message.c:800 src/xz/message.c:844 +#: src/xz/message.c:792 src/xz/message.c:842 msgid "Internal error (bug)" msgstr "Interner Fehler (Bug)" -#: src/xz/message.c:807 +#: src/xz/message.c:799 msgid "Cannot establish signal handlers" msgstr "Kann Signal Routine nicht setzen" -#: src/xz/message.c:816 +#: src/xz/message.c:808 msgid "No integrity check; not verifying file integrity" msgstr "Kein Integritäts-Check; werde Datei-Integrität nicht überprüfen" -#: src/xz/message.c:819 +#: src/xz/message.c:811 msgid "Unsupported type of integrity check; not verifying file integrity" -msgstr "" -"Typ des Integritäts-Checks nicht unterstützt; werde Datei-Integrität nicht " -"überprüfen" +msgstr "Typ des Integritäts-Checks nicht unterstützt; werde Datei-Integrität nicht überprüfen" -#: src/xz/message.c:826 +#: src/xz/message.c:818 msgid "Memory usage limit reached" msgstr "Speicher-Limit erreicht" -#: src/xz/message.c:829 +#: src/xz/message.c:821 msgid "File format not recognized" msgstr "Datei Format nicht erkannt" -#: src/xz/message.c:832 +#: src/xz/message.c:824 msgid "Unsupported options" msgstr "Optionen nicht unterstützt" -#: src/xz/message.c:835 +#: src/xz/message.c:827 msgid "Compressed data is corrupt" msgstr "Komprimierte Daten sind korrupt" -#: src/xz/message.c:838 +#: src/xz/message.c:830 msgid "Unexpected end of input" msgstr "Unerwartetes Eingabe Ende" -#: src/xz/message.c:886 +#: src/xz/message.c:881 #, c-format msgid "%s MiB of memory is required. The limit is %s." msgstr "%s MiB Speicher wird benötigt. Limit ist %s." -#: src/xz/message.c:1053 +#: src/xz/message.c:1048 #, c-format msgid "%s: Filter chain: %s\n" msgstr "%s: Filter Kette: %s\n" -#: src/xz/message.c:1063 +#: src/xz/message.c:1058 #, c-format msgid "Try `%s --help' for more information." msgstr "Versuchen Sie `%s --help' für mehr Informationen." -#: src/xz/message.c:1089 +#: src/xz/message.c:1084 #, c-format msgid "" "Usage: %s [OPTION]... [FILE]...\n" @@ -492,18 +467,17 @@ msgstr "" "Komprimiert oder dekomprimiert .xz DATEI(EN).\n" "\n" -#: src/xz/message.c:1096 -msgid "" -"Mandatory arguments to long options are mandatory for short options too.\n" +#: src/xz/message.c:1091 +msgid "Mandatory arguments to long options are mandatory for short options too.\n" msgstr "" "Obligatorische Argumente für lange Optionen sind auch für kurze Optionen\n" "zwingend.\n" -#: src/xz/message.c:1100 +#: src/xz/message.c:1095 msgid " Operation mode:\n" msgstr " Operationsmodus:\n" -#: src/xz/message.c:1103 +#: src/xz/message.c:1098 msgid "" " -z, --compress force compression\n" " -d, --decompress force decompression\n" @@ -515,7 +489,7 @@ msgstr "" " -t, --test überprüfe Datei Integrität\n" " -l, --list liste Datei Informationen" -#: src/xz/message.c:1109 +#: src/xz/message.c:1104 msgid "" "\n" " Operation modifiers:\n" @@ -523,7 +497,7 @@ msgstr "" "\n" " Operationsmodifikatoren:\n" -#: src/xz/message.c:1112 +#: src/xz/message.c:1107 msgid "" " -k, --keep keep (don't delete) input files\n" " -f, --force force overwrite of output file and (de)compress links\n" @@ -535,14 +509,13 @@ msgstr "" " -c, --stdout schreibe nach Standard Output und lösche nicht die\n" " Eingabedateien" -#: src/xz/message.c:1118 +#: src/xz/message.c:1113 msgid "" " --no-sparse do not create sparse files when decompressing\n" " -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n" " --files[=FILE] read filenames to process from FILE; if FILE is\n" " omitted, filenames are read from the standard input;\n" -" filenames must be terminated with the newline " -"character\n" +" filenames must be terminated with the newline character\n" " --files0[=FILE] like --files but use the null character as terminator" msgstr "" " --no-sparse erzeuge keine sparse Datei beim Dekomprimieren\n" @@ -551,10 +524,9 @@ msgstr "" " DATEI nicht angegeben wurde, werden Dateinamen\n" " von Standard Input gelesen. Dateinamen müssen mit\n" " einem Zeilenumbruch voneinander getrennt werden\n" -" --files0=[DATEI] wie --files, aber benutze den Null Charakter als " -"Trenner" +" --files0=[DATEI] wie --files, aber benutze den Null Charakter als Trenner" -#: src/xz/message.c:1126 +#: src/xz/message.c:1121 msgid "" "\n" " Basic file format and compression options:\n" @@ -562,76 +534,62 @@ msgstr "" "\n" " Grundlegende Optionen für Dateiformat und Kompression:\n" -#: src/xz/message.c:1128 +#: src/xz/message.c:1123 msgid "" " -F, --format=FMT file format to encode or decode; possible values are\n" " `auto' (default), `xz', `lzma', and `raw'\n" " -C, --check=CHECK integrity check type: `none' (use with caution),\n" " `crc32', `crc64' (default), or `sha256'" msgstr "" -" -F, --format=FMT Dateiformat zur Kodierung oder Dekodierung; " -"mögliche\n" -" Werte sind `auto' (Voreinstellung), `xz', `lzma' " -"und\n" +" -F, --format=FMT Dateiformat zur Kodierung oder Dekodierung; mögliche\n" +" Werte sind `auto' (Voreinstellung), `xz', `lzma' und\n" " `raw'\n" -" -C, --check=CHECK Typ des Integritätschecks: `none' (Vorsicht), " -"`crc32',\n" +" -C, --check=CHECK Typ des Integritätschecks: `none' (Vorsicht), `crc32',\n" " `crc64' (Voreinstellung), oder `sha256'" -#: src/xz/message.c:1135 +#: src/xz/message.c:1130 msgid "" -" -0 ... -9 compression preset; default is 6; take compressor " -"*and*\n" -" decompressor memory usage into account before using 7-" -"9!" +" -0 ... -9 compression preset; default is 6; take compressor *and*\n" +" decompressor memory usage into account before using 7-9!" msgstr "" -" -0 .. -9 Kompressionseinstellung; Voreinstellung is 6. " -"Beachten\n" -" Sie den Speicherverbrauch des Komprimieres *und* " -"des\n" +" -0 .. -9 Kompressionseinstellung; Voreinstellung is 6. Beachten\n" +" Sie den Speicherverbrauch des Komprimieres *und* des\n" " Dekomprimierers, wenn Sie 7-9 benutzen!" -#: src/xz/message.c:1139 +#: src/xz/message.c:1134 msgid "" -" -e, --extreme try to improve compression ratio by using more CPU " -"time;\n" +" -e, --extreme try to improve compression ratio by using more CPU time;\n" " does not affect decompressor memory requirements" msgstr "" -" -e, --extreme Versuche durch stärkere CPU Nutzung das " -"Kompressions-\n" +" -e, --extreme Versuche durch stärkere CPU Nutzung das Kompressions-\n" " verhältnis zu verbessern. Das beeinflusst nicht den\n" " Speicherbedarf des Dekomprimierers." -#: src/xz/message.c:1144 +#: src/xz/message.c:1139 #, no-c-format msgid "" " --memlimit-compress=LIMIT\n" " --memlimit-decompress=LIMIT\n" " -M, --memlimit=LIMIT\n" -" set memory usage limit for compression, " -"decompression,\n" +" set memory usage limit for compression, decompression,\n" " or both; LIMIT is in bytes, % of RAM, or 0 for defaults" msgstr "" " --memlimit-compress=LIMIT\n" " --memlimit-decompress=LIMIT\n" " -M, --memlimit=LIMIT Setze Speicher Nutzungslimit für Kompression,\n" -" Dekompression, oder beides; LIMIT ist in bytes, % " -"RAM,\n" +" Dekompression, oder beides; LIMIT ist in bytes, % RAM,\n" " oder 0 für Grundeinstellungen." -#: src/xz/message.c:1151 +#: src/xz/message.c:1146 msgid "" -" --no-adjust if compression settings exceed the memory usage " -"limit,\n" -" give an error instead of adjusting the settings " -"downwards" +" --no-adjust if compression settings exceed the memory usage limit,\n" +" give an error instead of adjusting the settings downwards" msgstr "" " --no-adjust Wenn die Kompressionseinstellungen das Speicher\n" -" Nutzungslimit übersteigen, erzeuge einen Fehler " -"statt\n" +" Nutzungslimit übersteigen, erzeuge einen Fehler statt\n" " die Einstellungen nach unten anzupassen." -#: src/xz/message.c:1157 +#: src/xz/message.c:1152 msgid "" "\n" " Custom filter chain for compression (alternative for using presets):" @@ -639,13 +597,11 @@ msgstr "" "\n" " User-definierte Filter Kette für Kompression (alternativ zu Voreinstellung):" -#: src/xz/message.c:1166 +#: src/xz/message.c:1161 msgid "" "\n" -" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero " -"or\n" -" --lzma2[=OPTS] more of the following options (valid values; " -"default):\n" +" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" +" --lzma2[=OPTS] more of the following options (valid values; default):\n" " preset=PRE reset options to a preset (0-9[e])\n" " dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n" " lc=NUM number of literal context bits (0-4; 3)\n" @@ -653,37 +609,28 @@ msgid "" " pb=NUM number of position bits (0-4; 2)\n" " mode=MODE compression mode (fast, normal; normal)\n" " nice=NUM nice length of a match (2-273; 64)\n" -" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; " -"bt4)\n" -" depth=NUM maximum search depth; 0=automatic " -"(default)" +" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n" +" depth=NUM maximum search depth; 0=automatic (default)" msgstr "" "\n" " --lzma1[=OPTIONEN] LZMA1 oder LZMA2; OPTIONEN ist eine durch Kommata\n" -" --lzma2[=OPTIONEN] getrennte Liste bestehend aus den folgenden " -"Optionen\n" +" --lzma2[=OPTIONEN] getrennte Liste bestehend aus den folgenden Optionen\n" " (zulässige Werte; Voreinstellung):\n" -" preset=NUM Setze Optionen zurück zu " -"Voreinstellung\n" +" preset=NUM Setze Optionen zurück zu Voreinstellung\n" " (0-9[e])\n" -" dict=NUM Wörterbuch Größe (4 KiB - 1536 MiB; 8 " -"MiB)\n" -" lc=NUM Anzahl der Literal Kontext Bits (0-4; " -"3)\n" -" lp=NUM Anzahl der Literal Positionsbits (0-4; " -"0)\n" +" dict=NUM Wörterbuch Größe (4 KiB - 1536 MiB; 8 MiB)\n" +" lc=NUM Anzahl der Literal Kontext Bits (0-4; 3)\n" +" lp=NUM Anzahl der Literal Positionsbits (0-4; 0)\n" " pb=NUM Anzahl der Positionsbits (0-4; 2)\n" -" mode=MODUS Kompressionsmodus (fast, normal; " -"normal)\n" +" mode=MODUS Kompressionsmodus (fast, normal; normal)\n" " nice=NUM Nice-Länge eines Treffers (2-273; 64)\n" " mf=NAME Algorithmus zum Auffinden von\n" -" Übereinstimmungen (hc3, hc4, bt2, bt3, " -"bt4;\n" +" Übereinstimmungen (hc3, hc4, bt2, bt3, bt4;\n" " bt4)\n" " depth=NUM Maximale Suchtiefe; 0=automatisch\n" " (Voreinstellung)" -#: src/xz/message.c:1181 +#: src/xz/message.c:1176 msgid "" "\n" " --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n" @@ -706,7 +653,7 @@ msgstr "" " start=NUM Start-Offset für Konversion\n" " (Voreinstellung=0)" -#: src/xz/message.c:1193 +#: src/xz/message.c:1188 msgid "" "\n" " --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" @@ -716,11 +663,10 @@ msgstr "" "\n" " --delta[=OPTIONEN] Delta Filter; zulässige Optionen (gültige Werte;\n" " Voreinstellung):\n" -" dist=NUM Abstand zwischen den Bytes, die " -"voneinander\n" +" dist=NUM Abstand zwischen den Bytes, die voneinander\n" " subtrahiert werden (1-256; 1)" -#: src/xz/message.c:1201 +#: src/xz/message.c:1196 msgid "" "\n" " Other options:\n" @@ -728,37 +674,33 @@ msgstr "" "\n" " Andere Optionen:\n" -#: src/xz/message.c:1204 +#: src/xz/message.c:1199 msgid "" -" -q, --quiet suppress warnings; specify twice to suppress errors " -"too\n" +" -q, --quiet suppress warnings; specify twice to suppress errors too\n" " -v, --verbose be verbose; specify twice for even more verbose" msgstr "" " -q, --quiet unterdrücke Warnungen; benutze diese Option zweimal\n" " um auch Fehlermeldungen zu unterdrücken\n" -" -v, --verbose sei gesprächig; benutze diese Option zweimal um " -"noch\n" +" -v, --verbose sei gesprächig; benutze diese Option zweimal um noch\n" " gesprächiger zu sein" -#: src/xz/message.c:1209 +#: src/xz/message.c:1204 msgid " -Q, --no-warn make warnings not affect the exit status" msgstr " -Q, --no-warn Warnungen verändern nicht den exit status" -#: src/xz/message.c:1211 -msgid "" -" --robot use machine-parsable messages (useful for scripts)" +#: src/xz/message.c:1206 +msgid " --robot use machine-parsable messages (useful for scripts)" msgstr "" " --robot benutze Maschinen-lesbare Meldungen (nützlich für\n" " Skripte)" -#: src/xz/message.c:1214 +#: src/xz/message.c:1209 msgid "" -" --info-memory display the total amount of RAM and the currently " -"active\n" +" --info-memory display the total amount of RAM and the currently active\n" " memory usage limits, and exit" msgstr " --info-memory zeige Speicherlimit an und terminiere" -#: src/xz/message.c:1217 +#: src/xz/message.c:1212 msgid "" " -h, --help display the short help (lists only the basic options)\n" " -H, --long-help display this long help and exit" @@ -767,21 +709,20 @@ msgstr "" " Optionen)\n" " -H, --long-help zeige diese lange Hilfe an und terminiere" -#: src/xz/message.c:1221 +#: src/xz/message.c:1216 msgid "" " -h, --help display this short help and exit\n" " -H, --long-help display the long help (lists also the advanced options)" msgstr "" " -h, --help zeige diese kurze Hilfe an und terminiere\n" -" -H, --long-help zeige die lange Hilfe an (zeigt auch " -"fortgeschrittene\n" +" -H, --long-help zeige die lange Hilfe an (zeigt auch fortgeschrittene\n" " Optionen an)" -#: src/xz/message.c:1226 +#: src/xz/message.c:1221 msgid " -V, --version display the version number and exit" msgstr " -V, --version zeige Versionsnummer an und terminiere" -#: src/xz/message.c:1228 +#: src/xz/message.c:1223 msgid "" "\n" "With no FILE, or when FILE is -, read standard input.\n" @@ -794,15 +735,14 @@ msgstr "" #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the email or WWW #. address for translation bugs. Thanks. -#: src/xz/message.c:1234 +#: src/xz/message.c:1229 #, c-format msgid "Report bugs to <%s> (in English or Finnish).\n" msgstr "" "Melde Bugs an <%s> (in englisch oder finnisch).\n" -"Melde Übersetzungsfehler an (in englisch oder " -"deutsch).\n" +"Melde Übersetzungsfehler an (in englisch oder deutsch).\n" -#: src/xz/message.c:1236 +#: src/xz/message.c:1231 #, c-format msgid "%s home page: <%s>\n" msgstr "%s Homepage: <%s>\n" @@ -810,9 +750,7 @@ msgstr "%s Homepage: <%s>\n" #: src/xz/options.c:86 #, c-format msgid "%s: Options must be `name=value' pairs separated with commas" -msgstr "" -"%s: Optionen müssen in der Form `Name=Wert` gegeben werden, getrennt durch " -"Kommata" +msgstr "%s: Optionen müssen in der Form `Name=Wert` gegeben werden, getrennt durch Kommata" #: src/xz/options.c:93 #, c-format @@ -836,17 +774,12 @@ msgstr "Die Summe aus lc und lp darf höchstens 4 sein" #: src/xz/options.c:359 #, c-format msgid "The selected match finder requires at least nice=%" -msgstr "" -"Der ausgewählte Algorithmus zum Auffinden von Übereinstimmungen braucht " -"mindestens nice=%" +msgstr "Der ausgewählte Algorithmus zum Auffinden von Übereinstimmungen braucht mindestens nice=%" #: src/xz/suffix.c:79 src/xz/suffix.c:164 #, c-format -msgid "" -"%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" -msgstr "" -"%s: Mit --format=raw ist --sufix=.SUF notwendig, falls nicht nach stdout " -"geschrieben wird" +msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" +msgstr "%s: Mit --format=raw ist --sufix=.SUF notwendig, falls nicht nach stdout geschrieben wird" #: src/xz/suffix.c:99 #, c-format diff --git a/po/it.po b/po/it.po index 8e096dd4eaef..4f9ef0ddd483 100644 --- a/po/it.po +++ b/po/it.po @@ -7,10 +7,11 @@ msgid "" msgstr "" "Project-Id-Version: xz-utils\n" "Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n" -"POT-Creation-Date: 2010-09-10 14:50+0300\n" +"POT-Creation-Date: 2010-10-23 17:48+0300\n" "PO-Revision-Date: 2010-09-16 21:32+0200\n" "Last-Translator: Milo Casagrande \n" "Language-Team: Italian \n" +"Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -43,9 +44,7 @@ msgstr "Il numero massimo di filtri è quattro" #: src/xz/coder.c:108 msgid "Memory usage limit is too low for the given filter setup." -msgstr "" -"Il limite dell'uso della memoria è troppo basso per l'impostazione del " -"filtro dato." +msgstr "Il limite dell'uso della memoria è troppo basso per l'impostazione del filtro dato." #: src/xz/coder.c:129 msgid "Using a preset in raw mode is discouraged." @@ -53,8 +52,7 @@ msgstr "Non è consigliato usare un preset nella modalità raw." #: src/xz/coder.c:131 msgid "The exact options of the presets may vary between software versions." -msgstr "" -"Le opzioni esatte per i preset possono variare tra le versioni del software." +msgstr "Le opzioni esatte per i preset possono variare tra le versioni del software." #: src/xz/coder.c:157 msgid "The .lzma format supports only the LZMA1 filter" @@ -75,12 +73,8 @@ msgstr "L'estrazione necessita di %s MiB di memoria." #: src/xz/coder.c:247 #, c-format -msgid "" -"Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the " -"memory usage limit of %s MiB" -msgstr "" -"Regolata la dimensione del dizionario LZMA%c da %s MiB a %s MiB per non " -"superare il limite dell'uso della memoria di %s MiB" +msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB" +msgstr "Regolata la dimensione del dizionario LZMA%c da %s MiB a %s MiB per non superare il limite dell'uso della memoria di %s MiB" #. TRANSLATORS: When compression or decompression finishes, #. and xz is going to remove the source file, xz first checks @@ -160,8 +154,7 @@ msgstr "%s: chiusura del file non riuscita: %s" #: src/xz/file_io.c:762 src/xz/file_io.c:946 #, c-format msgid "%s: Seeking failed when trying to create a sparse file: %s" -msgstr "" -"%s: posizionamento non riuscito nel tentativo di creare un file sparso: %s" +msgstr "%s: posizionamento non riuscito nel tentativo di creare un file sparso: %s" #: src/xz/file_io.c:821 #, c-format @@ -212,7 +205,7 @@ msgstr "Nessuno" #. but the Check ID is known (here 2). This and other "Unknown-N" #. strings are used in tables, so the width must not exceed ten #. columns with a fixed-width font. It's OK to omit the dash if -#. you need space for one extra letter. +#. you need space for one extra letter, but don't use spaces. #: src/xz/list.c:69 msgid "Unknown-2" msgstr "Sconosc2" @@ -320,12 +313,10 @@ msgstr " Padding dello stream: %s\n" #: src/xz/list.c:693 msgid "" " Streams:\n" -" Stream Blocks CompOffset UncompOffset CompSize " -"UncompSize Ratio Check Padding" +" Stream Blocks CompOffset UncompOffset CompSize UncompSize Ratio Check Padding" msgstr "" "Stream:\n" -" Stream Blocc. Offset comp. Offset estr. Dim. comp. Dim. " -"estratto Rapp. Contr Padding" +" Stream Blocc. Offset comp. Offset estr. Dim. comp. Dim. estratto Rapp. Contr Padding" #. TRANSLATORS: The second line is column headings. All #. except Check are right aligned; Check is left aligned. @@ -333,12 +324,10 @@ msgstr "" #, c-format msgid "" " Blocks:\n" -" Stream Block CompOffset UncompOffset TotalSize " -"UncompSize Ratio Check" +" Stream Block CompOffset UncompOffset TotalSize UncompSize Ratio Check" msgstr "" " Blocchi:\n" -" Stream Blocc. Offset comp. Offset estratto Dim. tot. Dim. " -"estratto Rapp. Contr" +" Stream Blocc. Offset comp. Offset estratto Dim. tot. Dim. estratto Rapp. Contr" #. TRANSLATORS: These are additional column headings #. for the most verbose listing mode. CheckVal @@ -408,80 +397,69 @@ msgstr "%s: fine dell'input durante la lettura dei nomi dei file non attesa" #: src/xz/main.c:120 #, c-format -msgid "" -"%s: Null character found when reading filenames; maybe you meant to use `--" -"files0' instead of `--files'?" -msgstr "" -"%s: nessun carattere trovato durante la lettura dei nomi dei file; forse si " -"intendeva usare \"--files0\" invece di \"--files\"?" +msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?" +msgstr "%s: nessun carattere trovato durante la lettura dei nomi dei file; forse si intendeva usare \"--files0\" invece di \"--files\"?" #: src/xz/main.c:174 msgid "Compression and decompression with --robot are not supported yet." msgstr "La compressione e l'estrazione con --robot non sono ancora supportate." #: src/xz/main.c:231 -msgid "" -"Cannot read data from standard input when reading filenames from standard " -"input" -msgstr "" -"Impossibile leggere i dati dallo standard input durante la lettura dei nomi " -"dei file dallo standard input" +msgid "Cannot read data from standard input when reading filenames from standard input" +msgstr "Impossibile leggere i dati dallo standard input durante la lettura dei nomi dei file dallo standard input" -#: src/xz/message.c:800 src/xz/message.c:844 +#: src/xz/message.c:792 src/xz/message.c:842 msgid "Internal error (bug)" msgstr "Errore interno (bug)" -#: src/xz/message.c:807 +#: src/xz/message.c:799 msgid "Cannot establish signal handlers" msgstr "Impossibile stabilire i gestori dei segnali" -#: src/xz/message.c:816 +#: src/xz/message.c:808 msgid "No integrity check; not verifying file integrity" -msgstr "" -"Nessun controllo d'integrità; l'integrità del file non viene verificata" +msgstr "Nessun controllo d'integrità; l'integrità del file non viene verificata" -#: src/xz/message.c:819 +#: src/xz/message.c:811 msgid "Unsupported type of integrity check; not verifying file integrity" -msgstr "" -"Tipo di controllo di integrità non supportato; l'integrità del file non " -"viene verificata" +msgstr "Tipo di controllo di integrità non supportato; l'integrità del file non viene verificata" -#: src/xz/message.c:826 +#: src/xz/message.c:818 msgid "Memory usage limit reached" msgstr "Limite di utilizzo della memoria raggiunto" -#: src/xz/message.c:829 +#: src/xz/message.c:821 msgid "File format not recognized" msgstr "Formato di file non riconosciuto" -#: src/xz/message.c:832 +#: src/xz/message.c:824 msgid "Unsupported options" msgstr "Opzioni non supportate" -#: src/xz/message.c:835 +#: src/xz/message.c:827 msgid "Compressed data is corrupt" msgstr "I dati compressi sono danneggiati" -#: src/xz/message.c:838 +#: src/xz/message.c:830 msgid "Unexpected end of input" msgstr "Fine dell'input non attesa" -#: src/xz/message.c:886 +#: src/xz/message.c:881 #, c-format msgid "%s MiB of memory is required. The limit is %s." msgstr "%s MiB di memoria sono richiesti. Il limite è %s." -#: src/xz/message.c:1053 +#: src/xz/message.c:1048 #, c-format msgid "%s: Filter chain: %s\n" msgstr "%s: catena di filtri: %s\n" -#: src/xz/message.c:1063 +#: src/xz/message.c:1058 #, c-format msgid "Try `%s --help' for more information." msgstr "Provare \"%s --help\" per maggiori informazioni." -#: src/xz/message.c:1089 +#: src/xz/message.c:1084 #, c-format msgid "" "Usage: %s [OPTION]... [FILE]...\n" @@ -492,18 +470,15 @@ msgstr "" "Comprime o estrae i FILE nel formato .xz.\n" "\n" -#: src/xz/message.c:1096 -msgid "" -"Mandatory arguments to long options are mandatory for short options too.\n" -msgstr "" -"Gli argomenti obbligatori per le opzioni lunghe lo sono anche per quelle " -"brevi.\n" +#: src/xz/message.c:1091 +msgid "Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "Gli argomenti obbligatori per le opzioni lunghe lo sono anche per quelle brevi.\n" -#: src/xz/message.c:1100 +#: src/xz/message.c:1095 msgid " Operation mode:\n" msgstr " Modalità di operazione:\n" -#: src/xz/message.c:1103 +#: src/xz/message.c:1098 msgid "" " -z, --compress force compression\n" " -d, --decompress force decompression\n" @@ -515,7 +490,7 @@ msgstr "" " -t, --test Verifica l'integrità dei file compressi\n" " -l, --list Elenca informazioni sui file .xz" -#: src/xz/message.c:1109 +#: src/xz/message.c:1104 msgid "" "\n" " Operation modifiers:\n" @@ -523,40 +498,35 @@ msgstr "" "\n" " Modificatori di operazioni:\n" -#: src/xz/message.c:1112 +#: src/xz/message.c:1107 msgid "" " -k, --keep keep (don't delete) input files\n" " -f, --force force overwrite of output file and (de)compress links\n" " -c, --stdout write to standard output and don't delete input files" msgstr "" " -k, --keep Mantiene (non elimina) i file di input\n" -" -f, --force Forza la sovrascrittura dell'output e comprime/estrae " -"i\n" +" -f, --force Forza la sovrascrittura dell'output e comprime/estrae i\n" " collegamenti\n" -" -c, --stdout Scrive sullo standard output e non elimina i file di " -"input" +" -c, --stdout Scrive sullo standard output e non elimina i file di input" -#: src/xz/message.c:1118 +#: src/xz/message.c:1113 msgid "" " --no-sparse do not create sparse files when decompressing\n" " -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n" " --files[=FILE] read filenames to process from FILE; if FILE is\n" " omitted, filenames are read from the standard input;\n" -" filenames must be terminated with the newline " -"character\n" +" filenames must be terminated with the newline character\n" " --files0[=FILE] like --files but use the null character as terminator" msgstr "" " --no-sparse Non crea file sparsi durante l'estrazione\n" " -S, --suffix=.SUF Usa il suffisso \".SUF\" sui file compressi\n" " --files=[FILE] Legge i nomi dei file da elaborare da FILE; se FILE è\n" -" omesso, i nomi dei file sono letti dallo standard " -"input;\n" -" i nomi dei file devono essere terminati con un " -"carattere\n" +" omesso, i nomi dei file sono letti dallo standard input;\n" +" i nomi dei file devono essere terminati con un carattere\n" " di newline\n" " --files0=[FILE] Come --files ma usa il carattere null come terminatore" -#: src/xz/message.c:1126 +#: src/xz/message.c:1121 msgid "" "\n" " Basic file format and compression options:\n" @@ -564,76 +534,62 @@ msgstr "" "\n" " Formato file di base e opzioni di compressione:\n" -#: src/xz/message.c:1128 +#: src/xz/message.c:1123 msgid "" " -F, --format=FMT file format to encode or decode; possible values are\n" " `auto' (default), `xz', `lzma', and `raw'\n" " -C, --check=CHECK integrity check type: `none' (use with caution),\n" " `crc32', `crc64' (default), or `sha256'" msgstr "" -" -F, --format=FMT Formato file per codificare o decodificare; i " -"possibili\n" -" valori sono \"auto\" (predefinito) \"xz\", \"lzma\" e " -"\"raw\"\n" -" -C, --check=CHECK Tipo di verifica integrità: \"none\" (usare con " -"attenzione),\n" +" -F, --format=FMT Formato file per codificare o decodificare; i possibili\n" +" valori sono \"auto\" (predefinito) \"xz\", \"lzma\" e \"raw\"\n" +" -C, --check=CHECK Tipo di verifica integrità: \"none\" (usare con attenzione),\n" " \"crc32\", \"crc64\" (predefinito) o \"sha256\"" -#: src/xz/message.c:1135 +#: src/xz/message.c:1130 msgid "" -" -0 ... -9 compression preset; default is 6; take compressor " -"*and*\n" -" decompressor memory usage into account before using 7-" -"9!" +" -0 ... -9 compression preset; default is 6; take compressor *and*\n" +" decompressor memory usage into account before using 7-9!" msgstr "" -" -0 ... -9 Preset di compressione; predefinito è 6; tenere a " -"mente\n" -" l'utilizzo di memoria per comprimere ed estrarre " -"prima\n" +" -0 ... -9 Preset di compressione; predefinito è 6; tenere a mente\n" +" l'utilizzo di memoria per comprimere ed estrarre prima\n" " di usare 7-9" -#: src/xz/message.c:1139 +#: src/xz/message.c:1134 msgid "" -" -e, --extreme try to improve compression ratio by using more CPU " -"time;\n" +" -e, --extreme try to improve compression ratio by using more CPU time;\n" " does not affect decompressor memory requirements" msgstr "" " -e, --extreme Tenta di migliorare il rapporto di compressione\n" -" utilizzando più tempo di CPU; non cambia i requisiti " -"di\n" +" utilizzando più tempo di CPU; non cambia i requisiti di\n" " memoria in fase di estrazione" -#: src/xz/message.c:1144 +#: src/xz/message.c:1139 #, no-c-format msgid "" " --memlimit-compress=LIMIT\n" " --memlimit-decompress=LIMIT\n" " -M, --memlimit=LIMIT\n" -" set memory usage limit for compression, " -"decompression,\n" +" set memory usage limit for compression, decompression,\n" " or both; LIMIT is in bytes, % of RAM, or 0 for defaults" msgstr "" " --memlimit-compress=LIMIT\n" " --memlimit-decompress=LIMIT\n" " -M, --memlimit=LIMIT\n" " Imposta il limite di utilizzo della memoria per la\n" -" compressione, l'estrazione o entrambe; LIMIT è in " -"byte,\n" +" compressione, l'estrazione o entrambe; LIMIT è in byte,\n" " % della memoria RAM oppure 0 per il valore predefinito" -#: src/xz/message.c:1151 +#: src/xz/message.c:1146 msgid "" -" --no-adjust if compression settings exceed the memory usage " -"limit,\n" -" give an error instead of adjusting the settings " -"downwards" +" --no-adjust if compression settings exceed the memory usage limit,\n" +" give an error instead of adjusting the settings downwards" msgstr "" -" --no-adjust Se le impostazioni di compressione eccedono il limite " -"di\n" +" --no-adjust Se le impostazioni di compressione eccedono il limite di\n" " utilizzo della memoria, lancia un errore invece di\n" " utilizzare valori più piccoli" -#: src/xz/message.c:1157 +#: src/xz/message.c:1152 msgid "" "\n" " Custom filter chain for compression (alternative for using presets):" @@ -642,13 +598,11 @@ msgstr "" " Catena di filtri personalizzati per la compressione (alternative per\n" " l'utilizzo di preset):" -#: src/xz/message.c:1166 +#: src/xz/message.c:1161 msgid "" "\n" -" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero " -"or\n" -" --lzma2[=OPTS] more of the following options (valid values; " -"default):\n" +" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" +" --lzma2[=OPTS] more of the following options (valid values; default):\n" " preset=PRE reset options to a preset (0-9[e])\n" " dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n" " lc=NUM number of literal context bits (0-4; 3)\n" @@ -656,24 +610,17 @@ msgid "" " pb=NUM number of position bits (0-4; 2)\n" " mode=MODE compression mode (fast, normal; normal)\n" " nice=NUM nice length of a match (2-273; 64)\n" -" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; " -"bt4)\n" -" depth=NUM maximum search depth; 0=automatic " -"(default)" +" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n" +" depth=NUM maximum search depth; 0=automatic (default)" msgstr "" "\n" -" --lzma1[=OPZ] LZMA1 o LZMA2; OPZ è un elenco separato da virgole di " -"zero\n" -" --lzma2[=OPZ] o più delle seguenti opzioni (valori validi; " -"predefinito):\n" -" preset=NUM Reimposta le opzioni al preset NUM (0-9" -"[e])\n" +" --lzma1[=OPZ] LZMA1 o LZMA2; OPZ è un elenco separato da virgole di zero\n" +" --lzma2[=OPZ] o più delle seguenti opzioni (valori validi; predefinito):\n" +" preset=NUM Reimposta le opzioni al preset NUM (0-9[e])\n" " dict=NUM Dimensione del dizionario\n" " (4KiB - 1536MiB; 8MiB)\n" -" lc=NUM Numero di bit letterali di contesto (0-4; " -"3)\n" -" lp=NUM Numero di bit letterali di posizione (0-" -"4; 0)\n" +" lc=NUM Numero di bit letterali di contesto (0-4; 3)\n" +" lp=NUM Numero di bit letterali di posizione (0-4; 0)\n" " pb=NUM Numero di bit di posizione (0-4; 2)\n" " mode=MODE Modalità di compressione\n" " (fast, normal; normal)\n" @@ -681,11 +628,10 @@ msgstr "" " (2-273; 64)\n" " mf=NAME Strumento per cercare corrispondenze\n" " (hc3, hc4, bt2, bt3, bt4; bt4)\n" -" depth=NUM Profondità massima di ricerca; " -"0=automatica\n" +" depth=NUM Profondità massima di ricerca; 0=automatica\n" " (predefinito)" -#: src/xz/message.c:1181 +#: src/xz/message.c:1176 msgid "" "\n" " --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n" @@ -708,7 +654,7 @@ msgstr "" " start=NUM Offset iniziale per le conversioni\n" " (predefinito=0)" -#: src/xz/message.c:1193 +#: src/xz/message.c:1188 msgid "" "\n" " --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" @@ -720,7 +666,7 @@ msgstr "" " dist=NUM Distanza tra byte sottratti\n" " gli uni dagli altri (1-256; 1)" -#: src/xz/message.c:1201 +#: src/xz/message.c:1196 msgid "" "\n" " Other options:\n" @@ -728,39 +674,33 @@ msgstr "" "\n" " Altre opzioni:\n" -#: src/xz/message.c:1204 +#: src/xz/message.c:1199 msgid "" -" -q, --quiet suppress warnings; specify twice to suppress errors " -"too\n" +" -q, --quiet suppress warnings; specify twice to suppress errors too\n" " -v, --verbose be verbose; specify twice for even more verbose" msgstr "" -" -q, --quiet Sopprime gli avvisi; specificare due volte per " -"sopprimere\n" +" -q, --quiet Sopprime gli avvisi; specificare due volte per sopprimere\n" " anche gli errori\n" -" -v, --verbose Output prolisso; specificare due volte per output " -"ancora\n" +" -v, --verbose Output prolisso; specificare due volte per output ancora\n" " più prolisso" -#: src/xz/message.c:1209 +#: src/xz/message.c:1204 msgid " -Q, --no-warn make warnings not affect the exit status" msgstr " -Q, --no-warn Gli avvisi non influenzano lo stato d'uscita" -#: src/xz/message.c:1211 -msgid "" -" --robot use machine-parsable messages (useful for scripts)" +#: src/xz/message.c:1206 +msgid " --robot use machine-parsable messages (useful for scripts)" msgstr " --robot Usa messaggi analizzabili (utile per gli script)" -#: src/xz/message.c:1214 +#: src/xz/message.c:1209 msgid "" -" --info-memory display the total amount of RAM and the currently " -"active\n" +" --info-memory display the total amount of RAM and the currently active\n" " memory usage limits, and exit" msgstr "" -" --info-memory Visualizza la quantità totale di RAM, il limite " -"attuale\n" +" --info-memory Visualizza la quantità totale di RAM, il limite attuale\n" " attivo di utilizzo della memore ed esce" -#: src/xz/message.c:1217 +#: src/xz/message.c:1212 msgid "" " -h, --help display the short help (lists only the basic options)\n" " -H, --long-help display this long help and exit" @@ -768,7 +708,7 @@ msgstr "" " -h, --help Stampa l'aiuto breve (elenca solo le opzioni di base)\n" " -H, --long-help Stampa questo lungo aiuto ed esce" -#: src/xz/message.c:1221 +#: src/xz/message.c:1216 msgid "" " -h, --help display this short help and exit\n" " -H, --long-help display the long help (lists also the advanced options)" @@ -776,11 +716,11 @@ msgstr "" " -h, --help Stampa questo breve aiuto ed esce\n" " -H, --long-help Stampa l'aiuto lungo (elenca anche le opzioni avanzate)" -#: src/xz/message.c:1226 +#: src/xz/message.c:1221 msgid " -V, --version display the version number and exit" msgstr " -V, --version Stampa il numero della versione ed esce" -#: src/xz/message.c:1228 +#: src/xz/message.c:1223 msgid "" "\n" "With no FILE, or when FILE is -, read standard input.\n" @@ -792,14 +732,14 @@ msgstr "" #. for this package. Please add _another line_ saying #. "Report translation bugs to <...>\n" with the email or WWW #. address for translation bugs. Thanks. -#: src/xz/message.c:1234 +#: src/xz/message.c:1229 #, c-format msgid "Report bugs to <%s> (in English or Finnish).\n" msgstr "" "Segnalare i bug a <%s> (in inglese o finlandese).\n" "Segnalare i bug di traduzione a .\n" -#: src/xz/message.c:1236 +#: src/xz/message.c:1231 #, c-format msgid "%s home page: <%s>\n" msgstr "Sito web di %s: <%s>\n" @@ -807,8 +747,7 @@ msgstr "Sito web di %s: <%s>\n" #: src/xz/options.c:86 #, c-format msgid "%s: Options must be `name=value' pairs separated with commas" -msgstr "" -"%s: le opzioni devono essere coppie \"nome=valore\" separate da virgole" +msgstr "%s: le opzioni devono essere coppie \"nome=valore\" separate da virgole" #: src/xz/options.c:93 #, c-format @@ -832,17 +771,12 @@ msgstr "La somma di lc e lp non deve superare 4" #: src/xz/options.c:359 #, c-format msgid "The selected match finder requires at least nice=%" -msgstr "" -"Lo strumento per cercare corrispondenze selezionato richiede almeno nice=%" -"" +msgstr "Lo strumento per cercare corrispondenze selezionato richiede almeno nice=%" #: src/xz/suffix.c:79 src/xz/suffix.c:164 #, c-format -msgid "" -"%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" -msgstr "" -"%s: con --format=raw, --suffix=.SUF è richiesto a meno che non si scriva " -"sullo stdout" +msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" +msgstr "%s: con --format=raw, --suffix=.SUF è richiesto a meno che non si scriva sullo stdout" #: src/xz/suffix.c:99 #, c-format @@ -871,15 +805,12 @@ msgstr "%s: suffisso del moltiplicatore non valido" #: src/xz/util.c:105 msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)." -msgstr "" -"I suffissi validi sono \"KiB\" (2^10), \"MiB\" (2^20), e \"GiB\" (2^30)." +msgstr "I suffissi validi sono \"KiB\" (2^10), \"MiB\" (2^20), e \"GiB\" (2^30)." #: src/xz/util.c:122 #, c-format msgid "Value of the option `%s' must be in the range [%, %]" -msgstr "" -"Il valore dell'opzione \"%s\" deve essere nell'intervallo [%, %" -"]" +msgstr "Il valore dell'opzione \"%s\" deve essere nell'intervallo [%, %]" #: src/xz/util.c:247 msgid "Empty filename, skipping" diff --git a/po/xz.pot b/po/xz.pot new file mode 100644 index 000000000000..80631f6bc844 --- /dev/null +++ b/po/xz.pot @@ -0,0 +1,736 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n" +"POT-Creation-Date: 2010-10-23 17:48+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: src/xz/args.c:333 +#, c-format +msgid "%s: Unknown file format type" +msgstr "" + +#: src/xz/args.c:356 src/xz/args.c:364 +#, c-format +msgid "%s: Unsupported integrity check type" +msgstr "" + +#: src/xz/args.c:382 +msgid "Only one file can be specified with `--files' or `--files0'." +msgstr "" + +#: src/xz/args.c:445 +#, c-format +msgid "The environment variable %s contains too many arguments" +msgstr "" + +#: src/xz/coder.c:95 +msgid "Maximum number of filters is four" +msgstr "" + +#: src/xz/coder.c:108 +msgid "Memory usage limit is too low for the given filter setup." +msgstr "" + +#: src/xz/coder.c:129 +msgid "Using a preset in raw mode is discouraged." +msgstr "" + +#: src/xz/coder.c:131 +msgid "The exact options of the presets may vary between software versions." +msgstr "" + +#: src/xz/coder.c:157 +msgid "The .lzma format supports only the LZMA1 filter" +msgstr "" + +#: src/xz/coder.c:165 +msgid "LZMA1 cannot be used with the .xz format" +msgstr "" + +#: src/xz/coder.c:182 +msgid "Unsupported filter chain or filter options" +msgstr "" + +#: src/xz/coder.c:190 +#, c-format +msgid "Decompression will need %s MiB of memory." +msgstr "" + +#: src/xz/coder.c:247 +#, c-format +msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB" +msgstr "" + +#. TRANSLATORS: When compression or decompression finishes, +#. and xz is going to remove the source file, xz first checks +#. if the source file still exists, and if it does, does its +#. device and inode numbers match what xz saw when it opened +#. the source file. If these checks fail, this message is +#. shown, %s being the filename, and the file is not deleted. +#. The check for device and inode numbers is there, because +#. it is possible that the user has put a new file in place +#. of the original file, and in that case it obviously +#. shouldn't be removed. +#: src/xz/file_io.c:137 +#, c-format +msgid "%s: File seems to have been moved, not removing" +msgstr "" + +#: src/xz/file_io.c:144 src/xz/file_io.c:590 +#, c-format +msgid "%s: Cannot remove: %s" +msgstr "" + +#: src/xz/file_io.c:169 +#, c-format +msgid "%s: Cannot set the file owner: %s" +msgstr "" + +#: src/xz/file_io.c:175 +#, c-format +msgid "%s: Cannot set the file group: %s" +msgstr "" + +#: src/xz/file_io.c:194 +#, c-format +msgid "%s: Cannot set the file permissions: %s" +msgstr "" + +#: src/xz/file_io.c:337 src/xz/file_io.c:420 +#, c-format +msgid "%s: Is a symbolic link, skipping" +msgstr "" + +#: src/xz/file_io.c:455 +#, c-format +msgid "%s: Is a directory, skipping" +msgstr "" + +#: src/xz/file_io.c:462 +#, c-format +msgid "%s: Not a regular file, skipping" +msgstr "" + +#: src/xz/file_io.c:479 +#, c-format +msgid "%s: File has setuid or setgid bit set, skipping" +msgstr "" + +#: src/xz/file_io.c:486 +#, c-format +msgid "%s: File has sticky bit set, skipping" +msgstr "" + +#: src/xz/file_io.c:493 +#, c-format +msgid "%s: Input file has more than one hard link, skipping" +msgstr "" + +#: src/xz/file_io.c:714 +#, c-format +msgid "Error restoring the O_APPEND flag to standard output: %s" +msgstr "" + +#: src/xz/file_io.c:726 +#, c-format +msgid "%s: Closing the file failed: %s" +msgstr "" + +#: src/xz/file_io.c:762 src/xz/file_io.c:946 +#, c-format +msgid "%s: Seeking failed when trying to create a sparse file: %s" +msgstr "" + +#: src/xz/file_io.c:821 +#, c-format +msgid "%s: Read error: %s" +msgstr "" + +#: src/xz/file_io.c:844 +#, c-format +msgid "%s: Error seeking the file: %s" +msgstr "" + +#: src/xz/file_io.c:854 +#, c-format +msgid "%s: Unexpected end of file" +msgstr "" + +#: src/xz/file_io.c:904 +#, c-format +msgid "%s: Write error: %s" +msgstr "" + +#: src/xz/hardware.c:100 +msgid "Disabled" +msgstr "" + +#. TRANSLATORS: Test with "xz --info-memory" to see if +#. the alignment looks nice. +#: src/xz/hardware.c:119 +msgid "Total amount of physical memory (RAM): " +msgstr "" + +#: src/xz/hardware.c:121 +msgid "Memory usage limit for compression: " +msgstr "" + +#: src/xz/hardware.c:123 +msgid "Memory usage limit for decompression: " +msgstr "" + +#. TRANSLATORS: Indicates that there is no integrity check. +#. This string is used in tables, so the width must not +#. exceed ten columns with a fixed-width font. +#: src/xz/list.c:62 +msgid "None" +msgstr "" + +#. TRANSLATORS: Indicates that integrity check name is not known, +#. but the Check ID is known (here 2). This and other "Unknown-N" +#. strings are used in tables, so the width must not exceed ten +#. columns with a fixed-width font. It's OK to omit the dash if +#. you need space for one extra letter, but don't use spaces. +#: src/xz/list.c:69 +msgid "Unknown-2" +msgstr "" + +#: src/xz/list.c:70 +msgid "Unknown-3" +msgstr "" + +#: src/xz/list.c:72 +msgid "Unknown-5" +msgstr "" + +#: src/xz/list.c:73 +msgid "Unknown-6" +msgstr "" + +#: src/xz/list.c:74 +msgid "Unknown-7" +msgstr "" + +#: src/xz/list.c:75 +msgid "Unknown-8" +msgstr "" + +#: src/xz/list.c:76 +msgid "Unknown-9" +msgstr "" + +#: src/xz/list.c:78 +msgid "Unknown-11" +msgstr "" + +#: src/xz/list.c:79 +msgid "Unknown-12" +msgstr "" + +#: src/xz/list.c:80 +msgid "Unknown-13" +msgstr "" + +#: src/xz/list.c:81 +msgid "Unknown-14" +msgstr "" + +#: src/xz/list.c:82 +msgid "Unknown-15" +msgstr "" + +#: src/xz/list.c:126 +#, c-format +msgid "%s: File is empty" +msgstr "" + +#: src/xz/list.c:131 +#, c-format +msgid "%s: Too small to be a valid .xz file" +msgstr "" + +#. TRANSLATORS: These are column headings. From Strms (Streams) +#. to Ratio, the columns are right aligned. Check and Filename +#. are left aligned. If you need longer words, it's OK to +#. use two lines here. Test with "xz -l foo.xz". +#: src/xz/list.c:612 +msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename" +msgstr "" + +#: src/xz/list.c:652 +#, c-format +msgid " Streams: %s\n" +msgstr "" + +#: src/xz/list.c:654 +#, c-format +msgid " Blocks: %s\n" +msgstr "" + +#: src/xz/list.c:656 +#, c-format +msgid " Compressed size: %s\n" +msgstr "" + +#: src/xz/list.c:659 +#, c-format +msgid " Uncompressed size: %s\n" +msgstr "" + +#: src/xz/list.c:662 +#, c-format +msgid " Ratio: %s\n" +msgstr "" + +#: src/xz/list.c:664 +#, c-format +msgid " Check: %s\n" +msgstr "" + +#: src/xz/list.c:665 +#, c-format +msgid " Stream padding: %s\n" +msgstr "" + +#. TRANSLATORS: The second line is column headings. All except +#. Check are right aligned; Check is left aligned. Test with +#. "xz -lv foo.xz". +#: src/xz/list.c:693 +msgid "" +" Streams:\n" +" Stream Blocks CompOffset UncompOffset CompSize UncompSize Ratio Check Padding" +msgstr "" + +#. TRANSLATORS: The second line is column headings. All +#. except Check are right aligned; Check is left aligned. +#: src/xz/list.c:748 +#, c-format +msgid "" +" Blocks:\n" +" Stream Block CompOffset UncompOffset TotalSize UncompSize Ratio Check" +msgstr "" + +#. TRANSLATORS: These are additional column headings +#. for the most verbose listing mode. CheckVal +#. (Check value), Flags, and Filters are left aligned. +#. Header (Block Header Size), CompSize, and MemUsage +#. are right aligned. %*s is replaced with 0-120 +#. spaces to make the CheckVal column wide enough. +#. Test with "xz -lvv foo.xz". +#: src/xz/list.c:760 +#, c-format +msgid " CheckVal %*s Header Flags CompSize MemUsage Filters" +msgstr "" + +#: src/xz/list.c:838 src/xz/list.c:1007 +#, c-format +msgid " Memory needed: %s MiB\n" +msgstr "" + +#: src/xz/list.c:840 src/xz/list.c:1009 +#, c-format +msgid " Sizes in headers: %s\n" +msgstr "" + +#: src/xz/list.c:841 src/xz/list.c:1010 +msgid "Yes" +msgstr "" + +#: src/xz/list.c:841 src/xz/list.c:1010 +msgid "No" +msgstr "" + +#. TRANSLATORS: %s is an integer. Only the plural form of this +#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz". +#: src/xz/list.c:986 +#, c-format +msgid "%s file\n" +msgid_plural "%s files\n" +msgstr[0] "" +msgstr[1] "" + +#: src/xz/list.c:999 +msgid "Totals:" +msgstr "" + +#: src/xz/list.c:1000 +#, c-format +msgid " Number of files: %s\n" +msgstr "" + +#: src/xz/list.c:1072 +msgid "--list works only on .xz files (--format=xz or --format=auto)" +msgstr "" + +#: src/xz/list.c:1078 +msgid "--list does not support reading from standard input" +msgstr "" + +#: src/xz/main.c:89 +#, c-format +msgid "%s: Error reading filenames: %s" +msgstr "" + +#: src/xz/main.c:96 +#, c-format +msgid "%s: Unexpected end of input when reading filenames" +msgstr "" + +#: src/xz/main.c:120 +#, c-format +msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?" +msgstr "" + +#: src/xz/main.c:174 +msgid "Compression and decompression with --robot are not supported yet." +msgstr "" + +#: src/xz/main.c:231 +msgid "Cannot read data from standard input when reading filenames from standard input" +msgstr "" + +#: src/xz/message.c:792 src/xz/message.c:842 +msgid "Internal error (bug)" +msgstr "" + +#: src/xz/message.c:799 +msgid "Cannot establish signal handlers" +msgstr "" + +#: src/xz/message.c:808 +msgid "No integrity check; not verifying file integrity" +msgstr "" + +#: src/xz/message.c:811 +msgid "Unsupported type of integrity check; not verifying file integrity" +msgstr "" + +#: src/xz/message.c:818 +msgid "Memory usage limit reached" +msgstr "" + +#: src/xz/message.c:821 +msgid "File format not recognized" +msgstr "" + +#: src/xz/message.c:824 +msgid "Unsupported options" +msgstr "" + +#: src/xz/message.c:827 +msgid "Compressed data is corrupt" +msgstr "" + +#: src/xz/message.c:830 +msgid "Unexpected end of input" +msgstr "" + +#: src/xz/message.c:881 +#, c-format +msgid "%s MiB of memory is required. The limit is %s." +msgstr "" + +#: src/xz/message.c:1048 +#, c-format +msgid "%s: Filter chain: %s\n" +msgstr "" + +#: src/xz/message.c:1058 +#, c-format +msgid "Try `%s --help' for more information." +msgstr "" + +#: src/xz/message.c:1084 +#, c-format +msgid "" +"Usage: %s [OPTION]... [FILE]...\n" +"Compress or decompress FILEs in the .xz format.\n" +"\n" +msgstr "" + +#: src/xz/message.c:1091 +msgid "Mandatory arguments to long options are mandatory for short options too.\n" +msgstr "" + +#: src/xz/message.c:1095 +msgid " Operation mode:\n" +msgstr "" + +#: src/xz/message.c:1098 +msgid "" +" -z, --compress force compression\n" +" -d, --decompress force decompression\n" +" -t, --test test compressed file integrity\n" +" -l, --list list information about .xz files" +msgstr "" + +#: src/xz/message.c:1104 +msgid "" +"\n" +" Operation modifiers:\n" +msgstr "" + +#: src/xz/message.c:1107 +msgid "" +" -k, --keep keep (don't delete) input files\n" +" -f, --force force overwrite of output file and (de)compress links\n" +" -c, --stdout write to standard output and don't delete input files" +msgstr "" + +#: src/xz/message.c:1113 +msgid "" +" --no-sparse do not create sparse files when decompressing\n" +" -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n" +" --files[=FILE] read filenames to process from FILE; if FILE is\n" +" omitted, filenames are read from the standard input;\n" +" filenames must be terminated with the newline character\n" +" --files0[=FILE] like --files but use the null character as terminator" +msgstr "" + +#: src/xz/message.c:1121 +msgid "" +"\n" +" Basic file format and compression options:\n" +msgstr "" + +#: src/xz/message.c:1123 +msgid "" +" -F, --format=FMT file format to encode or decode; possible values are\n" +" `auto' (default), `xz', `lzma', and `raw'\n" +" -C, --check=CHECK integrity check type: `none' (use with caution),\n" +" `crc32', `crc64' (default), or `sha256'" +msgstr "" + +#: src/xz/message.c:1130 +msgid "" +" -0 ... -9 compression preset; default is 6; take compressor *and*\n" +" decompressor memory usage into account before using 7-9!" +msgstr "" + +#: src/xz/message.c:1134 +msgid "" +" -e, --extreme try to improve compression ratio by using more CPU time;\n" +" does not affect decompressor memory requirements" +msgstr "" + +#: src/xz/message.c:1139 +#, no-c-format +msgid "" +" --memlimit-compress=LIMIT\n" +" --memlimit-decompress=LIMIT\n" +" -M, --memlimit=LIMIT\n" +" set memory usage limit for compression, decompression,\n" +" or both; LIMIT is in bytes, % of RAM, or 0 for defaults" +msgstr "" + +#: src/xz/message.c:1146 +msgid "" +" --no-adjust if compression settings exceed the memory usage limit,\n" +" give an error instead of adjusting the settings downwards" +msgstr "" + +#: src/xz/message.c:1152 +msgid "" +"\n" +" Custom filter chain for compression (alternative for using presets):" +msgstr "" + +#: src/xz/message.c:1161 +msgid "" +"\n" +" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" +" --lzma2[=OPTS] more of the following options (valid values; default):\n" +" preset=PRE reset options to a preset (0-9[e])\n" +" dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n" +" lc=NUM number of literal context bits (0-4; 3)\n" +" lp=NUM number of literal position bits (0-4; 0)\n" +" pb=NUM number of position bits (0-4; 2)\n" +" mode=MODE compression mode (fast, normal; normal)\n" +" nice=NUM nice length of a match (2-273; 64)\n" +" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n" +" depth=NUM maximum search depth; 0=automatic (default)" +msgstr "" + +#: src/xz/message.c:1176 +msgid "" +"\n" +" --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n" +" --powerpc[=OPTS] PowerPC BCJ filter (big endian only)\n" +" --ia64[=OPTS] IA-64 (Itanium) BCJ filter\n" +" --arm[=OPTS] ARM BCJ filter (little endian only)\n" +" --armthumb[=OPTS] ARM-Thumb BCJ filter (little endian only)\n" +" --sparc[=OPTS] SPARC BCJ filter\n" +" Valid OPTS for all BCJ filters:\n" +" start=NUM start offset for conversions (default=0)" +msgstr "" + +#: src/xz/message.c:1188 +msgid "" +"\n" +" --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n" +" dist=NUM distance between bytes being subtracted\n" +" from each other (1-256; 1)" +msgstr "" + +#: src/xz/message.c:1196 +msgid "" +"\n" +" Other options:\n" +msgstr "" + +#: src/xz/message.c:1199 +msgid "" +" -q, --quiet suppress warnings; specify twice to suppress errors too\n" +" -v, --verbose be verbose; specify twice for even more verbose" +msgstr "" + +#: src/xz/message.c:1204 +msgid " -Q, --no-warn make warnings not affect the exit status" +msgstr "" + +#: src/xz/message.c:1206 +msgid " --robot use machine-parsable messages (useful for scripts)" +msgstr "" + +#: src/xz/message.c:1209 +msgid "" +" --info-memory display the total amount of RAM and the currently active\n" +" memory usage limits, and exit" +msgstr "" + +#: src/xz/message.c:1212 +msgid "" +" -h, --help display the short help (lists only the basic options)\n" +" -H, --long-help display this long help and exit" +msgstr "" + +#: src/xz/message.c:1216 +msgid "" +" -h, --help display this short help and exit\n" +" -H, --long-help display the long help (lists also the advanced options)" +msgstr "" + +#: src/xz/message.c:1221 +msgid " -V, --version display the version number and exit" +msgstr "" + +#: src/xz/message.c:1223 +msgid "" +"\n" +"With no FILE, or when FILE is -, read standard input.\n" +msgstr "" + +#. TRANSLATORS: This message indicates the bug reporting address +#. for this package. Please add _another line_ saying +#. "Report translation bugs to <...>\n" with the email or WWW +#. address for translation bugs. Thanks. +#: src/xz/message.c:1229 +#, c-format +msgid "Report bugs to <%s> (in English or Finnish).\n" +msgstr "" + +#: src/xz/message.c:1231 +#, c-format +msgid "%s home page: <%s>\n" +msgstr "" + +#: src/xz/options.c:86 +#, c-format +msgid "%s: Options must be `name=value' pairs separated with commas" +msgstr "" + +#: src/xz/options.c:93 +#, c-format +msgid "%s: Invalid option name" +msgstr "" + +#: src/xz/options.c:113 +#, c-format +msgid "%s: Invalid option value" +msgstr "" + +#: src/xz/options.c:247 +#, c-format +msgid "Unsupported LZMA1/LZMA2 preset: %s" +msgstr "" + +#: src/xz/options.c:355 +msgid "The sum of lc and lp must not exceed 4" +msgstr "" + +#: src/xz/options.c:359 +#, c-format +msgid "The selected match finder requires at least nice=%" +msgstr "" + +#: src/xz/suffix.c:79 src/xz/suffix.c:164 +#, c-format +msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout" +msgstr "" + +#: src/xz/suffix.c:99 +#, c-format +msgid "%s: Filename has an unknown suffix, skipping" +msgstr "" + +#: src/xz/suffix.c:154 +#, c-format +msgid "%s: File already has `%s' suffix, skipping" +msgstr "" + +#: src/xz/suffix.c:205 +#, c-format +msgid "%s: Invalid filename suffix" +msgstr "" + +#: src/xz/util.c:61 +#, c-format +msgid "%s: Value is not a non-negative decimal integer" +msgstr "" + +#: src/xz/util.c:103 +#, c-format +msgid "%s: Invalid multiplier suffix" +msgstr "" + +#: src/xz/util.c:105 +msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)." +msgstr "" + +#: src/xz/util.c:122 +#, c-format +msgid "Value of the option `%s' must be in the range [%, %]" +msgstr "" + +#: src/xz/util.c:247 +msgid "Empty filename, skipping" +msgstr "" + +#: src/xz/util.c:261 +msgid "Compressed data cannot be read from a terminal" +msgstr "" + +#: src/xz/util.c:274 +msgid "Compressed data cannot be written to a terminal" +msgstr "" + +#: src/common/tuklib_exit.c:39 +msgid "Writing to standard output failed" +msgstr "" + +#: src/common/tuklib_exit.c:42 +msgid "Unknown error" +msgstr "" diff --git a/src/common/sysdefs.h b/src/common/sysdefs.h index 1e138b1c2e79..c74c6212cff5 100644 --- a/src/common/sysdefs.h +++ b/src/common/sysdefs.h @@ -24,6 +24,11 @@ # include #endif +// Get standard-compliant stdio functions under MinGW and MinGW-w64. +#ifdef __MINGW32__ +# define __USE_MINGW_ANSI_STDIO 1 +#endif + // size_t and NULL #include diff --git a/src/liblzma/api/lzma.h b/src/liblzma/api/lzma.h index fb593a35a07e..fb874c3e1377 100644 --- a/src/liblzma/api/lzma.h +++ b/src/liblzma/api/lzma.h @@ -60,8 +60,8 @@ * * Some could argue that liblzma API should provide all the required types, * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was - * seen unnecessary mess, since most systems already provide all the necessary - * types and macros in the standard headers. + * seen as an unnecessary mess, since most systems already provide all the + * necessary types and macros in the standard headers. * * Note that liblzma API still has lzma_bool, because using stdbool.h would * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't diff --git a/src/liblzma/api/lzma/base.h b/src/liblzma/api/lzma/base.h index 993626a4cdfd..43dde8d60f3d 100644 --- a/src/liblzma/api/lzma/base.h +++ b/src/liblzma/api/lzma/base.h @@ -281,21 +281,21 @@ typedef enum { * Using LZMA_SYNC_FLUSH very often can dramatically reduce * the compression ratio. With some filters (for example, * LZMA2), fine-tuning the compression options may help - * mitigate this problem significantly. + * mitigate this problem significantly (for example, + * match finder with LZMA2). * * Decoders don't support LZMA_SYNC_FLUSH. */ LZMA_FULL_FLUSH = 2, /**< - * \brief Make all the input available at output + * \brief Finish encoding of the current Block * - * Finish encoding of the current Block. All the input - * data going to the current Block must have been given - * to the encoder (the last bytes can still be pending in - * next_in). Call lzma_code() with LZMA_FULL_FLUSH until - * it returns LZMA_STREAM_END. Then continue normally with - * LZMA_RUN or finish the Stream with LZMA_FINISH. + * All the input data going to the current Block must have + * been given to the encoder (the last bytes can still be + * pending in* next_in). Call lzma_code() with LZMA_FULL_FLUSH + * until it returns LZMA_STREAM_END. Then continue normally + * with LZMA_RUN or finish the Stream with LZMA_FINISH. * * This action is currently supported only by Stream encoder * and easy encoder (which uses Stream encoder). If there is @@ -306,12 +306,12 @@ typedef enum { /**< * \brief Finish the coding operation * - * Finishes the coding operation. All the input data must - * have been given to the encoder (the last bytes can still - * be pending in next_in). Call lzma_code() with LZMA_FINISH - * until it returns LZMA_STREAM_END. Once LZMA_FINISH has - * been used, the amount of input must no longer be changed - * by the application. + * All the input data must have been given to the encoder + * (the last bytes can still be pending in next_in). + * Call lzma_code() with LZMA_FINISH until it returns + * LZMA_STREAM_END. Once LZMA_FINISH has been used, + * the amount of input must no longer be changed by + * the application. * * When decoding, using LZMA_FINISH is optional unless the * LZMA_CONCATENATED flag was used when the decoder was @@ -478,8 +478,12 @@ typedef struct { */ void *reserved_ptr1; void *reserved_ptr2; + void *reserved_ptr3; + void *reserved_ptr4; uint64_t reserved_int1; uint64_t reserved_int2; + size_t reserved_int3; + size_t reserved_int4; lzma_reserved_enum reserved_enum1; lzma_reserved_enum reserved_enum2; @@ -506,7 +510,8 @@ typedef struct { */ #define LZMA_STREAM_INIT \ { NULL, 0, 0, NULL, 0, 0, NULL, NULL, \ - NULL, NULL, 0, 0, LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM } + NULL, NULL, NULL, NULL, 0, 0, 0, 0, \ + LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM } /** @@ -554,11 +559,11 @@ extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow; * this may give misleading information if decoding .xz Streams that have * multiple Blocks, because each Block can have different memory requirements. * - * \return Rough estimate of how much memory is currently allocated - * for the filter decoders. If no filter chain is currently - * allocated, some non-zero value is still returned, which is - * less than or equal to what any filter chain would indicate - * as its memory requirement. + * \return How much memory is currently allocated for the filter + * decoders. If no filter chain is currently allocated, + * some non-zero value is still returned, which is less than + * or equal to what any filter chain would indicate as its + * memory requirement. * * If this function isn't supported by *strm or some other error * occurs, zero is returned. diff --git a/src/liblzma/api/lzma/bcj.h b/src/liblzma/api/lzma/bcj.h index 82e4a440b218..8e37538ad4af 100644 --- a/src/liblzma/api/lzma/bcj.h +++ b/src/liblzma/api/lzma/bcj.h @@ -31,7 +31,7 @@ #define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) /**< - * Filter for IA64 (Itanium) binaries. + * Filter for IA-64 (Itanium) binaries. */ #define LZMA_FILTER_ARM LZMA_VLI_C(0x07) @@ -41,7 +41,7 @@ #define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) /**< - * Filter for ARMThumb binaries. + * Filter for ARM-Thumb binaries. */ #define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) diff --git a/src/liblzma/api/lzma/block.h b/src/liblzma/api/lzma/block.h index 8e681ed2811b..3019bf916fec 100644 --- a/src/liblzma/api/lzma/block.h +++ b/src/liblzma/api/lzma/block.h @@ -318,8 +318,8 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode( * The size of the Block Header must have already been decoded with * lzma_block_header_size_decode() macro and stored to block->header_size. * - * block->filters must have been allocated, but not necessarily initialized. - * Possible existing filter options are _not_ freed. + * block->filters must have been allocated, but they don't need to be + * initialized (possible existing filter options are not freed). * * \param block Destination for Block options. * \param allocator lzma_allocator for custom allocator functions. diff --git a/src/liblzma/api/lzma/container.h b/src/liblzma/api/lzma/container.h index 0d907650fc49..83e70b44f220 100644 --- a/src/liblzma/api/lzma/container.h +++ b/src/liblzma/api/lzma/container.h @@ -55,13 +55,13 @@ * * This flag doesn't affect the memory usage requirements of the decoder (at * least not significantly). The memory usage of the encoder may be increased - * a little but only at the lowest preset levels (0-2). + * a little but only at the lowest preset levels (0-3). */ #define LZMA_PRESET_EXTREME (UINT32_C(1) << 31) /** - * \brief Calculate rough memory usage of easy encoder + * \brief Calculate approximate memory usage of easy encoder * * This function is a wrapper for lzma_raw_encoder_memusage(). * @@ -72,7 +72,7 @@ extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset) /** - * \brief Calculate rough decoder memory usage of a preset + * \brief Calculate approximate decoder memory usage of a preset * * This function is a wrapper for lzma_raw_decoder_memusage(). * @@ -93,16 +93,19 @@ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) * \param preset Compression preset to use. A preset consist of level * number and zero or more flags. Usually flags aren't * used, so preset is simply a number [0, 9] which match - * the options -0 .. -9 of the xz command line tool. + * the options -0 ... -9 of the xz command line tool. * Additional flags can be be set using bitwise-or with * the preset level number, e.g. 6 | LZMA_PRESET_EXTREME. * \param check Integrity check type to use. See check.h for available - * checks. If you are unsure, use LZMA_CHECK_CRC32. + * checks. The xz command line tool defaults to + * LZMA_CHECK_CRC64, which is a good choice if you are + * unsure. LZMA_CHECK_CRC32 is good too as long as the + * uncompressed file is not many gigabytes. * * \return - LZMA_OK: Initialization succeeded. Use lzma_code() to * encode your data. * - LZMA_MEM_ERROR: Memory allocation failed. - * - LZMA_OPTIONS_ERROR: The given compression level is not + * - LZMA_OPTIONS_ERROR: The given compression preset is not * supported by this build of liblzma. * - LZMA_UNSUPPORTED_CHECK: The given check type is not * supported by this liblzma build. @@ -310,7 +313,8 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode( * \brief Initialize .xz Stream decoder * * \param strm Pointer to properly prepared lzma_stream - * \param memlimit Rough memory usage limit as bytes + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. * \param flags Bitwise-or of zero or more of the decoder flags: * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, * LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED @@ -318,6 +322,7 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode( * \return - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags + * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_stream_decoder( lzma_stream *strm, uint64_t memlimit, uint32_t flags) @@ -332,12 +337,14 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder( * of the input file has been detected. * * \param strm Pointer to properly prepared lzma_stream - * \param memlimit Rough memory usage limit as bytes + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. * \param flags Bitwise-or of flags, or zero for no flags. * * \return - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags + * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_auto_decoder( lzma_stream *strm, uint64_t memlimit, uint32_t flags) @@ -353,6 +360,7 @@ extern LZMA_API(lzma_ret) lzma_auto_decoder( * * \return - LZMA_OK * - LZMA_MEM_ERROR + * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_alone_decoder( lzma_stream *strm, uint64_t memlimit) @@ -379,7 +387,7 @@ extern LZMA_API(lzma_ret) lzma_alone_decoder( * won't be read is in[in_size]. * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. - * *out_pos is updated only if encoding succeeds. + * *out_pos is updated only if decoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * diff --git a/src/liblzma/api/lzma/filter.h b/src/liblzma/api/lzma/filter.h index 038a93398c68..efd036f7f041 100644 --- a/src/liblzma/api/lzma/filter.h +++ b/src/liblzma/api/lzma/filter.h @@ -1,6 +1,6 @@ /** * \file lzma/filter.h - * \brief Common filter related types + * \brief Common filter related types and functions */ /* @@ -59,11 +59,6 @@ typedef struct { * If the filter doesn't need options, set this to NULL. If id is * set to LZMA_VLI_UNKNOWN, options is ignored, and thus * doesn't need be initialized. - * - * Some filters support changing the options in the middle of - * the encoding process. These filters store the pointer of the - * options structure and communicate with the application via - * modifications of the options structure. */ void *options; @@ -126,15 +121,16 @@ extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src, /** - * \brief Calculate rough memory requirements for raw encoder + * \brief Calculate approximate memory requirements for raw encoder * - * Because the calculation is rough, this function can be used to calculate - * the memory requirements for Block and Stream encoders too. + * This function can be used to calculate the memory requirements for + * Block and Stream encoders too because Block and Stream encoders don't + * need significantly more memory than raw encoder. * * \param filters Array of filters terminated with * .id == LZMA_VLI_UNKNOWN. * - * \return Rough number of bytes of memory required for the given + * \return Number of bytes of memory required for the given * filter chain when encoding. */ extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters) @@ -142,15 +138,16 @@ extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters) /** - * \brief Calculate rough memory requirements for raw decoder + * \brief Calculate approximate memory requirements for raw decoder * - * Because the calculation is rough, this function can be used to calculate - * the memory requirements for Block and Stream decoders too. + * This function can be used to calculate the memory requirements for + * Block and Stream decoders too because Block and Stream decoders don't + * need significantly more memory than raw decoder. * * \param filters Array of filters terminated with * .id == LZMA_VLI_UNKNOWN. * - * \return Rough number of bytes of memory required for the given + * \return Number of bytes of memory required for the given * filter chain when decoding. */ extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters) @@ -251,7 +248,8 @@ extern LZMA_API(lzma_ret) lzma_filters_update( * * \note There is no function to calculate how big output buffer * would surely be big enough. (lzma_stream_buffer_bound() - * works only for lzma_stream_buffer_encode().) + * works only for lzma_stream_buffer_encode(); raw encoder + * won't necessarily meet that bound.) */ extern LZMA_API(lzma_ret) lzma_raw_buffer_encode( const lzma_filter *filters, lzma_allocator *allocator, @@ -323,9 +321,10 @@ extern LZMA_API(lzma_ret) lzma_properties_size( * succeeds but using the same options to initialize the encoder * will fail. * - * \note It is OK to skip calling this function if - * lzma_properties_size() indicated that the size - * of the Filter Properties field is zero. + * \note If lzma_properties_size() indicated that the size + * of the Filter Properties field is zero, calling + * lzma_properties_encode() is not required, but it + * won't do any harm either. */ extern LZMA_API(lzma_ret) lzma_properties_encode( const lzma_filter *filter, uint8_t *props) lzma_nothrow; @@ -364,11 +363,11 @@ extern LZMA_API(lzma_ret) lzma_properties_decode( * memory to hold the encoded Filter Flags. * * \param size Pointer to integer to hold the calculated size - * \param filters Filter ID and associated options whose encoded + * \param filter Filter ID and associated options whose encoded * size is to be calculated * * \return - LZMA_OK: *size set successfully. Note that this doesn't - * guarantee that filters->options is valid, thus + * guarantee that filter->options is valid, thus * lzma_filter_flags_encode() may still fail. * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options. * - LZMA_PROG_ERROR: Invalid options @@ -377,7 +376,7 @@ extern LZMA_API(lzma_ret) lzma_properties_decode( * you need to loop over every lzma_filter entry. */ extern LZMA_API(lzma_ret) lzma_filter_flags_size( - uint32_t *size, const lzma_filter *filters) + uint32_t *size, const lzma_filter *filter) lzma_nothrow lzma_attr_warn_unused_result; @@ -387,7 +386,7 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_size( * In contrast to some functions, this doesn't allocate the needed buffer. * This is due to how this function is used internally by liblzma. * - * \param filters Filter ID and options to be encoded + * \param filter Filter ID and options to be encoded * \param out Beginning of the output buffer * \param out_pos out[*out_pos] is the next write position. This * is updated by the encoder. @@ -399,7 +398,7 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_size( * buffer space (you should have checked it with * lzma_filter_flags_size()). */ -extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filters, +extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; @@ -407,8 +406,8 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filters, /** * \brief Decode Filter Flags from given buffer * - * The decoded result is stored into *filters. filters->options is - * initialized but the old value is NOT free()d. + * The decoded result is stored into *filter. The old value of + * filter->options is not free()d. * * \return - LZMA_OK * - LZMA_OPTIONS_ERROR @@ -416,6 +415,6 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filters, * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_filter_flags_decode( - lzma_filter *filters, lzma_allocator *allocator, + lzma_filter *filter, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow lzma_attr_warn_unused_result; diff --git a/src/liblzma/api/lzma/hardware.h b/src/liblzma/api/lzma/hardware.h index f44cb602ff90..e7dd03c3e8dd 100644 --- a/src/liblzma/api/lzma/hardware.h +++ b/src/liblzma/api/lzma/hardware.h @@ -39,8 +39,7 @@ * * This function may be useful when determining a reasonable memory * usage limit for decompressing or how much memory it is OK to use - * for compressing. For example, the default limit used by the xz - * command line tool is 40 % of RAM. + * for compressing. * * \return On success, the total amount of physical memory in bytes * is returned. If the amount of RAM cannot be determined, diff --git a/src/liblzma/api/lzma/index.h b/src/liblzma/api/lzma/index.h index 5ea12e359e5d..16bacc287dfc 100644 --- a/src/liblzma/api/lzma/index.h +++ b/src/liblzma/api/lzma/index.h @@ -136,6 +136,13 @@ typedef struct { * * This offset is relative to the beginning of the lzma_index * (i.e. usually the beginning of the .xz file). + * + * When doing random-access reading, it is possible that + * the target offset is not exactly at Block boundary. One + * will need to compare the target offset against + * uncompressed_file_offset or uncompressed_stream_offset, + * and possibly decode and throw away some amount of data + * before reaching the target offset. */ lzma_vli uncompressed_file_offset; @@ -166,14 +173,8 @@ typedef struct { * \brief Uncompressed size of this Block * * You should pass this to the Block decoder if you will - * decode this Block. - * - * When doing random-access reading, it is possible that - * the target offset is not exactly at Block boundary. One - * will need to compare the target offset against - * uncompressed_file_offset or uncompressed_stream_offset, - * and possibly decode and throw away some amount of data - * before reaching the target offset. + * decode this Block. It will allow the Block decoder to + * validate the uncompressed size. */ lzma_vli uncompressed_size; @@ -181,7 +182,8 @@ typedef struct { * \brief Unpadded size of this Block * * You should pass this to the Block decoder if you will - * decode this Block. + * decode this Block. It will allow the Block decoder to + * validate the unpadded size. */ lzma_vli unpadded_size; @@ -583,7 +585,9 @@ extern LZMA_API(lzma_index *) lzma_index_dup( * \param strm Pointer to properly prepared lzma_stream * \param i Pointer to lzma_index which should be encoded. * - * The only valid action value for lzma_code() is LZMA_RUN. + * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * It is enough to use only one of them (you can choose freely; use LZMA_RUN + * to support liblzma versions older than 5.0.0). * * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). * - LZMA_MEM_ERROR @@ -608,7 +612,9 @@ extern LZMA_API(lzma_ret) lzma_index_encoder( * \param memlimit How much memory the resulting lzma_index is * allowed to require. * - * The only valid action value for lzma_code() is LZMA_RUN. + * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. + * It is enough to use only one of them (you can choose freely; use LZMA_RUN + * to support liblzma versions older than 5.0.0). * * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). * - LZMA_MEM_ERROR diff --git a/src/liblzma/api/lzma/index_hash.h b/src/liblzma/api/lzma/index_hash.h index 94726e7beeae..fa2e048d552d 100644 --- a/src/liblzma/api/lzma/index_hash.h +++ b/src/liblzma/api/lzma/index_hash.h @@ -1,6 +1,6 @@ /** * \file lzma/index_hash.h - * \brief Validates Index by using a hash function + * \brief Validate Index by using a hash function * * Hashing makes it possible to use constant amount of memory to validate * Index of arbitrary size. diff --git a/src/liblzma/api/lzma/lzma.h b/src/liblzma/api/lzma/lzma.h index 9d31a5ce51bc..8d5fdb6e5cad 100644 --- a/src/liblzma/api/lzma/lzma.h +++ b/src/liblzma/api/lzma/lzma.h @@ -46,6 +46,10 @@ * Match finder has major effect on both speed and compression ratio. * Usually hash chains are faster than binary trees. * + * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better + * choice, because binary trees get much higher compression ratio penalty + * with LZMA_SYNC_FLUSH. + * * The memory usage formulas are only rough estimates, which are closest to * reality when dict_size is a power of two. The formulas are more complex * in reality, and can also change a little between liblzma versions. Use @@ -173,6 +177,7 @@ extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode) * Since LZMA1 and LZMA2 share most of the code, it's simplest to share * the options structure too. For encoding, all but the reserved variables * need to be initialized unless specifically mentioned otherwise. + * lzma_lzma_preset() can be used to get a good starting point. * * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb. @@ -255,7 +260,13 @@ typedef struct { * eight-bit byte (also known as `literal') are taken into * account when predicting the bits of the next literal. * - * \todo Example + * E.g. in typical English text, an upper-case letter is + * often followed by a lower-case letter, and a lower-case + * letter is usually followed by another lower-case letter. + * In the US-ASCII character set, the highest three bits are 010 + * for upper-case letters and 011 for lower-case letters. + * When lc is at least 3, the literal coding can take advantage of + * this property in the uncompressed data. * * There is a limit that applies to literal context bits and literal * position bits together: lc + lp <= 4. Without this limit the @@ -275,12 +286,9 @@ typedef struct { /** * \brief Number of literal position bits * - * How many of the lowest bits of the current position (number - * of bytes from the beginning of the uncompressed data) in the - * uncompressed data is taken into account when predicting the - * bits of the next literal (a single eight-bit byte). - * - * \todo Example + * lp affects what kind of alignment in the uncompressed data is + * assumed when encoding literals. A literal is a single 8-bit byte. + * See pb below for more information about alignment. */ uint32_t lp; # define LZMA_LP_DEFAULT 0 @@ -288,14 +296,22 @@ typedef struct { /** * \brief Number of position bits * - * How many of the lowest bits of the current position in the - * uncompressed data is taken into account when estimating - * probabilities of matches. A match is a sequence of bytes for - * which a matching sequence is found from the dictionary and - * thus can be stored as distance-length pair. + * pb affects what kind of alignment in the uncompressed data is + * assumed in general. The default means four-byte alignment + * (2^ pb =2^2=4), which is often a good choice when there's + * no better guess. * - * Example: If most of the matches occur at byte positions of - * 8 * n + 3, that is, 3, 11, 19, ... set pb to 3, because 2**3 == 8. + * When the aligment is known, setting pb accordingly may reduce + * the file size a little. E.g. with text files having one-byte + * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can + * improve compression slightly. For UTF-16 text, pb=1 is a good + * choice. If the alignment is an odd number like 3 bytes, pb=0 + * might be the best choice. + * + * Even though the assumed alignment can be adjusted with pb and + * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment. + * It might be worth taking into account when designing file formats + * that are likely to be often compressed with LZMA1 or LZMA2. */ uint32_t pb; # define LZMA_PB_MIN 0 @@ -346,7 +362,7 @@ typedef struct { * * Setting depth to zero tells liblzma to use an automatic default * value, that depends on the selected match finder and nice_len. - * The default is in the range [10, 200] or so (it may vary between + * The default is in the range [4, 200] or so (it may vary between * liblzma versions). * * Using a bigger depth value than the default can increase @@ -365,8 +381,6 @@ typedef struct { * with the currently supported options, so it is safe to leave these * uninitialized. */ - void *reserved_ptr1; - void *reserved_ptr2; uint32_t reserved_int1; uint32_t reserved_int2; uint32_t reserved_int3; @@ -379,6 +393,8 @@ typedef struct { lzma_reserved_enum reserved_enum2; lzma_reserved_enum reserved_enum3; lzma_reserved_enum reserved_enum4; + void *reserved_ptr1; + void *reserved_ptr2; } lzma_options_lzma; diff --git a/src/liblzma/api/lzma/stream_flags.h b/src/liblzma/api/lzma/stream_flags.h index d255bdda15f6..bbdd408263ea 100644 --- a/src/liblzma/api/lzma/stream_flags.h +++ b/src/liblzma/api/lzma/stream_flags.h @@ -91,8 +91,6 @@ typedef struct { lzma_reserved_enum reserved_enum2; lzma_reserved_enum reserved_enum3; lzma_reserved_enum reserved_enum4; - lzma_reserved_enum reserved_enum5; - lzma_reserved_enum reserved_enum6; lzma_bool reserved_bool1; lzma_bool reserved_bool2; lzma_bool reserved_bool3; @@ -103,8 +101,6 @@ typedef struct { lzma_bool reserved_bool8; uint32_t reserved_int1; uint32_t reserved_int2; - uint32_t reserved_int3; - uint32_t reserved_int4; } lzma_stream_flags; @@ -148,7 +144,7 @@ extern LZMA_API(lzma_ret) lzma_stream_footer_encode( /** * \brief Decode Stream Header * - * \param options Stream Header options to be encoded. + * \param options Target for the decoded Stream Header options. * \param in Beginning of the input buffer of * LZMA_STREAM_HEADER_SIZE bytes. * @@ -183,7 +179,7 @@ extern LZMA_API(lzma_ret) lzma_stream_header_decode( /** * \brief Decode Stream Footer * - * \param options Stream Header options to be encoded. + * \param options Target for the decoded Stream Header options. * \param in Beginning of the input buffer of * LZMA_STREAM_HEADER_SIZE bytes. * diff --git a/src/liblzma/api/lzma/version.h b/src/liblzma/api/lzma/version.h index 0f7c2d3737db..25e8a8201faf 100644 --- a/src/liblzma/api/lzma/version.h +++ b/src/liblzma/api/lzma/version.h @@ -20,10 +20,10 @@ /* * Version number split into components */ -#define LZMA_VERSION_MAJOR 4 -#define LZMA_VERSION_MINOR 999 -#define LZMA_VERSION_PATCH 9 -#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_BETA +#define LZMA_VERSION_MAJOR 5 +#define LZMA_VERSION_MINOR 0 +#define LZMA_VERSION_PATCH 0 +#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE #ifndef LZMA_VERSION_COMMIT # define LZMA_VERSION_COMMIT "" diff --git a/src/liblzma/api/lzma/vli.h b/src/liblzma/api/lzma/vli.h index 57e3d3882b5e..9ad13f2e2fc4 100644 --- a/src/liblzma/api/lzma/vli.h +++ b/src/liblzma/api/lzma/vli.h @@ -29,7 +29,7 @@ /** - * \brief Maximum supported value of variable-length integer + * \brief Maximum supported value of a variable-length integer */ #define LZMA_VLI_MAX (UINT64_MAX / 2) @@ -39,11 +39,10 @@ #define LZMA_VLI_UNKNOWN UINT64_MAX /** - * \brief Maximum supported length of variable length integers + * \brief Maximum supported encoded length of variable length integers */ #define LZMA_VLI_BYTES_MAX 9 - /** * \brief VLI constant suffix */ @@ -53,19 +52,19 @@ /** * \brief Variable-length integer type * - * This will always be unsigned integer. Valid VLI values are in the range - * [0, LZMA_VLI_MAX]. Unknown value is indicated with LZMA_VLI_UNKNOWN, - * which is the maximum value of the underlaying integer type. + * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is + * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the + * underlaying integer type. * - * In future, even if lzma_vli is defined to be something other than uint64_t, - * it is guaranteed that 2 * LZMA_VLI_MAX will not overflow lzma_vli. - * This simplifies integer overflow detection. + * lzma_vli will be uint64_t for the foreseeable future. If a bigger size + * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will + * not overflow lzma_vli. This simplifies integer overflow detection. */ typedef uint64_t lzma_vli; /** - * \brief Simple macro to validate variable-length integer + * \brief Validate a variable-length integer * * This is useful to test that application has given acceptable values * for example in the uncompressed_size and compressed_size variables. @@ -88,9 +87,9 @@ typedef uint64_t lzma_vli; * * \param vli Integer to be encoded * \param vli_pos How many VLI-encoded bytes have already been written - * out. When starting to encode a new integer, *vli_pos - * must be set to zero. To use single-call encoding, - * set vli_pos to NULL. + * out. When starting to encode a new integer in + * multi-call mode, *vli_pos must be set to zero. + * To use single-call encoding, set vli_pos to NULL. * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * \param out_size Size of the out buffer; the first byte into @@ -126,9 +125,9 @@ extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos, * initialize it to zero when *vli_pos == 0, so * application isn't required to initialize *vli. * \param vli_pos How many bytes have already been decoded. When - * starting to decode a new integer, *vli_pos must - * be initialized to zero. To use single-call decoding, - * set this to NULL. + * starting to decode a new integer in multi-call + * mode, *vli_pos must be initialized to zero. To + * use single-call decoding, set vli_pos to NULL. * \param in Beginning of the input buffer * \param in_pos The next byte will be read from in[*in_pos]. * \param in_size Size of the input buffer; the first byte that diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c index 07b1d4763f69..0408e15328b3 100644 --- a/src/liblzma/common/common.c +++ b/src/liblzma/common/common.c @@ -182,6 +182,20 @@ lzma_code(lzma_stream *strm, lzma_action action) || !strm->internal->supported_actions[action]) return LZMA_PROG_ERROR; + // Check if unsupported members have been set to non-zero or non-NULL, + // which would indicate that some new feature is wanted. + if (strm->reserved_ptr1 != NULL + || strm->reserved_ptr2 != NULL + || strm->reserved_ptr3 != NULL + || strm->reserved_ptr4 != NULL + || strm->reserved_int1 != 0 + || strm->reserved_int2 != 0 + || strm->reserved_int3 != 0 + || strm->reserved_int4 != 0 + || strm->reserved_enum1 != LZMA_RESERVED_ENUM + || strm->reserved_enum2 != LZMA_RESERVED_ENUM) + return LZMA_OPTIONS_ERROR; + switch (strm->internal->sequence) { case ISEQ_RUN: switch (action) { diff --git a/src/liblzma/common/filter_encoder.c b/src/liblzma/common/filter_encoder.c index 436d2cc6e424..635d81223472 100644 --- a/src/liblzma/common/filter_encoder.c +++ b/src/liblzma/common/filter_encoder.c @@ -226,6 +226,7 @@ lzma_raw_encoder_memusage(const lzma_filter *filters) } +/* extern LZMA_API(lzma_vli) lzma_chunk_size(const lzma_filter *filters) { @@ -247,6 +248,7 @@ lzma_chunk_size(const lzma_filter *filters) return max; } +*/ extern LZMA_API(lzma_ret) diff --git a/src/liblzma/common/filter_encoder.h b/src/liblzma/common/filter_encoder.h index a978932def75..5bc137f64584 100644 --- a/src/liblzma/common/filter_encoder.h +++ b/src/liblzma/common/filter_encoder.h @@ -16,8 +16,8 @@ #include "common.h" -// FIXME !!! Public API -extern lzma_vli lzma_chunk_size(const lzma_filter *filters); +// FIXME: Might become a part of the public API once finished. +// extern lzma_vli lzma_chunk_size(const lzma_filter *filters); extern lzma_ret lzma_raw_encoder_init( diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c index 3941e28ba724..ddb9d3643623 100644 --- a/src/liblzma/common/index.c +++ b/src/liblzma/common/index.c @@ -18,7 +18,7 @@ /// /// This should be big enough to avoid making lots of tiny allocations /// but small enough to avoid too much unused memory at once. -#define INDEX_GROUP_SIZE 500 +#define INDEX_GROUP_SIZE 512 /// \brief How many Records can be allocated at once at maximum diff --git a/src/liblzma/common/index_decoder.c b/src/liblzma/common/index_decoder.c index 86a22971b064..a6bc650e046c 100644 --- a/src/liblzma/common/index_decoder.c +++ b/src/liblzma/common/index_decoder.c @@ -291,6 +291,7 @@ lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit) lzma_next_strm_init(index_decoder_init, strm, i, memlimit); strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; return LZMA_OK; } diff --git a/src/liblzma/common/index_encoder.c b/src/liblzma/common/index_encoder.c index 706f1fd79905..c10d7afa06b4 100644 --- a/src/liblzma/common/index_encoder.c +++ b/src/liblzma/common/index_encoder.c @@ -209,6 +209,7 @@ lzma_index_encoder(lzma_stream *strm, const lzma_index *i) lzma_next_strm_init(lzma_index_encoder_init, strm, i); strm->internal->supported_actions[LZMA_RUN] = true; + strm->internal->supported_actions[LZMA_FINISH] = true; return LZMA_OK; } diff --git a/src/liblzma/lzma/lzma2_decoder.c b/src/liblzma/lzma/lzma2_decoder.c index b4c2f2d5ba70..f38879ce17cd 100644 --- a/src/liblzma/lzma/lzma2_decoder.c +++ b/src/liblzma/lzma/lzma2_decoder.c @@ -191,7 +191,6 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict, case SEQ_COPY: { // Copy from input to the dictionary as is. - // FIXME Can copy too much? dict_write(dict, in, in_pos, in_size, &coder->compressed_size); if (coder->compressed_size != 0) return LZMA_OK; diff --git a/src/liblzma/lzma/lzma_decoder.c b/src/liblzma/lzma/lzma_decoder.c index 4329e0199273..9979bb4261b8 100644 --- a/src/liblzma/lzma/lzma_decoder.c +++ b/src/liblzma/lzma/lzma_decoder.c @@ -656,7 +656,8 @@ lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr, } case SEQ_EOPM: - // TODO Comment + // LZMA1 stream with + // end-of-payload marker. rc_normalize(SEQ_EOPM); ret = LZMA_STREAM_END; goto out; @@ -856,7 +857,6 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt) // NOTE: We assume that lc/lp/pb are valid since they were // successfully decoded with lzma_lzma_decode_properties(). - // FIXME? // Calculate pos_mask. We don't need pos_bits as is for anything. coder->pos_mask = (1U << options->pb) - 1; diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c index 0fe992d510a1..0b9ee9e15079 100644 --- a/src/liblzma/lzma/lzma_encoder.c +++ b/src/liblzma/lzma/lzma_encoder.c @@ -334,7 +334,7 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf, // With LZMA2 we need to take care that compressed size of // a chunk doesn't get too big. - // TODO + // FIXME? Check if this could be improved. if (limit != UINT32_MAX && (mf->read_pos - mf->read_ahead >= limit || *out_pos + rc_pending(&coder->rc) diff --git a/src/xz/message.c b/src/xz/message.c index 3f2b813d7c7a..38cce4a1b0fd 100644 --- a/src/xz/message.c +++ b/src/xz/message.c @@ -77,6 +77,17 @@ static uint64_t start_time; // gettimeofday(). #ifdef SIGALRM +const int message_progress_sigs[] = { + SIGALRM, +#ifdef SIGINFO + SIGINFO, +#endif +#ifdef SIGUSR1 + SIGUSR1, +#endif + 0 +}; + /// The signal handler for SIGALRM sets this to true. It is set back to false /// once the progress message has been updated. static volatile sig_atomic_t progress_needs_updating = false; @@ -142,34 +153,15 @@ message_init(void) */ #ifdef SIGALRM - // DJGPP lacks SA_RESTART, but it shouldn't give EINTR - // in most places either. -# if defined(__DJGPP__) && !defined(SA_RESTART) -# define SA_RESTART 0 -# endif - // Establish the signal handlers which set a flag to tell us that - // progress info should be updated. Since these signals don't - // require any quick action, we set SA_RESTART. That way we don't - // need to block them either in signals_block() to keep stdio - // functions from getting EINTR. - static const int sigs[] = { - SIGALRM, -#ifdef SIGINFO - SIGINFO, -#endif -#ifdef SIGUSR1 - SIGUSR1, -#endif - }; - + // progress info should be updated. struct sigaction sa; sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; + sa.sa_flags = 0; sa.sa_handler = &progress_signal_handler; - for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) - if (sigaction(sigs[i], &sa, NULL)) + for (size_t i = 0; message_progress_sigs[i] != 0; ++i) + if (sigaction(message_progress_sigs[i], &sa, NULL)) message_signal_handler(); #endif @@ -841,10 +833,13 @@ message_strm(lzma_ret code) case LZMA_STREAM_END: case LZMA_GET_CHECK: case LZMA_PROG_ERROR: - return _("Internal error (bug)"); + // Without "default", compiler will warn if new constants + // are added to lzma_ret, it is not too easy to forget to + // add the new constants to this function. + break; } - return NULL; + return _("Internal error (bug)"); } diff --git a/src/xz/message.h b/src/xz/message.h index 37e608216886..e3fca3cc42ca 100644 --- a/src/xz/message.h +++ b/src/xz/message.h @@ -16,10 +16,14 @@ enum message_verbosity { V_ERROR, ///< Only error messages V_WARNING, ///< Errors and warnings V_VERBOSE, ///< Errors, warnings, and verbose statistics - V_DEBUG, ///< Debugging, FIXME remove? + V_DEBUG, ///< Very verbose }; +/// \brief Signals used for progress message handling +extern const int message_progress_sigs[]; + + /// \brief Initializes the message functions /// /// If an error occurs, this function doesn't return. diff --git a/src/xz/signals.c b/src/xz/signals.c index 7e65b2a38bf3..4d6a9da31624 100644 --- a/src/xz/signals.c +++ b/src/xz/signals.c @@ -71,6 +71,12 @@ signals_init(void) for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) sigaddset(&hooked_signals, sigs[i]); +#ifdef SIGALRM + // Add also the signals from message.c to hooked_signals. + for (size_t i = 0; message_progress_sigs[i] != 0; ++i) + sigaddset(&hooked_signals, message_progress_sigs[i]); +#endif + struct sigaction sa; // All the signals that we handle we also blocked while the signal @@ -142,7 +148,7 @@ signals_exit(void) const int sig = exit_signal; if (sig != 0) { -#ifdef TUKLIB_DOSLIKE +#if defined(TUKLIB_DOSLIKE) || defined(__VMS) // Don't raise(), set only exit status. This avoids // printing unwanted message about SIGINT when the user // presses C-c. From da2bbf0cbd9ae4762dc3ae79cbb0c36d93698d1a Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 11 Nov 2010 22:35:42 +0000 Subject: [PATCH 05/28] Make sure to specify the alignment of minbrk and curbrk. They were correctly aligned by accident with earlier binutils, but no longer are, causing link failures. Submitted by: nwhitehorn Obtained from: projects/binutils-2.17 --- lib/libc/powerpc64/sys/brk.S | 1 + lib/libc/powerpc64/sys/sbrk.S | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/libc/powerpc64/sys/brk.S b/lib/libc/powerpc64/sys/brk.S index 5450a87462a8..59b891c3f768 100644 --- a/lib/libc/powerpc64/sys/brk.S +++ b/lib/libc/powerpc64/sys/brk.S @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); .globl CNAME(_end) .data + .align 3 HIDENAME(minbrk): .llong CNAME(_end) diff --git a/lib/libc/powerpc64/sys/sbrk.S b/lib/libc/powerpc64/sys/sbrk.S index d11b17747ad3..a7a9c7705bb2 100644 --- a/lib/libc/powerpc64/sys/sbrk.S +++ b/lib/libc/powerpc64/sys/sbrk.S @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); .globl CNAME(_end) .data + .align 3 HIDENAME(curbrk): .llong CNAME(_end) From b9c727d84e270aa45bf5a4582fc49ac698c5483c Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 11 Nov 2010 22:53:55 +0000 Subject: [PATCH 06/28] Use -fPIC to build libexec/rtld-elf on sparc64, so it will also be able to link with newer binutils, without overflowing the GOT. Obtained from: projects/binutils-2.17 --- libexec/rtld-elf/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 62aaaab96a99..bc23f7c139da 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -29,7 +29,12 @@ SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} MLINKS= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 -CFLAGS+= -fpic -DPIC +.if ${MACHINE_CPUARCH} == "sparc64" +CFLAGS+= -fPIC +.else +CFLAGS+= -fpic +.endif +CFLAGS+= -DPIC LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic -lssp_nonshared From bd4473b82278b5f19574c29a0cf907745fc96c77 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 11 Nov 2010 23:00:37 +0000 Subject: [PATCH 07/28] Fix typo, and re-wrap paragraph. --- share/mk/sys.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index fae3f3e5f50e..e6368ba82a69 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -7,11 +7,11 @@ unix ?= We run FreeBSD, not UNIX. .if !defined(%POSIX) # # MACHINE_CPUARCH defines a collection of MACHINE_ARCH. Machines with -# the same MACHINE_ARCH can run reach-other's binaries, so it -# necessarily has word size and endian swizzled in. However, support -# files for these machines often are shared amongst all combinations -# of size and/or endian. This is called MACHINE_CPU in NetBSD, but -# that's used for something different in FreeBSD. +# the same MACHINE_ARCH can run each other's binaries, so it necessarily +# has word size and endian swizzled in. However, support files for +# these machines often are shared amongst all combinations of size +# and/or endian. This is called MACHINE_CPU in NetBSD, but that's used +# for something different in FreeBSD. # MACHINE_CPUARCH=${MACHINE_ARCH:C/mipse[lb]/mips/:C/armeb/arm/:C/powerpc64/powerpc/} .endif From dfbf73475a5c2759f860a5bbf332172767a45a02 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 11 Nov 2010 23:41:36 +0000 Subject: [PATCH 08/28] Do not build or install gasp.info anymore, as gasp has not been built or installed for more than 6 years. Obtained from: projects/binutils-2.17 --- ObsoleteFiles.inc | 2 ++ gnu/usr.bin/binutils/doc/Makefile | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 97eea7e9e9a7..66983cc448e0 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20101112: removed gasp.info +OLD_FILES+=usr/share/info/gasp.info.gz # 20101109: headers moved to machine/ to x86/ .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/mptable.h diff --git a/gnu/usr.bin/binutils/doc/Makefile b/gnu/usr.bin/binutils/doc/Makefile index b271f19b0a62..42c178452f2b 100644 --- a/gnu/usr.bin/binutils/doc/Makefile +++ b/gnu/usr.bin/binutils/doc/Makefile @@ -4,10 +4,9 @@ .PATH: ${SRCDIR}/gas/doc ${SRCDIR}/ld ${SRCDIR}/bfd/doc -INFO= as ld gasp binutils +INFO= as ld binutils INFOSECTION= "Programming & development tools." INFOENTRY_as= "* As: (as). The GNU assembler." -INFOENTRY_gasp= "* Gasp: (gasp). The GNU Assembler Macro Preprocessor." INFOENTRY_ld= "* Ld: (ld). The GNU linker." INFOENTRY_binutils= "* Binutils: (binutils). The GNU Binary Utilities." From cfe6b823a21ef330633d755517783973bfb63bfb Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 11 Nov 2010 23:45:19 +0000 Subject: [PATCH 09/28] Garbage collect gnu/usr.bin/binutils/{gasp,gdb,gdbreplay}, as these have not been connected to the build for more than 6 years. Obtained from: projects/binutils-2.17 --- gnu/usr.bin/binutils/gasp/Makefile | 21 - gnu/usr.bin/binutils/gasp/gasp.1 | 115 --- gnu/usr.bin/binutils/gdb/Makefile | 139 --- gnu/usr.bin/binutils/gdb/Makefile.arm | 5 - gnu/usr.bin/binutils/gdb/Makefile.i386 | 9 - gnu/usr.bin/binutils/gdb/Makefile.ia64 | 5 - gnu/usr.bin/binutils/gdb/Makefile.powerpc | 5 - gnu/usr.bin/binutils/gdb/Makefile.powerpc64 | 5 - gnu/usr.bin/binutils/gdb/Makefile.sparc64 | 4 - gnu/usr.bin/binutils/gdb/config.h | 505 ----------- gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h | 14 - gnu/usr.bin/binutils/gdb/fbsd-kgdb-amd64.h | 8 - gnu/usr.bin/binutils/gdb/fbsd-kgdb-arm.h | 8 - gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h | 21 - gnu/usr.bin/binutils/gdb/fbsd-kgdb-ia64.h | 8 - gnu/usr.bin/binutils/gdb/fbsd-kgdb-powerpc.h | 8 - gnu/usr.bin/binutils/gdb/fbsd-kgdb-sparc64.h | 9 - gnu/usr.bin/binutils/gdb/fbsd-kgdb.h | 34 - gnu/usr.bin/binutils/gdb/freebsd-uthread.c | 889 ------------------- gnu/usr.bin/binutils/gdb/gdb.1 | 385 -------- gnu/usr.bin/binutils/gdb/kvm-fbsd-alpha.h | 77 -- gnu/usr.bin/binutils/gdb/kvm-fbsd-i386.h | 131 --- gnu/usr.bin/binutils/gdb/kvm-fbsd-sparc64.h | 96 -- gnu/usr.bin/binutils/gdb/kvm-fbsd.c | 502 ----------- gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c | 304 ------- gnu/usr.bin/binutils/gdbreplay/Makefile | 23 - 26 files changed, 3330 deletions(-) delete mode 100644 gnu/usr.bin/binutils/gasp/Makefile delete mode 100644 gnu/usr.bin/binutils/gasp/gasp.1 delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile.arm delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile.i386 delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile.ia64 delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile.powerpc delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile.powerpc64 delete mode 100644 gnu/usr.bin/binutils/gdb/Makefile.sparc64 delete mode 100644 gnu/usr.bin/binutils/gdb/config.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-amd64.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-arm.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-ia64.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-powerpc.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb-sparc64.h delete mode 100644 gnu/usr.bin/binutils/gdb/fbsd-kgdb.h delete mode 100644 gnu/usr.bin/binutils/gdb/freebsd-uthread.c delete mode 100644 gnu/usr.bin/binutils/gdb/gdb.1 delete mode 100644 gnu/usr.bin/binutils/gdb/kvm-fbsd-alpha.h delete mode 100644 gnu/usr.bin/binutils/gdb/kvm-fbsd-i386.h delete mode 100644 gnu/usr.bin/binutils/gdb/kvm-fbsd-sparc64.h delete mode 100644 gnu/usr.bin/binutils/gdb/kvm-fbsd.c delete mode 100644 gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c delete mode 100644 gnu/usr.bin/binutils/gdbreplay/Makefile diff --git a/gnu/usr.bin/binutils/gasp/Makefile b/gnu/usr.bin/binutils/gasp/Makefile deleted file mode 100644 index 51ea9d9ec479..000000000000 --- a/gnu/usr.bin/binutils/gasp/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc0" - -.PATH: ${SRCDIR}/gas - -PROG= gasp -SRCS+= gasp.c macro.c sb.c hash.c xregex.h -WARNS?= 2 -CFLAGS+= -DBFD_ASSEMBLER -CFLAGS+= -I${.CURDIR}/../as/${TARGET_ARCH}-freebsd -I${.CURDIR}/../as -CFLAGS+= -I${.CURDIR} -CFLAGS+= -I${SRCDIR} -I${SRCDIR}/gas -I${SRCDIR}/gas/config -DPADD= ${RELTOP}/libiberty/libiberty.a -LDADD= ${DPADD} -CLEANFILES= xregex.h - -xregex.h: - @echo '#include ' >${.TARGET} - -.include diff --git a/gnu/usr.bin/binutils/gasp/gasp.1 b/gnu/usr.bin/binutils/gasp/gasp.1 deleted file mode 100644 index 5aaff9a165bb..000000000000 --- a/gnu/usr.bin/binutils/gasp/gasp.1 +++ /dev/null @@ -1,115 +0,0 @@ -.\" Copyright (c) 1999 -.\" The Regents of the University of California. All rights reserved. -.\" and David E. O'Brien -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd December 29, 1999 -.Dt GASP 1 -.Os -.Sh NAME -.Nm gasp -.Nd the GNU Assembler Macro Preprocessor -.Sh SYNOPSIS -.Nm -.Op Fl adhMpsuv -.Op Fl c Ar char -.Op Fl o Ar outfile -.Op Fl D Ns Ar name=value -.Op Fl I Ns Ar path -.Op infile -.Sh DESCRIPTION -.Nm -is the GNU Assembler Macro Preprocessor. -The argument -.Ar infile -is processed and the resulting text is sent to the standard output. -.Pp -The options are as follows: -.Bl -tag -width "-Dname=value" -.It Fl a -Enter enter alternate macro mode. -Also specifiable as -.Op Fl \-alternate -.It Fl c Ar char -Change the comment character from `!' -Also specifiable as -.Op Fl \-commentchar\ char -.It Fl d -Print limited debugging information. -Also specifiable as -.Op Fl \-debug -.It Fl h -Print the help message. -Also specifiable as -.Op Fl \-help -.It Fl M -Enter MRI compatibility mode -Also specifiable as -.Op Fl \-mri -.It Fl o Ar outfile -Specify the output file. -Also specifiable as -.Op Fl \-output\ outfile -.It Fl p -Print line numbers. -Also specifiable as -.Op Fl \-print -.It Fl s -Copy source through as comments. -Also specifiable as -.Op Fl \-copysource -.It Fl u -Allow unreasonable nesting. -Also specifiable as -.Op Fl \-unreasonable -.It Fl v -Print the program version and exit. -Also specifiable as -.Op Fl \-version -.It Fl D Ns Ar name=value -Define the preprocessor symbol -.Ar name -to have the value specified by "value". -.It Fl I Ns Ar path -Add -.Ar path -to the include path list. -.El -.Sh SEE ALSO -.Xr cpp 1 , -.Xr m4 1 -.Rs -.%T The gasp GNU hypertext system info pages -.Re -.Sh HISTORY -The -.Nm -command is part of the GNU Binutils package. -.Sh AUTHORS -This man page was written by -.An David E. O'Brien . diff --git a/gnu/usr.bin/binutils/gdb/Makefile b/gnu/usr.bin/binutils/gdb/Makefile deleted file mode 100644 index f51d9e357045..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -# ex:ts=8 -# $FreeBSD$ - -.include "../Makefile.inc0" - -GDBDIR= ${.CURDIR}/../../../../contrib/gdb -.PATH: ${GDBDIR}/gdb ${GDBDIR}/gdb/cli ${GDBDIR}/gdb/mi -.PATH: ${SRCDIR}/opcodes ${SRCDIR}/binutils - -# For FSF GDB files, use their CPU (arch) name; for our files use ours. -GDB_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc.*/rs6000/:C/sparc64/sparc/} -NO_SHARED?=yes -PROG= gdb -XSRCS= annotate.c arch-utils.c ax-general.c ax-gdb.c bcache.c \ - blockframe.c breakpoint.c buildsym.c complaints.c completer.c \ - copying.c corefile.c corelow.c dcache.c doublest.c event-loop.c \ - event-top.c environ.c eval.c exec.c expprint.c fork-child.c \ - frame.c gdb-events.c gdbarch.c gdbtypes.c infcmd.c inflow.c \ - infptrace.c inf-loop.c infrun.c inftarg.c language.c linespec.c \ - main.c maint.c mdebugread.c mem-break.c memattr.c minsyms.c \ - objfiles.c parse.c printcmd.c regcache.c remote.c \ - remote-utils.c signals.c source.c stabsread.c stack.c symfile.c \ - symmisc.c symtab.c target.c thread.c top.c tracepoint.c \ - typeprint.c ui-file.c ui-out.c utils.c valarith.c valops.c \ - varobj.c valprint.c values.c wrapper.c \ - cli-cmds.c cli-cmds.h cli-decode.c cli-decode.h cli-out.c \ - cli-script.c cli-script.h cli-setshow.c cli-setshow.h \ - cli-utils.c cli-utils.h \ - mi-cmd-break.c mi-cmd-disas.c mi-cmd-stack.c mi-cmd-var.c \ - mi-cmds.c mi-console.c mi-getopt.c mi-main.c mi-out.c mi-parse.c\ - serial.c ser-unix.c ser-tcp.c \ - c-exp.y c-lang.c c-typeprint.c c-valprint.c \ - ch-exp.c ch-lang.c ch-typeprint.c ch-valprint.c \ - cp-abi.c gnu-v2-abi.c gnu-v3-abi.c cp-valprint.c demangle.c \ - f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c \ - jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c nlmread.c \ - m2-lang.c m2-exp.y m2-typeprint.c m2-valprint.c \ - scm-exp.c scm-lang.c scm-valprint.c \ - coffread.c dbxread.c dwarfread.c dwarf2read.c elfread.c \ - solib.c solib-svr4.c solib-legacy.c -XSRCS+= freebsd-uthread.c kvm-fbsd.c kvm-fbsd-machine.h solib-fbsd-kld.c -SRCS= init.c ${XSRCS} nm.h tm.h xm.h gdbversion.c xregex.h - -.include "${.CURDIR}/Makefile.${TARGET_ARCH}" - -WARNS?= 0 -.if ${TARGET_ARCH} != ${MACHINE_ARCH} -CFLAGS+= -DCROSS_COMPILE=1 -.endif -CFLAGS+= -DDEFAULT_BFD_ARCH=bfd_${GDB_CPU}_arch -CFLAGS+= -I${.CURDIR}/${TARGET_CPUARCH} -CFLAGS+= -I${SRCDIR}/binutils -I${SRCDIR}/bfd -CFLAGS+= -I${GDBDIR}/gdb -I${GDBDIR}/gdb/config -CFLAGS+= -I$(.CURDIR) - -YFLAGS= - -DPADD= ${LIBKVM} ${LIBM} -DPADD+= ${RELTOP}/libbfd/libbfd.a ${RELTOP}/libopcodes/libopcodes.a -DPADD+= ${LIBGNUREGEX} -DPADD+= ${RELTOP}/libiberty/libiberty.a -DPADD+= ${LIBREADLINE} ${LIBTERMCAP} -LDADD= -lkvm -lm -LDADD+= ${RELTOP}/libbfd/libbfd.a ${RELTOP}/libopcodes/libopcodes.a -LDADD+= -lgnuregex -LDADD+= ${RELTOP}/libiberty/libiberty.a -LDADD+= -lreadline -ltermcap - -CLEANFILES= init.c init.c-tmp nm.h tm.h xm.h gdbversion.c xregex.h kvm-fbsd-machine.h - -# We do this by grepping through sources. If that turns out to be too slow, -# maybe we could just require every .o file to have an initialization routine -# of a given name (remote-udi.o -> _initialize_remote_udi, etc.). -# -# Formatting conventions: The name of the _initialize_* routines must start -# in column zero, and must not be inside #if. -# -# Note that the set of files with init functions might change, or the names -# of the functions might change, so this files needs to depend on all the -# object files that will be linked into gdb. - -init.c: ${XSRCS} - @${ECHO} Making ${.TARGET} - @rm -f init.c-tmp - @echo '/* Do not modify this file. */' >init.c-tmp - @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp - @echo '#include "defs.h"' >>init.c-tmp - @echo '#include "call-cmds.h"' >>init.c-tmp - @echo 'void initialize_all_files () {' >>init.c-tmp - @for i in ${.ALLSRC} ; do \ - filename=`echo $$i | sed \ - -e '/^Onindy.c/d' \ - -e '/^nindy.c/d' \ - -e '/ttyflush.c/d' \ - -e '/xdr_ld.c/d' \ - -e '/xdr_ptrace.c/d' \ - -e '/xdr_rdb.c/d' \ - -e '/udr.c/d' \ - -e '/udip2soc.c/d' \ - -e '/udi2go32.c/d' \ - -e '/version.c/d' \ - -e '/^[a-z0-9A-Z_]*_[SU].c/d' \ - -e '/[a-z0-9A-Z_]*-exp.tab.c/d'` ; \ - case $$filename in \ - "") ;; \ - *) sed <$$filename >>init.c-tmp -n \ - -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (); \1 ();}/p' ; ;; \ - esac ; \ - done - @echo '}' >>init.c-tmp - @mv init.c-tmp ${.TARGET} - -.PRECIOUS: init.c - -tm.h: - echo '#include "${GDB_CPU}/tm-fbsd.h"' > ${.TARGET} -.if exists(${.CURDIR}/fbsd-kgdb-${TARGET_CPUARCH}.h) - echo '#include "fbsd-kgdb-${TARGET_CPUARCH}.h"' >> ${.TARGET} -.endif - -.for H in nm-fbsd xm-${GDB_CPU} -${H:C/-.*$//}.h: - ln -sf ${GDBDIR}/gdb/config/${GDB_CPU}/${H}.h ${.TARGET} -.endfor - -kvm-fbsd-machine.h: - ln -sf ${.CURDIR}/kvm-fbsd-${TARGET_CPUARCH}.h ${.TARGET} - -GDB_VERSION= "5.2.1 (FreeBSD)" -gdbversion.c: Makefile - @echo '#include "version.h"' > ${.TARGET} - @echo 'const char version[] = ${GDB_VERSION};' >>${.TARGET} - @echo 'const char host_name[] = "${MACHINE_ARCH}-undermydesk-freebsd";' >>${.TARGET} - @echo 'const char target_name[] = "${TARGET_ARCH}-undermydesk-freebsd";' >>${.TARGET} - -xregex.h: - @echo '#include ' >${.TARGET} - -.include diff --git a/gnu/usr.bin/binutils/gdb/Makefile.arm b/gnu/usr.bin/binutils/gdb/Makefile.arm deleted file mode 100644 index 3a8bcff9b135..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile.arm +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -XSRCS+= armnbsd-nat.c armnbsd-tdep.c arm-tdep.c \ - core-regset.c -CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf32_arm_vec diff --git a/gnu/usr.bin/binutils/gdb/Makefile.i386 b/gnu/usr.bin/binutils/gdb/Makefile.i386 deleted file mode 100644 index 14e7a3fe7856..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile.i386 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -XSRCS+= i386fbsd-nat.c i386bsd-tdep.c i386bsd-nat.c i386-nat.c i386-tdep.c \ - i387-nat.c i387-tdep.c \ - core-regset.c core-aout.c - -CFLAGS+= -Dprint_insn_i386=print_insn_i386_att -CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf32_i386_freebsd_vec -CFLAGS+= -DGDB_XM_FILE diff --git a/gnu/usr.bin/binutils/gdb/Makefile.ia64 b/gnu/usr.bin/binutils/gdb/Makefile.ia64 deleted file mode 100644 index 08283c7344b0..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile.ia64 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -XSRCS+= ia64-tdep.c ia64-fbsd-nat.c \ - core-regset.c -CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_ia64_vec diff --git a/gnu/usr.bin/binutils/gdb/Makefile.powerpc b/gnu/usr.bin/binutils/gdb/Makefile.powerpc deleted file mode 100644 index b5f9778667a3..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile.powerpc +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -XSRCS+= ppcnbsd-nat.c ppc-tdep.c \ - core-regset.c -CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf32_powerpc_vec diff --git a/gnu/usr.bin/binutils/gdb/Makefile.powerpc64 b/gnu/usr.bin/binutils/gdb/Makefile.powerpc64 deleted file mode 100644 index 4cea11345a12..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile.powerpc64 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -XSRCS+= ppcnbsd-nat.c ppc-tdep.c \ - core-regset.c -CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_powerpc_vec diff --git a/gnu/usr.bin/binutils/gdb/Makefile.sparc64 b/gnu/usr.bin/binutils/gdb/Makefile.sparc64 deleted file mode 100644 index 5eb0f2ec7dfe..000000000000 --- a/gnu/usr.bin/binutils/gdb/Makefile.sparc64 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD$ - -XSRCS+= sparc-nat.c sparc-tdep.c -CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_sparc_vec diff --git a/gnu/usr.bin/binutils/gdb/config.h b/gnu/usr.bin/binutils/gdb/config.h deleted file mode 100644 index a5731261b088..000000000000 --- a/gnu/usr.bin/binutils/gdb/config.h +++ /dev/null @@ -1,505 +0,0 @@ -/* $FreeBSD$ */ - -/* config.h. Generated automatically by configure. */ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -/* #undef _ALL_SOURCE */ -#endif - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have and it should be used (not on Ultrix). */ -/* #undef HAVE_ALLOCA_H */ - -/* Define if the `long double' type works. */ -#define HAVE_LONG_DOUBLE 1 - -/* Define if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define if you have . */ -/* #undef HAVE_VFORK_H */ - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `long' if doesn't define. */ -/* #undef off_t */ - -/* Define to `int' if doesn't define. */ -/* #undef pid_t */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if the `setpgrp' function takes no argument. */ -/* #undef SETPGRP_VOID */ - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -/* #undef STACK_DIRECTION */ - -/* Define if the `S_IS*' macros in do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define vfork as fork if vfork does not work. */ -/* #undef vfork */ - -/* Define if compiling on Solaris 7. */ -/* #undef _MSE_INT_H */ - -/* Define if your struct reg has r_fs. */ -#define HAVE_STRUCT_REG_R_FS 1 - -/* Define if your struct reg has r_gs. */ -#define HAVE_STRUCT_REG_R_GS 1 - -/* Define if exists and defines struct link_map which has - members with an ``l_'' prefix. (For Solaris, SVR4, and - SVR4-like systems.) */ -#define HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS 1 - -/* Define if exists and defines struct link_map which has - members with an ``lm_'' prefix. (For SunOS.) */ -/* #undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */ - -/* Define if exists and defines a struct so_map which has - members with an ``som_'' prefix. (Found on older *BSD systems.) */ -/* #undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */ - -/* Define if has struct link_map32 */ -/* #undef HAVE_STRUCT_LINK_MAP32 */ - -/* Define if the prfpregset_t type is broken. */ -/* #undef PRFPREGSET_T_BROKEN */ - -/* Define if you want to use new multi-fd /proc interface - (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */ -/* #undef NEW_PROC_API */ - -/* Define if ioctl argument PIOCSET is available. */ -/* #undef HAVE_PROCFS_PIOCSET */ - -/* Define if the `long long' type works. */ -#define CC_HAS_LONG_LONG 1 - -/* Define if the "ll" format works to print long long ints. */ -#define PRINTF_HAS_LONG_LONG 1 - -/* Define if the "%Lg" format works to print long doubles. */ -#define PRINTF_HAS_LONG_DOUBLE 1 - -/* Define if the "%Lg" format works to scan long doubles. */ -#define SCANF_HAS_LONG_DOUBLE 1 - -/* Define if using Solaris thread debugging. */ -/* #undef HAVE_THREAD_DB_LIB */ - -/* Define on a GNU/Linux system to work around problems in sys/procfs.h. */ -/* #undef START_INFERIOR_TRAPS_EXPECTED */ -/* #undef sys_quotactl */ - -/* Define if you have HPUX threads */ -/* #undef HAVE_HPUX_THREAD_SUPPORT */ - -/* Define if you want to use the memory mapped malloc package (mmalloc). */ -/* #undef USE_MMALLOC */ - -/* Define if the runtime uses a routine from mmalloc before gdb has a chance - to initialize mmalloc, and we want to force checking to be used anyway. - This may cause spurious memory corruption messages if the runtime tries - to explicitly deallocate that memory when gdb calls exit. */ -/* #undef MMCHECK_FORCE */ - -/* Define if on solaris uses int instead of - size_t, and assorted other type changes. */ -/* #undef PROC_SERVICE_IS_OLD */ - -/* If you want to specify a default CPU variant, define this to be its - name, as a C string. */ -/* #undef TARGET_CPU_DEFAULT */ - -/* Define if the simulator is being linked in. */ -/* #undef WITH_SIM */ - -/* Set to true if the save_state_t structure is present */ -/* #undef HAVE_STRUCT_SAVE_STATE_T */ - -/* Set to true if the save_state_t structure has the ss_wide member */ -/* #undef HAVE_STRUCT_MEMBER_SS_WIDE */ - -/* Define if defines the PTRACE_GETREGS request. */ -/* #undef HAVE_PTRACE_GETREGS */ - -/* Define if defines the PTRACE_GETFPXREGS request. */ -/* #undef HAVE_PTRACE_GETFPXREGS */ - -/* Define if defines the PT_GETDBREGS request. */ -#define HAVE_PT_GETDBREGS 1 - -/* Define if defines the PT_GETXMMREGS request. */ -/* #undef HAVE_PT_GETXMMREGS */ - -/* Define if gnu-regex.c included with GDB should be used. */ -#define USE_INCLUDED_REGEX 1 - -/* BFD's default architecture. */ -/* #define DEFAULT_BFD_ARCH bfd_alpha_arch */ - -/* BFD's default target vector. */ -/* #define DEFAULT_BFD_VEC bfd_elf64_alpha_vec */ - -/* Multi-arch enabled. */ -/* #undef GDB_MULTI_ARCH */ - -/* hostfile */ -/* #define GDB_XM_FILE 1 */ - -/* targetfile */ -#define GDB_TM_FILE 1 - -/* nativefile */ -#define GDB_NM_FILE 1 - -/* Define if you have the __argz_count function. */ -/* #undef HAVE___ARGZ_COUNT */ - -/* Define if you have the __argz_next function. */ -/* #undef HAVE___ARGZ_NEXT */ - -/* Define if you have the __argz_stringify function. */ -/* #undef HAVE___ARGZ_STRINGIFY */ - -/* Define if you have the bcopy function. */ -#define HAVE_BCOPY 1 - -/* Define if you have the btowc function. */ -/* #undef HAVE_BTOWC */ - -/* Define if you have the bzero function. */ -#define HAVE_BZERO 1 - -/* Define if you have the canonicalize_file_name function. */ -/* #undef HAVE_CANONICALIZE_FILE_NAME */ - -/* Define if you have the dcgettext function. */ -/* #undef HAVE_DCGETTEXT */ - -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the isascii function. */ -#define HAVE_ISASCII 1 - -/* Define if you have the munmap function. */ -#define HAVE_MUNMAP 1 - -/* Define if you have the poll function. */ -#define HAVE_POLL 1 - -/* Define if you have the putenv function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the realpath function. */ -#define HAVE_REALPATH 1 - -/* Define if you have the sbrk function. */ -#define HAVE_SBRK 1 - -/* Define if you have the setenv function. */ -#define HAVE_SETENV 1 - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the setpgid function. */ -#define HAVE_SETPGID 1 - -/* Define if you have the setpgrp function. */ -#define HAVE_SETPGRP 1 - -/* Define if you have the sigaction function. */ -#define HAVE_SIGACTION 1 - -/* Define if you have the sigprocmask function. */ -#define HAVE_SIGPROCMASK 1 - -/* Define if you have the sigsetmask function. */ -#define HAVE_SIGSETMASK 1 - -/* Define if you have the socketpair function. */ -#define HAVE_SOCKETPAIR 1 - -/* Define if you have the stpcpy function. */ -#define HAVE_STPCPY 1 - -/* Define if you have the strcasecmp function. */ -#define HAVE_STRCASECMP 1 - -/* Define if you have the strchr function. */ -#define HAVE_STRCHR 1 - -/* Define if you have the header file. */ -/* #undef HAVE_ARGZ_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_ASM_DEBUGREG_H */ - -/* Define if you have the header file. */ -#define HAVE_CTYPE_H 1 - -/* Define if you have the header file. */ -#define HAVE_CURSES_H 1 - -/* Define if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the header file. */ -#define HAVE_LINK_H 1 - -/* Define if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_MALLOC_H */ - -/* Define if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the header file. */ -#define HAVE_NCURSES_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_NL_TYPES_H 1 - -/* Define if you have the header file. */ -#define HAVE_NLIST_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_OBJLIST_H */ - -/* Define if you have the header file. */ -#define HAVE_POLL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_PROC_SERVICE_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_PTRACE_H */ - -/* Define if you have the header file. */ -#define HAVE_SGTTY_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_DEBUGREG_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FAULT_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_FILIO_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PROCFS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PTRACE_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_REG_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SYSCALL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_USER_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the header file. */ -#define HAVE_TERM_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_TERMIO_H */ - -/* Define if you have the header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_THREAD_DB_H */ - -/* Define if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_VALUES_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_WAIT_H */ - -/* Define if you have the header file. */ -#define HAVE_WCHAR_H 1 - -/* Define if you have the header file. */ -#define HAVE_WCTYPE_H 1 - -/* Define if you have the dl library (-ldl). */ -/* #undef HAVE_LIBDL */ - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the socket library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Define if you have the w library (-lw). */ -/* #undef HAVE_LIBW */ - -/* Define if you have the stpcpy function */ -#define HAVE_STPCPY 1 - -/* Define if your locale.h file contains LC_MESSAGES. */ -#define HAVE_LC_MESSAGES 1 - -/* Define to 1 if NLS is requested */ -/* #define ENABLE_NLS 1 */ - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -/* #undef HAVE_GETTEXT */ - -/* Define if sigsetjmp is available. */ -#define HAVE_SIGSETJMP 1 - -/* Define if malloc is not declared in system header files. */ -/* #undef NEED_DECLARATION_MALLOC */ - -/* Define if realloc is not declared in system header files. */ -/* #undef NEED_DECLARATION_REALLOC */ - -/* Define if free is not declared in system header files. */ -/* #undef NEED_DECLARATION_FREE */ - -/* Define if strerror is not declared in system header files. */ -/* #undef NEED_DECLARATION_STRERROR */ - -/* Define if strdup is not declared in system header files. */ -/* #undef NEED_DECLARATION_STRDUP */ - -/* Define if strstr is not declared in system header files. */ -/* #undef NEED_DECLARATION_STRSTR */ - -/* Define if has pstatus_t. */ -/* #undef HAVE_PSTATUS_T */ - -/* Define if has prrun_t. */ -/* #undef HAVE_PRRUN_T */ - -/* Define if has gregset_t. */ -#ifndef CROSS_COMPILE -#define HAVE_GREGSET_T 1 -#endif - -/* Define if has fpregset_t. */ -#define HAVE_FPREGSET_T 1 - -/* Define if has prgregset_t. */ -/* #undef HAVE_PRGREGSET_T */ - -/* Define if has prfpregset_t. */ -#define HAVE_PRFPREGSET_T 1 - -/* Define if has prgregset32_t. */ -/* #undef HAVE_PRGREGSET32_T */ - -/* Define if has prfpregset32_t. */ -/* #undef HAVE_PRFPREGSET32_T */ - -/* Define if has lwpid_t. */ -/* #undef HAVE_LWPID_T */ - -/* Define if has psaddr_t. */ -/* #undef HAVE_PSADDR_T */ - -/* Define if has prsysent_t. */ -/* #undef HAVE_PRSYSENT_T */ - -/* Define if has pr_sigset_t. */ -/* #undef HAVE_PR_SIGSET_T */ - -/* Define if has pr_sigaction64_t. */ -/* #undef HAVE_PR_SIGACTION64_T */ - -/* Define if has pr_siginfo64_t. */ -/* #undef HAVE_PR_SIGINFO64_T */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h deleted file mode 100644 index 6b5cf20a8527..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h +++ /dev/null @@ -1,14 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_ALPHA_H -#define FBSD_KGDB_ALPHA_H - -#include "alpha/tm-fbsd.h" -#include "fbsd-kgdb.h" - -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(FRAME) \ - (kernel_debugging ? fbsd_kern_frame_saved_pc(FRAME) : \ - alpha_saved_pc_after_call(FRAME)) - -#endif /* FBSD_KGDB_ALPHA_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-amd64.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-amd64.h deleted file mode 100644 index ee62200abb77..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-amd64.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_AMD64_H -#define FBSD_KGDB_AMD64_H - -#include "fbsd-kgdb.h" - -#endif /* FBSD_KGDB_AMD64_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-arm.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-arm.h deleted file mode 100644 index 5896125f03c8..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-arm.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_ARM_H -#define FBSD_KGDB_ARM_H - -#include "fbsd-kgdb.h" - -#endif /* FBSD_KGDB_ARM_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h deleted file mode 100644 index 3196316d83b9..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_I386_H -#define FBSD_KGDB_I386_H - -#include "i386/tm-fbsd.h" -#include "fbsd-kgdb.h" - -/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */ -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(FRAME) \ - (kernel_debugging \ - ? fbsd_kern_frame_saved_pc (FRAME) \ - : i386bsd_frame_saved_pc (FRAME)) -extern CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *fr); - -/* Offset to saved PC in sigcontext, from . */ -/* DEO:XXX where is this really from??? */ -#define SIGCONTEXT_PC_OFFSET 20 - -#endif /* FBSD_KGDB_I386_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-ia64.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-ia64.h deleted file mode 100644 index 8f198fdfa1b3..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-ia64.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_IA64_H -#define FBSD_KGDB_IA64_H - -#include "fbsd-kgdb.h" - -#endif /* FBSD_KGDB_IA64_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-powerpc.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-powerpc.h deleted file mode 100644 index c6821e109e55..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-powerpc.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_POWERPC_H -#define FBSD_KGDB_POWERPC_H - -#include "fbsd-kgdb.h" - -#endif /* FBSD_KGDB_POWERPC_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-sparc64.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-sparc64.h deleted file mode 100644 index 56fd480deffa..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-sparc64.h +++ /dev/null @@ -1,9 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef FBSD_KGDB_SPARC64_H -#define FBSD_KGDB_SPARC64_H - -#include "sparc/tm-fbsd.h" -#include "fbsd-kgdb.h" - -#endif /* FBSD_KGDB_SPARC64_H */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb.h deleted file mode 100644 index e7744363106f..000000000000 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Native-kernel debugging definitions for FreeBSD. - * $FreeBSD$ - */ - -#ifndef FBSD_KGDB_H -#define FBSD_KGDB_H - -extern int kernel_debugging; -extern int kernel_writablecore; -extern struct target_so_ops kgdb_so_ops; - -#define ADDITIONAL_OPTIONS \ - {"kernel", no_argument, &kernel_debugging, 1}, \ - {"k", no_argument, &kernel_debugging, 1}, \ - {"wcore", no_argument, &kernel_writablecore, 1}, \ - {"w", no_argument, &kernel_writablecore, 1}, - -#define ADDITIONAL_OPTION_HELP \ - "\ - --kernel Enable kernel debugging.\n\ - --wcore Make core file writable (only works for /dev/mem).\n\ - This option only works while debugging a kernel !!\n\ -" - -#define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) " - -/* misuse START_PROGRESS to test whether we're running as kgdb */ -/* START_PROGRESS is called at the top of main */ -#undef START_PROGRESS -#define START_PROGRESS(STR,N) \ - if (!strcmp (STR, "kgdb")) \ - kernel_debugging = 1; - -#endif /* FBSD_KGDB_H */ diff --git a/gnu/usr.bin/binutils/gdb/freebsd-uthread.c b/gnu/usr.bin/binutils/gdb/freebsd-uthread.c deleted file mode 100644 index 0974c3ee04fc..000000000000 --- a/gnu/usr.bin/binutils/gdb/freebsd-uthread.c +++ /dev/null @@ -1,889 +0,0 @@ -/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger. - Copyright 1996, 1999 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* $FreeBSD$ */ - -/* This module implements a sort of half target that sits between the - machine-independent parts of GDB and the ptrace interface (infptrace.c) to - provide access to the FreeBSD user-mode thread implementation. - - FreeBSD threads are true user-mode threads, which are invoked via - the pthread_* interfaces. These are mostly implemented in - user-space, with all thread context kept in various structures that - live in the user's heap. For the most part, the kernel has no - knowlege of these threads. - - Based largely on hpux-thread.c - - */ - - -#include "defs.h" -#include -#include -#include -#include "gdbthread.h" -#include "target.h" -#include "inferior.h" -#include -#include -#include -#include -#include "gdbcore.h" - -extern int child_suppress_run; -extern struct target_ops child_ops; /* target vector for inftarg.c */ - -extern void _initialize_freebsd_uthread PARAMS ((void)); - -/* Set to true while we are part-way through attaching */ -static int freebsd_uthread_attaching; - -static int freebsd_uthread_active = 0; -static CORE_ADDR P_thread_list; -static CORE_ADDR P_thread_run; - -/* Pointer to the next function on the objfile event chain. */ -static void (*target_new_objfile_chain) (struct objfile *objfile); - -static void freebsd_uthread_resume PARAMS ((ptid_t pid, int step, - enum target_signal signo)); - -static void init_freebsd_uthread_ops PARAMS ((void)); - -static struct target_ops freebsd_uthread_ops; - -static ptid_t find_active_ptid PARAMS ((void)); - -struct cached_pthread { - u_int64_t uniqueid; - int state; - CORE_ADDR name; - union { - ucontext_t uc; - jmp_buf jb; - } ctx; -}; - -static ptid_t cached_ptid; -static struct cached_pthread cached_pthread; -static CORE_ADDR cached_pthread_addr; - -LIST_HEAD(idmaplist, idmap); - -struct idmap { - LIST_ENTRY(idmap) link; - u_int64_t uniqueid; - int tid; -}; - -#define MAPHASH_SIZE 257 -#define TID_MIN 1 -#define TID_MAX 16383 - -static int tid_to_hash[TID_MAX + 1]; /* set to map_hash index */ -static struct idmaplist map_hash[MAPHASH_SIZE]; -static int next_free_tid = TID_MIN; /* first available tid */ -static int last_free_tid = TID_MIN; /* first unavailable */ - -static CORE_ADDR P_thread_next_offset; -static CORE_ADDR P_thread_uniqueid_offset; -static CORE_ADDR P_thread_state_offset; -static CORE_ADDR P_thread_name_offset; -static CORE_ADDR P_thread_ctx_offset; -static CORE_ADDR P_thread_PS_RUNNING_value; -static CORE_ADDR P_thread_PS_DEAD_value; - -static int next_offset; -static int uniqueid_offset; -static int state_offset; -static int name_offset; -static int ctx_offset; -static int PS_RUNNING_value; -static int PS_DEAD_value; - -#define UNIQUEID_HASH(id) (id % MAPHASH_SIZE) -#define TID_ADD1(tid) (((tid) + 1) == TID_MAX + 1 \ - ? TID_MIN : (tid) + 1) -#define IS_TID_FREE(tid) (tid_to_hash[tid] == -1) - -static int -get_new_tid(int h) -{ - int tid = next_free_tid; - - tid_to_hash[tid] = h; - next_free_tid = TID_ADD1(next_free_tid); - if (next_free_tid == last_free_tid) - { - int i; - - for (i = last_free_tid; TID_ADD1(i) != last_free_tid; i = TID_ADD1(i)) - if (IS_TID_FREE(i)) - break; - if (TID_ADD1(i) == last_free_tid) - { - error("too many threads"); - return 0; - } - next_free_tid = i; - for (i = TID_ADD1(i); IS_TID_FREE(i); i = TID_ADD1(i)) - ; - last_free_tid = i; - } - - return tid; -} - -static ptid_t -find_ptid(u_int64_t uniqueid) -{ - int h = UNIQUEID_HASH(uniqueid); - struct idmap *im; - - LIST_FOREACH(im, &map_hash[h], link) - if (im->uniqueid == uniqueid) - return MERGEPID(PIDGET(inferior_ptid), im->tid); - - im = xmalloc(sizeof(struct idmap)); - im->uniqueid = uniqueid; - im->tid = get_new_tid(h); - LIST_INSERT_HEAD(&map_hash[h], im, link); - - return MERGEPID(PIDGET(inferior_ptid), im->tid); -} - -static void -free_ptid(ptid_t ptid) -{ - int tid = TIDGET(ptid); - int h = tid_to_hash[tid]; - struct idmap *im; - - if (!tid) return; - - LIST_FOREACH(im, &map_hash[h], link) - if (im->tid == tid) - break; - - if (!im) return; - - LIST_REMOVE(im, link); - tid_to_hash[tid] = -1; - free(im); -} - -#define READ_OFFSET(field) read_memory(P_thread_##field##_offset, \ - (char *) &field##_offset, \ - sizeof(field##_offset)) - -#define READ_VALUE(name) read_memory(P_thread_##name##_value, \ - (char *) &name##_value, \ - sizeof(name##_value)) - -static void -read_thread_offsets (void) -{ - READ_OFFSET(next); - READ_OFFSET(uniqueid); - READ_OFFSET(state); - READ_OFFSET(name); - READ_OFFSET(ctx); - - READ_VALUE(PS_RUNNING); - READ_VALUE(PS_DEAD); -} - -#define READ_FIELD(ptr, T, field, result) \ - read_memory ((ptr) + field##_offset, (char *) &(result), sizeof result) - -static u_int64_t -read_pthread_uniqueid (CORE_ADDR ptr) -{ - u_int64_t uniqueid; - READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid); - return uniqueid; -} - -static CORE_ADDR -read_pthread_next (CORE_ADDR ptr) -{ - CORE_ADDR next; - READ_FIELD(ptr, CORE_ADDR, next, next); - return next; -} - -static void -read_cached_pthread (CORE_ADDR ptr, struct cached_pthread *cache) -{ - READ_FIELD(ptr, u_int64_t, uniqueid, cache->uniqueid); - READ_FIELD(ptr, int, state, cache->state); - READ_FIELD(ptr, CORE_ADDR, name, cache->name); - READ_FIELD(ptr, ucontext_t, ctx, cache->ctx); -} - -static ptid_t -find_active_ptid (void) -{ - CORE_ADDR ptr; - - read_memory ((CORE_ADDR)P_thread_run, - (char *)&ptr, - sizeof ptr); - - return find_ptid(read_pthread_uniqueid(ptr)); -} - -static CORE_ADDR find_pthread_addr PARAMS ((ptid_t ptid)); -static struct cached_pthread * find_pthread PARAMS ((ptid_t ptid)); - -static CORE_ADDR -find_pthread_addr (ptid_t ptid) -{ - CORE_ADDR ptr; - - if (ptid_equal(ptid, cached_ptid)) - return cached_pthread_addr; - - read_memory ((CORE_ADDR)P_thread_list, - (char *)&ptr, - sizeof ptr); - - while (ptr != 0) - { - if (ptid_equal(find_ptid(read_pthread_uniqueid(ptr)), ptid)) - { - cached_ptid = ptid; - cached_pthread_addr = ptr; - read_cached_pthread(ptr, &cached_pthread); - return ptr; - } - ptr = read_pthread_next(ptr); - } - - return NULL; -} - -static struct cached_pthread * -find_pthread (ptid_t ptid) -{ - CORE_ADDR ptr; - - if (ptid_equal(ptid, cached_ptid)) - return &cached_pthread; - - read_memory ((CORE_ADDR)P_thread_list, - (char *)&ptr, - sizeof ptr); - - while (ptr != 0) - { - if (ptid_equal(find_ptid(read_pthread_uniqueid(ptr)), ptid)) - { - cached_ptid = ptid; - cached_pthread_addr = ptr; - read_cached_pthread(ptr, &cached_pthread); - return &cached_pthread; - } - ptr = read_pthread_next(ptr); - } - -#if 0 - error ("Can't find pthread %d,%d", PIDGET(ptid), TIDGET(ptid)); -#endif - return NULL; -} - - -/* Most target vector functions from here on actually just pass through to - inftarg.c, as they don't need to do anything specific for threads. */ - -/* ARGSUSED */ -static void -freebsd_uthread_open (char *arg, int from_tty) -{ - child_ops.to_open (arg, from_tty); -} - -/* Attach to process PID, then initialize for debugging it - and wait for the trace-trap that results from attaching. */ - -static void -freebsd_uthread_attach (char *args, int from_tty) -{ - child_ops.to_attach (args, from_tty); - push_target (&freebsd_uthread_ops); - freebsd_uthread_attaching = 1; -} - -/* After an attach, see if the target is threaded */ - -static void -freebsd_uthread_post_attach (int pid) -{ - if (freebsd_uthread_active) - { - read_thread_offsets (); - inferior_ptid = find_active_ptid (); - add_thread (inferior_ptid); - } - else - { - unpush_target (&freebsd_uthread_ops); - push_target (&child_ops); - } - - freebsd_uthread_attaching = 0; -} - -/* Take a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We'd better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via the normal ptrace (PTRACE_TRACEME). */ - -static void -freebsd_uthread_detach (char *args, int from_tty) -{ - child_ops.to_detach (args, from_tty); -} - -/* Resume execution of process PID. If STEP is nozero, then - just single step it. If SIGNAL is nonzero, restart it with that - signal activated. We may have to convert pid from a thread-id to an LWP id - for procfs. */ - -static void -freebsd_uthread_resume (ptid_t ptid, int step, enum target_signal signo) -{ - if (freebsd_uthread_attaching) - { - child_ops.to_resume (ptid, step, signo); - return; - } - - child_ops.to_resume (ptid, step, signo); - cached_ptid = MERGEPID(0, 0); -} - -/* Wait for any threads to stop. We may have to convert PID from a thread id - to a LWP id, and vice versa on the way out. */ - -static ptid_t -freebsd_uthread_wait (ptid_t ptid, struct target_waitstatus *ourstatus) -{ - ptid_t rtnval; - - if (freebsd_uthread_attaching) - { - return child_ops.to_wait (ptid, ourstatus); - } - - rtnval = child_ops.to_wait (ptid, ourstatus); - - if (PIDGET(rtnval) >= 0) - { - rtnval = find_active_ptid (); - if (!in_thread_list (rtnval)) - add_thread (rtnval); - } - - return rtnval; -} - -/* XXX: this needs to be selected by target, not [build] host */ -#ifdef __i386__ - -static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */ -{ - 6, /* eax */ - -1, /* ecx */ - -1, /* edx */ - 1, /* ebx */ - 2, /* esp */ - 3, /* ebp */ - 4, /* esi */ - 5, /* edi */ - 0, /* eip */ - -1, /* eflags */ - -1, /* cs */ - -1, /* ss */ - -1, /* ds */ - -1, /* es */ - -1, /* fs */ - -1, /* gs */ - -1, -1, -1, -1, -1, -1, -1, /* st0-st7 */ - -1, -1, -1, -1, -1, -1, -1, /* fctrl-fop */ - -1, -1, -1, -1, -1, -1, -1, /* xmm0-xmm7 */ - -1, /* mxcsr */ -}; - -#endif - -#ifdef __alpha__ - -static char jmpmap[NUM_REGS] = { - 4, 5, 6, 7, 8, 9, 10, 11, /* v0 - t6 */ - 12, 13, 14, 15, 16, 17, 18, 19, /* t7 - fp */ - 20, 21, 22, 23, 24, 25, 26, 27, /* a0 - t9 */ - 28, 29, 30, 31, 32, 33, 34, 35, /* t10 - zero */ - 37, 38, 39, 40, 41, 42, 43, 44, /* f0 - f7 */ - 45, 46, 47, 48, 49, 50, 51, 52, /* f8 - f15 */ - 53, 54, 55, 56, 57, 58, 59, 60, /* f16 - f23 */ - 61, 62, 63, 64, 65, 66, 67, 68, /* f24 - f31 */ - 2, -1, /* pc, vfp */ -}; - -#endif - -#ifdef __sparc64__ - -static char jmpmap[125] = { - -1 -}; - -#endif - -static void -freebsd_uthread_fetch_registers (int regno) -{ - struct cached_pthread *thread; - int active; - int first_regno, last_regno; - register_t *regbase; - char *regmap; - - if (freebsd_uthread_attaching || TIDGET(inferior_ptid) == 0) - { - child_ops.to_fetch_registers (regno); - return; - } - - thread = find_pthread (inferior_ptid); - active = (ptid_equal(inferior_ptid, find_active_ptid())); - - if (active) - { - child_ops.to_fetch_registers (regno); - return; - } - - if (regno == -1) - { - first_regno = 0; - last_regno = NUM_REGS - 1; - } - else - { - first_regno = regno; - last_regno = regno; - } - - regbase = (register_t*) &thread->ctx.jb[0]; - regmap = jmpmap; - - for (regno = first_regno; regno <= last_regno; regno++) - { - if (regmap[regno] == -1) - child_ops.to_fetch_registers (regno); - else - if (thread) - supply_register (regno, (char*) ®base[regmap[regno]]); - else - supply_register (regno, NULL); - } -} - -static void -freebsd_uthread_store_registers (int regno) -{ - struct cached_pthread *thread; - CORE_ADDR ptr; - int first_regno, last_regno; - u_int32_t *regbase; - char *regmap; - - if (freebsd_uthread_attaching) - { - child_ops.to_store_registers (regno); - return; - } - - thread = find_pthread (inferior_ptid); - - if (thread->state == PS_RUNNING_value) - { - child_ops.to_store_registers (regno); - return; - } - - if (regno == -1) - { - first_regno = 0; - last_regno = NUM_REGS - 1; - } - else - { - first_regno = regno; - last_regno = regno; - } - - regbase = (u_int32_t*) &thread->ctx.jb[0]; - regmap = jmpmap; - - ptr = find_pthread_addr (inferior_ptid); - for (regno = first_regno; regno <= last_regno; regno++) - { - if (regmap[regno] == -1) - child_ops.to_store_registers (regno); - else - { - u_int32_t *reg = ®base[regmap[regno]]; - int off; - - /* Hang onto cached value */ - memcpy(reg, registers + REGISTER_BYTE (regno), - REGISTER_RAW_SIZE (regno)); - - /* And push out to inferior */ - off = (char *) reg - (char *) thread; - write_memory (ptr + off, - registers + REGISTER_BYTE (regno), - REGISTER_RAW_SIZE (regno)); - } - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -freebsd_uthread_prepare_to_store (void) -{ - child_ops.to_prepare_to_store (); -} - -static int -freebsd_uthread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, - int dowrite, struct mem_attrib *attrib, - struct target_ops *target) -{ - return child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, - attrib, target); -} - -/* Print status information about what we're accessing. */ - -static void -freebsd_uthread_files_info (struct target_ops *ignore) -{ - child_ops.to_files_info (ignore); -} - -static void -freebsd_uthread_kill_inferior (void) -{ - child_ops.to_kill (); -} - -static void -freebsd_uthread_notice_signals (ptid_t ptid) -{ - child_ops.to_notice_signals (ptid); -} - -/* Fork an inferior process, and start debugging it with /proc. */ - -static void -freebsd_uthread_create_inferior (char *exec_file, char *allargs, char **env) -{ - child_ops.to_create_inferior (exec_file, allargs, env); - - if (PIDGET(inferior_ptid) && freebsd_uthread_active) - { - read_thread_offsets (); - push_target (&freebsd_uthread_ops); - inferior_ptid = find_active_ptid (); - add_thread (inferior_ptid); - } -} - -/* This routine is called to find out if the inferior is using threads. - We check for the _thread_run and _thread_list globals. */ - -void -freebsd_uthread_new_objfile (struct objfile *objfile) -{ - struct minimal_symbol *ms; - - if (!objfile) - { - freebsd_uthread_active = 0; - return; - } - - ms = lookup_minimal_symbol ("_thread_run", NULL, objfile); - - if (!ms) - return; - - P_thread_run = SYMBOL_VALUE_ADDRESS (ms); - - ms = lookup_minimal_symbol ("_thread_list", NULL, objfile); - - if (!ms) - return; - - P_thread_list = SYMBOL_VALUE_ADDRESS (ms); - -#define OFFSET_SYM(field) "_thread_" #field "_offset" -#define LOOKUP_OFFSET(field) \ - do { \ - ms = lookup_minimal_symbol (OFFSET_SYM(field), NULL, objfile); \ - if (!ms) \ - return; \ - P_thread_##field##_offset = SYMBOL_VALUE_ADDRESS (ms); \ - } while (0); - -#define VALUE_SYM(name) "_thread_" #name "_value" -#define LOOKUP_VALUE(name) \ - do { \ - ms = lookup_minimal_symbol (VALUE_SYM(name), NULL, objfile); \ - if (!ms) \ - return; \ - P_thread_##name##_value = SYMBOL_VALUE_ADDRESS (ms); \ - } while (0); - - LOOKUP_OFFSET(next); - LOOKUP_OFFSET(uniqueid); - LOOKUP_OFFSET(state); - LOOKUP_OFFSET(name); - LOOKUP_OFFSET(ctx); - - LOOKUP_VALUE(PS_RUNNING); - LOOKUP_VALUE(PS_DEAD); - - freebsd_uthread_active = 1; -} - -/* Clean up after the inferior dies. */ - -static void -freebsd_uthread_mourn_inferior () -{ - child_ops.to_mourn_inferior (); - unpush_target (&freebsd_uthread_ops); -} - -/* Mark our target-struct as eligible for stray "run" and "attach" commands. */ - -static int -freebsd_uthread_can_run () -{ - return child_suppress_run; -} - -static int -freebsd_uthread_thread_alive (ptid_t ptid) -{ - struct cached_pthread *thread; - int ret = 0; - - if (freebsd_uthread_attaching) - return 1; - - /* - * We can get called from child_ops.to_wait() which passes the underlying - * pid (without a thread number). - */ - if (TIDGET(ptid) == 0) - return 1; - - if (find_pthread_addr (ptid) != 0) - { - thread = find_pthread (ptid); - ret = (thread->state != PS_DEAD_value); - } - - if (!ret) - free_ptid(ptid); - - return ret; -} - -static void -freebsd_uthread_stop (void) -{ - child_ops.to_stop (); -} - -static void -freebsd_uthread_find_new_threads (void) -{ - CORE_ADDR ptr; - int state; - u_int64_t uniqueid; - - read_memory ((CORE_ADDR)P_thread_list, - (char *)&ptr, - sizeof ptr); - - while (ptr != 0) - { - READ_FIELD(ptr, int, state, state); - READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid); - if (state != PS_DEAD_value && - !in_thread_list (find_ptid(uniqueid))) - add_thread (find_ptid(uniqueid)); - ptr = read_pthread_next(ptr); - } -} - -/* MUST MATCH enum pthread_state */ -static const char *statenames[] = { - "RUNNING", - "SIGTHREAD", - "MUTEX_WAIT", - "COND_WAIT", - "FDLR_WAIT", - "FDLW_WAIT", - "FDR_WAIT", - "FDW_WAIT", - "POLL_WAIT", - "FILE_WAIT", - "SELECT_WAIT", - "SLEEP_WAIT", - "WAIT_WAIT", - "SIGSUSPEND", - "SIGWAIT", - "SPINBLOCK", - "JOIN", - "SUSPENDED", - "DEAD", - "DEADLOCK", -}; - -#if 0 - -static int -freebsd_uthread_get_thread_info (ref, selection, info) - gdb_threadref *ref; - int selection; - struct gdb_ext_thread_info *info; -{ - int pid = *ref; - struct cached_pthread *thread = find_pthread (pid); - struct cleanup *old_chain; - - old_chain = save_inferior_pid (); - inferior_pid = main_pid; - - memset(&info->threadid, 0, OPAQUETHREADBYTES); - - memcpy(&info->threadid, ref, sizeof *ref); - info->active = thread->state == PS_RUNNING_value; - strcpy(info->display, statenames[thread->state]); - if (thread->name) - read_memory ((CORE_ADDR) thread->name, info->shortname, 32); - else - strcpy(info->shortname, ""); - - do_cleanups (old_chain); - return (0); -} - -#endif - -char * -freebsd_uthread_pid_to_str (ptid_t ptid) -{ - static char buf[30]; - - if (STREQ (current_target.to_shortname, "freebsd-uthreads")) - sprintf (buf, "Process %d, Thread %ld", - PIDGET(ptid), TIDGET(ptid)); - else - sprintf (buf, "Process %d", PIDGET(ptid)); - - return buf; -} - - -static void -init_freebsd_uthread_ops () -{ - freebsd_uthread_ops.to_shortname = "freebsd-uthreads"; - freebsd_uthread_ops.to_longname = "FreeBSD uthreads"; - freebsd_uthread_ops.to_doc = "FreeBSD user threads support."; - freebsd_uthread_ops.to_open = freebsd_uthread_open; - freebsd_uthread_ops.to_attach = freebsd_uthread_attach; - freebsd_uthread_ops.to_post_attach = freebsd_uthread_post_attach; - freebsd_uthread_ops.to_detach = freebsd_uthread_detach; - freebsd_uthread_ops.to_resume = freebsd_uthread_resume; - freebsd_uthread_ops.to_wait = freebsd_uthread_wait; - freebsd_uthread_ops.to_fetch_registers = freebsd_uthread_fetch_registers; - freebsd_uthread_ops.to_store_registers = freebsd_uthread_store_registers; - freebsd_uthread_ops.to_prepare_to_store = freebsd_uthread_prepare_to_store; - freebsd_uthread_ops.to_xfer_memory = freebsd_uthread_xfer_memory; - freebsd_uthread_ops.to_files_info = freebsd_uthread_files_info; - freebsd_uthread_ops.to_insert_breakpoint = memory_insert_breakpoint; - freebsd_uthread_ops.to_remove_breakpoint = memory_remove_breakpoint; - freebsd_uthread_ops.to_terminal_init = terminal_init_inferior; - freebsd_uthread_ops.to_terminal_inferior = terminal_inferior; - freebsd_uthread_ops.to_terminal_ours_for_output = terminal_ours_for_output; - freebsd_uthread_ops.to_terminal_ours = terminal_ours; - freebsd_uthread_ops.to_terminal_info = child_terminal_info; - freebsd_uthread_ops.to_kill = freebsd_uthread_kill_inferior; - freebsd_uthread_ops.to_create_inferior = freebsd_uthread_create_inferior; - freebsd_uthread_ops.to_mourn_inferior = freebsd_uthread_mourn_inferior; - freebsd_uthread_ops.to_can_run = freebsd_uthread_can_run; - freebsd_uthread_ops.to_notice_signals = freebsd_uthread_notice_signals; - freebsd_uthread_ops.to_thread_alive = freebsd_uthread_thread_alive; - freebsd_uthread_ops.to_stop = freebsd_uthread_stop; - freebsd_uthread_ops.to_stratum = process_stratum; - freebsd_uthread_ops.to_has_all_memory = 1; - freebsd_uthread_ops.to_has_memory = 1; - freebsd_uthread_ops.to_has_stack = 1; - freebsd_uthread_ops.to_has_registers = 1; - freebsd_uthread_ops.to_has_execution = 1; - freebsd_uthread_ops.to_has_thread_control = 0; - freebsd_uthread_ops.to_magic = OPS_MAGIC; - freebsd_uthread_ops.to_find_new_threads = freebsd_uthread_find_new_threads; - freebsd_uthread_ops.to_pid_to_str = freebsd_uthread_pid_to_str; -#if 0 - freebsd_uthread_vec.get_thread_info = freebsd_uthread_get_thread_info; -#endif -} - -void -_initialize_freebsd_uthread () -{ - init_freebsd_uthread_ops (); - add_target (&freebsd_uthread_ops); - - target_new_objfile_chain = target_new_objfile_hook; - target_new_objfile_hook = freebsd_uthread_new_objfile; - - child_suppress_run = 1; -} diff --git a/gnu/usr.bin/binutils/gdb/gdb.1 b/gnu/usr.bin/binutils/gdb/gdb.1 deleted file mode 100644 index b6cd3cc47d76..000000000000 --- a/gnu/usr.bin/binutils/gdb/gdb.1 +++ /dev/null @@ -1,385 +0,0 @@ -.\" Copyright (c) 1991 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.\" $FreeBSD$ -.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools" -.SH NAME -gdb \- The GNU Debugger -.SH SYNOPSIS -.na -.TP -.B gdb -.RB "[\|" \-help "\|]" -.RB "[\|" \-nx "\|]" -.RB "[\|" \-q "\|]" -.RB "[\|" \-batch "\|]" -.RB "[\|" \-cd=\c -.I dir\c -\|] -.RB "[\|" \-f "\|]" -.RB "[\|" \-k "\|]" -.RB "[\|" \-wcore "\|]" -.RB "[\|" "\-b\ "\c -.IR bps "\|]" -.RB "[\|" "\-tty="\c -.IR dev "\|]" -.RB "[\|" "\-s "\c -.I symfile\c -\&\|] -.RB "[\|" "\-e "\c -.I prog\c -\&\|] -.RB "[\|" "\-se "\c -.I prog\c -\&\|] -.RB "[\|" "\-c "\c -.I core\c -\&\|] -.RB "[\|" "\-x "\c -.I cmds\c -\&\|] -.RB "[\|" "\-d "\c -.I dir\c -\&\|] -.RB "[\|" \c -.I prog\c -.RB "[\|" \c -.IR core \||\| procID\c -\&\|]\&\|] -.ad b -.SH DESCRIPTION -The purpose of a debugger such as GDB is to allow you to see what is -going on ``inside'' another program while it executes\(em\&or what another -program was doing at the moment it crashed. - -GDB can do four main kinds of things (plus other things in support of -these) to help you catch bugs in the act: - -.TP -\ \ \ \(bu -Start your program, specifying anything that might affect its behavior. - -.TP -\ \ \ \(bu -Make your program stop on specified conditions. - -.TP -\ \ \ \(bu -Examine what has happened, when your program has stopped. - -.TP -\ \ \ \(bu -Change things in your program, so you can experiment with correcting the -effects of one bug and go on to learn about another. -.PP - -You can use GDB to debug programs written in C, C++, and Modula-2. -Fortran support will be added when a GNU Fortran compiler is ready. - -GDB is invoked with the shell command \c -.B gdb\c -\&. Once started, it reads -commands from the terminal until you tell it to exit with the GDB -command \c -.B quit\c -\&. You can get online help from \c -.B gdb\c -\& itself -by using the command \c -.B help\c -\&. - -You can run \c -.B gdb\c -\& with no arguments or options; but the most -usual way to start GDB is with one argument or two, specifying an -executable program as the argument: -.sp -.br -gdb\ program -.br -.sp - -You can also start with both an executable program and a core file specified: -.sp -.br -gdb\ program\ core -.br -.sp - -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: -.sp -.br -gdb\ program\ 1234 -.br -.sp - -would attach GDB to process \c -.B 1234\c -\& (unless you also have a file -named `\|\c -.B 1234\c -\&\|'; GDB does check for a core file first). - -Here are some of the most frequently needed GDB commands: -.TP -.B break \fR[\|\fIfile\fB:\fR\|]\fIfunction -\& -Set a breakpoint at \c -.I function\c -\& (in \c -.I file\c -\&). -.TP -.B run \fR[\|\fIarglist\fR\|] -Start your program (with \c -.I arglist\c -\&, if specified). -.TP -.B bt -Backtrace: display the program stack. -.TP -.BI print " expr"\c -\& -Display the value of an expression. -.TP -.B c -Continue running your program (after stopping, e.g. at a breakpoint). -.TP -.B next -Execute next program line (after stopping); step \c -.I over\c -\& any -function calls in the line. -.TP -.B step -Execute next program line (after stopping); step \c -.I into\c -\& any -function calls in the line. -.TP -.B help \fR[\|\fIname\fR\|] -Show information about GDB command \c -.I name\c -\&, or general information -about using GDB. -.TP -.B quit -Exit from GDB. -.PP -For full details on GDB, see \c -.I -Using GDB: A Guide to the GNU Source-Level Debugger\c -\&, by Richard M. Stallman and Roland H. Pesch. The same text is available online -as the \c -.B gdb\c -\& entry in the \c -.B info\c -\& program. -.SH OPTIONS -Any arguments other than options specify an executable -file and core file (or process ID); that is, the first argument -encountered with no -associated option flag is equivalent to a `\|\c -.B \-se\c -\&\|' option, and the -second, if any, is equivalent to a `\|\c -.B \-c\c -\&\|' option if it's the name of a file. Many options have -both long and short forms; both are shown here. The long forms are also -recognized if you truncate them, so long as enough of the option is -present to be unambiguous. (If you prefer, you can flag option -arguments with `\|\c -.B +\c -\&\|' rather than `\|\c -.B \-\c -\&\|', though we illustrate the -more usual convention.) - -All the options and command line arguments you give are processed -in sequential order. The order makes a difference when the -`\|\c -.B \-x\c -\&\|' option is used. - -.TP -.B \-help -.TP -.B \-h -List all options, with brief explanations. - -.TP -.BI "\-symbols=" "file"\c -.TP -.BI "\-s " "file"\c -\& -Read symbol table from file \c -.I file\c -\&. - -.TP -.BI "\-exec=" "file"\c -.TP -.BI "\-e " "file"\c -\& -Use file \c -.I file\c -\& as the executable file to execute when -appropriate, and for examining pure data in conjunction with a core -dump. - -.TP -.BI "\-se=" "file"\c -\& -Read symbol table from file \c -.I file\c -\& and use it as the executable -file. - -.TP -.BI "\-core=" "file"\c -.TP -.BI "\-c " "file"\c -\& -Use file \c -.I file\c -\& as a core dump to examine. - -.TP -.BI "\-command=" "file"\c -.TP -.BI "\-x " "file"\c -\& -Execute GDB commands from file \c -.I file\c -\&. - -.TP -.BI "\-directory=" "directory"\c -.TP -.BI "\-d " "directory"\c -\& -Add \c -.I directory\c -\& to the path to search for source files. -.PP - -.TP -.B \-nx -.TP -.B \-n -Do not execute commands from any `\|\c -.B .gdbinit\c -\&\|' initialization files. -Normally, the commands in these files are executed after all the -command options and arguments have been processed. - - -.TP -.B \-quiet -.TP -.B \-q -``Quiet''. Do not print the introductory and copyright messages. These -messages are also suppressed in batch mode. - -.TP -.B \-batch -Run in batch mode. Exit with status \c -.B 0\c -\& after processing all the command -files specified with `\|\c -.B \-x\c -\&\|' (and `\|\c -.B .gdbinit\c -\&\|', if not inhibited). -Exit with nonzero status if an error occurs in executing the GDB -commands in the command files. - -Batch mode may be useful for running GDB as a filter, for example to -download and run a program on another computer; in order to make this -more useful, the message -.sp -.br -Program\ exited\ normally. -.br -.sp - -(which is ordinarily issued whenever a program running under GDB control -terminates) is not issued when running in batch mode. - -.TP -.BI "\-cd=" "directory"\c -\& -Run GDB using \c -.I directory\c -\& as its working directory, -instead of the current directory. - -.TP -.B \-fullname -.TP -.B \-f -Emacs sets this option when it runs GDB as a subprocess. It tells GDB -to output the full file name and line number in a standard, -recognizable fashion each time a stack frame is displayed (which -includes each time the program stops). This recognizable format looks -like two `\|\c -.B \032\c -\&\|' characters, followed by the file name, line number -and character position separated by colons, and a newline. The -Emacs-to-GDB interface program uses the two `\|\c -.B \032\c -\&\|' characters as -a signal to display the source code for the frame. - -.TP -.B \-kernel -.TP -.B \-k -Use gdb in kernel debugging mode. The prompt is set to ``(kgdb)''. - -.TP -.B \-wcore -This option may only be used in kernel debugging mode while -debugging a ``live'' kernel and makes the corefile (/dev/mem) -writable. - -.TP -.BI "\-b " "bps"\c -\& -Set the line speed (baud rate or bits per second) of any serial -interface used by GDB for remote debugging. - -.TP -.BI "\-tty=" "device"\c -\& -Run using \c -.I device\c -\& for your program's standard input and output. -.PP - -.SH "SEE ALSO" -.RB "`\|" gdb "\|'" -entry in -.B info\c -\&; -.I -Using GDB: A Guide to the GNU Source-Level Debugger\c -, Richard M. Stallman and Roland H. Pesch, July 1991. -.SH COPYING -Copyright (c) 1991 Free Software Foundation, Inc. -.PP -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. -.PP -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. -.PP -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be included in -translations approved by the Free Software Foundation instead of in -the original English. diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd-alpha.h b/gnu/usr.bin/binutils/gdb/kvm-fbsd-alpha.h deleted file mode 100644 index 11260acec53a..000000000000 --- a/gnu/usr.bin/binutils/gdb/kvm-fbsd-alpha.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/Alpha. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#include "alpha/tm-alpha.h" - -#ifndef S0_REGNUM -#define S0_REGNUM (T7_REGNUM+1) -#endif - -static void -fetch_kcore_registers (struct pcb *pcbp) -{ - - /* First clear out any garbage. */ - memset (registers, '\0', REGISTER_BYTES); - - /* SP */ - *(long *) ®isters[REGISTER_BYTE (SP_REGNUM)] = - pcbp->pcb_hw.apcb_ksp; - - /* S0 through S6 */ - memcpy (®isters[REGISTER_BYTE (S0_REGNUM)], - &pcbp->pcb_context[0], 7 * sizeof (long)); - - /* PC */ - *(long *) ®isters[REGISTER_BYTE (PC_REGNUM)] = - pcbp->pcb_context[7]; - - registers_fetched (); -} - -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR this_saved_pc; - - this_saved_pc = alpha_frame_saved_pc (fi); - - sym = lookup_minimal_symbol_by_pc (this_saved_pc); - - if (sym != NULL && - (strcmp (SYMBOL_NAME (sym), "XentArith") == 0 || - strcmp (SYMBOL_NAME (sym), "XentIF") == 0 || - strcmp (SYMBOL_NAME (sym), "XentInt") == 0 || - strcmp (SYMBOL_NAME (sym), "XentMM") == 0 || - strcmp (SYMBOL_NAME (sym), "XentSys") == 0 || - strcmp (SYMBOL_NAME (sym), "XentUna") == 0 || - strcmp (SYMBOL_NAME (sym), "XentRestart") == 0)) - { - return (read_memory_integer (fi->frame + 32 * 8, 8)); - } - else - { - return (this_saved_pc); - } -} diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd-i386.h b/gnu/usr.bin/binutils/gdb/kvm-fbsd-i386.h deleted file mode 100644 index b7e4a204108d..000000000000 --- a/gnu/usr.bin/binutils/gdb/kvm-fbsd-i386.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/i386. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#include - -static CORE_ADDR -ksym_maxuseraddr (void) -{ - static CORE_ADDR maxuseraddr; - struct minimal_symbol *sym; - - if (maxuseraddr == 0) - { - sym = lookup_minimal_symbol ("PTmap", NULL, NULL); - if (sym == NULL) { - maxuseraddr = VM_MAXUSER_ADDRESS; - } else { - maxuseraddr = SYMBOL_VALUE_ADDRESS (sym); - } - } - return maxuseraddr; -} - - -/* Symbol names of kernel entry points. Use special frames. */ -#define KSYM_TRAP "calltrap" -#define KSYM_INTR "Xintr" -#define KSYM_FASTINTR "Xfastintr" -#define KSYM_OLDSYSCALL "Xlcall_syscall" -#define KSYM_SYSCALL "Xint0x80_syscall" - -/* The following is FreeBSD-specific hackery to decode special frames - and elide the assembly-language stub. This could be made faster by - defining a frame_type field in the machine-dependent frame information, - but we don't think that's too important right now. */ -enum frametype { tf_normal, tf_trap, tf_interrupt, tf_syscall }; - -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR this_saved_pc; - enum frametype frametype; - - this_saved_pc = read_memory_integer (fi->frame + 4, 4); - sym = lookup_minimal_symbol_by_pc (this_saved_pc); - frametype = tf_normal; - if (sym != NULL) - { - if (strcmp (SYMBOL_NAME (sym), KSYM_TRAP) == 0) - frametype = tf_trap; - else - if (strncmp (SYMBOL_NAME (sym), KSYM_INTR, - strlen (KSYM_INTR)) == 0 || strncmp (SYMBOL_NAME(sym), - KSYM_FASTINTR, strlen (KSYM_FASTINTR)) == 0) - frametype = tf_interrupt; - else - if (strcmp (SYMBOL_NAME (sym), KSYM_SYSCALL) == 0 || - strcmp (SYMBOL_NAME (sym), KSYM_OLDSYSCALL) == 0) - frametype = tf_syscall; - } - - switch (frametype) - { - case tf_normal: - return (this_saved_pc); -#define oEIP offsetof (struct trapframe, tf_eip) - - case tf_trap: - return (read_memory_integer (fi->frame + 8 + oEIP, 4)); - - case tf_interrupt: - return (read_memory_integer (fi->frame + 12 + oEIP, 4)); - - case tf_syscall: - return (read_memory_integer (fi->frame + 8 + oEIP, 4)); -#undef oEIP - } -} - -static void -fetch_kcore_registers (struct pcb *pcb) -{ - int i; - int noreg; - - /* Get the register values out of the sys pcb and store them where - `read_register' will find them. */ - /* - * XXX many registers aren't available. - * XXX for the non-core case, the registers are stale - they are for - * the last context switch to the debugger. - * XXX gcc's register numbers aren't all #defined in tm-i386.h. - */ - noreg = 0; - for (i = 0; i < 3; ++i) /* eax,ecx,edx */ - supply_register (i, (char *)&noreg); - - supply_register (3, (char *) &pcb->pcb_ebx); - supply_register (SP_REGNUM, (char *) &pcb->pcb_esp); - supply_register (FP_REGNUM, (char *) &pcb->pcb_ebp); - supply_register (6, (char *) &pcb->pcb_esi); - supply_register (7, (char *) &pcb->pcb_edi); - supply_register (PC_REGNUM, (char *) &pcb->pcb_eip); - - for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es, fs */ - supply_register (i, (char *) &noreg); - supply_register (15, (char *) &pcb->pcb_gs); - - /* XXX 80387 registers? */ -} diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd-sparc64.h b/gnu/usr.bin/binutils/gdb/kvm-fbsd-sparc64.h deleted file mode 100644 index 52ed91cf0938..000000000000 --- a/gnu/usr.bin/binutils/gdb/kvm-fbsd-sparc64.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/sparc64. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#define SPARC_INTREG_SIZE 8 - -static void -fetch_kcore_registers (struct pcb *pcbp) -{ - static struct frame top; - CORE_ADDR f_addr; - int i; - - /* Get the register values out of the sys pcb and store them where - `read_register' will find them. */ - /* - * XXX many registers aren't available. - * XXX for the non-core case, the registers are stale - they are for - * the last context switch to the debugger. - * XXX do something with the floating-point registers? - */ - supply_register (SP_REGNUM, (char *)&pcbp->pcb_ufp); - supply_register (PC_REGNUM, (char *)&pcbp->pcb_pc); - f_addr = extract_address (&pcbp->pcb_ufp, SPARC_INTREG_SIZE); - /* Load the previous frame by hand (XXX) and supply it. */ - read_memory (f_addr + SPOFF, (char *)&top, sizeof (top)); - for (i = 0; i < 8; i++) - supply_register (i + L0_REGNUM, (char *)&top.fr_local[i]); - for (i = 0; i < 8; i++) - supply_register (i + I0_REGNUM, (char *)&top.fr_in[i]); -} - -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR frame, pc_addr, pc; - char *buf; - - buf = alloca (MAX_REGISTER_RAW_SIZE); - /* XXX: duplicates fi->extra_info->bottom. */ - frame = (fi->next != NULL) ? fi->next->frame : read_sp (); - pc_addr = frame + offsetof (struct frame, fr_in[7]); - -#define READ_PC(pc, a, b) do { \ - read_memory (a, b, SPARC_INTREG_SIZE); \ - pc = extract_address (b, SPARC_INTREG_SIZE); \ -} while (0) - - READ_PC (pc, pc_addr, buf); - - sym = lookup_minimal_symbol_by_pc (pc); - if (sym != NULL) - { - if (strncmp (SYMBOL_NAME (sym), "tl0_", 4) == 0 || - strcmp (SYMBOL_NAME (sym), "btext") == 0 || - strcmp (SYMBOL_NAME (sym), "mp_startup") == 0 || - strcmp (SYMBOL_NAME (sym), "fork_trampoline") == 0) - { - /* - * Ugly kluge: user space addresses aren't separated from kernel - * ones by range; if encountering a trap from user space, just - * return a 0 to stop the trace. - * Do the same for entry points of kernel processes to avoid - * printing garbage. - */ - pc = 0; - } - if (strncmp (SYMBOL_NAME (sym), "tl1_", 4) == 0) - { - pc_addr = fi->frame + sizeof (struct frame) + - offsetof (struct trapframe, tf_tpc); - READ_PC (pc, pc_addr, buf); - } - } - return (pc); -} diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c deleted file mode 100644 index 93395a7f9040..000000000000 --- a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c +++ /dev/null @@ -1,502 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include -__FBSDID("$FreeBSD$"); - -/* - * This works like "remote" but, you use it like this: - * target kcore /dev/mem - * or - * target kcore /var/crash/host/core.0 - * - * This way makes it easy to short-circut the whole bfd monster, - * and direct the inferior stuff to our libkvm implementation. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "defs.h" -#include -#include "gdb_string.h" -#include "frame.h" /* required by inferior.h */ -#include "inferior.h" -#include "symfile.h" -#include "objfiles.h" -#include "command.h" -#include "bfd.h" -#include "gdbcore.h" -#include "solist.h" - -#include "kvm-fbsd-machine.h" - -static void -kcore_files_info (struct target_ops *); - -static void -kcore_close (int); - -static void -get_kcore_registers (int); - -static int -xfer_umem (CORE_ADDR, char *, int, int); - -#ifdef SOLIB_ADD -static int kcore_solib_add_stub (PTR); -#endif - -static char *core_file; -static kvm_t *core_kd; -static struct pcb cur_pcb; -static struct kinfo_proc *cur_proc; - -static struct target_ops kcore_ops; - -int kernel_debugging; -int kernel_writablecore; - -/* Read the "thing" at kernel address 'addr' into the space pointed to - by point. The length of the "thing" is determined by the type of p. - Result is non-zero if transfer fails. */ - -#define kvread(addr, p) \ - (target_read_memory ((CORE_ADDR) (addr), (char *) (p), sizeof (*(p)))) - -static CORE_ADDR -ksym_kernbase (void) -{ - static CORE_ADDR kernbase; - struct minimal_symbol *sym; - - if (kernbase == 0) - { - sym = lookup_minimal_symbol ("kernbase", NULL, NULL); - if (sym == NULL) { - kernbase = KERNBASE; - } else { - kernbase = SYMBOL_VALUE_ADDRESS (sym); - } - } - return kernbase; -} - -#define KERNOFF (ksym_kernbase ()) -#define INKERNEL(x) ((x) >= KERNOFF) - -static CORE_ADDR -ksym_lookup(const char *name) -{ - struct minimal_symbol *sym; - - sym = lookup_minimal_symbol (name, NULL, NULL); - if (sym == NULL) - error ("kernel symbol `%s' not found.", name); - - return SYMBOL_VALUE_ADDRESS (sym); -} - -/* Provide the address of an initial PCB to use. - If this is a crash dump, try for "dumppcb". - If no "dumppcb" or it's /dev/mem, use proc0. - Return the core address of the PCB we found. */ - -static CORE_ADDR -initial_pcb (void) -{ - struct minimal_symbol *sym; - CORE_ADDR addr; - void *val; - - /* Make sure things are open... */ - if (!core_kd || !core_file) - return (0); - - /* If this is NOT /dev/mem try for dumppcb. */ - if (strncmp (core_file, _PATH_DEV, sizeof _PATH_DEV - 1)) - { - sym = lookup_minimal_symbol ("dumppcb", NULL, NULL); - if (sym != NULL) - { - addr = SYMBOL_VALUE_ADDRESS (sym); - return (addr); - } - } - - /* OK, just use thread0's pcb. Note that curproc might - not exist, and if it does, it will point to gdb. - Therefore, just use proc0 and let the user set - some other context if they care about it. */ - - addr = ksym_lookup ("thread0"); - if (kvread (addr, &val)) - { - error ("cannot read thread0 pointer at %x\n", addr); - val = 0; - } - else - { - /* Read the PCB address in thread structure. */ - addr += offsetof (struct thread, td_pcb); - if (kvread (addr, &val)) - { - error ("cannot read thread0->td_pcb pointer at %x\n", addr); - val = 0; - } - } - - /* thread0 is wholly in the kernel and cur_proc is only used for - reading user mem, so no point in setting this up. */ - cur_proc = 0; - - return ((CORE_ADDR)val); -} - -/* Set the current context to that of the PCB struct at the system address - passed. */ - -static int -set_context (CORE_ADDR addr) -{ - if (kvread (addr, &cur_pcb)) - error ("cannot read pcb at %#x", addr); - - /* Fetch all registers from core file. */ - target_fetch_registers (-1); - - /* Now, set up the frame cache, and print the top of stack. */ - flush_cached_frames (); - set_current_frame (create_new_frame (read_fp (), read_pc ())); - select_frame (get_current_frame (), 0); - return (0); -} - -/* Discard all vestiges of any previous core file and mark data and stack - spaces as empty. */ - -/* ARGSUSED */ -static void -kcore_close (int quitting) -{ - - inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */ - - /* Clear out solib state while the bfd is still open. See - comments in clear_solib in solib.c. */ -#ifdef CLEAR_SOLIB - CLEAR_SOLIB (); -#endif - - if (core_kd) - { - kvm_close (core_kd); - free (core_file); - core_file = NULL; - core_kd = NULL; - } -} - -/* This routine opens and sets up the core file bfd. */ - -static void -kcore_open (char *filename /* the core file */, int from_tty) -{ - kvm_t *kd; - const char *p; - struct cleanup *old_chain; - char buf[256], *cp; - int ontop; - CORE_ADDR addr; - - target_preopen (from_tty); - - /* The exec file is required for symbols. */ - if (exec_bfd == NULL) - error ("No kernel exec file specified"); - - if (core_kd) - { - error ("No core file specified." - " (Use `detach' to stop debugging a core file.)"); - return; - } - - if (!filename) - { - error ("No core file specified."); - return; - } - - filename = tilde_expand (filename); - if (filename[0] != '/') - { - cp = concat (current_directory, "/", filename, NULL); - free (filename); - filename = cp; - } - - old_chain = make_cleanup (free, filename); - - kd = kvm_open (bfd_get_filename(exec_bfd), filename, NULL, - kernel_writablecore ? O_RDWR: O_RDONLY, 0); - if (kd == NULL) - { - perror_with_name (filename); - return; - } - - /* Looks semi-reasonable. Toss the old core file and work on the new. */ - - discard_cleanups (old_chain); /* Don't free filename any more. */ - core_file = filename; - unpush_target (&kcore_ops); - ontop = !push_target (&kcore_ops); - - /* Note unpush_target (above) calls kcore_close. */ - core_kd = kd; - - /* Print out the panic string if there is one. */ - if (kvread (ksym_lookup ("panicstr"), &addr) == 0 && - addr != 0 && - target_read_memory (addr, buf, sizeof(buf)) == 0) - { - - for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++) - if (!isascii (*cp) || (!isprint (*cp) && !isspace (*cp))) - *cp = '?'; - *cp = '\0'; - if (buf[0] != '\0') - printf_filtered ("panic: %s\n", buf); - } - - /* Print all the panic messages if possible. */ - if (symfile_objfile != NULL) - { - printf ("panic messages:\n---\n"); - snprintf (buf, sizeof buf, - "/sbin/dmesg -N %s -M %s | \ - /usr/bin/awk '/^(panic:|Fatal trap) / { printing = 1 } \ - { if (printing) print $0 }'", - symfile_objfile->name, filename); - fflush (stdout); - system (buf); - printf ("---\n"); - } - - if (ontop) - { - /* Add symbols and section mappings for any kernel modules. */ -#ifdef SOLIB_ADD - current_target_so_ops = &kgdb_so_ops; - catch_errors (kcore_solib_add_stub, &from_tty, (char *) 0, - RETURN_MASK_ALL); -#endif - } - else - { - warning ("you won't be able to access this core file until you terminate\n" - "your %s; do ``info files''", target_longname); - return; - } - - /* Now, set up process context, and print the top of stack. */ - (void)set_context (initial_pcb()); - print_stack_frame (selected_frame, selected_frame_level, 1); -} - -static void -kcore_detach (char *args, int from_tty) -{ - if (args) - error ("Too many arguments"); - unpush_target (&kcore_ops); - reinit_frame_cache (); - if (from_tty) - printf_filtered ("No kernel core file now.\n"); -} - -/* Get the registers out of a core file. This is the machine- - independent part. Fetch_core_registers is the machine-dependent - part, typically implemented in the xm-file for each architecture. */ - -/* We just get all the registers, so we don't use regno. */ - -/* ARGSUSED */ -static void -get_kcore_registers (int regno) -{ - - /* XXX - Only read the pcb when set_context() is called. - When looking at a live kernel this may be a problem, - but the user can do another "proc" or "pcb" command to - grab a new copy of the pcb... */ - - /* Zero out register set then fill in the ones we know about. */ - fetch_kcore_registers (&cur_pcb); -} - -static void -kcore_files_info (t) - struct target_ops *t; -{ - printf_filtered ("\t`%s'\n", core_file); -} - -static int -xfer_kmem (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct mem_attrib *attrib, struct target_ops *target) -{ - int n; - - - if (!INKERNEL (memaddr)) - return xfer_umem (memaddr, myaddr, len, write); - - if (core_kd == NULL) - return 0; - - if (write) - n = kvm_write (core_kd, memaddr, myaddr, len); - else - n = kvm_read (core_kd, memaddr, myaddr, len) ; - if (n < 0) { - fprintf_unfiltered (gdb_stderr, "can not access 0x%x, %s\n", - (unsigned)memaddr, kvm_geterr (core_kd)); - n = 0; - } - - return n; -} - - -static int -xfer_umem (CORE_ADDR memaddr, char *myaddr, int len, int write /* ignored */) -{ - int n = 0; - - if (cur_proc == 0) - { - error ("---Can't read userspace from dump, or kernel process---\n"); - return 0; - } - - if (write) - error ("kvm_uwrite unimplemented\n"); - else - n = kvm_uread (core_kd, cur_proc, memaddr, myaddr, len) ; - - if (n < 0) - return 0; - - return n; -} - -static void -set_proc_cmd (char *arg, int from_tty) -{ - CORE_ADDR addr, pid_addr, first_td; - void *val; - struct kinfo_proc *kp; - int cnt; - pid_t pid; - - if (!arg) - error_no_arg ("proc address for the new context"); - - if (core_kd == NULL) - error ("no kernel core file"); - - addr = (CORE_ADDR) parse_and_eval_address (arg); - - if (!INKERNEL (addr)) - { - kp = kvm_getprocs (core_kd, KERN_PROC_PID, addr, &cnt); - if (!cnt) - error ("invalid pid"); - addr = (CORE_ADDR)kp->ki_paddr; - cur_proc = kp; - } - else - { - /* Update cur_proc. */ - pid_addr = addr + offsetof (struct proc, p_pid); - if (kvread (pid_addr, &pid)) - error ("cannot read pid ptr"); - cur_proc = kvm_getprocs (core_kd, KERN_PROC_PID, pid, &cnt); - if (!cnt) - error("invalid pid"); - } - - /* Find the first thread in the process. XXXKSE */ - addr += offsetof (struct proc, p_threads.tqh_first); - if (kvread (addr, &first_td)) - error ("cannot read thread ptr"); - - /* Read the PCB address in thread structure. */ - addr = first_td + offsetof (struct thread, td_pcb); - if (kvread (addr, &val)) - error("cannot read pcb ptr"); - - /* Read the PCB address in proc structure. */ - if (set_context ((CORE_ADDR) val)) - error ("invalid proc address"); -} - -#ifdef SOLIB_ADD -static int -kcore_solib_add_stub (PTR from_ttyp) -{ - SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_target, auto_solib_add); - return 0; -} -#endif /* SOLIB_ADD */ - -void -_initialize_kcorelow (void) -{ - kcore_ops.to_shortname = "kcore"; - kcore_ops.to_longname = "Kernel core dump file"; - kcore_ops.to_doc = - "Use a core file as a target. Specify the filename of the core file."; - kcore_ops.to_open = kcore_open; - kcore_ops.to_close = kcore_close; - kcore_ops.to_attach = find_default_attach; - kcore_ops.to_detach = kcore_detach; - kcore_ops.to_fetch_registers = get_kcore_registers; - kcore_ops.to_xfer_memory = xfer_kmem; - kcore_ops.to_files_info = kcore_files_info; - kcore_ops.to_create_inferior = find_default_create_inferior; - kcore_ops.to_stratum = kcore_stratum; - kcore_ops.to_has_memory = 1; - kcore_ops.to_has_stack = 1; - kcore_ops.to_has_registers = 1; - kcore_ops.to_magic = OPS_MAGIC; - - add_target (&kcore_ops); - add_com ("proc", class_obscure, set_proc_cmd, "Set current process context"); -} diff --git a/gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c b/gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c deleted file mode 100644 index 190e6e668716..000000000000 --- a/gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c +++ /dev/null @@ -1,304 +0,0 @@ -/* Handle FreeBSD kernel modules as shared libraries. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, - 2001 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* $FreeBSD$ */ - -#include -#include -#include -#define _KERNEL -#include -#undef _KERNEL - -/* XXX, kludge to avoid duplicate definitions while sys/linker.h is used. */ -#define _ELF_COMMON_H - -#include "defs.h" -#include "symtab.h" -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include "gdbcore.h" -#include "target.h" -#include "inferior.h" - -#include "solist.h" - -struct lm_info - { - CORE_ADDR address; - }; - -static int try_modpath (char *buf, int buflen, char *fmt, ...); -static char *guess_modpath (char *modname); - -static void -kgdb_relocate_section_addresses (struct so_list *so, - struct section_table *sec) -{ - sec->addr += so->lm_info->address; - sec->endaddr += so->lm_info->address; -} - -static int -kgdb_open_symbol_file_object (void *from_ttyp) -{ - warning ("kgdb_open_symbol_file_object called\n"); - return 0; -} - -static struct so_list * -kgdb_current_sos (void) -{ - linker_file_list_t linker_files; - struct linker_file lfile; - struct minimal_symbol *msymbol; - struct linker_file *lfilek; - struct so_list *head = NULL; - struct so_list **link_ptr = &head; - - CORE_ADDR lfiles_addr; - - msymbol = lookup_minimal_symbol ("linker_files", NULL, symfile_objfile); - if (msymbol == NULL || SYMBOL_VALUE_ADDRESS (msymbol) == 0) - { - warning ("failed to find linker_files symbol\n"); - return 0; - } - lfiles_addr = SYMBOL_VALUE_ADDRESS (msymbol); - if (target_read_memory (lfiles_addr, (char *)&linker_files, - sizeof (linker_files))) - { - warning ("failed to read linker_files data\n"); - return 0; - } - for (lfilek = TAILQ_FIRST (&linker_files); lfilek != NULL; - lfilek = TAILQ_NEXT (&lfile, link)) - { - struct so_list *new; - struct cleanup *old_chain; - char *buf; - int errcode; - - if (target_read_memory ((CORE_ADDR) lfilek, (char *) &lfile, - sizeof (lfile))) - { - warning ("failed to read linker file data at %p\n", lfilek); - return 0; - } - target_read_string ((CORE_ADDR) lfile.filename, &buf, - SO_NAME_MAX_PATH_SIZE - 1, &errcode); - if (errcode != 0) - { - warning ("cannot read linker file pathname: %s\n", - safe_strerror (errcode)); - return 0; - } - if (strlen (buf) < 3 || strcmp (&buf[strlen (buf) - 3], ".ko") != 0) - { - xfree (buf); - continue; - } - - new = (struct so_list *) xmalloc (sizeof (struct so_list)); - old_chain = make_cleanup (xfree, new); - - memset (new, 0, sizeof (*new)); - - new->lm_info = xmalloc (sizeof (struct lm_info)); - make_cleanup (xfree, new->lm_info); - - new->lm_info->address = (CORE_ADDR) lfile.address; - - strncpy (new->so_original_name, buf, SO_NAME_MAX_PATH_SIZE - 1); - new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; - xfree (buf); - snprintf (new->so_name, SO_NAME_MAX_PATH_SIZE, "%s", - guess_modpath (new->so_original_name)); - - new->next = NULL; - *link_ptr = new; - link_ptr = &new->next; - - discard_cleanups (old_chain); - } - return head; -} - -static int -kgdb_in_dynsym_resolve_code (CORE_ADDR pc) -{ - warning ("kgdb_in_dynsym_resolve_code called\n"); - return 0; -} - -static void -kgdb_special_symbol_handling (void) -{ -} - -static void -kgdb_solib_create_inferior_hook (void) -{ - struct so_list *inferior_sos; - - inferior_sos = kgdb_current_sos (); - if (inferior_sos) - { - solib_add (NULL, /*from_tty*/0, NULL, auto_solib_add); - } -} - -static void -kgdb_clear_solib (void) -{ -} - -static void -kgdb_free_so (struct so_list *so) -{ - xfree (so->lm_info); -} - -static int -try_modpath (char *buf, int buflen, char *fmt, ...) -{ - struct stat sb; - va_list ap; - - va_start (ap, fmt); - vsnprintf (buf, buflen, fmt, ap); - va_end(ap); - - return (stat (buf, &sb) == 0); -} - -static char * -guess_modpath (char *modname) -{ - static char buf[2048], moddir[128], syspath[1024]; - struct minimal_symbol *msymbol; - char *kernpath, *objpath, *p, *version; - int errcode, n, syspathlen; - - /* Set default module location */ - snprintf (buf, sizeof (buf), "/boot/kernel/%s", modname); - - /* Guess at the subdirectory off sys/modules. XXX, only sometimes correct */ - n = strlen (modname); - if (n > 3 && strcmp (&modname[n - 3], ".ko") == 0) - n -= 3; - snprintf (moddir, sizeof (moddir), "%.*s", n, modname); - - /* Try to locate the kernel compile location from version[] */ - msymbol = lookup_minimal_symbol ("version", NULL, symfile_objfile); - if (msymbol == NULL || SYMBOL_VALUE_ADDRESS (msymbol) == 0) - { - warning("cannot find `version' symbol; using default module path\n"); - return buf; - } - target_read_string (SYMBOL_VALUE_ADDRESS (msymbol), &version, 2048, &errcode); - if (errcode != 0) - { - warning ("cannot read `version' string; using default module path: %s\n", - safe_strerror (errcode)); - return buf; - } - - /* Find the kernel build path after user@host: on the second line. */ - if ((p = strchr (version, '\n')) == NULL || - (kernpath = strchr (p, ':')) == NULL || - (p = strchr (kernpath, '\n')) == NULL) - { - warning ("cannot parse version[]; using default module path\n"); - xfree (version); - return buf; - } - kernpath++; - *p = '\0'; - - /* - * Find the absolute path to src/sys by skipping back over path - * components until we find a "/sys/". - */ - syspathlen = 0; - while (p > kernpath && syspathlen == 0) - { - while (p > kernpath && *p != '/') - p--; - if (strncmp (p, "/sys/", 5) == 0) - syspathlen = p - kernpath + 4; - else if (p > kernpath) - p--; - } - if (syspathlen == 0) - { - warning ("cannot find /sys/ in `%s'; using default module path\n", - kernpath); - xfree (version); - return buf; - } - /* - * For kernels compiled with buildkernel, the object path will have - * been prepended to the /sys/ path in `kernpath'. - */ - objpath = getenv ("MAKEOBJDIRPREFIX"); - if (objpath == NULL) - objpath = "/usr/obj"; - n = strlen (objpath); - if (syspathlen > n + 1 && strncmp (kernpath, objpath, n) == 0 && - kernpath[n] == '/') - snprintf (syspath, sizeof (syspath), "%.*s", syspathlen - n, kernpath + n); - else - snprintf (syspath, sizeof (syspath), "%.*s", syspathlen, kernpath); - - /* Now try to find the module file */ - if (!try_modpath (buf, sizeof (buf), "./%s.debug", modname) && - !try_modpath (buf, sizeof (buf), "./%s", modname) && !try_modpath (buf, - sizeof (buf), "%s/modules%s/modules/%s/%s.debug", kernpath, syspath, - moddir, modname) && !try_modpath (buf, sizeof (buf), - "%s/modules%s/modules/%s/%s", kernpath, syspath, moddir, modname) && - !try_modpath (buf, sizeof (buf), "/boot/kernel/%s.debug", modname) && - !try_modpath (buf, sizeof (buf), "/boot/kernel/%s", modname)) - { - warning ("cannot find file for module %s\n", modname); - snprintf (buf, sizeof (buf), "%s", modname); - } - xfree (version); - - return buf; -} - -struct target_so_ops kgdb_so_ops; - -void -_initialize_kgdb_solib (void) -{ - kgdb_so_ops.relocate_section_addresses = kgdb_relocate_section_addresses; - kgdb_so_ops.free_so = kgdb_free_so; - kgdb_so_ops.clear_solib = kgdb_clear_solib; - kgdb_so_ops.solib_create_inferior_hook = kgdb_solib_create_inferior_hook; - kgdb_so_ops.special_symbol_handling = kgdb_special_symbol_handling; - kgdb_so_ops.current_sos = kgdb_current_sos; - kgdb_so_ops.open_symbol_file_object = kgdb_open_symbol_file_object; - kgdb_so_ops.in_dynsym_resolve_code = kgdb_in_dynsym_resolve_code; -} diff --git a/gnu/usr.bin/binutils/gdbreplay/Makefile b/gnu/usr.bin/binutils/gdbreplay/Makefile deleted file mode 100644 index 107051a11873..000000000000 --- a/gnu/usr.bin/binutils/gdbreplay/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc0" - -# Not elf specific so don't install in /usr/libexec/elf -BINDIR=/usr/bin - -GDBDIR= ${.CURDIR}/../../../../contrib/gdb -.PATH: ${GDBDIR}/gdb/gdbserver -.PATH: ${GDBDIR}/gdb - -PROG= gdbreplay -NO_MAN= - -SRCS= gdbreplay.c - -CFLAGS+= -I${.CURDIR}/../gdb -CFLAGS+= -I${GDBDIR}/gdb -CFLAGS+= -I${GDBDIR}/gdb/config -CFLAGS+= -I${GDBDIR}/gdb/gdbserver -CFLAGS+= -DNO_MMALLOC - -.include From 67f285a22e4e2eb8667d68ea8940ff8687456d60 Mon Sep 17 00:00:00 2001 From: Lawrence Stewart Date: Fri, 12 Nov 2010 00:19:42 +0000 Subject: [PATCH 10/28] The university does not require that its CRICOS number be included in source code. Remove all references from the tree. MFC after: 3 days --- sys/netinet/libalias/alias_sctp.c | 3 +-- sys/netinet/libalias/alias_sctp.h | 3 +-- sys/netinet/siftr.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/netinet/libalias/alias_sctp.c b/sys/netinet/libalias/alias_sctp.c index 22cf5cd65457..8a78ea82541a 100644 --- a/sys/netinet/libalias/alias_sctp.c +++ b/sys/netinet/libalias/alias_sctp.c @@ -1,8 +1,7 @@ /** * @file alias_sctp.c * Copyright (c) 2008, Centre for Advanced Internet Architectures - * Swinburne University of Technology, Melbourne, Australia - * (CRICOS number 00111D). + * Swinburne University of Technology, Melbourne, Australia. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/netinet/libalias/alias_sctp.h b/sys/netinet/libalias/alias_sctp.h index b4608ee4bbe3..ff2c4c26c71e 100644 --- a/sys/netinet/libalias/alias_sctp.h +++ b/sys/netinet/libalias/alias_sctp.h @@ -1,8 +1,7 @@ /** * @file alias_sctp.h * Copyright (c) 2008, Centre for Advanced Internet Architectures - * Swinburne University of Technology, Melbourne, Australia - * (CRICOS number 00111D). + * Swinburne University of Technology, Melbourne, Australia. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index 176d0d0a30fe..154e8aa31025 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -1,7 +1,6 @@ /*- * Copyright (c) 2007-2009, Centre for Advanced Internet Architectures - * Swinburne University of Technology, Melbourne, Australia - * (CRICOS number 00111D). + * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010, The FreeBSD Foundation * All rights reserved. * From 619ad9eb3e3cd1b03ae6412934d74bd21adcbeab Mon Sep 17 00:00:00 2001 From: Lawrence Stewart Date: Fri, 12 Nov 2010 00:44:18 +0000 Subject: [PATCH 11/28] Standardise all Swinburne related copyright/licence statements throughout the tree in preparation for another large code import. Swinburne University is the legal entity that owns copyright and the 2-clause BSD licence is acceptable. --- sys/netinet/libalias/alias_sctp.c | 19 ++++++++----------- sys/netinet/libalias/alias_sctp.h | 19 ++++++++----------- sys/netinet/siftr.c | 4 ++-- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/sys/netinet/libalias/alias_sctp.c b/sys/netinet/libalias/alias_sctp.c index 8a78ea82541a..3bd5331d1764 100644 --- a/sys/netinet/libalias/alias_sctp.c +++ b/sys/netinet/libalias/alias_sctp.c @@ -1,8 +1,7 @@ -/** - * @file alias_sctp.c - * Copyright (c) 2008, Centre for Advanced Internet Architectures - * Swinburne University of Technology, Melbourne, Australia. - * +/*- + * Copyright (c) 2008 + * Swinburne University of Technology, Melbourne, Australia. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -11,11 +10,7 @@ * 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. The names of the authors, the "Centre for Advanced Internet Architectures" - * and "Swinburne University of Technology" may not be used to endorse - * or promote products derived from this software without specific - * prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 @@ -27,7 +22,9 @@ * 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. - * + */ + +/* * Alias_sctp forms part of the libalias kernel module to handle * Network Address Translation (NAT) for the SCTP protocol. * diff --git a/sys/netinet/libalias/alias_sctp.h b/sys/netinet/libalias/alias_sctp.h index ff2c4c26c71e..80ed96568d4d 100644 --- a/sys/netinet/libalias/alias_sctp.h +++ b/sys/netinet/libalias/alias_sctp.h @@ -1,8 +1,7 @@ -/** - * @file alias_sctp.h - * Copyright (c) 2008, Centre for Advanced Internet Architectures - * Swinburne University of Technology, Melbourne, Australia. - * +/*- + * Copyright (c) 2008 + * Swinburne University of Technology, Melbourne, Australia. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -11,11 +10,7 @@ * 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. The names of the authors, the "Centre for Advanced Internet Architectures" - * and "Swinburne University of Technology" may not be used to endorse - * or promote products derived from this software without specific - * prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 @@ -27,7 +22,9 @@ * 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. - * + */ + +/* * Alias_sctp forms part of the libalias kernel module to handle * Network Address Translation (NAT) for the SCTP protocol. * diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index 154e8aa31025..5f2a6927b2fa 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2007-2009, Centre for Advanced Internet Architectures - * Swinburne University of Technology, Melbourne, Australia. + * Copyright (c) 2007-2009 + * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010, The FreeBSD Foundation * All rights reserved. * From d25e560a159d091d4d01c66654c5f09a6c7a12b1 Mon Sep 17 00:00:00 2001 From: Lawrence Stewart Date: Fri, 12 Nov 2010 01:40:29 +0000 Subject: [PATCH 12/28] The first releases SIFTR will ship in will be 7.4 and 8.2. MFC after: 3 days --- share/man/man4/siftr.4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/man/man4/siftr.4 b/share/man/man4/siftr.4 index e706a643e026..0e6f544852c3 100644 --- a/share/man/man4/siftr.4 +++ b/share/man/man4/siftr.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 25, 2010 +.Dd November 12, 2010 .Dt SIFTR 4 .Os .Sh NAME @@ -610,7 +610,9 @@ and the FreeBSD Foundation. .Sh HISTORY .Nm first appeared in -.Fx 9.0 . +.Fx 7.4 +and +.Fx 8.2 . .Pp .Nm was first released in 2007 by Lawrence Stewart and James Healy whilst working on From 5b7ed13bc8df9ffcdb50b2019c71a85d58b9e387 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Fri, 12 Nov 2010 03:43:22 +0000 Subject: [PATCH 13/28] Centralize CPU idle routines into powerpc/cpu.c and use the same cpu_idle_hook mechanism that x86 uses for overriding the idle routine. This is required for supporting ilding the CPU under PowerPC hypervisors. --- sys/powerpc/aim/machdep.c | 58 --------------------- sys/powerpc/booke/machdep.c | 44 ---------------- sys/powerpc/powerpc/cpu.c | 100 +++++++++++++++++++++++++++++++++++- 3 files changed, 98 insertions(+), 104 deletions(-) diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index f52f7a4f5b97..456fa4473d61 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -639,64 +639,6 @@ cpu_halt(void) OF_exit(); } -void -cpu_idle(int busy) -{ - register_t msr; - uint16_t vers; - - msr = mfmsr(); - vers = mfpvr() >> 16; - -#ifdef INVARIANTS - if ((msr & PSL_EE) != PSL_EE) { - struct thread *td = curthread; - printf("td msr %#lx\n", (u_long)td->td_md.md_saved_msr); - panic("ints disabled in idleproc!"); - } -#endif - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", - busy, curcpu); - if (powerpc_pow_enabled) { - if (!busy) { - critical_enter(); - cpu_idleclock(); - } - switch (vers) { - case IBM970: - case IBM970FX: - case IBM970MP: - case MPC7447A: - case MPC7448: - case MPC7450: - case MPC7455: - case MPC7457: - __asm __volatile("\ - dssall; sync; mtmsr %0; isync" - :: "r"(msr | PSL_POW)); - break; - default: - powerpc_sync(); - mtmsr(msr | PSL_POW); - isync(); - break; - } - if (!busy) { - cpu_activeclock(); - critical_exit(); - } - } - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", - busy, curcpu); -} - -int -cpu_idle_wakeup(int cpu) -{ - - return (0); -} - int ptrace_set_pc(struct thread *td, unsigned long addr) { diff --git a/sys/powerpc/booke/machdep.c b/sys/powerpc/booke/machdep.c index b8a77a59b063..860c271c9817 100644 --- a/sys/powerpc/booke/machdep.c +++ b/sys/powerpc/booke/machdep.c @@ -468,50 +468,6 @@ cpu_flush_dcache(void *ptr, size_t len) /* TBD */ } -/* - * cpu_idle - * - * Set Wait state enable. - */ -void -cpu_idle (int busy) -{ - register_t msr; - - msr = mfmsr(); - -#ifdef INVARIANTS - if ((msr & PSL_EE) != PSL_EE) { - struct thread *td = curthread; - printf("td msr %x\n", td->td_md.md_saved_msr); - panic("ints disabled in idleproc!"); - } -#endif - - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", - busy, curcpu); - if (!busy) { - critical_enter(); - cpu_idleclock(); - } - /* Freescale E500 core RM section 6.4.1. */ - msr = msr | PSL_WE; - __asm __volatile("msync; mtmsr %0; isync" :: "r" (msr)); - if (!busy) { - cpu_activeclock(); - critical_exit(); - } - CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", - busy, curcpu); -} - -int -cpu_idle_wakeup(int cpu) -{ - - return (0); -} - void spinlock_enter(void) { diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index 4bbfcac82bbe..e5d43d89bf6a 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -73,12 +74,15 @@ #include #include -int powerpc_pow_enabled; - static void cpu_6xx_setup(int cpuid, uint16_t vers); static void cpu_e500_setup(int cpuid, uint16_t vers); static void cpu_970_setup(int cpuid, uint16_t vers); +int powerpc_pow_enabled; +void (*cpu_idle_hook)(void) = NULL; +static void cpu_idle_60x(void); +static void cpu_idle_e500(void); + struct cputab { const char *name; uint16_t version; @@ -374,6 +378,9 @@ cpu_6xx_setup(int cpuid, uint16_t vers) } printf("cpu%d: HID0 %b\n", cpuid, (int)hid0, bitmask); + + if (cpu_idle_hook == NULL) + cpu_idle_hook = cpu_idle_60x; } @@ -441,6 +448,9 @@ cpu_e500_setup(int cpuid, uint16_t vers) mtspr(SPR_HID0, hid0); printf("cpu%d: HID0 %b\n", cpuid, (int)hid0, HID0_E500_BITMASK); + + if (cpu_idle_hook == NULL) + cpu_idle_hook = cpu_idle_e500; } static void @@ -478,6 +488,8 @@ cpu_970_setup(int cpuid, uint16_t vers) : "=r" (hid0_hi) : "K" (SPR_HID0)); printf("cpu%d: HID0 %b\n", cpuid, (int)(hid0_hi), HID0_970_BITMASK); #endif + + cpu_idle_hook = cpu_idle_60x; } static int @@ -490,3 +502,87 @@ cpu_feature_bit(SYSCTL_HANDLER_ARGS) return (sysctl_handle_int(oidp, &result, 0, req)); } +void +cpu_idle(int busy) +{ + +#ifdef INVARIANTS + if ((mfmsr() & PSL_EE) != PSL_EE) { + struct thread *td = curthread; + printf("td msr %#lx\n", (u_long)td->td_md.md_saved_msr); + panic("ints disabled in idleproc!"); + } +#endif + + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", + busy, curcpu); + if (cpu_idle_hook != NULL) { + if (!busy) { + critical_enter(); + cpu_idleclock(); + } + cpu_idle_hook(); + if (!busy) { + cpu_activeclock(); + critical_exit(); + } + } + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", + busy, curcpu); +} + +int +cpu_idle_wakeup(int cpu) +{ + return (0); +} + +static void +cpu_idle_60x(void) +{ + register_t msr; + uint16_t vers; + + if (!powerpc_pow_enabled) + return; + + msr = mfmsr(); + vers = mfpvr() >> 16; + +#ifdef AIM + switch (vers) { + case IBM970: + case IBM970FX: + case IBM970MP: + case MPC7447A: + case MPC7448: + case MPC7450: + case MPC7455: + case MPC7457: + __asm __volatile("\ + dssall; sync; mtmsr %0; isync" + :: "r"(msr | PSL_POW)); + break; + default: + powerpc_sync(); + mtmsr(msr | PSL_POW); + isync(); + break; + } +#endif +} + +static void +cpu_idle_e500(void) +{ + register_t msr; + + msr = mfmsr(); + +#ifdef E500 + /* Freescale E500 core RM section 6.4.1. */ + __asm __volatile("msync; mtmsr %0; isync" :: + "r" (msr | PSL_WE)); +#endif +} + From b13c7dec5fc04a9466cadd9e087c620ab7b2d5d0 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Fri, 12 Nov 2010 04:13:48 +0000 Subject: [PATCH 14/28] Fix an error in r215067. An existing /chosen/mmu but missing translations property just means we shouldn't add any translations, not that we should panic. --- sys/powerpc/aim/mmu_oea64.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 3e336c9e6ab6..002754d71ca7 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1126,14 +1126,14 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) ofw_pmap.pm_sr[i] = kernel_pmap->pm_sr[i]; #endif - if ((mmu = OF_instance_to_package(mmui)) == -1) - panic("moea64_bootstrap: can't get mmu package"); - if ((sz = OF_getproplen(mmu, "translations")) == -1) - panic("moea64_bootstrap: can't get ofw translation count"); + mmu = OF_instance_to_package(mmui); + if (mmu == -1 || (sz = OF_getproplen(mmu, "translations")) == -1) + sz = 0; if (sz > 6144 /* tmpstksz - 2 KB headroom */) panic("moea64_bootstrap: too many ofw translations"); - moea64_add_ofw_mappings(mmup, mmu, sz); + if (sz > 0) + moea64_add_ofw_mappings(mmup, mmu, sz); } #ifdef SMP From 6413b05739b7641cc79edc0711bc8a753917e669 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Fri, 12 Nov 2010 04:18:19 +0000 Subject: [PATCH 15/28] Add some platform KOBJ extensions and continue integrating PowerPC hypervisor infrastructure support: - Fix coexistence of multiple platform modules in the same kernel - Allow platform modules to provide an SMP topology - PowerPC hypervisors limit the amount of memory accessible in real mode. Allow the platform modules to specify the maximum real-mode address, and modify the bits of the kernel that need to allocate real-mode-accessible buffers to respect this limits. --- sys/powerpc/aim/mmu_oea64.c | 3 ++ sys/powerpc/aim/ofw_machdep.c | 13 -------- sys/powerpc/aim/slb.c | 55 +++++++++++++++++++++++++++++++ sys/powerpc/booke/machdep.c | 9 ----- sys/powerpc/include/platform.h | 1 + sys/powerpc/powerpc/mp_machdep.c | 7 ---- sys/powerpc/powerpc/platform.c | 51 ++++++++++++++++++++++++++-- sys/powerpc/powerpc/platform_if.m | 30 +++++++++++++++++ sys/sys/smp.h | 5 +-- 9 files changed, 140 insertions(+), 34 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 002754d71ca7..af57834f324f 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -2385,6 +2385,9 @@ moea64_bootstrap_alloc(vm_size_t size, u_int align) if (s < phys_avail[i] || e > phys_avail[i + 1]) continue; + if (s + size > platform_real_maxaddr()) + continue; + if (s == phys_avail[i]) { phys_avail[i] += size; } else if (e == phys_avail[i + 1]) { diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/aim/ofw_machdep.c index 1ebcd0cb7d85..84f9cf0ae72a 100644 --- a/sys/powerpc/aim/ofw_machdep.c +++ b/sys/powerpc/aim/ofw_machdep.c @@ -692,16 +692,3 @@ OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag, return (bus_space_map(*tag, addr, size, 0, handle)); } -int -mem_valid(vm_offset_t addr, int len) -{ - int i; - - for (i = 0; i < nOFmem; i++) - if ((addr >= OFmem[i].mr_start) - && (addr + len < OFmem[i].mr_start + OFmem[i].mr_size)) - return (0); - - return (EFAULT); -} - diff --git a/sys/powerpc/aim/slb.c b/sys/powerpc/aim/slb.c index 9d8828ac2daa..d5fb12e779f6 100644 --- a/sys/powerpc/aim/slb.c +++ b/sys/powerpc/aim/slb.c @@ -36,9 +36,14 @@ #include #include #include +#include #include +#include +#include +#include #include +#include #include #include @@ -474,6 +479,51 @@ slb_insert_user(pmap_t pm, struct slb *slb) pm->pm_slb[i] = slb; } +static void * +slb_uma_real_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + static vm_offset_t realmax = 0; + void *va; + vm_page_t m; + int pflags; + + if (realmax == 0) + realmax = platform_real_maxaddr(); + + *flags = UMA_SLAB_PRIV; + if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) + pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED; + else + pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED; + if (wait & M_ZERO) + pflags |= VM_ALLOC_ZERO; + + for (;;) { + m = vm_phys_alloc_contig(1, 0, realmax, PAGE_SIZE, + PAGE_SIZE); + if (m == NULL) { + if (wait & M_NOWAIT) + return (NULL); + VM_WAIT; + } else + break; + } + + va = (void *) VM_PAGE_TO_PHYS(m); + + if (!hw_direct_map) + pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); + + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) + bzero(va, PAGE_SIZE); + + /* vm_phys_alloc_contig does not track wiring */ + atomic_add_int(&cnt.v_wire_count, 1); + m->wire_count = 1; + + return (va); +} + static void slb_zone_init(void *dummy) { @@ -482,6 +532,11 @@ slb_zone_init(void *dummy) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); slb_cache_zone = uma_zcreate("SLB cache", 64*sizeof(struct slb *), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); + + if (platform_real_maxaddr() != VM_MAX_ADDRESS) { + uma_zone_set_allocf(slb_cache_zone, slb_uma_real_alloc); + uma_zone_set_allocf(slbt_zone, slb_uma_real_alloc); + } } struct slb ** diff --git a/sys/powerpc/booke/machdep.c b/sys/powerpc/booke/machdep.c index 860c271c9817..921dfbf81f9b 100644 --- a/sys/powerpc/booke/machdep.c +++ b/sys/powerpc/booke/machdep.c @@ -597,12 +597,3 @@ bzero(void *buf, size_t len) } } -/* - * XXX what is the better/proper place for this routine? - */ -int -mem_valid(vm_offset_t addr, int len) -{ - - return (1); -} diff --git a/sys/powerpc/include/platform.h b/sys/powerpc/include/platform.h index cfa7a0d0890c..48ea0e603250 100644 --- a/sys/powerpc/include/platform.h +++ b/sys/powerpc/include/platform.h @@ -44,6 +44,7 @@ struct mem_region { }; void mem_regions(struct mem_region **, int *, struct mem_region **, int *); +vm_offset_t platform_real_maxaddr(void); u_long platform_timebase_freq(struct cpuref *); diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index 9086db5299c0..ee95f861aaa2 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -98,13 +98,6 @@ machdep_ap_bootstrap(void) sched_throw(NULL); } -struct cpu_group * -cpu_topo(void) -{ - - return (smp_topo_none()); -} - void cpu_mp_setmaxid(void) { diff --git a/sys/powerpc/powerpc/platform.c b/sys/powerpc/powerpc/platform.c index 2b5c60792db3..02d89ee3dae2 100644 --- a/sys/powerpc/powerpc/platform.c +++ b/sys/powerpc/powerpc/platform.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -47,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -62,11 +64,45 @@ static char plat_name[64] = ""; SYSCTL_STRING(_hw, OID_AUTO, platform, CTLFLAG_RD | CTLFLAG_TUN, plat_name, 0, "Platform currently in use"); +static struct mem_region *pregions = NULL; +static struct mem_region *aregions = NULL; +static int npregions, naregions; + void mem_regions(struct mem_region **phys, int *physsz, struct mem_region **avail, int *availsz) { - PLATFORM_MEM_REGIONS(plat_obj, phys, physsz, avail, availsz); + if (pregions == NULL) + PLATFORM_MEM_REGIONS(plat_obj, &pregions, &npregions, + &aregions, &naregions); + + *phys = pregions; + *avail = aregions; + *physsz = npregions; + *availsz = naregions; +} + +int +mem_valid(vm_offset_t addr, int len) +{ + int i; + + if (pregions == NULL) + PLATFORM_MEM_REGIONS(plat_obj, &pregions, &npregions, + &aregions, &naregions); + + for (i = 0; i < npregions; i++) + if ((addr >= pregions[i].mr_start) + && (addr + len < pregions[i].mr_start + pregions[i].mr_size)) + return (0); + + return (EFAULT); +} + +vm_offset_t +platform_real_maxaddr(void) +{ + return (PLATFORM_REAL_MAXADDR(plat_obj)); } const char * @@ -105,6 +141,14 @@ platform_smp_start_cpu(struct pcpu *cpu) return (PLATFORM_SMP_START_CPU(plat_obj, cpu)); } +#ifdef SMP +struct cpu_group * +cpu_topo(void) +{ + return (PLATFORM_SMP_TOPO(plat_obj)); +} +#endif + /* * Reset back to firmware. */ @@ -164,9 +208,10 @@ platform_probe_and_attach() } /* - * We can't free the KOBJ, since it is static. Luckily, - * this has no ill effects since it gets reset every time. + * We can't free the KOBJ, since it is static. Reset the ops + * member of this class so that we can come back later. */ + platp->ops = NULL; } if (plat_def_impl == NULL) diff --git a/sys/powerpc/powerpc/platform_if.m b/sys/powerpc/powerpc/platform_if.m index 07e49bc884cd..94383c327d6e 100644 --- a/sys/powerpc/powerpc/platform_if.m +++ b/sys/powerpc/powerpc/platform_if.m @@ -30,10 +30,12 @@ #include #include #include +#include #include #include #include +#include /** * @defgroup PLATFORM platform - KObj methods for PowerPC platform @@ -66,6 +68,18 @@ CODE { { return (ENOENT); } + static struct cpu_group *platform_null_smp_topo(platform_t plat) + { +#ifdef SMP + return (smp_topo_none()); +#else + return (NULL); +#endif + } + static vm_offset_t platform_null_real_maxaddr(platform_t plat) + { + return (VM_MAX_ADDRESS); + } }; /** @@ -108,6 +122,15 @@ METHOD void mem_regions { int *_availsz; }; +/** + * @brief Return the maximum address accessible in real mode + * (for use with hypervisors) + */ +METHOD vm_offset_t real_maxaddr { + platform_t _plat; +} DEFAULT platform_null_real_maxaddr; + + /** * @brief Get the CPU's timebase frequency, in ticks per second. * @@ -161,6 +184,13 @@ METHOD int smp_start_cpu { struct pcpu *_cpu; }; +/** + * @brief Return SMP topology + */ +METHOD cpu_group_t smp_topo { + platform_t _plat; +} DEFAULT platform_null_smp_topo; + /** * @brief Reset system */ diff --git a/sys/sys/smp.h b/sys/sys/smp.h index 619eba813f5a..6104d3e22422 100644 --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -16,8 +16,6 @@ #ifndef LOCORE -#ifdef SMP - /* * Topology of a NUMA or HTT system. * @@ -41,6 +39,8 @@ struct cpu_group { int8_t cg_flags; /* Traversal modifiers. */ }; +typedef struct cpu_group *cpu_group_t; + /* * Defines common resources for CPUs in the group. The highest level * resource should be used when multiple are shared. @@ -60,6 +60,7 @@ struct cpu_group { /* * Convenience routines for building topologies. */ +#ifdef SMP struct cpu_group *smp_topo(void); struct cpu_group *smp_topo_none(void); struct cpu_group *smp_topo_1level(int l1share, int l1count, int l1flags); From 16bfd6f3478c91e3feb9ae952e7e8dc5d5316539 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Fri, 12 Nov 2010 04:22:00 +0000 Subject: [PATCH 16/28] Remove or conditionalize some hypervisor-unfriendly instruction sequences. --- sys/powerpc/aim/mmu_oea64.c | 4 ---- sys/powerpc/powerpc/mp_machdep.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index af57834f324f..a2c80c079f4f 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1136,10 +1136,6 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) moea64_add_ofw_mappings(mmup, mmu, sz); } -#ifdef SMP - TLBSYNC(); -#endif - /* * Calculate the last available physical address. */ diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index ee95f861aaa2..81c5481a7878 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -78,7 +78,13 @@ machdep_ap_bootstrap(void) ; /* Initialize DEC and TB, sync with the BSP values */ +#ifdef __powerpc64__ + /* Writing to the time base register is hypervisor-privileged */ + if (mfmsr() & PSL_HV) + mttb(ap_timebase); +#else mttb(ap_timebase); +#endif decr_ap_init(); /* Serialize console output and AP count increment */ @@ -240,7 +246,13 @@ cpu_mp_unleash(void *dummy) /* Let APs continue */ atomic_store_rel_int(&ap_letgo, 1); +#ifdef __powerpc64__ + /* Writing to the time base register is hypervisor-privileged */ + if (mfmsr() & PSL_HV) + mttb(ap_timebase); +#else mttb(ap_timebase); +#endif while (ap_awake < smp_cpus) ; From fe3b4685c7bf5573e46a465f3882e9fd7a617bb2 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Fri, 12 Nov 2010 05:12:38 +0000 Subject: [PATCH 17/28] Remove use of a separate ofw_pmap on 32-bit CPUs. Many Open Firmware mappings need to end up in the kernel anyway since the kernel begins executing in OF context. Separating them adds needless complexity, especially since the powerpc64 and mmu_oea64 code gave up on it a long time ago. As a side effect, the PPC ofw_machdep code is no longer AIM-specific, so move it to powerpc/ofw. --- sys/conf/files.powerpc | 2 +- sys/powerpc/aim/machdep.c | 2 - sys/powerpc/aim/mmu_oea.c | 43 ++++++-------------- sys/powerpc/aim/mmu_oea64.c | 9 ----- sys/powerpc/{aim => ofw}/ofw_machdep.c | 55 ++++++-------------------- 5 files changed, 24 insertions(+), 87 deletions(-) rename sys/powerpc/{aim => ofw}/ofw_machdep.c (93%) diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 021c51d413f9..d46b39fcf936 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -85,7 +85,6 @@ powerpc/aim/mmu_oea.c optional aim powerpc powerpc/aim/mmu_oea64.c optional aim powerpc/aim/mp_cpudep.c optional aim smp powerpc/aim/nexus.c optional aim -powerpc/aim/ofw_machdep.c optional aim powerpc/aim/ofwmagic.S optional aim powerpc/aim/slb.c optional aim powerpc64 powerpc/aim/swtch32.S optional aim powerpc @@ -131,6 +130,7 @@ powerpc/mpc85xx/nexus.c optional mpc85xx powerpc/mpc85xx/openpic_fdt.c optional fdt powerpc/mpc85xx/pci_fdt.c optional pci mpc85xx powerpc/ofw/ofw_cpu.c optional aim +powerpc/ofw/ofw_machdep.c optional aim powerpc/ofw/ofw_pcibus.c optional pci aim powerpc/ofw/ofw_pcib_pci.c optional pci aim powerpc/ofw/ofw_real.c optional aim diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index 456fa4473d61..87aa482b9d4b 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -159,8 +159,6 @@ int setfault(faultbuf); /* defined in locore.S */ long Maxmem = 0; long realmem = 0; -struct pmap ofw_pmap; - #ifndef __powerpc64__ struct bat battable[16]; #endif diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 5ba029c3f5cf..7bd07e113725 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -197,8 +197,6 @@ static u_int phys_avail_count; static int regions_sz, pregions_sz; static struct ofw_map *translations; -extern struct pmap ofw_pmap; - /* * Lock for the pteg and pvo tables. */ @@ -669,10 +667,7 @@ moea_cpu_bootstrap(mmu_t mmup, int ap) isync(); for (i = 0; i < 16; i++) - mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT); - - __asm __volatile("mtsr %0,%1" :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT)); - __asm __volatile("mtsr %0,%1" :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT)); + mtsrin(i << ADDR_SR_SHFT, kernel_pmap->pm_sr[i]); powerpc_sync(); sdr = (u_int)moea_pteg_table | (moea_pteg_mask >> 10); @@ -859,11 +854,16 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) moea_vsid_bitmap[0] |= 1; /* - * Set up the Open Firmware pmap and add it's mappings. + * Initialize the kernel pmap (which is statically allocated). + */ + PMAP_LOCK_INIT(kernel_pmap); + for (i = 0; i < 16; i++) + kernel_pmap->pm_sr[i] = EMPTY_SEGMENT + i; + kernel_pmap->pm_active = ~0; + + /* + * Set up the Open Firmware mappings */ - moea_pinit(mmup, &ofw_pmap); - ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT; - ofw_pmap.pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT; if ((chosen = OF_finddevice("/chosen")) == -1) panic("moea_bootstrap: can't find /chosen"); OF_getprop(chosen, "mmu", &mmui, 4); @@ -900,16 +900,8 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) /* Enter the pages */ for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { - struct vm_page m; - - m.phys_addr = translations[i].om_pa + off; - m.md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT; - m.oflags = VPO_BUSY; - PMAP_LOCK(&ofw_pmap); - moea_enter_locked(&ofw_pmap, - translations[i].om_va + off, &m, - VM_PROT_ALL, 1); - PMAP_UNLOCK(&ofw_pmap); + moea_kenter(mmup, translations[i].om_va + off, + translations[i].om_pa + off); ofw_mappings++; } } @@ -921,17 +913,6 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) ; Maxmem = powerpc_btop(phys_avail[i + 1]); - /* - * Initialize the kernel pmap (which is statically allocated). - */ - PMAP_LOCK_INIT(kernel_pmap); - for (i = 0; i < 16; i++) { - kernel_pmap->pm_sr[i] = EMPTY_SEGMENT; - } - kernel_pmap->pm_sr[KERNEL_SR] = KERNEL_SEGMENT; - kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT; - kernel_pmap->pm_active = ~0; - moea_cpu_bootstrap(mmup,0); pmap_bootstrapped++; diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index a2c80c079f4f..506676fa2264 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -275,8 +275,6 @@ static struct mem_region *pregions; static u_int phys_avail_count; static int regions_sz, pregions_sz; -extern struct pmap ofw_pmap; - extern void bs_remap_earlyboot(void); @@ -1119,13 +1117,6 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) chosen = OF_finddevice("/chosen"); if (chosen != -1 && OF_getprop(chosen, "mmu", &mmui, 4) != -1) { - #ifndef __powerpc64__ - moea64_pinit(mmup, &ofw_pmap); - - for (i = 0; i < 16; i++) - ofw_pmap.pm_sr[i] = kernel_pmap->pm_sr[i]; - #endif - mmu = OF_instance_to_package(mmui); if (mmu == -1 || (sz = OF_getproplen(mmu, "translations")) == -1) sz = 0; diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/ofw/ofw_machdep.c similarity index 93% rename from sys/powerpc/aim/ofw_machdep.c rename to sys/powerpc/ofw/ofw_machdep.c index 84f9cf0ae72a..f0daa4f28139 100644 --- a/sys/powerpc/aim/ofw_machdep.c +++ b/sys/powerpc/ofw/ofw_machdep.c @@ -66,7 +66,6 @@ static struct mem_region OFfree[OFMEM_REGIONS + 3]; static int nOFmem; extern register_t ofmsr[5]; -extern struct pmap ofw_pmap; static int (*ofwcall)(void *); static void *fdt; int ofw_real_mode; @@ -417,59 +416,27 @@ openfirmware_core(void *args) { int result; register_t oldmsr; - #ifndef __powerpc64__ - register_t srsave[16]; - u_int i; - #endif /* * Turn off exceptions - we really don't want to end up - * anywhere unexpected with PCPU set to something strange, - * the stack pointer wrong, or the OFW mapping enabled. + * anywhere unexpected with PCPU set to something strange + * or the stack pointer wrong. */ oldmsr = intr_disable(); ofw_sprg_prepare(); - #ifndef __powerpc64__ - if (pmap_bootstrapped && !ofw_real_mode) { - /* - * Swap the kernel's address space with Open Firmware's - */ - - for (i = 0; i < 16; i++) { - srsave[i] = mfsrin(i << ADDR_SR_SHFT); - mtsrin(i << ADDR_SR_SHFT, ofw_pmap.pm_sr[i]); - } - - /* - * Clear battable[] translations - */ - if (!(cpu_features & PPC_FEATURE_64)) { - __asm __volatile("mtdbatu 2, %0\n" - "mtdbatu 3, %0" : : "r" (0)); - } - isync(); - } - #endif +#if defined(AIM) && !defined(__powerpc64__) + /* + * Clear battable[] translations + */ + if (!(cpu_features & PPC_FEATURE_64)) + __asm __volatile("mtdbatu 2, %0\n" + "mtdbatu 3, %0" : : "r" (0)); + isync(); +#endif result = ofwcall(args); - - #ifndef __powerpc64__ - if (pmap_bootstrapped && !ofw_real_mode) { - /* - * Restore the kernel's addr space. The isync() doesn;t - * work outside the loop unless mtsrin() is open-coded - * in an asm statement :( - */ - - for (i = 0; i < 16; i++) { - mtsrin(i << ADDR_SR_SHFT, srsave[i]); - isync(); - } - } - #endif - ofw_sprg_restore(); intr_restore(oldmsr); From dbc4240942e7e10156974cc15a1646c342bfc7cc Mon Sep 17 00:00:00 2001 From: Lawrence Stewart Date: Fri, 12 Nov 2010 06:41:55 +0000 Subject: [PATCH 18/28] This commit marks the first formal contribution of the "Five New TCP Congestion Control Algorithms for FreeBSD" FreeBSD Foundation funded project. More details about the project are available at: http://caia.swin.edu.au/freebsd/5cc/ - Add a KPI and supporting infrastructure to allow modular congestion control algorithms to be used in the net stack. Algorithms can maintain per-connection state if required, and connections maintain their own algorithm pointer, which allows different connections to concurrently use different algorithms. The TCP_CONGESTION socket option can be used with getsockopt()/setsockopt() to programmatically query or change the congestion control algorithm respectively from within an application at runtime. - Integrate the framework with the TCP stack in as least intrusive a manner as possible. Care was also taken to develop the framework in a way that should allow integration with other congestion aware transport protocols (e.g. SCTP) in the future. The hope is that we will one day be able to share a single set of congestion control algorithm modules between all congestion aware transport protocols. - Introduce a new congestion recovery (TF_CONGRECOVERY) state into the TCP stack and use it to decouple the meaning of recovery from a congestion event and recovery from packet loss (TF_FASTRECOVERY) a la RFC2581. ECN and delay based congestion control protocols don't generally need to recover from packet loss and need a different way to note a congestion recovery episode within the stack. - Remove the net.inet.tcp.newreno sysctl, which simplifies some portions of code and ensures the stack always uses the appropriate mechanisms for recovering from packet loss during a congestion recovery episode. - Extract the NewReno congestion control algorithm from the TCP stack and massage it into module form. NewReno is always built into the kernel and will remain the default algorithm for the forseeable future. Implementations of additional different algorithms will become available in the near future. - Bump __FreeBSD_version to 900025 and note in UPDATING that rebuilding code that relies on the size of "struct tcpcb" is required. Many thanks go to the Cisco University Research Program Fund at Community Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work at the Centre for Advanced Internet Architectures, Swinburne University of Technology is greatly appreciated. In collaboration with: David Hayes and Grenville Armitage Sponsored by: Cisco URP, FreeBSD Foundation Reviewed by: rpaulo Tested by: David Hayes (and many others over the years) MFC after: 3 months --- UPDATING | 7 + sys/conf/files | 2 + sys/netinet/cc.h | 161 ++++++++++++ sys/netinet/cc/cc.c | 340 +++++++++++++++++++++++++ sys/netinet/cc/cc_module.h | 70 ++++++ sys/netinet/cc/cc_newreno.c | 231 +++++++++++++++++ sys/netinet/tcp_input.c | 484 +++++++++++++++++++----------------- sys/netinet/tcp_output.c | 24 +- sys/netinet/tcp_sack.c | 2 +- sys/netinet/tcp_subr.c | 33 ++- sys/netinet/tcp_timer.c | 49 +--- sys/netinet/tcp_usrreq.c | 62 ++++- sys/netinet/tcp_var.h | 30 ++- sys/sys/param.h | 2 +- 14 files changed, 1209 insertions(+), 288 deletions(-) create mode 100644 sys/netinet/cc.h create mode 100644 sys/netinet/cc/cc.c create mode 100644 sys/netinet/cc/cc_module.h create mode 100644 sys/netinet/cc/cc_newreno.c diff --git a/UPDATING b/UPDATING index aa8e5906b04d..5009b099d1b5 100644 --- a/UPDATING +++ b/UPDATING @@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW: machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20101111: + The TCP stack has received a significant update to add support for + modularised congestion control and generally improve the clarity of + congestion control decisions. Bump __FreeBSD_version to 900025. User + space tools that rely on the size of struct tcpcb in tcp_var.h (e.g. + sockstat) need to be recompiled. + 20101002: The man(1) utility has been replaced by a new version that no longer uses /etc/manpath.config. Please consult man.conf(5) for how to diff --git a/sys/conf/files b/sys/conf/files index ce2eb82ed4ba..c859ec82b3a5 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2598,6 +2598,8 @@ netinet/ip_mroute.c optional mrouting inet | mrouting inet6 netinet/ip_options.c optional inet netinet/ip_output.c optional inet netinet/raw_ip.c optional inet +netinet/cc/cc.c optional inet +netinet/cc/cc_newreno.c optional inet netinet/sctp_asconf.c optional inet sctp netinet/sctp_auth.c optional inet sctp netinet/sctp_bsd_addr.c optional inet sctp diff --git a/sys/netinet/cc.h b/sys/netinet/cc.h new file mode 100644 index 000000000000..6f24f117bf54 --- /dev/null +++ b/sys/netinet/cc.h @@ -0,0 +1,161 @@ +/*- + * Copyright (c) 2007-2008 + * Swinburne University of Technology, Melbourne, Australia. + * Copyright (c) 2009-2010 Lawrence Stewart + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed at the Centre for Advanced Internet + * Architectures, Swinburne University, by Lawrence Stewart and James Healy, + * made possible in part by a grant from the Cisco University Research Program + * Fund at Community Foundation Silicon Valley. + * + * Portions of this software were developed at the Centre for Advanced + * Internet Architectures, Swinburne University of Technology, Melbourne, + * Australia by David Hayes under sponsorship from the FreeBSD Foundation. + * + * 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 software was first released in 2007 by James Healy and Lawrence Stewart + * whilst working on the NewTCP research project at Swinburne University's + * Centre for Advanced Internet Architectures, Melbourne, Australia, which was + * made possible in part by a grant from the Cisco University Research Program + * Fund at Community Foundation Silicon Valley. More details are available at: + * http://caia.swin.edu.au/urp/newtcp/ + */ + +#ifndef _NETINET_CC_H_ +#define _NETINET_CC_H_ + +/* XXX: TCP_CA_NAME_MAX define lives in tcp.h for compat reasons. */ +#include + +/* Global CC vars. */ +extern STAILQ_HEAD(cc_head, cc_algo) cc_list; +extern const int tcprexmtthresh; +extern struct cc_algo newreno_cc_algo; + +/* Define the new net.inet.tcp.cc sysctl tree. */ +SYSCTL_DECL(_net_inet_tcp_cc); + +/* CC housekeeping functions. */ +void cc_init(void); +int cc_register_algo(struct cc_algo *add_cc); +int cc_deregister_algo(struct cc_algo *remove_cc); + +/* + * Wrapper around transport structs that contain same-named congestion + * control variables. Allows algos to be shared amongst multiple CC aware + * transprots. + */ +struct cc_var { + void *cc_data; /* Per-connection private CC algorithm data. */ + int bytes_this_ack; /* # bytes acked by the current ACK. */ + tcp_seq curack; /* Most recent ACK. */ + uint32_t flags; /* Flags for cc_var (see below) */ + int type; /* Indicates which ptr is valid in ccvc. */ + union ccv_container { + struct tcpcb *tcp; + struct sctp_nets *sctp; + } ccvc; +}; + +/* cc_var flags. */ +#define CCF_ABC_SENTAWND 0x0001 /* ABC counted cwnd worth of bytes? */ +#define CCF_CWND_LIMITED 0x0002 /* Are we currently cwnd limited? */ + +/* ACK types passed to the ack_received() hook. */ +#define CC_ACK 0x0001 /* Regular in sequence ACK. */ +#define CC_DUPACK 0x0002 /* Duplicate ACK. */ +#define CC_PARTIALACK 0x0004 /* Not yet. */ +#define CC_SACK 0x0008 /* Not yet. */ + +/* + * Congestion signal types passed to the cong_signal() hook. The highest order 8 + * bits (0x01000000 - 0x80000000) are reserved for CC algos to declare their own + * congestion signal types. + */ +#define CC_ECN 0x000001/* ECN marked packet received. */ +#define CC_RTO 0x000002/* RTO fired. */ +#define CC_RTO_ERR 0x000004/* RTO fired in error. */ +#define CC_NDUPACK 0x000008/* Threshold of dupack's reached. */ + +/* + * Structure to hold data and function pointers that together represent a + * congestion control algorithm. + */ +struct cc_algo { + char name[TCP_CA_NAME_MAX]; + + /* Init global module state on kldload. */ + int (*mod_init)(void); + + /* Cleanup global module state on kldunload. */ + int (*mod_destroy)(void); + + /* Init CC state for a new control block. */ + int (*cb_init)(struct cc_var *ccv); + + /* Cleanup CC state for a terminating control block. */ + void (*cb_destroy)(struct cc_var *ccv); + + /* Init variables for a newly established connection. */ + void (*conn_init)(struct cc_var *ccv); + + /* Called on receipt of an ack. */ + void (*ack_received)(struct cc_var *ccv, uint16_t type); + + /* Called on detection of a congestion signal. */ + void (*cong_signal)(struct cc_var *ccv, uint32_t type); + + /* Called after exiting congestion recovery. */ + void (*post_recovery)(struct cc_var *ccv); + + /* Called when data transfer resumes after an idle period. */ + void (*after_idle)(struct cc_var *ccv); + + STAILQ_ENTRY (cc_algo) entries; +}; + +/* Macro to obtain the CC algo's struct ptr. */ +#define CC_ALGO(tp) ((tp)->cc_algo) + +/* Macro to obtain the CC algo's data ptr. */ +#define CC_DATA(tp) ((tp)->ccv->cc_data) + +/* Macro to obtain the system default CC algo's struct ptr. */ +#define CC_DEFAULT() STAILQ_FIRST(&cc_list) + +extern struct rwlock cc_list_lock; +#define CC_LIST_LOCK_INIT() rw_init(&cc_list_lock, "cc_list") +#define CC_LIST_LOCK_DESTROY() rw_destroy(&cc_list_lock) +#define CC_LIST_RLOCK() rw_rlock(&cc_list_lock) +#define CC_LIST_RUNLOCK() rw_runlock(&cc_list_lock) +#define CC_LIST_WLOCK() rw_wlock(&cc_list_lock) +#define CC_LIST_WUNLOCK() rw_wunlock(&cc_list_lock) +#define CC_LIST_WLOCK_ASSERT() rw_assert(&cc_list_lock, RA_WLOCKED) + +#endif /* _NETINET_CC_H_ */ diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c new file mode 100644 index 000000000000..4643ca40105e --- /dev/null +++ b/sys/netinet/cc/cc.c @@ -0,0 +1,340 @@ +/*- + * Copyright (c) 2007-2008 + * Swinburne University of Technology, Melbourne, Australia. + * Copyright (c) 2009-2010 Lawrence Stewart + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed at the Centre for Advanced Internet + * Architectures, Swinburne University, by Lawrence Stewart and James Healy, + * made possible in part by a grant from the Cisco University Research Program + * Fund at Community Foundation Silicon Valley. + * + * Portions of this software were developed at the Centre for Advanced + * Internet Architectures, Swinburne University of Technology, Melbourne, + * Australia by David Hayes under sponsorship from the FreeBSD Foundation. + * + * 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. + */ + +/* + * This software was first released in 2007 by James Healy and Lawrence Stewart + * whilst working on the NewTCP research project at Swinburne University's + * Centre for Advanced Internet Architectures, Melbourne, Australia, which was + * made possible in part by a grant from the Cisco University Research Program + * Fund at Community Foundation Silicon Valley. More details are available at: + * http://caia.swin.edu.au/urp/newtcp/ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +/* + * List of available cc algorithms on the current system. First element + * is used as the system default CC algorithm. + */ +struct cc_head cc_list = STAILQ_HEAD_INITIALIZER(cc_list); + +/* Protects the cc_list TAILQ. */ +struct rwlock cc_list_lock; + +/* + * Set the default CC algorithm to new_default. The default is identified + * by being the first element in the cc_list TAILQ. + */ +static void +cc_set_default(struct cc_algo *new_default) +{ + CC_LIST_WLOCK_ASSERT(); + + /* + * Make the requested system default CC algorithm the first element in + * the list if it isn't already. + */ + if (new_default != CC_DEFAULT()) { + STAILQ_REMOVE(&cc_list, new_default, cc_algo, entries); + STAILQ_INSERT_HEAD(&cc_list, new_default, entries); + } +} + +/* + * Sysctl handler to show and change the default CC algorithm. + */ +static int +cc_default_algo(SYSCTL_HANDLER_ARGS) +{ + struct cc_algo *funcs; + int err, found; + + err = found = 0; + + if (req->newptr == NULL) { + char default_cc[TCP_CA_NAME_MAX]; + + /* Just print the current default. */ + CC_LIST_RLOCK(); + strlcpy(default_cc, CC_DEFAULT()->name, TCP_CA_NAME_MAX); + CC_LIST_RUNLOCK(); + err = sysctl_handle_string(oidp, default_cc, 1, req); + } else { + /* Find algo with specified name and set it to default. */ + CC_LIST_WLOCK(); + STAILQ_FOREACH(funcs, &cc_list, entries) { + if (strncmp((char *)req->newptr, funcs->name, + TCP_CA_NAME_MAX) == 0) { + found = 1; + cc_set_default(funcs); + } + } + CC_LIST_WUNLOCK(); + + if (!found) + err = ESRCH; + } + + return (err); +} + +/* + * Sysctl handler to display the list of available CC algorithms. + */ +static int +cc_list_available(SYSCTL_HANDLER_ARGS) +{ + struct cc_algo *algo; + struct sbuf *s; + int err, first; + + err = 0; + first = 1; + s = sbuf_new(NULL, NULL, TCP_CA_NAME_MAX, SBUF_AUTOEXTEND); + + if (s == NULL) + return (ENOMEM); + + CC_LIST_RLOCK(); + STAILQ_FOREACH(algo, &cc_list, entries) { + err = sbuf_printf(s, first ? "%s" : ", %s", algo->name); + if (err) + break; + first = 0; + } + CC_LIST_RUNLOCK(); + + if (!err) { + sbuf_finish(s); + err = sysctl_handle_string(oidp, sbuf_data(s), 1, req); + } + + sbuf_delete(s); + return (err); +} + +/* + * Initialise CC subsystem on system boot. + */ +void +cc_init() +{ + CC_LIST_LOCK_INIT(); + STAILQ_INIT(&cc_list); +} + +/* + * Returns non-zero on success, 0 on failure. + */ +int +cc_deregister_algo(struct cc_algo *remove_cc) +{ + struct cc_algo *funcs, *tmpfuncs; + struct tcpcb *tp; + struct inpcb *inp; + int err; + + err = ENOENT; + + /* Never allow newreno to be deregistered. */ + if (&newreno_cc_algo == remove_cc) + return (EPERM); + + /* Remove algo from cc_list so that new connections can't use it. */ + CC_LIST_WLOCK(); + STAILQ_FOREACH_SAFE(funcs, &cc_list, entries, tmpfuncs) { + if (funcs == remove_cc) { + /* + * If we're removing the current system default, + * reset the default to newreno. + */ + if (strncmp(CC_DEFAULT()->name, remove_cc->name, + TCP_CA_NAME_MAX) == 0) + cc_set_default(&newreno_cc_algo); + + STAILQ_REMOVE(&cc_list, funcs, cc_algo, entries); + err = 0; + break; + } + } + CC_LIST_WUNLOCK(); + + if (!err) { + /* + * Check all active control blocks and change any that are + * using this algorithm back to newreno. If the algorithm that + * was in use requires cleanup code to be run, call it. + * + * New connections already part way through being initialised + * with the CC algo we're removing will not race with this code + * because the INP_INFO_WLOCK is held during initialisation. + * We therefore don't enter the loop below until the connection + * list has stabilised. + */ + INP_INFO_RLOCK(&V_tcbinfo); + LIST_FOREACH(inp, &V_tcb, inp_list) { + INP_WLOCK(inp); + /* Important to skip tcptw structs. */ + if (!(inp->inp_flags & INP_TIMEWAIT) && + (tp = intotcpcb(inp)) != NULL) { + /* + * By holding INP_WLOCK here, we are + * assured that the connection is not + * currently executing inside the CC + * module's functions i.e. it is safe to + * make the switch back to newreno. + */ + if (CC_ALGO(tp) == remove_cc) { + tmpfuncs = CC_ALGO(tp); + /* Newreno does not require any init. */ + CC_ALGO(tp) = &newreno_cc_algo; + if (tmpfuncs->cb_destroy != NULL) + tmpfuncs->cb_destroy(tp->ccv); + } + } + INP_WUNLOCK(inp); + } + INP_INFO_RUNLOCK(&V_tcbinfo); + } + + return (err); +} + +/* + * Returns 0 on success, non-zero on failure. + */ +int +cc_register_algo(struct cc_algo *add_cc) +{ + struct cc_algo *funcs; + int err; + + err = 0; + + /* + * Iterate over list of registered CC algorithms and make sure + * we're not trying to add a duplicate. + */ + CC_LIST_WLOCK(); + STAILQ_FOREACH(funcs, &cc_list, entries) { + if (funcs == add_cc || strncmp(funcs->name, add_cc->name, + TCP_CA_NAME_MAX) == 0) + err = EEXIST; + } + + if (!err) + STAILQ_INSERT_TAIL(&cc_list, add_cc, entries); + + CC_LIST_WUNLOCK(); + + return (err); +} + +/* + * Handles kld related events. Returns 0 on success, non-zero on failure. + */ +int +cc_modevent(module_t mod, int event_type, void *data) +{ + struct cc_algo *algo; + int err; + + err = 0; + algo = (struct cc_algo *)data; + + switch(event_type) { + case MOD_LOAD: + if (algo->mod_init != NULL) + err = algo->mod_init(); + if (!err) + err = cc_register_algo(algo); + break; + + case MOD_QUIESCE: + case MOD_SHUTDOWN: + case MOD_UNLOAD: + err = cc_deregister_algo(algo); + if (!err && algo->mod_destroy != NULL) + algo->mod_destroy(); + if (err == ENOENT) + err = 0; + break; + + default: + err = EINVAL; + break; + } + + return (err); +} + +/* Declare sysctl tree and populate it. */ +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, cc, CTLFLAG_RW, NULL, + "congestion control related settings"); + +SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, algorithm, CTLTYPE_STRING|CTLFLAG_RW, + NULL, 0, cc_default_algo, "A", "default congestion control algorithm"); + +SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, available, CTLTYPE_STRING|CTLFLAG_RD, + NULL, 0, cc_list_available, "A", + "list available congestion control algorithms"); diff --git a/sys/netinet/cc/cc_module.h b/sys/netinet/cc/cc_module.h new file mode 100644 index 000000000000..f3fe7525c5b9 --- /dev/null +++ b/sys/netinet/cc/cc_module.h @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2009-2010 Lawrence Stewart + * All rights reserved. + * + * This software was developed by Lawrence Stewart while studying at the Centre + * for Advanced Internet Architectures, Swinburne University, made possible in + * part by a grant from the Cisco University Research Program Fund at Community + * Foundation Silicon Valley. + * + * 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 software was first released in 2009 by Lawrence Stewart as part of the + * NewTCP research project at Swinburne University's Centre for Advanced + * Internet Architectures, Melbourne, Australia, which was made possible in part + * by a grant from the Cisco University Research Program Fund at Community + * Foundation Silicon Valley. More details are available at: + * http://caia.swin.edu.au/urp/newtcp/ + */ + +#ifndef _NETINET_CC_MODULE_H_ +#define _NETINET_CC_MODULE_H_ + +/* + * Allows a CC algorithm to manipulate a commonly named CC variable regardless + * of the transport protocol and associated C struct. + * XXXLAS: Out of action until the work to support SCTP is done. + * +#define CCV(ccv, what) \ +(*( \ + (ccv)->type == IPPROTO_TCP ? &(ccv)->ccvc.tcp->what : \ + &(ccv)->ccvc.sctp->what \ +)) + */ +#define CCV(ccv, what) (ccv)->ccvc.tcp->what + +#define DECLARE_CC_MODULE(ccname, ccalgo) \ + static moduledata_t cc_##ccname = { \ + .name = #ccname, \ + .evhand = cc_modevent, \ + .priv = ccalgo \ + }; \ + DECLARE_MODULE(ccname, cc_##ccname, \ + SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY) + +int cc_modevent(module_t mod, int type, void *data); + +#endif /* _NETINET_CC_MODULE_H_ */ diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c new file mode 100644 index 000000000000..e3835100ddb6 --- /dev/null +++ b/sys/netinet/cc/cc_newreno.c @@ -0,0 +1,231 @@ +/*- + * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 + * The Regents of the University of California. + * Copyright (c) 2007-2008,2010 + * Swinburne University of Technology, Melbourne, Australia. + * Copyright (c) 2009-2010 Lawrence Stewart + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed at the Centre for Advanced Internet + * Architectures, Swinburne University, by Lawrence Stewart, James Healy and + * David Hayes, made possible in part by a grant from the Cisco University + * Research Program Fund at Community Foundation Silicon Valley. + * + * Portions of this software were developed at the Centre for Advanced + * Internet Architectures, Swinburne University of Technology, Melbourne, + * Australia by David Hayes under sponsorship from the FreeBSD Foundation. + * + * 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. + */ + +/* + * This software was first released in 2007 by James Healy and Lawrence Stewart + * whilst working on the NewTCP research project at Swinburne University's + * Centre for Advanced Internet Architectures, Melbourne, Australia, which was + * made possible in part by a grant from the Cisco University Research Program + * Fund at Community Foundation Silicon Valley. More details are available at: + * http://caia.swin.edu.au/urp/newtcp/ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +void newreno_ack_received(struct cc_var *ccv, uint16_t type); +void newreno_cong_signal(struct cc_var *ccv, uint32_t type); +void newreno_post_recovery(struct cc_var *ccv); +void newreno_after_idle(struct cc_var *ccv); + +struct cc_algo newreno_cc_algo = { + .name = "newreno", + .ack_received = newreno_ack_received, + .cong_signal = newreno_cong_signal, + .post_recovery = newreno_post_recovery, + .after_idle = newreno_after_idle +}; + +/* + * Increase cwnd on receipt of a successful ACK: + * if cwnd <= ssthresh, increases by 1 MSS per ACK + * if cwnd > ssthresh, increase by ~1 MSS per RTT + */ +void +newreno_ack_received(struct cc_var *ccv, uint16_t type) +{ + if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && + (ccv->flags & CCF_CWND_LIMITED)) { + u_int cw = CCV(ccv, snd_cwnd); + u_int incr = CCV(ccv, t_maxseg); + + /* + * Regular in-order ACK, open the congestion window. + * Method depends on which congestion control state we're + * in (slow start or cong avoid) and if ABC (RFC 3465) is + * enabled. + * + * slow start: cwnd <= ssthresh + * cong avoid: cwnd > ssthresh + * + * slow start and ABC (RFC 3465): + * Grow cwnd exponentially by the amount of data + * ACKed capping the max increment per ACK to + * (abc_l_var * maxseg) bytes. + * + * slow start without ABC (RFC 5681): + * Grow cwnd exponentially by maxseg per ACK. + * + * cong avoid and ABC (RFC 3465): + * Grow cwnd linearly by maxseg per RTT for each + * cwnd worth of ACKed data. + * + * cong avoid without ABC (RFC 5681): + * Grow cwnd linearly by approximately maxseg per RTT using + * maxseg^2 / cwnd per ACK as the increment. + * If cwnd > maxseg^2, fix the cwnd increment at 1 byte to + * avoid capping cwnd. + */ + if (cw > CCV(ccv, snd_ssthresh)) { + if (V_tcp_do_rfc3465) { + if (ccv->flags & CCF_ABC_SENTAWND) + ccv->flags &= ~CCF_ABC_SENTAWND; + else + incr = 0; + } else + incr = max((incr * incr / cw), 1); + } else if (V_tcp_do_rfc3465) { + /* + * In slow-start with ABC enabled and no RTO in sight? + * (Must not use abc_l_var > 1 if slow starting after + * an RTO. On RTO, snd_nxt = snd_una, so the + * snd_nxt == snd_max check is sufficient to + * handle this). + * + * XXXLAS: Find a way to signal SS after RTO that + * doesn't rely on tcpcb vars. + */ + if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max)) + incr = min(ccv->bytes_this_ack, + V_tcp_abc_l_var * CCV(ccv, t_maxseg)); + else + incr = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg)); + } + /* ABC is on by default, so incr equals 0 frequently. */ + if (incr > 0) + CCV(ccv, snd_cwnd) = min(cw + incr, + TCP_MAXWIN << CCV(ccv, snd_scale)); + } +} + +/* + * manage congestion signals + */ +void +newreno_cong_signal(struct cc_var *ccv, uint32_t type) +{ + u_int win; + + win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * + CCV(ccv, t_maxseg); + + switch (type) { + case CC_NDUPACK: + if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) + CCV(ccv, snd_ssthresh) = win; + ENTER_RECOVERY(CCV(ccv, t_flags)); + } + break; + case CC_ECN: + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { + CCV(ccv, snd_ssthresh) = win; + CCV(ccv, snd_cwnd) = win; + ENTER_CONGRECOVERY(CCV(ccv, t_flags)); + } + break; + } +} + +/* + * decrease the cwnd in response to packet loss or a transmit timeout. + * th can be null, in which case cwnd will be set according to reno instead + * of new reno. + */ +void +newreno_post_recovery(struct cc_var *ccv) +{ + if (IN_FASTRECOVERY(CCV(ccv, t_flags))) { + /* + * Fast recovery will conclude after returning from this + * function. Window inflation should have left us with + * approximately snd_ssthresh outstanding data. But in case we + * would be inclined to send a burst, better to do it via the + * slow start mechanism. + * + * XXXLAS: Find a way to do this without needing curack + */ + if (SEQ_GT(ccv->curack + CCV(ccv, snd_ssthresh), + CCV(ccv, snd_max))) + CCV(ccv, snd_cwnd) = CCV(ccv, snd_max) - + ccv->curack + CCV(ccv, t_maxseg); + else + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + } +} + +/* + * if a connection has been idle for a while and more data is ready to be sent, + * reset cwnd + */ +void +newreno_after_idle(struct cc_var *ccv) +{ + /* + * We have been idle for "a while" and no acks are expected to clock out + * any data we send -- slow start to get ack "clock" running again. + */ + if (V_tcp_do_rfc3390) + CCV(ccv, snd_cwnd) = min(4 * CCV(ccv, t_maxseg), + max(2 * CCV(ccv, t_maxseg), 4380)); + else + CCV(ccv, snd_cwnd) = CCV(ccv, t_maxseg) * 2; +} + + +DECLARE_CC_MODULE(newreno, &newreno_cc_algo); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 22a2ea4a89c7..8fb9a52dc2a8 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,6 +1,20 @@ /*- * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 * The Regents of the University of California. All rights reserved. + * Copyright (c) 2007-2008,2010 + * Swinburne University of Technology, Melbourne, Australia. + * Copyright (c) 2009-2010 Lawrence Stewart + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed at the Centre for Advanced Internet + * Architectures, Swinburne University, by Lawrence Stewart, James Healy and + * David Hayes, made possible in part by a grant from the Cisco University + * Research Program Fund at Community Foundation Silicon Valley. + * + * Portions of this software were developed at the Centre for Advanced + * Internet Architectures, Swinburne University of Technology, Melbourne, + * Australia by David Hayes under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -61,6 +75,7 @@ __FBSDID("$FreeBSD$"); #define TCPSTATES /* for logging */ +#include #include #include #include @@ -75,7 +90,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -96,7 +110,7 @@ __FBSDID("$FreeBSD$"); #include -static const int tcprexmtthresh = 3; +const int tcprexmtthresh = 3; VNET_DEFINE(struct tcpstat, tcpstat); SYSCTL_VNET_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RW, @@ -132,19 +146,16 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_RW, "Enable RFC 3042 (Limited Transmit)"); VNET_DEFINE(int, tcp_do_rfc3390) = 1; -#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, rfc3390, CTLFLAG_RW, &VNET_NAME(tcp_do_rfc3390), 0, "Enable RFC 3390 (Increasing TCP's Initial Congestion Window)"); VNET_DEFINE(int, tcp_do_rfc3465) = 1; -#define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, rfc3465, CTLFLAG_RW, &VNET_NAME(tcp_do_rfc3465), 0, "Enable RFC 3465 (Appropriate Byte Counting)"); VNET_DEFINE(int, tcp_abc_l_var) = 2; -#define V_tcp_abc_l_var VNET(tcp_abc_l_var) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, abc_l_var, CTLFLAG_RW, &VNET_NAME(tcp_abc_l_var), 2, "Cap the max cwnd increment during slow-start to this number of segments"); @@ -203,8 +214,10 @@ static void tcp_pulloutofband(struct socket *, struct tcphdr *, struct mbuf *, int); static void tcp_xmit_timer(struct tcpcb *, int); static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *); -static void inline - tcp_congestion_exp(struct tcpcb *); +static void inline cc_ack_received(struct tcpcb *tp, struct tcphdr *th, + uint16_t type); +static void inline cc_conn_init(struct tcpcb *tp); +static void inline cc_post_recovery(struct tcpcb *tp, struct tcphdr *th); /* * Kernel module interface for updating tcpstat. The argument is an index @@ -220,20 +233,188 @@ kmod_tcpstat_inc(int statnum) (*((u_long *)&V_tcpstat + statnum))++; } +/* + * CC wrapper hook functions + */ static void inline -tcp_congestion_exp(struct tcpcb *tp) +cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type) { - u_int win; - - win = min(tp->snd_wnd, tp->snd_cwnd) / - 2 / tp->t_maxseg; - if (win < 2) - win = 2; - tp->snd_ssthresh = win * tp->t_maxseg; - ENTER_FASTRECOVERY(tp); - tp->snd_recover = tp->snd_max; - if (tp->t_flags & TF_ECN_PERMIT) - tp->t_flags |= TF_ECN_SND_CWR; + INP_WLOCK_ASSERT(tp->t_inpcb); + + tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th); + if (tp->snd_cwnd == min(tp->snd_cwnd, tp->snd_wnd)) + tp->ccv->flags |= CCF_CWND_LIMITED; + else + tp->ccv->flags &= ~CCF_CWND_LIMITED; + + if (type == CC_ACK) { + if (tp->snd_cwnd > tp->snd_ssthresh) { + tp->t_bytes_acked += min(tp->ccv->bytes_this_ack, + V_tcp_abc_l_var * tp->t_maxseg); + if (tp->t_bytes_acked >= tp->snd_cwnd) { + tp->t_bytes_acked -= tp->snd_cwnd; + tp->ccv->flags |= CCF_ABC_SENTAWND; + } + } else { + tp->ccv->flags &= ~CCF_ABC_SENTAWND; + tp->t_bytes_acked = 0; + } + } + + if (CC_ALGO(tp)->ack_received != NULL) { + /* XXXLAS: Find a way to live without this */ + tp->ccv->curack = th->th_ack; + CC_ALGO(tp)->ack_received(tp->ccv, type); + } +} + +static void inline +cc_conn_init(struct tcpcb *tp) +{ + struct hc_metrics_lite metrics; + struct inpcb *inp = tp->t_inpcb; + int rtt; +#ifdef INET6 + int isipv6 = ((inp->inp_vflag & INP_IPV6) != 0) ? 1 : 0; +#endif + + INP_WLOCK_ASSERT(tp->t_inpcb); + + tcp_hc_get(&inp->inp_inc, &metrics); + + if (tp->t_srtt == 0 && (rtt = metrics.rmx_rtt)) { + tp->t_srtt = rtt; + tp->t_rttbest = tp->t_srtt + TCP_RTT_SCALE; + TCPSTAT_INC(tcps_usedrtt); + if (metrics.rmx_rttvar) { + tp->t_rttvar = metrics.rmx_rttvar; + TCPSTAT_INC(tcps_usedrttvar); + } else { + /* default variation is +- 1 rtt */ + tp->t_rttvar = + tp->t_srtt * TCP_RTTVAR_SCALE / TCP_RTT_SCALE; + } + TCPT_RANGESET(tp->t_rxtcur, + ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1, + tp->t_rttmin, TCPTV_REXMTMAX); + } + if (metrics.rmx_ssthresh) { + /* + * There's some sort of gateway or interface + * buffer limit on the path. Use this to set + * the slow start threshhold, but set the + * threshold to no less than 2*mss. + */ + tp->snd_ssthresh = max(2 * tp->t_maxseg, metrics.rmx_ssthresh); + TCPSTAT_INC(tcps_usedssthresh); + } + + /* + * Set the slow-start flight size depending on whether this + * is a local network or not. + * + * Extend this so we cache the cwnd too and retrieve it here. + * Make cwnd even bigger than RFC3390 suggests but only if we + * have previous experience with the remote host. Be careful + * not make cwnd bigger than remote receive window or our own + * send socket buffer. Maybe put some additional upper bound + * on the retrieved cwnd. Should do incremental updates to + * hostcache when cwnd collapses so next connection doesn't + * overloads the path again. + * + * XXXAO: Initializing the CWND from the hostcache is broken + * and in its current form not RFC conformant. It is disabled + * until fixed or removed entirely. + * + * RFC3390 says only do this if SYN or SYN/ACK didn't got lost. + * We currently check only in syncache_socket for that. + */ +/* #define TCP_METRICS_CWND */ +#ifdef TCP_METRICS_CWND + if (metrics.rmx_cwnd) + tp->snd_cwnd = max(tp->t_maxseg, min(metrics.rmx_cwnd / 2, + min(tp->snd_wnd, so->so_snd.sb_hiwat))); + else +#endif + if (V_tcp_do_rfc3390) + tp->snd_cwnd = min(4 * tp->t_maxseg, + max(2 * tp->t_maxseg, 4380)); +#ifdef INET6 + else if ((isipv6 && in6_localaddr(&inp->in6p_faddr)) || + (!isipv6 && in_localaddr(inp->inp_faddr))) +#else + else if (in_localaddr(inp->inp_faddr)) +#endif + tp->snd_cwnd = tp->t_maxseg * V_ss_fltsz_local; + else + tp->snd_cwnd = tp->t_maxseg * V_ss_fltsz; + + if (CC_ALGO(tp)->conn_init != NULL) + CC_ALGO(tp)->conn_init(tp->ccv); +} + +void inline +cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) +{ + INP_WLOCK_ASSERT(tp->t_inpcb); + + switch(type) { + case CC_NDUPACK: + if (!IN_FASTRECOVERY(tp->t_flags)) { + tp->snd_recover = tp->snd_max; + if (tp->t_flags & TF_ECN_PERMIT) + tp->t_flags |= TF_ECN_SND_CWR; + } + break; + case CC_ECN: + if (!IN_CONGRECOVERY(tp->t_flags)) { + TCPSTAT_INC(tcps_ecn_rcwnd); + tp->snd_recover = tp->snd_max; + if (tp->t_flags & TF_ECN_PERMIT) + tp->t_flags |= TF_ECN_SND_CWR; + } + break; + case CC_RTO: + tp->t_dupacks = 0; + tp->t_bytes_acked = 0; + EXIT_RECOVERY(tp->t_flags); + tp->snd_cwnd = tp->t_maxseg; + break; + case CC_RTO_ERR: + TCPSTAT_INC(tcps_sndrexmitbad); + /* RTO was unnecessary, so reset everything. */ + tp->snd_cwnd = tp->snd_cwnd_prev; + tp->snd_ssthresh = tp->snd_ssthresh_prev; + tp->snd_recover = tp->snd_recover_prev; + if (tp->t_flags & TF_WASFRECOVERY) + ENTER_FASTRECOVERY(tp->t_flags); + if (tp->t_flags & TF_WASCRECOVERY) + ENTER_CONGRECOVERY(tp->t_flags); + tp->snd_nxt = tp->snd_max; + tp->t_badrxtwin = 0; + break; + } + + if (CC_ALGO(tp)->cong_signal != NULL) { + if (th != NULL) + tp->ccv->curack = th->th_ack; + CC_ALGO(tp)->cong_signal(tp->ccv, type); + } +} + +static void inline +cc_post_recovery(struct tcpcb *tp, struct tcphdr *th) +{ + INP_WLOCK_ASSERT(tp->t_inpcb); + + /* XXXLAS: KASSERT that we're in recovery? */ + + if (CC_ALGO(tp)->post_recovery != NULL) { + tp->ccv->curack = th->th_ack; + CC_ALGO(tp)->post_recovery(tp->ccv); + } + /* XXXLAS: EXIT_RECOVERY ? */ + tp->t_bytes_acked = 0; } /* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ @@ -1157,14 +1338,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, TCPSTAT_INC(tcps_ecn_ect1); break; } - /* - * Congestion experienced. - * Ignore if we are already trying to recover. - */ - if ((thflags & TH_ECE) && - SEQ_LEQ(th->th_ack, tp->snd_recover)) { - TCPSTAT_INC(tcps_ecn_rcwnd); - tcp_congestion_exp(tp); + /* Congestion experienced. */ + if (thflags & TH_ECE) { + cc_cong_signal(tp, th, CC_ECN); } } @@ -1259,15 +1435,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (tlen == 0) { if (SEQ_GT(th->th_ack, tp->snd_una) && SEQ_LEQ(th->th_ack, tp->snd_max) && - tp->snd_cwnd >= tp->snd_wnd && - ((!V_tcp_do_newreno && - !(tp->t_flags & TF_SACK_PERMIT) && - tp->t_dupacks < tcprexmtthresh) || - ((V_tcp_do_newreno || - (tp->t_flags & TF_SACK_PERMIT)) && - !IN_FASTRECOVERY(tp) && - (to.to_flags & TOF_SACK) == 0 && - TAILQ_EMPTY(&tp->snd_holes)))) { + !IN_RECOVERY(tp->t_flags) && + (to.to_flags & TOF_SACK) == 0 && + TAILQ_EMPTY(&tp->snd_holes)) { /* * This is a pure ack for outstanding data. */ @@ -1287,15 +1457,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) { - TCPSTAT_INC(tcps_sndrexmitbad); - tp->snd_cwnd = tp->snd_cwnd_prev; - tp->snd_ssthresh = - tp->snd_ssthresh_prev; - tp->snd_recover = tp->snd_recover_prev; - if (tp->t_flags & TF_WASFRECOVERY) - ENTER_FASTRECOVERY(tp); - tp->snd_nxt = tp->snd_max; - tp->t_badrxtwin = 0; + cc_cong_signal(tp, th, CC_RTO_ERR); } /* @@ -1321,13 +1483,22 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tcp_xmit_timer(tp, ticks - tp->t_rtttime); } - acked = th->th_ack - tp->snd_una; + acked = BYTES_THIS_ACK(tp, th); TCPSTAT_INC(tcps_rcvackpack); TCPSTAT_ADD(tcps_rcvackbyte, acked); sbdrop(&so->so_snd, acked); if (SEQ_GT(tp->snd_una, tp->snd_recover) && SEQ_LEQ(th->th_ack, tp->snd_recover)) tp->snd_recover = th->th_ack - 1; + + /* + * Let the congestion control algorithm update + * congestion control related information. This + * typically means increasing the congestion + * window. + */ + cc_ack_received(tp, th, CC_ACK); + tp->snd_una = th->th_ack; /* * Pull snd_wl2 up to prevent seq wrap relative @@ -1587,6 +1758,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, thflags &= ~TH_SYN; } else { tp->t_state = TCPS_ESTABLISHED; + cc_conn_init(tp); tcp_timer_activate(tp, TT_KEEP, tcp_keepidle); } } else { @@ -1990,6 +2162,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->t_flags &= ~TF_NEEDFIN; } else { tp->t_state = TCPS_ESTABLISHED; + cc_conn_init(tp); tcp_timer_activate(tp, TT_KEEP, tcp_keepidle); } /* @@ -2058,11 +2231,10 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, th->th_ack != tp->snd_una) tp->t_dupacks = 0; else if (++tp->t_dupacks > tcprexmtthresh || - ((V_tcp_do_newreno || - (tp->t_flags & TF_SACK_PERMIT)) && - IN_FASTRECOVERY(tp))) { + IN_FASTRECOVERY(tp->t_flags)) { + cc_ack_received(tp, th, CC_DUPACK); if ((tp->t_flags & TF_SACK_PERMIT) && - IN_FASTRECOVERY(tp)) { + IN_FASTRECOVERY(tp->t_flags)) { int awnd; /* @@ -2093,19 +2265,20 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * recovery. */ if (tp->t_flags & TF_SACK_PERMIT) { - if (IN_FASTRECOVERY(tp)) { + if (IN_FASTRECOVERY(tp->t_flags)) { tp->t_dupacks = 0; break; } - } else if (V_tcp_do_newreno || - V_tcp_do_ecn) { + } else { if (SEQ_LEQ(th->th_ack, tp->snd_recover)) { tp->t_dupacks = 0; break; } } - tcp_congestion_exp(tp); + /* Congestion signal before ack. */ + cc_cong_signal(tp, th, CC_NDUPACK); + cc_ack_received(tp, th, CC_DUPACK); tcp_timer_activate(tp, TT_REXMT, 0); tp->t_rtttime = 0; if (tp->t_flags & TF_SACK_PERMIT) { @@ -2129,6 +2302,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->snd_nxt = onxt; goto drop; } else if (V_tcp_do_rfc3042) { + cc_ack_received(tp, th, CC_DUPACK); u_long oldcwnd = tp->snd_cwnd; tcp_seq oldsndmax = tp->snd_max; u_int sent; @@ -2170,37 +2344,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * If the congestion window was inflated to account * for the other side's cached packets, retract it. */ - if (V_tcp_do_newreno || (tp->t_flags & TF_SACK_PERMIT)) { - if (IN_FASTRECOVERY(tp)) { - if (SEQ_LT(th->th_ack, tp->snd_recover)) { - if (tp->t_flags & TF_SACK_PERMIT) - tcp_sack_partialack(tp, th); - else - tcp_newreno_partial_ack(tp, th); - } else { - /* - * Out of fast recovery. - * Window inflation should have left us - * with approximately snd_ssthresh - * outstanding data. - * But in case we would be inclined to - * send a burst, better to do it via - * the slow start mechanism. - */ - if (SEQ_GT(th->th_ack + - tp->snd_ssthresh, - tp->snd_max)) - tp->snd_cwnd = tp->snd_max - - th->th_ack + - tp->t_maxseg; - else - tp->snd_cwnd = tp->snd_ssthresh; - } - } - } else { - if (tp->t_dupacks >= tcprexmtthresh && - tp->snd_cwnd > tp->snd_ssthresh) - tp->snd_cwnd = tp->snd_ssthresh; + if (IN_FASTRECOVERY(tp->t_flags)) { + if (SEQ_LT(th->th_ack, tp->snd_recover)) { + if (tp->t_flags & TF_SACK_PERMIT) + tcp_sack_partialack(tp, th); + else + tcp_newreno_partial_ack(tp, th); + } else + cc_post_recovery(tp, th); } tp->t_dupacks = 0; /* @@ -2231,7 +2382,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, ("tcp_input: process_ACK ti_locked %d", ti_locked)); INP_WLOCK_ASSERT(tp->t_inpcb); - acked = th->th_ack - tp->snd_una; + acked = BYTES_THIS_ACK(tp, th); TCPSTAT_INC(tcps_rcvackpack); TCPSTAT_ADD(tcps_rcvackbyte, acked); @@ -2242,16 +2393,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * original cwnd and ssthresh, and proceed to transmit where * we left off. */ - if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) { - TCPSTAT_INC(tcps_sndrexmitbad); - tp->snd_cwnd = tp->snd_cwnd_prev; - tp->snd_ssthresh = tp->snd_ssthresh_prev; - tp->snd_recover = tp->snd_recover_prev; - if (tp->t_flags & TF_WASFRECOVERY) - ENTER_FASTRECOVERY(tp); - tp->snd_nxt = tp->snd_max; - tp->t_badrxtwin = 0; /* XXX probably not required */ - } + if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) + cc_cong_signal(tp, th, CC_RTO_ERR); /* * If we have a timestamp reply, update smoothed @@ -2298,61 +2441,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, goto step6; /* - * When new data is acked, open the congestion window. - * Method depends on which congestion control state we're - * in (slow start or cong avoid) and if ABC (RFC 3465) is - * enabled. - * - * slow start: cwnd <= ssthresh - * cong avoid: cwnd > ssthresh - * - * slow start and ABC (RFC 3465): - * Grow cwnd exponentially by the amount of data - * ACKed capping the max increment per ACK to - * (abc_l_var * maxseg) bytes. - * - * slow start without ABC (RFC 2581): - * Grow cwnd exponentially by maxseg per ACK. - * - * cong avoid and ABC (RFC 3465): - * Grow cwnd linearly by maxseg per RTT for each - * cwnd worth of ACKed data. - * - * cong avoid without ABC (RFC 2581): - * Grow cwnd linearly by approximately maxseg per RTT using - * maxseg^2 / cwnd per ACK as the increment. - * If cwnd > maxseg^2, fix the cwnd increment at 1 byte to - * avoid capping cwnd. + * Let the congestion control algorithm update congestion + * control related information. This typically means increasing + * the congestion window. */ - if ((!V_tcp_do_newreno && !(tp->t_flags & TF_SACK_PERMIT)) || - !IN_FASTRECOVERY(tp)) { - u_int cw = tp->snd_cwnd; - u_int incr = tp->t_maxseg; - /* In congestion avoidance? */ - if (cw > tp->snd_ssthresh) { - if (V_tcp_do_rfc3465) { - tp->t_bytes_acked += acked; - if (tp->t_bytes_acked >= tp->snd_cwnd) - tp->t_bytes_acked -= cw; - else - incr = 0; - } - else - incr = max((incr * incr / cw), 1); - /* - * In slow-start with ABC enabled and no RTO in sight? - * (Must not use abc_l_var > 1 if slow starting after an - * RTO. On RTO, snd_nxt = snd_una, so the snd_nxt == - * snd_max check is sufficient to handle this). - */ - } else if (V_tcp_do_rfc3465 && - tp->snd_nxt == tp->snd_max) - incr = min(acked, - V_tcp_abc_l_var * tp->t_maxseg); - /* ABC is on by default, so (incr == 0) frequently. */ - if (incr > 0) - tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<snd_scale); - } + cc_ack_received(tp, th, CC_ACK); + SOCKBUF_LOCK(&so->so_snd); if (acked > so->so_snd.sb_cc) { tp->snd_wnd -= so->so_snd.sb_cc; @@ -2366,16 +2460,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, /* NB: sowwakeup_locked() does an implicit unlock. */ sowwakeup_locked(so); /* Detect una wraparound. */ - if ((V_tcp_do_newreno || (tp->t_flags & TF_SACK_PERMIT)) && - !IN_FASTRECOVERY(tp) && + if (!IN_RECOVERY(tp->t_flags) && SEQ_GT(tp->snd_una, tp->snd_recover) && SEQ_LEQ(th->th_ack, tp->snd_recover)) tp->snd_recover = th->th_ack - 1; - if ((V_tcp_do_newreno || (tp->t_flags & TF_SACK_PERMIT)) && - IN_FASTRECOVERY(tp) && + /* XXXLAS: Can this be moved up into cc_post_recovery? */ + if (IN_RECOVERY(tp->t_flags) && SEQ_GEQ(th->th_ack, tp->snd_recover)) { - EXIT_FASTRECOVERY(tp); - tp->t_bytes_acked = 0; + EXIT_RECOVERY(tp->t_flags); } tp->snd_una = th->th_ack; if (tp->t_flags & TF_SACK_PERMIT) { @@ -3240,24 +3332,19 @@ tcp_mss_update(struct tcpcb *tp, int offer, void tcp_mss(struct tcpcb *tp, int offer) { - int rtt, mss; + int mss; u_long bufsize; struct inpcb *inp; struct socket *so; struct hc_metrics_lite metrics; int mtuflags = 0; -#ifdef INET6 - int isipv6; -#endif + KASSERT(tp != NULL, ("%s: tp == NULL", __func__)); tcp_mss_update(tp, offer, &metrics, &mtuflags); mss = tp->t_maxseg; inp = tp->t_inpcb; -#ifdef INET6 - isipv6 = ((inp->inp_vflag & INP_IPV6) != 0) ? 1 : 0; -#endif /* * If there's a pipesize, change the socket buffer to that size, @@ -3297,71 +3384,6 @@ tcp_mss(struct tcpcb *tp, int offer) (void)sbreserve_locked(&so->so_rcv, bufsize, so, NULL); } SOCKBUF_UNLOCK(&so->so_rcv); - /* - * While we're here, check the others too. - */ - if (tp->t_srtt == 0 && (rtt = metrics.rmx_rtt)) { - tp->t_srtt = rtt; - tp->t_rttbest = tp->t_srtt + TCP_RTT_SCALE; - TCPSTAT_INC(tcps_usedrtt); - if (metrics.rmx_rttvar) { - tp->t_rttvar = metrics.rmx_rttvar; - TCPSTAT_INC(tcps_usedrttvar); - } else { - /* default variation is +- 1 rtt */ - tp->t_rttvar = - tp->t_srtt * TCP_RTTVAR_SCALE / TCP_RTT_SCALE; - } - TCPT_RANGESET(tp->t_rxtcur, - ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1, - tp->t_rttmin, TCPTV_REXMTMAX); - } - if (metrics.rmx_ssthresh) { - /* - * There's some sort of gateway or interface - * buffer limit on the path. Use this to set - * the slow start threshhold, but set the - * threshold to no less than 2*mss. - */ - tp->snd_ssthresh = max(2 * mss, metrics.rmx_ssthresh); - TCPSTAT_INC(tcps_usedssthresh); - } - - /* - * Set the slow-start flight size depending on whether this - * is a local network or not. - * - * Extend this so we cache the cwnd too and retrieve it here. - * Make cwnd even bigger than RFC3390 suggests but only if we - * have previous experience with the remote host. Be careful - * not make cwnd bigger than remote receive window or our own - * send socket buffer. Maybe put some additional upper bound - * on the retrieved cwnd. Should do incremental updates to - * hostcache when cwnd collapses so next connection doesn't - * overloads the path again. - * - * RFC3390 says only do this if SYN or SYN/ACK didn't got lost. - * We currently check only in syncache_socket for that. - */ -#define TCP_METRICS_CWND -#ifdef TCP_METRICS_CWND - if (metrics.rmx_cwnd) - tp->snd_cwnd = max(mss, - min(metrics.rmx_cwnd / 2, - min(tp->snd_wnd, so->so_snd.sb_hiwat))); - else -#endif - if (V_tcp_do_rfc3390) - tp->snd_cwnd = min(4 * mss, max(2 * mss, 4380)); -#ifdef INET6 - else if ((isipv6 && in6_localaddr(&inp->in6p_faddr)) || - (!isipv6 && in_localaddr(inp->inp_faddr))) -#else - else if (in_localaddr(inp->inp_faddr)) -#endif - tp->snd_cwnd = mss * V_ss_fltsz_local; - else - tp->snd_cwnd = mss * V_ss_fltsz; /* Check the interface for TSO capabilities. */ if (mtuflags & CSUM_TSO) @@ -3425,7 +3447,7 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) * Set snd_cwnd to one segment beyond acknowledged offset. * (tp->snd_una has not yet been updated when this function is called.) */ - tp->snd_cwnd = tp->t_maxseg + (th->th_ack - tp->snd_una); + tp->snd_cwnd = tp->t_maxseg + BYTES_THIS_ACK(tp, th); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); tp->snd_cwnd = ocwnd; @@ -3435,8 +3457,8 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) * Partial window deflation. Relies on fact that tp->snd_una * not updated yet. */ - if (tp->snd_cwnd > th->th_ack - tp->snd_una) - tp->snd_cwnd -= th->th_ack - tp->snd_una; + if (tp->snd_cwnd > BYTES_THIS_ACK(tp, th)) + tp->snd_cwnd -= BYTES_THIS_ACK(tp, th); else tp->snd_cwnd = 0; tp->snd_cwnd += tp->t_maxseg; diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index b5bc3d985520..7db0adb42ded 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -64,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#include #define TCPOUTFLAGS #include #include @@ -102,11 +102,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, local_slowstart_flightsize, CTLFLAG_RW, &VNET_NAME(ss_fltsz_local), 1, "Slow start flight size for local networks"); -VNET_DEFINE(int, tcp_do_newreno) = 1; -SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, newreno, CTLFLAG_RW, - &VNET_NAME(tcp_do_newreno), 0, - "Enable NewReno Algorithms"); - VNET_DEFINE(int, tcp_do_tso) = 1; #define V_tcp_do_tso VNET(tcp_do_tso) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, tso, CTLFLAG_RW, @@ -131,6 +126,19 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, sendbuf_max, CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_max), 0, "Max size of automatic send buffer"); +static void inline cc_after_idle(struct tcpcb *tp); + +/* + * CC wrapper hook functions + */ +static void inline +cc_after_idle(struct tcpcb *tp) +{ + INP_WLOCK_ASSERT(tp->t_inpcb); + + if (CC_ALGO(tp)->after_idle != NULL) + CC_ALGO(tp)->after_idle(tp->ccv); +} /* * Tcp output routine: figure out what should be sent and send it. @@ -241,7 +249,7 @@ tcp_output(struct tcpcb *tp) sack_bytes_rxmt = 0; len = 0; p = NULL; - if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp) && + if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags) && (p = tcp_sack_output(tp, &sack_bytes_rxmt))) { long cwin; @@ -1315,7 +1323,7 @@ tcp_output(struct tcpcb *tp) * on the transmitter effectively destroys the TCP window, forcing * it to four packets (1.5Kx4 = 6K window). */ - if (sendalot && (!V_tcp_do_newreno || --maxburst)) + if (sendalot && --maxburst) goto again; #endif if (sendalot) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 737c2b2af099..47d44ec16b91 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -576,7 +576,7 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) tcp_timer_activate(tp, TT_REXMT, 0); tp->t_rtttime = 0; /* Send one or 2 segments based on how much new data was acked. */ - if (((th->th_ack - tp->snd_una) / tp->t_maxseg) > 2) + if ((BYTES_THIS_ACK(tp, th) / tp->t_maxseg) > 2) num_segs = 2; tp->snd_cwnd = (tp->sackhint.sack_bytes_rexmit + (tp->snd_nxt - tp->sack_newdata) + num_segs * tp->t_maxseg); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index dc4395dc6137..8596e234f807 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -80,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#include #include #include #include @@ -238,6 +238,7 @@ static char * tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, struct tcpcb_mem { struct tcpcb tcb; struct tcp_timer tt; + struct cc_var ccv; }; static VNET_DEFINE(uma_zone_t, tcpcb_zone); @@ -277,6 +278,8 @@ tcp_init(void) { int hashsize; + cc_init(); + hashsize = TCBHASHSIZE; TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize); if (!powerof2(hashsize)) { @@ -640,6 +643,26 @@ tcp_newtcpcb(struct inpcb *inp) if (tm == NULL) return (NULL); tp = &tm->tcb; + + /* Initialise cc_var struct for this tcpcb. */ + tp->ccv = &tm->ccv; + tp->ccv->type = IPPROTO_TCP; + tp->ccv->ccvc.tcp = tp; + + /* + * Use the current system default CC algorithm. + */ + CC_LIST_RLOCK(); + KASSERT(!STAILQ_EMPTY(&cc_list), ("cc_list is empty!")); + CC_ALGO(tp) = CC_DEFAULT(); + CC_LIST_RUNLOCK(); + + if (CC_ALGO(tp)->cb_init != NULL) + if (CC_ALGO(tp)->cb_init(tp->ccv) > 0) { + uma_zfree(V_tcpcb_zone, tm); + return (NULL); + } + #ifdef VIMAGE tp->t_vnet = inp->inp_vnet; #endif @@ -805,6 +828,12 @@ tcp_discardcb(struct tcpcb *tp) tcp_offload_detach(tp); tcp_free_sackholes(tp); + + /* Allow the CC algorithm to clean up after itself. */ + if (CC_ALGO(tp)->cb_destroy != NULL) + CC_ALGO(tp)->cb_destroy(tp->ccv); + + CC_ALGO(tp) = NULL; inp->inp_ppcb = NULL; tp->t_inpcb = NULL; uma_zfree(V_tcpcb_zone, tp); @@ -1572,7 +1601,7 @@ tcp_mtudisc(struct inpcb *inp, int errno) tcp_free_sackholes(tp); tp->snd_recover = tp->snd_max; if (tp->t_flags & TF_SACK_PERMIT) - EXIT_FASTRECOVERY(tp); + EXIT_FASTRECOVERY(tp->t_flags); tcp_output_send(tp); return (inp); } diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 65c6a3ec41ab..2748e64601df 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -58,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#include #include #include #include @@ -515,10 +515,14 @@ tcp_timer_rexmt(void * xtp) tp->snd_cwnd_prev = tp->snd_cwnd; tp->snd_ssthresh_prev = tp->snd_ssthresh; tp->snd_recover_prev = tp->snd_recover; - if (IN_FASTRECOVERY(tp)) - tp->t_flags |= TF_WASFRECOVERY; + if (IN_FASTRECOVERY(tp->t_flags)) + tp->t_flags |= TF_WASFRECOVERY; else - tp->t_flags &= ~TF_WASFRECOVERY; + tp->t_flags &= ~TF_WASFRECOVERY; + if (IN_CONGRECOVERY(tp->t_flags)) + tp->t_flags |= TF_WASCRECOVERY; + else + tp->t_flags &= ~TF_WASCRECOVERY; tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1)); } TCPSTAT_INC(tcps_rexmttimeo); @@ -562,40 +566,9 @@ tcp_timer_rexmt(void * xtp) * If timing a segment in this window, stop the timer. */ tp->t_rtttime = 0; - /* - * Close the congestion window down to one segment - * (we'll open it by one segment for each ack we get). - * Since we probably have a window's worth of unacked - * data accumulated, this "slow start" keeps us from - * dumping all that data as back-to-back packets (which - * might overwhelm an intermediate gateway). - * - * There are two phases to the opening: Initially we - * open by one mss on each ack. This makes the window - * size increase exponentially with time. If the - * window is larger than the path can handle, this - * exponential growth results in dropped packet(s) - * almost immediately. To get more time between - * drops but still "push" the network to take advantage - * of improving conditions, we switch from exponential - * to linear window opening at some threshhold size. - * For a threshhold, we use half the current window - * size, truncated to a multiple of the mss. - * - * (the minimum cwnd that will give us exponential - * growth is 2 mss. We don't allow the threshhold - * to go below this.) - */ - { - u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; - if (win < 2) - win = 2; - tp->snd_cwnd = tp->t_maxseg; - tp->snd_ssthresh = win * tp->t_maxseg; - tp->t_dupacks = 0; - } - EXIT_FASTRECOVERY(tp); - tp->t_bytes_acked = 0; + + cc_cong_signal(tp, 0, CC_RTO); + (void) tcp_output(tp); out: diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index f35890bee192..a28ddef232a7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef INET6 @@ -77,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#include #include #include #include @@ -1242,6 +1242,8 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) struct inpcb *inp; struct tcpcb *tp; struct tcp_info ti; + char buf[TCP_CA_NAME_MAX]; + struct cc_algo *algo; error = 0; inp = sotoinpcb(so); @@ -1351,6 +1353,54 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) error = EINVAL; break; + case TCP_CONGESTION: + INP_WUNLOCK(inp); + bzero(buf, sizeof(buf)); + error = sooptcopyin(sopt, &buf, sizeof(buf), 1); + if (error) + break; + INP_WLOCK_RECHECK(inp); + /* + * Return EINVAL if we can't find the requested cc algo. + */ + error = EINVAL; + CC_LIST_RLOCK(); + STAILQ_FOREACH(algo, &cc_list, entries) { + if (strncmp(buf, algo->name, TCP_CA_NAME_MAX) + == 0) { + /* We've found the requested algo. */ + error = 0; + /* + * We hold a write lock over the tcb + * so it's safe to do these things + * without ordering concerns. + */ + if (CC_ALGO(tp)->cb_destroy != NULL) + CC_ALGO(tp)->cb_destroy(tp->ccv); + CC_ALGO(tp) = algo; + /* + * If something goes pear shaped + * initialising the new algo, + * fall back to newreno (which + * does not require initialisation). + */ + if (algo->cb_init != NULL) + if (algo->cb_init(tp->ccv) > 0) { + CC_ALGO(tp) = &newreno_cc_algo; + /* + * The only reason init + * should fail is + * because of malloc. + */ + error = ENOMEM; + } + break; /* Break the STAILQ_FOREACH. */ + } + } + CC_LIST_RUNLOCK(); + INP_WUNLOCK(inp); + break; + default: INP_WUNLOCK(inp); error = ENOPROTOOPT; @@ -1394,6 +1444,12 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) INP_WUNLOCK(inp); error = sooptcopyout(sopt, &ti, sizeof ti); break; + case TCP_CONGESTION: + bzero(buf, sizeof(buf)); + strlcpy(buf, CC_ALGO(tp)->name, TCP_CA_NAME_MAX); + INP_WUNLOCK(inp); + error = sooptcopyout(sopt, buf, TCP_CA_NAME_MAX); + break; default: INP_WUNLOCK(inp); error = ENOPROTOOPT; @@ -1707,6 +1763,10 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_FASTRECOVERY", comma ? ", " : ""); comma = 1; } + if (t_flags & TF_CONGRECOVERY) { + db_printf("%sTF_CONGRECOVERY", comma ? ", " : ""); + comma = 1; + } if (t_flags & TF_WASFRECOVERY) { db_printf("%sTF_WASFRECOVERY", comma ? ", " : ""); comma = 1; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 0b286812f1f1..442c73621b85 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -195,9 +195,11 @@ struct tcpcb { struct toe_usrreqs *t_tu; /* offload operations vector */ void *t_toe; /* TOE pcb pointer */ int t_bytes_acked; /* # bytes acked during current RTT */ + struct cc_algo *cc_algo; /* congestion control algorithm */ + struct cc_var *ccv; int t_ispare; /* explicit pad for 64bit alignment */ - void *t_pspare2[6]; /* 2 CC / 4 TBD */ + void *t_pspare2[4]; /* 4 TBD */ uint64_t _pad[12]; /* 7 UTO, 5 TBD (1-2 CC/RTT?) */ }; @@ -230,10 +232,22 @@ struct tcpcb { #define TF_ECN_PERMIT 0x4000000 /* connection ECN-ready */ #define TF_ECN_SND_CWR 0x8000000 /* ECN CWR in queue */ #define TF_ECN_SND_ECE 0x10000000 /* ECN ECE in queue */ +#define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ +#define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */ -#define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY) -#define ENTER_FASTRECOVERY(tp) tp->t_flags |= TF_FASTRECOVERY -#define EXIT_FASTRECOVERY(tp) tp->t_flags &= ~TF_FASTRECOVERY +#define IN_FASTRECOVERY(t_flags) (t_flags & TF_FASTRECOVERY) +#define ENTER_FASTRECOVERY(t_flags) t_flags |= TF_FASTRECOVERY +#define EXIT_FASTRECOVERY(t_flags) t_flags &= ~TF_FASTRECOVERY + +#define IN_CONGRECOVERY(t_flags) (t_flags & TF_CONGRECOVERY) +#define ENTER_CONGRECOVERY(t_flags) t_flags |= TF_CONGRECOVERY +#define EXIT_CONGRECOVERY(t_flags) t_flags &= ~TF_CONGRECOVERY + +#define IN_RECOVERY(t_flags) (t_flags & (TF_CONGRECOVERY | TF_FASTRECOVERY)) +#define ENTER_RECOVERY(t_flags) t_flags |= (TF_CONGRECOVERY | TF_FASTRECOVERY) +#define EXIT_RECOVERY(t_flags) t_flags &= ~(TF_CONGRECOVERY | TF_FASTRECOVERY) + +#define BYTES_THIS_ACK(tp, th) (th->th_ack - tp->snd_una) /* * Flags for the t_oobflags field. @@ -562,10 +576,11 @@ VNET_DECLARE(int, tcp_mssdflt); /* XXX */ VNET_DECLARE(int, tcp_minmss); VNET_DECLARE(int, tcp_delack_enabled); VNET_DECLARE(int, tcp_do_rfc3390); -VNET_DECLARE(int, tcp_do_newreno); VNET_DECLARE(int, path_mtu_discovery); VNET_DECLARE(int, ss_fltsz); VNET_DECLARE(int, ss_fltsz_local); +VNET_DECLARE(int, tcp_do_rfc3465); +VNET_DECLARE(int, tcp_abc_l_var); #define V_tcb VNET(tcb) #define V_tcbinfo VNET(tcbinfo) #define V_tcpstat VNET(tcpstat) @@ -573,10 +588,11 @@ VNET_DECLARE(int, ss_fltsz_local); #define V_tcp_minmss VNET(tcp_minmss) #define V_tcp_delack_enabled VNET(tcp_delack_enabled) #define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390) -#define V_tcp_do_newreno VNET(tcp_do_newreno) #define V_path_mtu_discovery VNET(path_mtu_discovery) #define V_ss_fltsz VNET(ss_fltsz) #define V_ss_fltsz_local VNET(ss_fltsz_local) +#define V_tcp_do_rfc3465 VNET(tcp_do_rfc3465) +#define V_tcp_abc_l_var VNET(tcp_abc_l_var) VNET_DECLARE(int, tcp_do_sack); /* SACK enabled/disabled */ VNET_DECLARE(int, tcp_sc_rst_sock_fail); /* RST on sock alloc failure */ @@ -678,6 +694,8 @@ void tcp_free_sackholes(struct tcpcb *tp); int tcp_newreno(struct tcpcb *, struct tcphdr *); u_long tcp_seq_subtract(u_long, u_long ); +void cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type); + #endif /* _KERNEL */ #endif /* _NETINET_TCP_VAR_H_ */ diff --git a/sys/sys/param.h b/sys/sys/param.h index a64c77b2601c..acd1f519e383 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900024 /* Master, propagated to newvers */ +#define __FreeBSD_version 900025 /* Master, propagated to newvers */ #ifndef LOCORE #include From 396a7f502550c3b92ddb03322241d6d1241f7ba3 Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Fri, 12 Nov 2010 12:07:36 +0000 Subject: [PATCH 19/28] Stop documenting vgonel() after its converting to the static function: svn r147332 (by jeff): "Don't make vgonel() globally visible". While here, specify the vnode locking scheme for vgone(). Discussed on: freebsd-hackers@ Approved by: kib (mentor) MFC after: 10 days --- ObsoleteFiles.inc | 2 ++ share/man/man9/Makefile | 1 - share/man/man9/vflush.9 | 1 - share/man/man9/vgone.9 | 26 +++++++++----------------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 66983cc448e0..ff0d20d2dd1d 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20101112: vgonel(9) has gone to private API a while ago +OLD_FILES+=usr/share/man/man9/vgonel.9.gz # 20101112: removed gasp.info OLD_FILES+=usr/share/info/gasp.info.gz # 20101109: headers moved to machine/ to x86/ diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ecb1dff57610..d75768231e77 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1318,7 +1318,6 @@ MLINKS+=vfs_getopt.9 vfs_copyopt.9 \ vfs_getopt.9 vfs_setopt_part.9 \ vfs_getopt.9 vfs_setopts.9 MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9 -MLINKS+=vgone.9 vgonel.9 MLINKS+=vhold.9 vdrop.9 \ vhold.9 vdropl.9 \ vhold.9 vholdl.9 diff --git a/share/man/man9/vflush.9 b/share/man/man9/vflush.9 index 37aa31bbfcf1..94485f925797 100644 --- a/share/man/man9/vflush.9 +++ b/share/man/man9/vflush.9 @@ -75,7 +75,6 @@ A value of 0 is returned if the flush is successful; otherwise, will be returned. .Sh SEE ALSO .Xr vgone 9 , -.Xr vgonel 9 , .Xr vrele 9 .Sh AUTHORS This manual page was written by diff --git a/share/man/man9/vgone.9 b/share/man/man9/vgone.9 index fa30c1eb3abf..12715e133ddd 100644 --- a/share/man/man9/vgone.9 +++ b/share/man/man9/vgone.9 @@ -26,24 +26,21 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2001 +.Dd November 12, 2010 .Dt VGONE 9 .Os .Sh NAME -.Nm vgone , vgonel +.Nm vgone .Nd "prepare a vnode for reuse" .Sh SYNOPSIS .In sys/param.h .In sys/vnode.h .Ft void .Fn vgone "struct vnode *vp" -.Ft void -.Fn vgonel "struct vnode *vp" "struct thread *td" .Sh DESCRIPTION +The .Fn vgone -and -.Fn vgonel -prepare a vnode for reuse by another file system. +function prepares the vnode to be destroyed. The preparation includes the cleaning of all file system specific data and the removal from its mount point vnode list. .Pp @@ -55,17 +52,12 @@ flag is not set, it is moved to the head of the free list as in most cases the vnode is about to be reused, or its file system is being unmounted. .Pp -The difference between +The .Fn vgone -and -.Fn vgonel -is that -.Fn vgone -locks the vnode interlock and then calls -.Fn vgonel -while -.Fn vgonel -expects the interlock to already be locked. +function takes an exclusively locked vnode, and returns with the vnode +exclusively locked. +.Sh SEE ALSO +.Xr vnode 9 .Sh AUTHORS This manual page was written by .An Chad David Aq davidc@acns.ab.ca . From 2f8d87d326d2a274b1a932d537f182bdae4dbf88 Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Fri, 12 Nov 2010 12:48:41 +0000 Subject: [PATCH 20/28] move the initialization of BINMAKE earler, so it is available throughout the entire build process. Submitted by: Matteo Landi MFC after: 3 days --- release/picobsd/build/picobsd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/release/picobsd/build/picobsd b/release/picobsd/build/picobsd index b798389286c9..7948b5b89f6e 100755 --- a/release/picobsd/build/picobsd +++ b/release/picobsd/build/picobsd @@ -297,11 +297,6 @@ build_image() { PICO_OBJ=${l_objtree}/picobsd/${THETYPE} log "PICO_OBJ is ${PICO_OBJ}" - if [ ${OSVERSION} -ge 500035 ] ; then - export MAKEOBJDIRPREFIX=${l_objtree} - eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" - eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` - fi # create build directory and subtree mkdir -p ${BUILDDIR}/crunch # remove any old stuff @@ -979,10 +974,17 @@ set_build_parameters() { l_usrtree=${USR:-${SRC}/../usr} fi l_objtree=${l_usrtree}/obj-pico + PICO_TREE=${PICO_TREE:-${SRC}/release/picobsd} set `grep "#define[\t ]__FreeBSD_version" ${SRC}/sys/sys/param.h` OSVERSION=$3 log "OSVERSION is ${OSVERSION}" + if [ ${OSVERSION} -ge 500035 ] ; then + export MAKEOBJDIRPREFIX=${l_objtree} + eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" + eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` + fi + if [ "${o_init_src}" != "" ] ; then if [ ${OSVERSION} -lt 500035 ] ; then create_includes_and_libraries From 5c9d0a9ad384b852bdbc408697e27015334ea249 Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Fri, 12 Nov 2010 13:02:26 +0000 Subject: [PATCH 21/28] This commit implements the SO_USER_COOKIE socket option, which lets you tag a socket with an uint32_t value. The cookie can then be used by the kernel for various purposes, e.g. setting the skipto rule or pipe number in ipfw (this is the reason SO_USER_COOKIE has been implemented; however there is nothing ipfw-specific in its implementation). The ipfw-related code that uses the optopn will be committed separately. This change adds a field to 'struct socket', but the struct is not part of any driver or userland-visible ABI so the change should be harmless. See the discussion at http://lists.freebsd.org/pipermail/freebsd-ipfw/2009-October/004001.html Idea and code from Paul Joe, small modifications and manpage changes by myself. Submitted by: Paul Joe MFC after: 1 week --- lib/libc/sys/getsockopt.2 | 18 ++++++++++++++++++ sys/kern/uipc_socket.c | 10 ++++++++++ sys/sys/socket.h | 1 + sys/sys/socketvar.h | 7 +++++++ 4 files changed, 36 insertions(+) diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2 index d3472d0b4aeb..7370b6b3354d 100644 --- a/lib/libc/sys/getsockopt.2 +++ b/lib/libc/sys/getsockopt.2 @@ -184,15 +184,18 @@ The following options are recognized in .It Dv SO_LISTENQLIMIT Ta "get backlog limit of the socket (get only)" .It Dv SO_LISTENQLEN Ta "get complete queue length of the socket (get only)" .It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get only)" +.It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket (uint32_t, set only)" .El .Pp .Dv SO_DEBUG enables debugging in the underlying protocol modules. +.Pp .Dv SO_REUSEADDR indicates that the rules used in validating addresses supplied in a .Xr bind 2 system call should allow reuse of local addresses. +.Pp .Dv SO_REUSEPORT allows completely duplicate bindings by multiple processes if they all set @@ -200,6 +203,7 @@ if they all set before binding the port. This option permits multiple instances of a program to each receive UDP/IP multicast or broadcast datagrams destined for the bound port. +.Pp .Dv SO_KEEPALIVE enables the periodic transmission of messages on a connected socket. @@ -208,6 +212,7 @@ connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified via a .Dv SIGPIPE signal when attempting to send data. +.Pp .Dv SO_DONTROUTE indicates that outgoing messages should bypass the standard routing facilities. @@ -244,6 +249,7 @@ The option requests permission to send broadcast datagrams on the socket. Broadcast was a privileged operation in earlier versions of the system. +.Pp With protocols that support out-of-band data, the .Dv SO_OOBINLINE option @@ -256,6 +262,7 @@ calls without the .Dv MSG_OOB flag. Some protocols always behave as if this option is set. +.Pp .Dv SO_SNDBUF and .Dv SO_RCVBUF @@ -285,6 +292,7 @@ only if the low water mark amount could be processed. The default value for .Dv SO_SNDLOWAT is set to a convenient size for network efficiency, often 1024. +.Pp .Dv SO_RCVLOWAT is an option to set the minimum count for input operations. In general, receive calls will block until any (non-zero) amount of data @@ -317,6 +325,7 @@ In the current implementation, this timer is restarted each time additional data are delivered to the protocol, implying that the limit applies to output portions ranging in size from the low water mark to the high water mark for output. +.Pp .Dv SO_RCVTIMEO is an option to set a timeout value for input operations. It accepts a @@ -338,6 +347,15 @@ The value must be from 0 to one less than the number returned from the sysctl .Em net.fibs . .Pp +.Dv SO_USER_COOKIE +can be used to set the uint32_t so_user_cookie field in the socket. +The value is an uint32_t, and can be used in the kernel code that +manipulates traffic related to the socket. +The default value for the field is 0. +As an example, the value can be used as the skipto target or +pipe number in +.Nm ipfw/dummynet . +.Pp .Dv SO_ACCEPTFILTER places an .Xr accept_filter 9 diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index d6c9854fa1fb..e3e8e288a179 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2386,6 +2386,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) struct linger l; struct timeval tv; u_long val; + uint32_t val32; #ifdef MAC struct mac extmac; #endif @@ -2461,6 +2462,15 @@ sosetopt(struct socket *so, struct sockopt *sopt) so->so_fibnum = 0; } break; + + case SO_USER_COOKIE: + error = sooptcopyin(sopt, &val32, sizeof val32, + sizeof val32); + if (error) + goto bad; + so->so_user_cookie = val32; + break; + case SO_SNDBUF: case SO_RCVBUF: case SO_SNDLOWAT: diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 9f227482f170..6a5821988c2d 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -137,6 +137,7 @@ typedef __uid_t uid_t; #define SO_LISTENQLEN 0x1012 /* socket's complete queue length */ #define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */ #define SO_SETFIB 0x1014 /* use this FIB to route */ +#define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */ #endif /* diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 6d6578b68abe..94c3b24e5c3e 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -117,7 +117,14 @@ struct socket { void *so_accept_filter_arg; /* saved filter args */ char *so_accept_filter_str; /* saved user args */ } *so_accf; + /* + * so_fibnum, so_user_cookie and friends can be used to attach + * some user-specified metadata to a socket, which then can be + * used by the kernel for various actions. + * so_user_cookie is used by ipfw/dummynet. + */ int so_fibnum; /* routing domain for this socket */ + uint32_t so_user_cookie; }; /* From ae99fd0e07d2bdfee11230e2981722ab9bf35c4c Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Fri, 12 Nov 2010 13:05:17 +0000 Subject: [PATCH 22/28] The first customer of the SO_USER_COOKIE option: the "sockarg" ipfw option matches packets associated to a local socket and with a non-zero so_user_cookie value. The value is made available as tablearg, so it can be used as a skipto target or pipe number in ipfw/dummynet rules. Code by Paul Joe, manpage by me. Submitted by: Paul Joe MFC after: 1 week --- sbin/ipfw/ipfw.8 | 11 +++++++++++ sbin/ipfw/ipfw2.c | 7 +++++++ sbin/ipfw/ipfw2.h | 1 + sys/netinet/ip_fw.h | 3 +++ sys/netinet/ipfw/ip_fw2.c | 33 ++++++++++++++++++++++++++++++++ sys/netinet/ipfw/ip_fw_sockopt.c | 1 + 6 files changed, 56 insertions(+) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index a954c1d5415f..a984f70cb9e7 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1510,6 +1510,17 @@ interface. Matches TCP packets that have the SYN bit set but no ACK bit. This is the short form of .Dq Li tcpflags\ syn,!ack . +.It Cm sockarg +Matches packets that are associated to a local socket and +for which the SO_USER_COOKIE socket option has been set +to a non-zero value. As a side effect, the value of the +option is made available as +.Cm tablearg +value, which in turn can be used as +.Cm skipto +or +.Cm pipe +number. .It Cm src-ip Ar ip-address Matches IPv4 packets whose source IP is one of the address(es) specified as an argument. diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index f313b51b968f..9f2fe6961400 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -266,6 +266,7 @@ static struct _s_x rule_options[] = { { "estab", TOK_ESTAB }, { "established", TOK_ESTAB }, { "setup", TOK_SETUP }, + { "sockarg", TOK_SOCKARG }, { "tcpdatalen", TOK_TCPDATALEN }, { "tcpflags", TOK_TCPFLAGS }, { "tcpflgs", TOK_TCPFLAGS }, @@ -1338,6 +1339,9 @@ show_ipfw(struct ip_fw *rule, int pcwidth, int bcwidth) case O_FIB: printf(" fib %u", cmd->arg1 ); break; + case O_SOCKARG: + printf(" sockarg"); + break; case O_IN: printf(cmd->len & F_NOT ? " out" : " in"); @@ -3531,6 +3535,9 @@ ipfw_add(char *av[]) fill_cmd(cmd, O_FIB, 0, strtoul(*av, NULL, 0)); av++; break; + case TOK_SOCKARG: + fill_cmd(cmd, O_SOCKARG, 0, 0); + break; case TOK_LOOKUP: { ipfw_insn_u32 *c = (ipfw_insn_u32 *)cmd; diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 8566cdef0218..2ba091fd5634 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -199,6 +199,7 @@ enum tokens { TOK_FIB, TOK_SETFIB, TOK_LOOKUP, + TOK_SOCKARG, }; /* * the following macro returns an error message if we run out of diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index cf5d8d03a90e..fdcc5fd4c1df 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -192,10 +192,13 @@ enum ipfw_opcodes { /* arguments (4 byte each) */ O_SETFIB, /* arg1=FIB number */ O_FIB, /* arg1=FIB desired fib number */ + + O_SOCKARG, /* socket argument */ O_LAST_OPCODE /* not an opcode! */ }; + /* * The extension header are filtered only for presence using a bit * vector with a flag for each header. diff --git a/sys/netinet/ipfw/ip_fw2.c b/sys/netinet/ipfw/ip_fw2.c index c291089c6f85..43b2d1114295 100644 --- a/sys/netinet/ipfw/ip_fw2.c +++ b/sys/netinet/ipfw/ip_fw2.c @@ -1801,6 +1801,39 @@ do { \ match = 1; break; + case O_SOCKARG: { + struct inpcb *inp = args->inp; + struct inpcbinfo *pi; + + if (is_ipv6) /* XXX can we remove this ? */ + break; + + if (proto == IPPROTO_TCP) + pi = &V_tcbinfo; + else if (proto == IPPROTO_UDP) + pi = &V_udbinfo; + else + break; + + /* For incomming packet, lookup up the + inpcb using the src/dest ip/port tuple */ + if (inp == NULL) { + INP_INFO_RLOCK(pi); + inp = in_pcblookup_hash(pi, + src_ip, htons(src_port), + dst_ip, htons(dst_port), + 0, NULL); + INP_INFO_RUNLOCK(pi); + } + + if (inp && inp->inp_socket) { + tablearg = inp->inp_socket->so_user_cookie; + if (tablearg) + match = 1; + } + break; + } + case O_TAGGED: { struct m_tag *mtag; uint32_t tag = (cmd->arg1 == IP_FW_TABLEARG) ? diff --git a/sys/netinet/ipfw/ip_fw_sockopt.c b/sys/netinet/ipfw/ip_fw_sockopt.c index c50572873a16..0c903eedf5c7 100644 --- a/sys/netinet/ipfw/ip_fw_sockopt.c +++ b/sys/netinet/ipfw/ip_fw_sockopt.c @@ -572,6 +572,7 @@ check_ipfw_struct(struct ip_fw *rule, int size) case O_IPTOS: case O_IPPRECEDENCE: case O_IPVER: + case O_SOCKARG: case O_TCPWIN: case O_TCPFLAGS: case O_TCPOPTS: From 3fdfd0a4357621fe4d8cb008d688c57132711588 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 12 Nov 2010 14:40:20 +0000 Subject: [PATCH 23/28] sh(1): Modernize the introduction a bit. In particular, remove the text about ksh-like features, which are usually taken for granted nowadays. The original Bourne shell is fading away and for most users our /bin/sh is one of the most minimalistic they know. --- bin/sh/sh.1 | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index d5296922cea2..062a9da77dae 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd October 31, 2010 +.Dd November 12, 2010 .Dt SH 1 .Os .Sh NAME @@ -65,20 +65,13 @@ The utility is the standard command interpreter for the system. The current version of .Nm -is in the process of being changed to -conform with the -.St -p1003.2 +is close to the +.St -p1003.1 specification for the shell. -This version has many features which make -it appear -similar in some respects to the Korn shell, but it is not a Korn -shell clone like -.Nm pdksh . -Only features +It only supports features designated by .Tn POSIX , -plus a few Berkeley extensions, are being -incorporated into this shell. +plus a few Berkeley extensions. This man page is not intended to be a tutorial nor a complete specification of the shell. .Ss Overview From 2971d3bb6eef91dc41d91b354625c81a5bff9257 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Fri, 12 Nov 2010 15:20:10 +0000 Subject: [PATCH 24/28] Add CPU support code for the IBM Cell Broadband Engine. --- sys/powerpc/aim/mp_cpudep.c | 30 ++++++++++++++++++++++++++++++ sys/powerpc/include/cpufunc.h | 11 +++++++++++ sys/powerpc/include/spr.h | 4 ++++ sys/powerpc/powerpc/cpu.c | 3 +++ 4 files changed, 48 insertions(+) diff --git a/sys/powerpc/aim/mp_cpudep.c b/sys/powerpc/aim/mp_cpudep.c index b0423659f431..312164e04174 100644 --- a/sys/powerpc/aim/mp_cpudep.c +++ b/sys/powerpc/aim/mp_cpudep.c @@ -228,6 +228,21 @@ cpudep_save_config(void *dummy) powerpc_sync(); break; +#ifdef __powerpc64__ + case IBMCELLBE: + if (mfmsr() & PSL_HV) { + bsp_state[0] = mfspr(SPR_HID0); + bsp_state[1] = mfspr(SPR_HID1); + bsp_state[2] = mfspr(SPR_HID4); + bsp_state[3] = mfspr(SPR_HID6); + + bsp_state[4] = mfspr(SPR_CELL_TSCR); + } + + bsp_state[5] = mfspr(SPR_CELL_TSRL); + + break; +#endif case MPC7450: case MPC7455: case MPC7457: @@ -288,6 +303,21 @@ cpudep_ap_setup() powerpc_sync(); break; +#ifdef __powerpc64__ + case IBMCELLBE: + if (mfmsr() & PSL_HV) { + mtspr(SPR_HID0, bsp_state[0]); + mtspr(SPR_HID1, bsp_state[1]); + mtspr(SPR_HID4, bsp_state[2]); + mtspr(SPR_HID6, bsp_state[3]); + + mtspr(SPR_CELL_TSCR, bsp_state[4]); + } + + mtspr(SPR_CELL_TSRL, bsp_state[5]); + + break; +#endif case MPC7450: case MPC7455: case MPC7457: diff --git a/sys/powerpc/include/cpufunc.h b/sys/powerpc/include/cpufunc.h index 775ef19f2eb1..914935f5e775 100644 --- a/sys/powerpc/include/cpufunc.h +++ b/sys/powerpc/include/cpufunc.h @@ -106,6 +106,17 @@ mfsrin(vm_offset_t va) } #endif +static __inline register_t +mfctrl(void) +{ + register_t value; + + __asm __volatile ("mfspr %0,136" : "=r"(value)); + + return (value); +} + + static __inline void mtdec(register_t value) { diff --git a/sys/powerpc/include/spr.h b/sys/powerpc/include/spr.h index 317f4d117629..4027461259ed 100644 --- a/sys/powerpc/include/spr.h +++ b/sys/powerpc/include/spr.h @@ -420,6 +420,10 @@ #define SPR_HID1 0x3f1 /* ..8 Hardware Implementation Register 1 */ #define SPR_HID4 0x3f4 /* ..8 Hardware Implementation Register 4 */ #define SPR_HID5 0x3f6 /* ..8 Hardware Implementation Register 5 */ +#define SPR_HID6 0x3f9 /* ..8 Hardware Implementation Register 6 */ + +#define SPR_CELL_TSRL 0x380 /* ... Cell BE Thread Status Register */ +#define SPR_CELL_TSCR 0x399 /* ... Cell BE Thread Switch Register */ #if defined(AIM) #define SPR_DBSR 0x3f0 /* 4.. Debug Status Register */ diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index e5d43d89bf6a..97011562a8e2 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -149,6 +149,9 @@ static const struct cputab models[] = { 0, cpu_e500_setup }, { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN, 0, cpu_e500_setup }, + { "IBM Cell Broadband Engine", IBMCELLBE, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + NULL}, { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, NULL }, }; From 414f6985f306a91830de56349dd57594f8319b68 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 12 Nov 2010 15:30:49 +0000 Subject: [PATCH 25/28] Make POLL_ERR and POLL_HUP different. The kernel currently does not generate any of the POLL_* constants, but some applications use them and break if they are not all distinct. PR: kern/126076 MFC after: 1 week --- sys/sys/signal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 85116430fccc..971683516e3c 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -284,7 +284,7 @@ typedef struct __siginfo { #define POLL_MSG 3 /* Input message available */ #define POLL_ERR 4 /* I/O Error */ #define POLL_PRI 5 /* High priority input available */ -#define POLL_HUP 4 /* Device disconnected */ +#define POLL_HUP 6 /* Device disconnected */ #endif From 7f39c0011f49ccab75f43d092a28facde1b506e6 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 12 Nov 2010 15:40:00 +0000 Subject: [PATCH 26/28] sh: Remove unused man page for echo builtin. The information in sh(1) about the echo builtin is equivalent, though less extensive. The echo(1) man page (bin/echo/echo.1) is different. Unfortunately, sh's echo builtin and /bin/echo have gone out of sync and this probably cannot be fixed any more. Reported by: uqs (list of untouched files) MFC after: 1 week --- bin/sh/bltin/echo.1 | 114 -------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 bin/sh/bltin/echo.1 diff --git a/bin/sh/bltin/echo.1 b/bin/sh/bltin/echo.1 deleted file mode 100644 index 83f233704fd2..000000000000 --- a/bin/sh/bltin/echo.1 +++ /dev/null @@ -1,114 +0,0 @@ -.\"- -.\" Copyright (c) 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Kenneth Almquist. -.\" Copyright 1989 by Kenneth Almquist -.\" -.\" 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. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)echo.1 8.2 (Berkeley) 5/4/95 -.\" $FreeBSD$ -.\" -.Dd May 4, 1995 -.Dt ECHO 1 -.Os -.Sh NAME -.Nm echo -.Nd produce message in a shell script -.Sh SYNOPSIS -.Nm -.Op Fl n | Fl e -.Ar args... -.Sh DESCRIPTION -The -.Nm -utility prints its arguments on the standard output, separated by spaces. -Unless the -.Fl n -option is present, a newline is output following the arguments. -The -.Fl e -option causes -.Nm -to treat the escape sequences specially, as described in the following -paragraph. -The -.Fl e -option is the default, and is provided solely for compatibility with -other systems. -Only one of the options -.Fl n -and -.Fl e -may be given. -.Pp -If any of the following sequences of characters is encountered during -output, the sequence is not output. -Instead, the specified action is -performed: -.Bl -tag -width indent -.It Li \eb -A backspace character is output. -.It Li \ec -Subsequent output is suppressed. -This is normally used at the end of the -last argument to suppress the trailing newline that -.Nm -would otherwise output. -.It Li \ef -Output a form feed. -.It Li \en -Output a newline character. -.It Li \er -Output a carriage return. -.It Li \et -Output a (horizontal) tab character. -.It Li \ev -Output a vertical tab. -.It Li \e0 Ns Ar digits -Output the character whose value is given by zero to three digits. -If there are zero digits, a -.Dv NUL -character is output. -.It Li \e\e -Output a backslash. -.El -.Sh HINTS -Remember that backslash is special to the shell and needs to be escaped. -To output a message to standard error, say -.Pp -.D1 echo message >&2 -.Sh BUGS -The octal character escape mechanism -.Pq Li \e0 Ns Ar digits -differs from the -C language mechanism. -.Pp -There is no way to force -.Nm -to treat its arguments literally, rather than interpreting them as -options and escape sequences. From 585d4a8062519831fc8bc33fb0c7134b87ca94b2 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Fri, 12 Nov 2010 15:52:27 +0000 Subject: [PATCH 27/28] Revert to libgcc for sparc64. I've had a report of a sparc64 system where cc1 generates illegal instructions. We still have to diagnose this properly, but instead of hosing all sparc64 boxes out there, fall back to libgcc to prevent more damage. Reported by: Florian Smeets --- gnu/lib/libgcc/Makefile | 4 ++++ lib/libcompiler_rt/Makefile | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile index 2021c8c737cc..73fb1bebc89f 100644 --- a/gnu/lib/libgcc/Makefile +++ b/gnu/lib/libgcc/Makefile @@ -15,6 +15,10 @@ MK_SSP= no .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" +.if ${TARGET_CPUARCH} == "sparc64" +LIB= gcc +.endif + .PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR} CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile index 2da28aa9e675..103bb8ca504d 100644 --- a/lib/libcompiler_rt/Makefile +++ b/lib/libcompiler_rt/Makefile @@ -147,11 +147,13 @@ SRCS+= ${file}.c . endif .endfor -.if ${MK_INSTALLLIB} != "no" +.if ${MACHINE_CPUARCH} != "sparc64" +. if ${MK_INSTALLLIB} != "no" SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a -.endif -.if ${MK_PROFILE} != "no" +. endif +. if ${MK_PROFILE} != "no" SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a +. endif .endif .include From 67fe5233fc8d397403004a3356e184d189bc84df Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Fri, 12 Nov 2010 16:50:11 +0000 Subject: [PATCH 28/28] Add 'jid' as a possible sort order to the help screen. PR: bin/150992 Submitted by: Frederic Culot Approved by: avg (mentor) MFC after: 5 days --- contrib/top/commands.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/top/commands.c b/contrib/top/commands.c index 83f966d5e21b..47f4a2ea05fb 100644 --- a/contrib/top/commands.c +++ b/contrib/top/commands.c @@ -80,10 +80,12 @@ n or # - change number of processes to display\n", stdout); #ifdef ORDER if (displaymode == DISP_CPU) fputs("\ -o - specify sort order (pri, size, res, cpu, time, threads)\n", stdout); +o - specify sort order (pri, size, res, cpu, time, threads, jid)\n", + stdout); else fputs("\ -o - specify sort order (vcsw, ivcsw, read, write, fault, total)\n", stdout); +o - specify sort order (vcsw, ivcsw, read, write, fault, total, jid)\n", + stdout); #endif fputs("\ r - renice a process\n\