fix debug code, automatize buffer size calculation.

--- lib/libsa/net.c
+++ lib/libsa/net.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: net.c,v 1.4 1996/09/23 14:18:57 mickey Exp $	*/
+/*	$OpenBSD: net.c,v 1.5 1996/10/16 11:04:38 mickey Exp $	*/
 /*	$NetBSD: net.c,v 1.12 1995/12/13 23:38:10 pk Exp $	*/

 /*
@@ -43,8 +43,6 @@
 #include <sys/param.h>
 #include <sys/socket.h>

-#include <string.h>
-
 #include <net/if.h>
 #include <netinet/in.h>

@@ -59,6 +57,12 @@
 #include "stand.h"
 #include "net.h"

+#if defined(ARP_DEBUG) || defined(NET_DEBUG) || defined(BOOTP_DEBUG) || \
+    defined(ETHER_DEBUG) || defined(NETIF_DEBUG) || defined(NFS_DEBUG) || \
+    defined(RPC_DEBUG)
+int net_debug = 0;
+#endif
+
 /* Caller must leave room for ethernet, ip and udp headers in front!! */
 ssize_t
 sendudp(d, pkt, len)
@@ -74,7 +78,7 @@
 	struct ip tip;

 #ifdef NET_DEBUG
- 	if (debug) {
+ 	if (net_debug) {
 		printf("sendudp: d=%x called.\n", (u_int)d);
 		if (d) {
 			printf("saddr: %s:%d",
@@ -146,7 +150,7 @@
 	u_int16_t etype;	/* host order */

 #ifdef NET_DEBUG
-	if (debug)
+	if (net_debug)
 		printf("readudp: called\n");
 #endif

@@ -171,7 +175,7 @@

 	if (etype != ETHERTYPE_IP) {
 #ifdef NET_DEBUG
-		if (debug)
+		if (net_debug)
 			printf("readudp: not IP. ether_type=%x\n", etype);
 #endif
 		return -1;
@@ -181,7 +185,7 @@
 	if (ip->ip_v != IPVERSION ||
 	    ip->ip_p != IPPROTO_UDP) {	/* half char */
 #ifdef NET_DEBUG
-		if (debug)
+		if (net_debug)
 			printf("readudp: IP version or not UDP. ip_v=%d ip_p=%d\n", ip->ip_v, ip->ip_p);
 #endif
 		return -1;
@@ -191,7 +195,7 @@
 	if (hlen < sizeof(*ip) ||
 	    in_cksum(ip, hlen) != 0) {
 #ifdef NET_DEBUG
-		if (debug)
+		if (net_debug)
 			printf("readudp: short hdr or bad cksum.\n");
 #endif
 		return -1;
@@ -199,14 +203,14 @@
 	NTOHS(ip->ip_len);
 	if (n < ip->ip_len) {
 #ifdef NET_DEBUG
-		if (debug)
+		if (net_debug)
 			printf("readudp: bad length %d < %d.\n", n, ip->ip_len);
 #endif
 		return -1;
 	}
 	if (d->myip.s_addr && ip->ip_dst.s_addr != d->myip.s_addr) {
 #ifdef NET_DEBUG
-		if (debug) {
+		if (net_debug) {
 			printf("readudp: bad saddr %s != ", inet_ntoa(d->myip));
 			printf("%s\n", inet_ntoa(ip->ip_dst));
 		}
@@ -222,7 +226,7 @@
 	}
 	if (uh->uh_dport != d->myport) {
 #ifdef NET_DEBUG
-		if (debug)
+		if (net_debug)
 			printf("readudp: bad dport %d != %d\n",
 				d->myport, ntohs(uh->uh_dport));
 #endif
@@ -243,7 +247,7 @@
 		ui->ui_len = uh->uh_ulen;
 		if (in_cksum(ui, n) != 0) {
 #ifdef NET_DEBUG
-			if (debug)
+			if (net_debug)
 				printf("readudp: bad cksum\n");
 #endif
 			*ip = tip;
@@ -256,7 +260,7 @@
 	NTOHS(uh->uh_ulen);
 	if (uh->uh_ulen < sizeof(*uh)) {
 #ifdef NET_DEBUG
-		if (debug)
+		if (net_debug)
 			printf("readudp: bad udp len %d < %d\n",
 				uh->uh_ulen, sizeof(*uh));
 #endif
@@ -292,7 +296,7 @@
 	long tleft;

 #ifdef NET_DEBUG
-	if (debug)
+	if (net_debug)
 		printf("sendrecv: called\n");
 #endif

@@ -427,7 +431,7 @@
 	register char *cp;
 	register u_int byte;
 	register int n;
-	static char buf[17];	/* strlen(".255.255.255.255") + 1 */
+	static char buf[sizeof(".255.255.255.255")];

 	NTOHL(addr);
 	cp = &buf[sizeof buf];


Improve Italian translations

Improve Italian translations

--- src/dialect.c
+++ src/dialect.c
@@ -1655,7 +1655,7 @@
 static const wchar_t* const it_scenario_KEYWORDS[] = { L"Esempio", L"Scenario" };
 static const Keywords it_scenario_keywords = { 2, it_scenario_KEYWORDS };

-static const wchar_t* const it_scenarioOutline_KEYWORDS[] = { L"Schema dello esempio", L"Schema dello scenario" };
+static const wchar_t* const it_scenarioOutline_KEYWORDS[] = { L"Schema dell'esempio", L"Schema dello scenario" };
 static const Keywords it_scenarioOutline_keywords = { 2, it_scenarioOutline_KEYWORDS };

 static const wchar_t* const it_then_KEYWORDS[] = { L"* ", L"Allora " };


pcm037: setup all pins at once and not in init functions

Signed-off-by: Sascha Hauer <c00cbc2b736c26791a3822db86f8796fe9efff67@pengutronix.de>

--- arch/arm/mach-mx3/pcm037.c
+++ arch/arm/mach-mx3/pcm037.c
@@ -46,6 +46,76 @@

 #include "devices.h"

+static unsigned int pcm037_pins[] = {
+	/* I2C */
+	MX31_PIN_CSPI2_MOSI__SCL,
+	MX31_PIN_CSPI2_MISO__SDA,
+	/* SDHC1 */
+	MX31_PIN_SD1_DATA3__SD1_DATA3,
+	MX31_PIN_SD1_DATA2__SD1_DATA2,
+	MX31_PIN_SD1_DATA1__SD1_DATA1,
+	MX31_PIN_SD1_DATA0__SD1_DATA0,
+	MX31_PIN_SD1_CLK__SD1_CLK,
+	MX31_PIN_SD1_CMD__SD1_CMD,
+	IOMUX_MODE(MX31_PIN_SCK6, IOMUX_CONFIG_GPIO), /* card detect */
+	IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), /* write protect */
+	/* SPI1 */
+	MX31_PIN_CSPI1_MOSI__MOSI,
+	MX31_PIN_CSPI1_MISO__MISO,
+	MX31_PIN_CSPI1_SCLK__SCLK,
+	MX31_PIN_CSPI1_SPI_RDY__SPI_RDY,
+	MX31_PIN_CSPI1_SS0__SS0,
+	MX31_PIN_CSPI1_SS1__SS1,
+	MX31_PIN_CSPI1_SS2__SS2,
+	/* UART1 */
+	MX31_PIN_CTS1__CTS1,
+	MX31_PIN_RTS1__RTS1,
+	MX31_PIN_TXD1__TXD1,
+	MX31_PIN_RXD1__RXD1,
+	/* UART2 */
+	MX31_PIN_TXD2__TXD2,
+	MX31_PIN_RXD2__RXD2,
+	MX31_PIN_CTS2__CTS2,
+	MX31_PIN_RTS2__RTS2,
+	/* UART3 */
+	MX31_PIN_CSPI3_MOSI__RXD3,
+	MX31_PIN_CSPI3_MISO__TXD3,
+	MX31_PIN_CSPI3_SCLK__RTS3,
+	MX31_PIN_CSPI3_SPI_RDY__CTS3,
+	/* LAN9217 irq pin */
+	IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
+	/* Onewire */
+	MX31_PIN_BATT_LINE__OWIRE,
+	/* Framebuffer */
+	MX31_PIN_LD0__LD0,
+	MX31_PIN_LD1__LD1,
+	MX31_PIN_LD2__LD2,
+	MX31_PIN_LD3__LD3,
+	MX31_PIN_LD4__LD4,
+	MX31_PIN_LD5__LD5,
+	MX31_PIN_LD6__LD6,
+	MX31_PIN_LD7__LD7,
+	MX31_PIN_LD8__LD8,
+	MX31_PIN_LD9__LD9,
+	MX31_PIN_LD10__LD10,
+	MX31_PIN_LD11__LD11,
+	MX31_PIN_LD12__LD12,
+	MX31_PIN_LD13__LD13,
+	MX31_PIN_LD14__LD14,
+	MX31_PIN_LD15__LD15,
+	MX31_PIN_LD16__LD16,
+	MX31_PIN_LD17__LD17,
+	MX31_PIN_VSYNC3__VSYNC3,
+	MX31_PIN_HSYNC__HSYNC,
+	MX31_PIN_FPSHIFT__FPSHIFT,
+	MX31_PIN_DRDY0__DRDY0,
+	MX31_PIN_D3_REV__D3_REV,
+	MX31_PIN_CONTRAST__CONTRAST,
+	MX31_PIN_D3_SPL__D3_SPL,
+	MX31_PIN_D3_CLS__D3_CLS,
+	MX31_PIN_LCS0__GPI03_23,
+};
+
 static struct physmap_flash_data pcm037_flash_data = {
 	.width  = 2,
 };
@@ -127,26 +197,8 @@
 };

 #ifdef CONFIG_I2C_IMX
-static int i2c_1_pins[] = {
-	MX31_PIN_CSPI2_MOSI__SCL,
-	MX31_PIN_CSPI2_MISO__SDA,
-};
-
-static int pcm037_i2c_1_init(struct device *dev)
-{
-	return mxc_iomux_setup_multiple_pins(i2c_1_pins, ARRAY_SIZE(i2c_1_pins),
-			"i2c-1");
-}
-
-static void pcm037_i2c_1_exit(struct device *dev)
-{
-	mxc_iomux_release_multiple_pins(i2c_1_pins, ARRAY_SIZE(i2c_1_pins));
-}
-
 static struct imxi2c_platform_data pcm037_i2c_1_data = {
 	.bitrate = 100000,
-	.init = pcm037_i2c_1_init,
-	.exit = pcm037_i2c_1_exit,
 };

 static struct at24_platform_data board_eeprom = {
@@ -166,24 +218,13 @@
 };
 #endif

-static int sdhc1_pins[] = {
-	MX31_PIN_SD1_DATA3__SD1_DATA3,
-	MX31_PIN_SD1_DATA2__SD1_DATA2,
-	MX31_PIN_SD1_DATA1__SD1_DATA1,
-	MX31_PIN_SD1_DATA0__SD1_DATA0,
-	MX31_PIN_SD1_CLK__SD1_CLK,
-	MX31_PIN_SD1_CMD__SD1_CMD,
-};
-
 static int pcm970_sdhc1_init(struct device *dev, irq_handler_t h, void *data)
 {
-	return mxc_iomux_setup_multiple_pins(sdhc1_pins, ARRAY_SIZE(sdhc1_pins),
-				"sdhc-1");
+	return 0;
 }

 static void pcm970_sdhc1_exit(struct device *dev, void *data)
 {
-	mxc_iomux_release_multiple_pins(sdhc1_pins, ARRAY_SIZE(sdhc1_pins));
 }

 /* No card and rw detection at the moment */
@@ -198,38 +239,23 @@
 	&pcm037_sram_device,
 };

-static int uart0_pins[] = {
-	MX31_PIN_CTS1__CTS1,
-	MX31_PIN_RTS1__RTS1,
-	MX31_PIN_TXD1__TXD1,
-	MX31_PIN_RXD1__RXD1
-};
-
-static int uart2_pins[] = {
-	MX31_PIN_CSPI3_MOSI__RXD3,
-	MX31_PIN_CSPI3_MISO__TXD3
-};
-
 /*
  * Board specific initialization.
  */
 static void __init mxc_board_init(void)
 {
+	mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
+			"pcm037");
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));

-	mxc_iomux_setup_multiple_pins(uart0_pins, ARRAY_SIZE(uart0_pins), "uart-0");
 	mxc_register_device(&mxc_uart_device0, &uart_pdata);
-
-	mxc_iomux_setup_multiple_pins(uart2_pins, ARRAY_SIZE(uart2_pins), "uart-2");
 	mxc_register_device(&mxc_uart_device2, &uart_pdata);

-	mxc_iomux_setup_pin(MX31_PIN_BATT_LINE__OWIRE, "batt-0wire");
 	mxc_register_device(&mxc_w1_master_device, NULL);

 	/* LAN9217 IRQ pin */
-	if (!mxc_iomux_setup_pin(IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
-				"pcm037-eth"))
-		gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
+	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));

 #ifdef CONFIG_I2C_IMX
 	i2c_register_board_info(1, pcm037_i2c_devices,


use STREAM_CHECK

use STREAM_CHECK

--- lib/numstream.c
+++ lib/numstream.c
@@ -32,9 +32,9 @@
 #define VALUE(o, type) (((type##StreamObject *) (o))->val)

 #define NUMERICSTREAM_SET(o, val) \
-    if ((o)->ob_type == &allStreams[INT_STREAM])         \
+    if (STREAM_CHECK(o, INT_STREAM))            \
         SET(o, Int, val);                       \
-    else if ((o)->ob_type == &allStreams[SHORT_STREAM])  \
+    else if (STREAM_CHECK(o, SHORT_STREAM))     \
         SET(o, Short, val);                     \
     else                                        \
         assert(0);
@@ -84,10 +84,10 @@
         return Py_None;
     }

-    if (self->ob_type == &allStreams[INT_STREAM]) {
+    if (STREAM_CHECK(self, INT_STREAM)) {
         IntStreamObject * o = (void *) self;
         return PyInt_FromLong(o->val);
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         ShortStreamObject * o = (void *) self;
         return PyInt_FromLong(o->val);
     }
@@ -104,14 +104,14 @@

     if (ISNONE(self) && ISNONE(other)) {
         return 0;
-    } else if (self->ob_type == &allStreams[INT_STREAM]) {
+    } else if (STREAM_CHECK(self, INT_STREAM)) {
         if (VALUE(self, Int) == VALUE(other, Int))
             return 0;
         else if (VALUE(self, Int) < VALUE(other, Int))
             return -1;

         return 1;
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         if (VALUE(self, Short) == VALUE(other, Short))
             return 0;
         else if (VALUE(self, Short) < VALUE(other, Short))
@@ -134,13 +134,13 @@
         return NULL;
     }

-    if (self->ob_type == &allStreams[INT_STREAM]) {
+    if (STREAM_CHECK(self, INT_STREAM)) {
         IntStreamObject * o1 = (void *) self;
         IntStreamObject * o2 = (void *) them;

         if ((o1->isNone != o2->isNone) || (o1->val != o2->val))
             return raw_IntStream_Freeze(o1);
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         ShortStreamObject * o1 = (void *) self;
         ShortStreamObject * o2 = (void *) them;

@@ -220,9 +220,9 @@
     if (self->isNone)
         return PyString_FromString("");

-    if (self->ob_type == &allStreams[INT_STREAM]) {
+    if (STREAM_CHECK(self, INT_STREAM)) {
         return raw_IntStream_Freeze((IntStreamObject *) self);
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         return raw_ShortStream_Freeze((ShortStreamObject *) self);
     } else {
         PyErr_SetString(PyExc_TypeError, "invalid type");
@@ -273,10 +273,10 @@
     if (!PyArg_ParseTuple(args, "i", &val))
         return NULL;

-    if (self->ob_type == &allStreams[INT_STREAM]) {
+    if (STREAM_CHECK(self, INT_STREAM)) {
         IntStreamObject * o = (void *) self;
         o->val = val;
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         ShortStreamObject * o = (void *) self;
         o->val = val;
     } else {
@@ -292,7 +292,7 @@
                                   int frozenLen) {
     self->isNone = 0;

-    if (self->ob_type == &allStreams[INT_STREAM]) {
+    if (STREAM_CHECK(self, INT_STREAM)) {
         IntStreamObject * o = (void *) self;

         if (frozenLen != 4) {
@@ -305,7 +305,7 @@
             o->isNone = 1;
         else
             o->val = ntohl(*((int *) frozen));
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         ShortStreamObject * o = (void *) self;

         if (frozenLen != 2) {
@@ -355,7 +355,7 @@
         return NULL;
     }

-    if (self->ob_type == &allStreams[INT_STREAM]) {
+    if (STREAM_CHECK(self, INT_STREAM)) {
         IntStreamObject * o = (void *) self;
         IntStreamObject * base = (void *) other;
         int newVal = 0;
@@ -380,7 +380,7 @@
             retVal = Py_True;
         else
             retVal = Py_False;
-    } else if (self->ob_type == &allStreams[SHORT_STREAM]) {
+    } else if (STREAM_CHECK(self, SHORT_STREAM)) {
         ShortStreamObject * o = (void *) self;
         ShortStreamObject * base = (void *) other;
         int newVal = 0;


ARM: pxa: pxa27x skip default device initialization with DT

When booting via DT, the default PXA devices must not have been probed
before, otherwise the augmented information from the device tree is
ignored.

This is the twin commit of commit 82ce44d104dc ("ARM: pxa3xx: skip
default device initialization when booting via DT").

Signed-off-by: Robert Jarzmik <94b2a0a74cb42a2dd0cf1b763601af7f13907aa9@free.fr>
Acked-by: Daniel Mack <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@zonque.org>


remove 'starting dyndnsd-...' syslog because it seems unnecessary

--- src/dyndnsd.c
+++ src/dyndnsd.c
@@ -134,8 +134,6 @@
 	EV_SET(&changes[1], routefd, EVFILT_READ, EV_ADD, 0, 0, NULL);
 	EV_SET(&changes[2], SIGTERM, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL);

-	syslog(LOG_INFO, "starting dyndnsd-%s", DYNDNSD_VERSION);
-
 	while (true) {
 		int nev;


ARM: tegra: switch FUSE clock on before usage

FUSE clock is enabled by most bootloaders, but we cannot expect it to be
on in all contexts (e.g. kexec).

Ensure the FUSE clock is enabled before any of its registers is touched.
Since FUSE is touched very early during system boot (before the clock
devices are registered), directly manipulate the clock register bit in
case the clock device cannot be acquired.

Signed-off-by: Alexandre Courbot <301cd6a3ea50a894b4b51e385c5eb12b9a4ffc0c@nvidia.com>
Signed-off-by: Stephen Warren <5ef2a23ba3aff51d1cfc8c113c1ec34b608b3b13@nvidia.com>

--- arch/arm/mach-tegra/fuse.c
+++ arch/arm/mach-tegra/fuse.c
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/export.h>
 #include <linux/random.h>
+#include <linux/clk.h>
 #include <linux/tegra-soc.h>

 #include "fuse.h"
@@ -54,6 +55,7 @@
 int tegra_soc_speedo_id;
 enum tegra_revision tegra_revision;

+static struct clk *fuse_clk;
 static int tegra_fuse_spare_bit;
 static void (*tegra_init_speedo_data)(void);

@@ -77,6 +79,22 @@
 	[TEGRA_REVISION_A04]     = "A04",
 };

+static void tegra_fuse_enable_clk(void)
+{
+	if (IS_ERR(fuse_clk))
+		fuse_clk = clk_get_sys(NULL, "fuse");
+	if (IS_ERR(fuse_clk))
+		return;
+	clk_prepare_enable(fuse_clk);
+}
+
+static void tegra_fuse_disable_clk(void)
+{
+	if (IS_ERR(fuse_clk))
+		return;
+	clk_disable_unprepare(fuse_clk);
+}
+
 u32 tegra_fuse_readl(unsigned long offset)
 {
 	return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
@@ -84,7 +102,15 @@

 bool tegra_spare_fuse(int bit)
 {
-	return tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
+	bool ret;
+
+	tegra_fuse_enable_clk();
+
+	ret = tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
+
+	tegra_fuse_disable_clk();
+
+	return ret;
 }

 static enum tegra_revision tegra_get_revision(u32 id)
@@ -113,10 +139,14 @@
 {
 	u32 reg;

+	tegra_fuse_enable_clk();
+
 	reg = tegra_fuse_readl(tegra_fuse_spare_bit);
 	tegra_cpu_process_id = (reg >> 6) & 3;
 	reg = tegra_fuse_readl(tegra_fuse_spare_bit);
 	tegra_core_process_id = (reg >> 12) & 3;
+
+	tegra_fuse_disable_clk();
 }

 u32 tegra_read_chipid(void)
@@ -158,6 +188,15 @@
 	u32 reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
 	reg |= 1 << 28;
 	writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
+
+	/*
+	 * Enable FUSE clock. This needs to be hardcoded because the clock
+	 * subsystem is not active during early boot.
+	 */
+	reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
+	reg |= 1 << 7;
+	writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
+	fuse_clk = ERR_PTR(-EINVAL);

 	reg = tegra_fuse_readl(FUSE_SKU_INFO);
 	randomness[0] = reg;


replace hard-coded stdin, stdout, stderr FDs with macros

--- src/dyndnsd.c
+++ src/dyndnsd.c
@@ -356,9 +356,9 @@
 	}

 	if (0 == pid) {
-		dup2(fd, 0);
-		dup2(fd, 1);
-		dup2(fd, 2);
+		dup2(fd, STDIN_FILENO);
+		dup2(fd, STDOUT_FILENO);
+		dup2(fd, STDERR_FILENO);
 		setsid();
 		execl(getshell(), getshell(), "-c", cmd, NULL);
 	}


arm64: ptrace: fix compat reg getter/setter return values

copy_{to,from}_user return the number of bytes remaining on failure, not
an error code.

This patch returns -EFAULT when the copy operation didn't complete,
rather than expose the number of bytes not copied directly to userspace.

Signed-off-by: Will Deacon <b913f13ef92ac157955c954ccaaff7be065faba4@arm.com>


Source-code indentation

Source-code indentation

--- src/ea_mono.c
+++ src/ea_mono.c
@@ -335,12 +335,12 @@
     finish_gromacs_execution();
     free(index_solutions_to_reproduce);
 /**************** FINISHED Mono-objetive Evolutionary Algorithm *************************/
-
+
     desallocate_solution(solutions_p, &in_para->size_population);
     desallocateProtein(population_p, &in_para->size_population);
     desallocate_primary_seq(primary_sequence);
-    _finish_random_gsl();
-
-	return 0;
-}
-
+    _finish_random_gsl();
+
+    return 0;
+}
+


[PATCH] kprobe-booster: disable in preemptible kernel

The kprobe-booster's safety check against preemption does not work well
now, because the preemption count has been modified by read_rcu_lock() in
atomic_notifier_call_chain() before we check it.  So, I'd like to prevent
boosting kprobe temporarily if the kernel is preemptable.

Now we are searching for the good solution.

Signed-off-by: Masami Hiramatsu <60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com>
Cc: Ananth N Mavinakayanahalli <7dc108d19a2513f6455353af182b9e4d3b794ec9@in.ibm.com>
Cc: Prasanna S Panchamukhi <eb77579c1911c89786ab7c4d92f05af038c76297@in.ibm.com>
Cc: Anil S Keshavamurthy <9788063cfe1a246c69b3446f8cc198bd2d8966a2@intel.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- arch/i386/kernel/kprobes.c
+++ arch/i386/kernel/kprobes.c
@@ -256,11 +256,6 @@
 	int ret = 0;
 	kprobe_opcode_t *addr;
 	struct kprobe_ctlblk *kcb;
-#ifdef CONFIG_PREEMPT
-	unsigned pre_preempt_count = preempt_count();
-#else
-	unsigned pre_preempt_count = 1;
-#endif

 	addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));

@@ -338,13 +333,15 @@
 		return 1;

 ss_probe:
-	if (pre_preempt_count && p->ainsn.boostable == 1 && !p->post_handler){
+#ifndef CONFIG_PREEMPT
+	if (p->ainsn.boostable == 1 && !p->post_handler){
 		/* Boost up -- we can execute copied instructions directly */
 		reset_current_kprobe();
 		regs->eip = (unsigned long)p->ainsn.insn;
 		preempt_enable_no_resched();
 		return 1;
 	}
+#endif
 	prepare_singlestep(p, regs);
 	kcb->kprobe_status = KPROBE_HIT_SS;
 	return 1;


[PATCH] i386: Vmi timer race

[PATCH] i386: Vmi timer race

Because timer code moves around, and we might eventually move our init to a
late_time_init hook, save and restore IRQs around this code because it is
definitely not interrupt safe.

Signed-off-by: Zachary Amsden <9de8c4480303b5335cd2a33eefe814615ba3612a@vmware.com>
Signed-off-by: Andi Kleen <0474aee45985f5ae829f53849df476200e876990@suse.de>

--- arch/i386/kernel/vmitime.c
+++ arch/i386/kernel/vmitime.c
@@ -180,7 +180,9 @@
 void __init vmi_time_init(void)
 {
 	unsigned long long cycles_per_sec, cycles_per_msec;
-
+	unsigned long flags;
+
+	local_irq_save(flags);
 	setup_irq(0, &vmi_timer_irq);
 #ifdef CONFIG_X86_LOCAL_APIC
 	set_intr_gate(LOCAL_TIMER_VECTOR, apic_vmi_timer_interrupt);
@@ -224,6 +226,8 @@
 		      VMI_ALARM_WIRED_IRQ0 | VMI_ALARM_IS_PERIODIC | VMI_CYCLES_AVAILABLE,
 		      per_cpu(process_times_cycles_accounted_cpu, 0) + cycles_per_alarm,
 		      cycles_per_alarm);
+
+	local_irq_restore(flags);
 }

 #ifdef CONFIG_X86_LOCAL_APIC


remove unused NETWORK_BUFSIZE.

remove unused NETWORK_BUFSIZE.

--- arch/macppc/dev/if_bmreg.h
+++ arch/macppc/dev/if_bmreg.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_bmreg.h,v 1.2 2001/09/16 03:19:30 drahn Exp $	*/
+/*	$OpenBSD: if_bmreg.h,v 1.3 2005/10/09 04:24:50 brad Exp $	*/
 /*	$NetBSD: if_bmreg.h,v 1.2 2000/01/25 14:38:50 tsubai Exp $	*/

 /*
@@ -142,5 +142,3 @@
 /* -------------------------------------------------------------------- */
 #define RxAbortBit	0x8000	/* status bit in BMac status for rx packets */
 #define RxLengthMask	0x3FFF	/* bits that determine length of rx packets */
-
-#define NETWORK_BUFSIZE		(ETHERMAXPACKET + ETHERCRC + 2)


MIPS: Don't read GCRs when a CM is not present

Commit 3885c2b463f6 ("MIPS: CM: Add support for reporting CM cache
errors") leads to Malta boards unconditionally reading CM GCRs upon bus
errors, regardless of whether a CM is present. This is incorrect & will
lead to further exceptions. Fix by moving the GCR reads to after the
check for whether a CM is present.

Signed-off-by: Paul Burton <85f1bffadddedccfafc0ae065a06aa636075387f@imgtec.com>
Cc: 562397917b9a8bf316569a848858b12fb417723f@linux-mips.org
Cc: Markos Chandras <5cdbcb0e11d2b5ebc39222958c54a1c6329d0c9d@imgtec.com>
Cc: 2578944098299abf708b08eff6fcf60565553586@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/11186/
Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>


Nuke unneeded definitions.

Nuke unneeded definitions.

--- arch/mvme88k/dev/dartreg.h
+++ arch/mvme88k/dev/dartreg.h
@@ -1,41 +1,11 @@
-/*	$OpenBSD: dartreg.h,v 1.4 2003/10/05 20:24:10 miod Exp $	*/
-
-/*
- * Something to put append a 'U' to a long constant if it's C so that
- * it'll be unsigned in both ANSI and traditional.
- */
-#if defined(ASSEMBLER)
-#	define U(num)	num
-#else
-#  if defined(__STDC__)
-#	define U(num)	num ## U
-#  else
-#	define U(num)	num/**/U
-#  endif
-#endif
-
-/*********************** CONFIGURATION *******************************/
+/*	$OpenBSD: dartreg.h,v 1.5 2004/04/15 12:34:42 miod Exp $	*/
+
 #define MAXPORTS	2		/* max count of PORTS/DUART */

-/*
- * The following define is for the utputc/utgetc Console routines
- * which have to work without any configuration.
- */
-#define MVME188_DUART	U(0xFFF82000)	/* M68692 DUART chip */
-
-/*********************** DEFINITIONS *********************************/
-#define  MISSING  0  /* flag, missing a configured DUART */
-#define  ON	      1  /* flag for modem() */
-#define  OFF      0  /* flag for modem() */
+#define MVME188_DUART	0xfff82000	/* M68692 DUART chip */
+
 #define  A_PORT   0  /* flag for port a */
 #define  B_PORT   1  /* flag for port b */
-
-/*********************** MACROS ***********************************/
-/*
- * spl priority level should always be the same.
- */
-#define SPLCLOCK   spl6		/* set clock priority level */
-#define SPLM681    splhi	/* set ut driver priority level */

 /* the access to the same command register must be delayed,
    because the chip has some hardware problems in this case */
@@ -275,39 +245,3 @@
 	volatile unsigned char	sv_imr;		/* interrupt mask register */
 	volatile unsigned char	sv_ivr;		/* interrupt vector register */
 };
-
-/* defines for receiver and DCD scanner */
-#define M681CSCAN 2	/* clock ticks for character scan */
-#define M681_CHAR 01	/* character arrived flag (ut_work) */
-#define M681_ACT  02	/* character in buffer flag (ut_work) */
-#define M681_DCD  04	/* DCD wait flag (ut_work) */
-
-
-/********************* SPECIAL IOCTL COMMAND DEFINITIONS ******************/
-/* HWHAND ioctls same as in MVME331 driver */
-#define MSETHWHAND	(('m'<<8)+20)	/* set hardware handshake */
-#define MCLEARHWHAND	(('m'<<8)+21)	/* clear hardware handshake */
-#define MGETHWHAND	(('m'<<8)+22)	/* get hardware handshake mode */
-
-#define M681STATUS	(('m'<<8)+40 )  /* get status of duarts */
-#define M681GETSTAT	(('m'<<8)+42 )  /* get statistics */
-
-#ifdef STATISTICS
-struct dart_stat {
-	int open_cnt;  /* count of open calls */
-	int intr_cnt;  /* count of interrupts */
-	int tx_cnt;    /* count of transmitted characters */
-	int rx_cnt;    /* count of received characters */
-	int brk_cnt;   /* count of break events */
-	int rovrn_cnt; /* count of overruns */
-	int frerr_cnt; /* count of frame errors */
-	int perr_cnt;  /* count of parity errors */
-	int rxoff_cnt; /* count of received XOFF chars */
-	int rxon_cnt;  /* count of received XON  chars */
-	int txoff_cnt; /* count of transmitted XOFF chars */
-	int txon_cnt;  /* count of transmitted XON  chars */
-};
-#endif
-
-
-


nios2: remove end address checking for initda

Remove the end address checking for initda function. We need to invalidate
each address line for initda instruction, from start to end address.

Signed-off-by: Ley Foon Tan <95f178e5e278816be0436ff61f034a97684bdd0e@altera.com>


Use rasops alloc_attr in alloc_screen so it doesn't crash when a screen is added.

--- arch/sparc64/dev/creator.c
+++ arch/sparc64/dev/creator.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: creator.c,v 1.1 2002/05/21 04:31:03 jason Exp $	*/
+/*	$OpenBSD: creator.c,v 1.2 2002/05/21 14:53:47 jason Exp $	*/

 /*
  * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -307,10 +307,10 @@
 	if (sc->sc_nscreens > 0)
 		return (ENOMEM);

-	*cookiep = &sc->sc_rcons;
-	*curyp = *sc->sc_rcons.rc_crowp;
-	*curxp = *sc->sc_rcons.rc_ccolp;
-	rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, attrp);
+	*cookiep = &sc->sc_rasops;
+	*curyp = 0;
+	*curxp = 0;
+	sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops, 0, 0, 0, attrp);
 	sc->sc_nscreens++;
 	return (0);
 }


x86: mark memory_setup __init

x86: mark memory_setup __init

Otherwise

WARNING: vmlinux.o(.text+0x64a9): Section mismatch: reference to .init.text:machine_specific_memory_setup (between 'memory_setup' and 'show_cpuinfo')

Signed-off-by: Andi Kleen <0474aee45985f5ae829f53849df476200e876990@suse.de>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- arch/x86/kernel/setup_64.c
+++ arch/x86/kernel/setup_64.c
@@ -279,7 +279,7 @@
 }

 /* Overridden in paravirt.c if CONFIG_PARAVIRT */
-void __attribute__((weak)) memory_setup(void)
+void __attribute__((weak)) __init memory_setup(void)
 {
        machine_specific_memory_setup();
 }


Ensure an enchant subdirectory exists and not just the user's home directory or config directory

git-svn-id: 18bf4e4f0ca11a3471e5785d6da82074410339c6@23636 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6

--- src/enchant.c
+++ src/enchant.c
@@ -122,15 +122,12 @@
 }

 static void
-_enchant_ensure_private_datadir (void)
-{
-	const char * config_dir;
-
-	config_dir = g_get_user_config_dir();
-	if (config_dir && !g_file_test (config_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
-		{
-			(void)g_remove (config_dir);
-			g_mkdir_with_parents (config_dir, 0700);
+_enchant_ensure_dir_exists (const char* dir)
+{
+	if (dir && !g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
+		{
+			(void)g_remove (dir);
+			g_mkdir_with_parents (dir, 0700);
 		}
 }

@@ -540,21 +537,22 @@
 	EnchantSession * session = NULL;
 	GSList *user_config_dirs, *iter;

-	_enchant_ensure_private_datadir ();
-
 	user_config_dirs = enchant_get_user_config_dirs ();
 	for (iter = user_config_dirs; iter != NULL && session == NULL; iter = iter->next)
 		{
 			session =_enchant_session_new (provider, iter->data, lang, TRUE);
 		}

+	if (session == NULL && user_config_dirs != NULL)
+		{
+			_enchant_ensure_dir_exists (user_config_dirs->data);
+
+			session =_enchant_session_new (provider, user_config_dirs->data, lang, FALSE);
+		}
+
 	g_slist_foreach (user_config_dirs, (GFunc)g_free, NULL);
 	g_slist_free (user_config_dirs);

-	if (!session)
-		{
-			session =_enchant_session_new (provider, g_get_user_config_dir(), lang, FALSE);
-		}

 	return session;
 }


Input thread implementation   - Handle input processing in a separate thread to allow main thread more time with thread handling etc   - Significant speedup can be seen when run on ultrafast settings and on a system with great number of cores

--- src/encmain.c
+++ src/encmain.c
@@ -119,6 +119,93 @@
     psnr[c] = 10 * log10((num_pixels * PSNRMAX) / ((double)psnr[c]));;
   }
 }
+
+typedef struct {
+  FILE* input;
+  pthread_mutex_t* input_mutex;
+  pthread_mutex_t* main_thread_mutex;
+
+  kvz_picture **img_in;
+  uint8_t field_parity;
+  cmdline_opts_t *opts;
+  encoder_control_t *encoder;
+  uint8_t padding_x;
+  uint8_t padding_y;
+  const kvz_api * api;
+  int retval;
+} input_handler_args;
+
+#define PTHREAD_LOCK(l) if (pthread_mutex_lock((l)) != 0) { fprintf(stderr, "pthread_mutex_lock(%s) failed!\n", #l); assert(0); return 0; }
+#define PTHREAD_UNLOCK(l) if (pthread_mutex_unlock((l)) != 0) { fprintf(stderr, "pthread_mutex_unlock(%s) failed!\n", #l); assert(0); return 0; }
+
+#define RETVAL_RUNNING 0
+#define RETVAL_FAILURE 1
+#define RETVAL_EOF 2
+
+/**
+* \brief Handles input reading in a thread
+*
+* \param in_args  pointer to argument struct
+*/
+static void* input_read_thread(void* in_args) {
+
+  input_handler_args* args = (input_handler_args*)in_args;
+  kvz_picture *frame_in = NULL;
+  int frames_read = 0;
+  for (;;) {
+
+    if (!feof(args->input) && (args->opts->frames == 0 || frames_read < args->opts->frames || args->field_parity == 1)) {
+      // Try to read an input frame.
+      if (args->field_parity == 0) frame_in = args->api->picture_alloc(args->opts->config->width + args->padding_x, args->opts->config->height + args->padding_y);
+      if (!frame_in) {
+        fprintf(stderr, "Failed to allocate image.\n");
+        goto exit_failure;
+      }
+
+      if (args->field_parity == 0) {
+        if (yuv_io_read(args->input, args->opts->config->width, args->opts->config->height, frame_in)) {
+          frames_read += 1;
+          args->img_in[frames_read & 1] = frame_in;
+        } else {
+          // EOF or some error
+          if (!feof(args->input)) {
+            fprintf(stderr, "Failed to read a frame %d\n", frames_read);
+            goto exit_failure;
+          }
+          goto exit_eof;
+        }
+      }
+
+      if (args->encoder->cfg->source_scan_type != 0) {
+        args->img_in[(frames_read+1) & 1] = args->api->picture_alloc(args->encoder->in.width, args->encoder->in.height);
+        yuv_io_extract_field(frame_in, args->encoder->cfg->source_scan_type, args->field_parity, args->img_in[(frames_read+1) & 1]);
+        if (args->field_parity == 1) args->api->picture_free(frame_in);
+        args->field_parity ^= 1; //0->1 or 1->0
+      }
+    } else {
+      goto exit_eof;
+    }
+    // Wait until main thread is ready to receive input and then release main thread
+    PTHREAD_LOCK(args->input_mutex);
+    PTHREAD_UNLOCK(args->main_thread_mutex);
+
+  }
+
+exit_eof:
+  args->retval = RETVAL_EOF;
+
+exit_failure:
+  // Do some cleaning up
+  args->img_in[0] = NULL;
+  args->img_in[1] = NULL;
+  if (!args->retval) {
+    args->api->picture_free(frame_in);
+    args->retval = RETVAL_FAILURE;
+  }
+  pthread_exit(NULL);
+  return 0;
+}
+

 /**
  * \brief Program main function.
@@ -215,43 +302,53 @@
     double psnr_sum[3] = { 0.0, 0.0, 0.0 };

     int8_t field_parity = 0;
-    kvz_picture *frame_in = NULL;
     uint8_t padding_x = get_padding(opts->config->width);
     uint8_t padding_y = get_padding(opts->config->height);

+    pthread_t input_thread;
+
+    pthread_mutex_t input_mutex = PTHREAD_MUTEX_INITIALIZER;
+    pthread_mutex_t main_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+    // Lock both mutexes at startup
+    PTHREAD_LOCK(&main_thread_mutex);
+    PTHREAD_LOCK(&input_mutex);
+
+    // Give arguments via struct to the input thread
+    input_handler_args in_args;
+    kvz_picture *img_in[2] = { NULL };
+    in_args.input = input;
+    in_args.img_in = img_in;
+    in_args.main_thread_mutex = &main_thread_mutex;
+    in_args.input_mutex = &input_mutex;
+    in_args.opts = opts;
+    in_args.field_parity = field_parity;
+    in_args.encoder = encoder;
+    in_args.padding_x = padding_x;
+    in_args.padding_y = padding_y;
+    in_args.api = api;
+    in_args.retval = 0;
+
+    if (pthread_create(&input_thread, NULL, input_read_thread, (void*)&in_args) != 0) {
+      fprintf(stderr, "pthread_create failed!\n");
+      assert(0);
+      return 0;
+    }
+    kvz_picture *cur_in_img;
     for (;;) {

-      kvz_picture *img_in = NULL;
-
-      if (!feof(input) && (opts->frames == 0 || frames_read < opts->frames || field_parity == 1) ) {
-        // Try to read an input frame.
-        if(field_parity == 0) frame_in = api->picture_alloc(opts->config->width + padding_x, opts->config->height + padding_y);
-        if (!frame_in) {
-          fprintf(stderr, "Failed to allocate image.\n");
-          goto exit_failure;
-        }
-
-        if (field_parity == 0){
-          if (yuv_io_read(input, opts->config->width, opts->config->height, frame_in)) {
-            frames_read += 1;
-            img_in = frame_in;
-          } else {
-            // EOF or some error
-            api->picture_free(frame_in);
-            img_in = NULL;
-            if (!feof(input)) {
-              fprintf(stderr, "Failed to read a frame %d\n", frames_read);
-              goto exit_failure;
-            }
-          }
-        }
-
-        if (encoder->cfg->source_scan_type != 0){
-          img_in = api->picture_alloc(encoder->in.width, encoder->in.height);
-          yuv_io_extract_field(frame_in, encoder->cfg->source_scan_type, field_parity, img_in);
-          if (field_parity == 1) api->picture_free(frame_in);
-          field_parity ^= 1; //0->1 or 1->0
-        }
+      // Skip mutex locking when thread is no longer in run state
+      if (in_args.retval == RETVAL_RUNNING) {
+        // Wait for input to be read
+        // unlock the input thread to be able to continue to the next picture
+        PTHREAD_UNLOCK(&input_mutex);
+        PTHREAD_LOCK(&main_thread_mutex);
+      }
+      frames_read++;
+      cur_in_img = img_in[frames_read & 1];
+
+      if (in_args.retval == EXIT_FAILURE) {
+        goto exit_failure;
       }

       kvz_data_chunk* chunks_out = NULL;
@@ -260,18 +357,18 @@
       uint32_t len_out = 0;
       kvz_frame_info info_out;
       if (!api->encoder_encode(enc,
-                               img_in,
+                               cur_in_img,
                                &chunks_out,
                                &len_out,
                                &img_rec,
                                &img_src,
                                &info_out)) {
         fprintf(stderr, "Failed to encode image.\n");
-        api->picture_free(img_in);
+        api->picture_free(cur_in_img);
         goto exit_failure;
       }

-      if (chunks_out == NULL && img_in == NULL) {
+      if (chunks_out == NULL && cur_in_img == NULL) {
         // We are done since there is no more input and output left.
         break;
       }
@@ -285,7 +382,7 @@
           assert(written + chunk->len <= len_out);
           if (fwrite(chunk->data, sizeof(uint8_t), chunk->len, output) != chunk->len) {
             fprintf(stderr, "Failed to write data to file.\n");
-            api->picture_free(img_in);
+            api->picture_free(cur_in_img);
             api->chunk_free(chunks_out);
             goto exit_failure;
           }
@@ -321,7 +418,7 @@
         print_frame_info(&info_out, frame_psnr, len_out);
       }

-      api->picture_free(img_in);
+      api->picture_free(cur_in_img);
       api->chunk_free(chunks_out);
       api->picture_free(img_rec);
       api->picture_free(img_src);


Some minor changes for stylistic consistency

--- src/entbuff.c
+++ src/entbuff.c
@@ -69,6 +69,7 @@
                 fprintf(stderr, "Error with ioctl call: %s\n", strerror(errno));
 		return -1;
         }
+
 	return entcnt;
 }

@@ -158,7 +159,9 @@
 	}

 	if(g_log_buffer_to_rand)
+	{
 		fprintf(stderr, "-W: %zu bytes buffer -> random device\n", to_transfer);
+	}

 	// First, let's cap our read to however many bytes we have in the buffer.
 	const size_t first_read_remaining = get_read_remaining();


Various type parsing tests

Various type parsing tests

error: pathspec 'test2/type_parsing_printing/various.c' did not match any file(s) known to git

--- test2/type_parsing_printing/various.c
+++ test2/type_parsing_printing/various.c
@@ -0,0 +1,13 @@
+// RUN: %ucc -fsyntax-only %s
+
+int atexit_b(void (^)(void));
+int atoi(const char *);
+int (*(*pf_pf)())();
+int read(void *p);
+int (*rf)();
+void _exit(int) __attribute__((__noreturn__));
+void f(void *);
+void g(void (*pf)());
+void (*pf)();
+void (*(*pfpf)())();
+void tpf(void (*pfv)(void));


fix fd leak on BPF open failure. from juan@foxpaw.com

--- src/eth-bsd.c
+++ src/eth-bsd.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
  *
- * $Id: eth-bsd.c,v 1.7 2002/01/20 21:23:27 dugsong Exp $
+ * $Id: eth-bsd.c,v 1.8 2003/02/23 02:32:09 dugsong Exp $
  */

 #include "config.h"
@@ -54,7 +54,7 @@
 			break;
 	}
 	if (e->fd < 0)
-		return (NULL);
+		return (eth_close(e));

 	memset(&ifr, 0, sizeof(ifr));
 	strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));


[http2] register getpeername

[http2] register getpeername

--- lib/http2/connection.c
+++ lib/http2/connection.c
@@ -716,6 +716,12 @@
     }
 }

+static int get_peername(h2o_conn_t *_conn, struct sockaddr *name, socklen_t *namelen)
+{
+    h2o_http2_conn_t *conn = (h2o_http2_conn_t*)_conn;
+    return h2o_socket_getpeername(conn->sock, name, namelen);
+}
+
 static h2o_http2_conn_t *create_conn(h2o_context_t *ctx, h2o_socket_t *sock)
 {
     h2o_http2_conn_t *conn = h2o_malloc(sizeof(*conn));
@@ -723,6 +729,7 @@
     /* init the connection */
     memset(conn, 0, offsetof(h2o_http2_conn_t, _write._pools[0]));
     conn->super.ctx = ctx;
+    conn->super.getpeername = get_peername;
     conn->sock = sock;
     conn->peer_settings = H2O_HTTP2_SETTINGS_DEFAULT;
     conn->open_streams = kh_init(h2o_http2_stream_t);


tls struct and related API work on

tls struct and related API work on

--- src/evt_tls.c
+++ src/evt_tls.c
@@ -259,7 +259,9 @@
             assert( sz > 0 && "number of bytes to write should be positive");
             r = SSL_write(conn->ssl, buf, sz);
             if ( 0 == r) goto handle_shutdown;
-            bytes = evt__send_pending(conn);
+            do {
+                bytes = evt__send_pending(conn);
+            } while ( bytes > 0 &&  );
             if ( r > 0 && conn->write_cb) {
                 conn->write_cb(conn, r);
             }


exchndl: Ignore a few more exceptions.

exchndl: Ignore a few more exceptions.

--- src/exchndl.c
+++ src/exchndl.c
@@ -464,10 +464,12 @@
 {
     PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;

-    /*
-     * Ignore OutputDebugStringA exception.
-     */
-    if (pExceptionRecord->ExceptionCode == DBG_PRINTEXCEPTION_C) {
+    // Ignore a few exceptions
+    switch (pExceptionRecord->ExceptionCode) {
+    case DBG_PRINTEXCEPTION_C: // OutputDebugStringA
+    case 0x406d1388: // Thread naming exception
+    case 0xe0434352: // .NET exceptions
+    case 0xe06d7363: // Visual C++ exceptions
         return EXCEPTION_CONTINUE_SEARCH;
     }


supported cmds with pipelines, still some bugs

--- src/execute.c
+++ src/execute.c
@@ -518,22 +518,22 @@
             if(cmd->input != NULL){ //存在输入重定向
                 if((pipeIn = open(cmd->input, O_RDONLY, S_IRUSR|S_IWUSR)) == -1){
                     printf("不能打开文件 %s！\n", cmd->input);
-                    return;
+                    exit(0);
                 }
                 if(dup2(pipeIn, 0) == -1){
                     printf("重定向标准输入错误！\n");
-                    return;
+                    exit(0);
                 }
             }

             if(cmd->output != NULL){ //存在输出重定向
                 if((pipeOut = open(cmd->output, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR)) == -1){
                     printf("不能打开文件 %s！\n", cmd->output);
-                    return ;
+                    exit(0);
                 }
                 if(dup2(pipeOut, 1) == -1){
                     printf("重定向标准输出错误！\n");
-                    return;
+                    exit(0);
                 }
             }

@@ -545,15 +545,16 @@
                 printf("[%d]\t%s\t\t%s\n", getpid(), RUNNING, inputBuff);
                 kill(getppid(), SIGUSR1);
             }
-
+            //puts("000child");
             justArgs(cmd->args[0]);
+            //puts("111child");
             if(execv(cmdBuff, cmd->args) < 0){ //执行命令
                 printf("execv failed!\n");
-                return;
+                exit(0);
             }
         }
 		else{ //父进程
-            if(cmd ->isBack){ //后台命令
+            if(cmd->isBack){ //后台命令
                 fgPid = 0; //pid置0，为下一命令做准备
                 addJob(pid); //增加新的作业
                 kill(pid, SIGUSR1); //子进程发信号，表示作业已加入
@@ -564,7 +565,10 @@
                 goon = 0;
             }else{ //非后台命令
                 fgPid = pid;
+                //printf("ffpid:%d\n",pid);
                 waitpid(pid, NULL, 0);
+               //printf("wwpid:%d\n",pid);
+
             }
 		}
     }else{ //命令不存在
@@ -640,6 +644,7 @@
     }
 }

+//preprocess cmds by constroy
 void *handleComplexCmdStr(int begin,int end) {
 	int i,j,cnt;
 	ComplexCmd *cmd = (ComplexCmd*)malloc(sizeof(ComplexCmd));
@@ -659,36 +664,63 @@
 	}
 	cmd->cmds[cnt++] = handleSimpleCmdStr(i,j);
 	cmd->isBack = cmd->cmds[cnt-1]->isBack;
+	for (i = 0; i<cmd->num; ++i) {
+		cmd->cmds[i]->isBack = cmd->isBack;
+	}
 	return cmd;
 }

-//execute a set of CMDs
+//execute a set of CMDs by constroy
 void executeComplexCmd(ComplexCmd *cmd) {
 	int i;
-	int pid
-	int pfd[2];
-	pfd[0] = 0;
-	pid = fork();
-	if (pid <0 ) {
-		perror("fork failed");
-		return;
-	}
-	if (!pid) {
-		execSimpleCmd(cmd->cmds[1]);
-	}
-	for (i = 1; i<cmd->num; ++i) {
+	pid_t pid;
+	int pfd[2][2]={{0,1},{0,1}};
+
+	for (i = 0; i<cmd->num; ++i) {
+		if (i == cmd->num - 1) {
+			pfd[1][1] = 1;
+		}
+		else {
+			if (pipe(pfd[1]) == -1) {
+				perror("pipe failed");
+				return;
+			}
+		}
 		pid = fork();
-		if (pid <0 ) {
+		//printf("fpid:%d\n",pid);
+		if (pid < 0) {
 			perror("fork failed");
-            return;
+			return;
+		} else if (pid) {
+			if (pfd[0][0] != 0) close(pfd[0][0]);
+			if (pfd[0][1] != 1) close(pfd[0][1]);
+			pfd[0][0]=pfd[1][0];
+			pfd[0][1]=pfd[1][1];
+		} else {
+			dup2(pfd[0][0],0);
+			dup2(pfd[1][1],1);
+			execSimpleCmd(cmd->cmds[i]);
+			close(pfd[0][0]);
+			close(pfd[1][1]);
+			exit(0);
 		}
-		if (pid) {
-
-		} else {
-			close(pfd[0]);
-		}
-
-	}
+	}
+	//puts("1!!!");
+	while ((pid=wait(NULL))>0) {
+		//printf("wpid:%d\n",pid);
+		continue;
+	}
+	//puts("2!!!");
+
+	/*
+	while ((i=read(pfd[0][0],buff,sizeof(buff)))>0) {
+		write(1,buff,i);
+	}
+	*/
+	//puts("!!!");while (1) sleep(10);
+	//write(1,"!!!",3);
+	//printf("pfd: %d\n",pfd[0][1]);
+
 	for (i = 0; i<cmd->num; ++i) {
 		free(cmd->cmds[i]);
 	}
@@ -697,9 +729,9 @@
                      命令执行接口
 ********************************************************/
 void execute(){
-    SimpleCmd *cmd = handleSimpleCmdStr(0, strlen(inputBuff));
-    execSimpleCmd(cmd);
-    //ComplexCmd *cmd = handleComplexCmdStr(0,strlen(inputBuff));
-    //executeComplexCmd(cmd);
-    free(cmd);
-}
+	//SimpleCmd *cmd = handleSimpleCmdStr(0, strlen(inputBuff));
+	//execSimpleCmd(cmd);
+	ComplexCmd *cmd = handleComplexCmdStr(0,strlen(inputBuff));
+	executeComplexCmd(cmd);
+	free(cmd);//puts("!!!");while (1);
+}


typecase getpid() return to int

typecase getpid() return to int

--- lib/rebuilddb.c
+++ lib/rebuilddb.c
@@ -26,7 +26,7 @@
     }

     newdbpath = alloca(strlen(dbpath) + 50 + strlen(rootdir));
-    sprintf(newdbpath, "%s/%s/rebuilddb.%d", rootdir, dbpath, getpid());
+    sprintf(newdbpath, "%s/%s/rebuilddb.%d", rootdir, dbpath, (int) getpid());

     if (!access(newdbpath, F_OK)) {
 	error(RPMERR_MKDIR, "temporary database %s already exists",
@@ -39,7 +39,7 @@
 	      newdbpath, strerror(errno));
     }

-    sprintf(newdbpath, "%s/rebuilddb.%d", dbpath, getpid());
+    sprintf(newdbpath, "%s/rebuilddb.%d", dbpath, (int) getpid());

     message(MESS_DEBUG, "opening old database\n");
     if (openDatabase(rootdir, dbpath, &olddb, O_RDONLY, 0644, 0)) {


Removed dependency on GL headers in main.

* We're no longer directly using OpenGL. No need for these here.

--- gol_main.c
+++ gol_main.c
@@ -2,10 +2,6 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <string.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <GL/glut.h>

 #include "ext/snt/utils.h"
 #include "ext/snt/color.h"


Add "VS2013" to changes between 0.11.1 and next version.

--- greatest.h
+++ greatest.h
@@ -17,7 +17,7 @@
 #ifndef GREATEST_H
 #define GREATEST_H

-/* 0.11.1 + (ASSERT_EQ_FMT, ASSERT_IN_RANGEm, USE_CLOCK) */
+/* 0.11.1 + (ASSERT_EQ_FMT, ASSERT_IN_RANGEm, USE_CLOCK, VS2013) */
 #define GREATEST_VERSION_MAJOR 0
 #define GREATEST_VERSION_MINOR 11
 #define GREATEST_VERSION_PATCH 1


Remove trailing comma to fix warning, it's a C99 extension.

--- greatest.h
+++ greatest.h
@@ -237,7 +237,7 @@
 typedef enum {
     GREATEST_TEST_RES_PASS = 0,
     GREATEST_TEST_RES_FAIL = -1,
-    GREATEST_TEST_RES_SKIP = 1,
+    GREATEST_TEST_RES_SKIP = 1
 } greatest_test_res;

 /* Run a suite. */


Updated the system messages

Updated the system messages

--- libat90/system_messages.h
+++ libat90/system_messages.h
@@ -94,7 +94,7 @@

 struct message_detail {
-	const uint16_t id;
+	const uint16_t id; // Should this be CAN_id?
 	const uint8_t len;
 	const uint8_t transport;
 };
@@ -109,10 +109,10 @@
 	[ECU_PKT + FUEL_PRESSURE]      = { .id = 258,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + STATUS_LAP_COUNT]   = { .id = 259,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + STATUS_INJ_SUM]     = { .id = 260,    .len =  4,    .transport = 0                   }, \
-	[ECU_PKT + LAST_GEAR_SHIFT]    = { .id = 261,    .len =  4,    .transport = 0                   }, \
+	[ECU_PKT + LAST_GEAR_SHIFT]    = { .id = 261,    .len =  4,    .transport = 0 |      XBEE       }, \
 	[ECU_PKT + MOTOR_OILTEMP]      = { .id = 262,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + OIL_PRESSURE]       = { .id = 263,    .len =  4,    .transport = 0                   }, \
-	[ECU_PKT + STATUS_TIME]        = { .id = 264,    .len =  4,    .transport = 0                   }, \
+	[ECU_PKT + STATUS_TIME]        = { .id = 264,    .len =  4,    .transport = 0 |              SD }, \
 	[ECU_PKT + STATUS_LAP_TIME]    = { .id = 265,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + GEAR_OIL_TEMP]      = { .id = 266,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + STATUS_TRACTION]    = { .id = 267,    .len =  4,    .transport = 0                   }, \
@@ -120,7 +120,7 @@
 	[ECU_PKT + STATUS_LAMBDA_V2]   = { .id = 269,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + STATUS_CAM_TRIG_P1] = { .id = 270,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + STATUS_CAM_TRIG_P2] = { .id = 271,    .len =  4,    .transport = 0                   }, \
-	[ECU_PKT + STATUS_CHOKER_ADD]  = { .id = 272,    .len =  4,    .transport = 0                   }, \
+	[ECU_PKT + STATUS_CHOKER_ADD]  = { .id = 272,    .len =  4,    .transport = 0 |       XBEE      }, \
 	[ECU_PKT + STATUS_LAMBDA_PWM]  = { .id = 273,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + WATER_TEMP]         = { .id = 274,    .len =  4,    .transport = 0 | CAN | XBEE | SD }, \
 	[ECU_PKT + MANIFOLD_AIR_TEMP]  = { .id = 275,    .len =  4,    .transport = 0       | XBEE | SD }, \
@@ -129,7 +129,7 @@
 	[ECU_PKT + TRIGGER_ERR]        = { .id = 278,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + CAM_ANGLE1]         = { .id = 279,    .len =  4,    .transport = 0                   }, \
 	[ECU_PKT + CAM_ANGLE2]         = { .id = 280,    .len =  4,    .transport = 0                   }, \
-	[ECU_PKT + ROAD_SPEED]         = { .id = 281,    .len =  4,    .transport = 0       | XBEE | SD }, \
+	[ECU_PKT + ROAD_SPEED]         = { .id = 281,    .len =  4,    .transport = 0       | XBEE | SD }, /* Check if this contains any data */ \
 	[ECU_PKT + MAP_SENSOR]         = { .id = 282,    .len =  4,    .transport = 0       | XBEE | SD }, \
 	[ECU_PKT + BATTERY_V]          = { .id = 283,    .len =  4,    .transport = 0 | CAN | XBEE | SD }, \
 	[ECU_PKT + LAMBDA_V]           = { .id = 284,    .len =  4,    .transport = 0       | XBEE | SD }, \


Add explicit (int) cast to i386 optimized MUL* macros.
Wrong result is returned when 16-bit value is passed as value.
Also fixes "Warning: using `%edx' instead of `%dx' due to `l' suffix".

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@14981 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b


cosmetics: use one type per field in every structs

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@9220 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- libavformat/matroskadec.c
+++ libavformat/matroskadec.c
@@ -39,15 +39,15 @@

     /* Unique track number and track ID. stream_index is the index that
      * the calling app uses for this track. */
-    uint32_t num,
-        uid,
-        stream_index;
-
-    char *name,
-        *language;
-
-    char *codec_id,
-        *codec_name;
+    uint32_t num;
+    uint32_t uid;
+    uint32_t stream_index;
+
+    char *name;
+    char *language;
+
+    char *codec_id;
+    char *codec_name;

     unsigned char *codec_priv;
     int codec_priv_size;
@@ -59,10 +59,10 @@
 typedef struct MatroskaVideoTrack {
     MatroskaTrack track;

-    int pixel_width,
-        pixel_height,
-        display_width,
-        display_height;
+    int pixel_width;
+    int pixel_height;
+    int display_width;
+    int display_height;

     uint32_t fourcc;

@@ -75,10 +75,10 @@
 typedef struct MatroskaAudioTrack {
     MatroskaTrack track;

-    int channels,
-        bitdepth,
-        internal_samplerate,
-        samplerate;
+    int channels;
+    int bitdepth;
+    int internal_samplerate;
+    int samplerate;
     int block_align;

     /* real audio header */
@@ -103,7 +103,8 @@
                                     sizeof(MatroskaSubtitleTrack)))

 typedef struct MatroskaLevel {
-    uint64_t start, length;
+    uint64_t start;
+    uint64_t length;
 } MatroskaLevel;

 typedef struct MatroskaDemuxIndex {
@@ -121,8 +122,8 @@
     int level_up;

     /* matroska stuff */
-    char *writing_app,
-        *muxing_app;
+    char *writing_app;
+    char *muxing_app;
     int64_t created;

     /* timescale in the file */
@@ -130,7 +131,8 @@

     /* num_streams is the number of streams that av_new_stream() was called
      * for ( = that are available to the calling program). */
-    int num_tracks, num_streams;
+    int num_tracks;
+    int num_streams;
     MatroskaTrack *tracks[MAX_STREAMS];

     /* cache for ID peeking */
@@ -144,9 +146,9 @@
     int num_packets;

     /* have we already parse metadata/cues/clusters? */
-    int metadata_parsed,
-        index_parsed,
-        done;
+    int metadata_parsed;
+    int index_parsed;
+    int done;

     /* The index for seeking. */
     int num_indexes;


Bugfix

Bugfix

--- libc/src/stdio/vfprintf.c
+++ libc/src/stdio/vfprintf.c
@@ -452,6 +452,13 @@
 		precision = 1;
 	};

+	int negative = 0;
+	if (x < 0)
+	{
+		negative = 1;
+		x = -x;
+	};
+
 	// do the integer part
 	char intconvbuf[30];
 	uint64_t intPart = (uint64_t) x;
@@ -475,6 +482,8 @@

 		*(--put) = c;
 	} while (intPart != 0);
+
+	if (negative) *(--put) = '-';

 	char *convbuf = (char*) malloc(strlen(put) + 1 + precision + 1);
 	strcpy(convbuf, put);


libc/string/i386/memset.c: memset 1 byte at a time is a bit gross

--- libc/string/i386/memset.c
+++ libc/string/i386/memset.c
@@ -28,21 +28,68 @@
  * More importantly, these should provide a good example for
  * others to follow when adding arch specific optimizations.
  *  -Erik
+ *
+ * 2009-04: modified by Denys Vlasenko <vda.linux@googlemail.com>
+ * Fill byte-by-byte is a bit too slow. I prefer 46 byte function
+ * which fills x4 faster than 21 bytes one.
  */

 #include <string.h>

-/* Experimentally off - libc_hidden_proto(memset) */
 #undef memset
 void *memset(void *s, int c, size_t count)
 {
-    int d0, d1;
-    __asm__ __volatile__(
-	    "rep\n\t"
-	    "stosb"
-	    : "=&c" (d0), "=&D" (d1)
-	    :"a" (c),"1" (s),"0" (count)
-	    :"memory");
-    return s;
+	int reg, edi;
+	__asm__ __volatile__(
+
+		/* Most of the time, count is divisible by 4 and nonzero */
+		/* It's better to make this case faster */
+	/*	"	jecxz	9f\n" - (optional) count == 0: goto ret */
+		"	mov	%%ecx, %1\n"
+		"	shr	$2, %%ecx\n"
+		"	jz	1f\n" /* zero words: goto fill_bytes */
+		/* extend 8-bit fill to 32 bits */
+		"	movzx	%%al, %%eax\n" /* 3 bytes */
+	/* or:	"	and	$0xff, %%eax\n" - 5 bytes */
+		"	imul	$0x01010101, %%eax\n" /* 6 bytes */
+		/* fill full words */
+		"	rep; stosl\n"
+		/* fill 0-3 bytes */
+		"1:	and	$3, %1\n"
+		"	jz	9f\n" /* (count & 3) == 0: goto end */
+		"2:	stosb\n"
+		"	dec	%1\n"
+		"	jnz	2b\n"
+		/* end */
+		"9:\n"
+
+		: "=&D" (edi), "=&r" (reg)
+		: "0" (s), "a" (c), "c" (count)
+		: "memory"
+	);
+	return s;
 }
 libc_hidden_def(memset)
+
+/*
+gcc 4.3.1
+=========
+57                     push   %edi
+8b 7c 24 08            mov    0x8(%esp),%edi
+8b 4c 24 10            mov    0x10(%esp),%ecx
+8b 44 24 0c            mov    0xc(%esp),%eax
+89 ca                  mov    %ecx,%edx
+c1 e9 02               shr    $0x2,%ecx
+74 0b                  je     1f <__GI_memset+0x1f>
+0f b6 c0               movzbl %al,%eax
+69 c0 01 01 01 01      imul   $0x1010101,%eax,%eax
+f3 ab                  rep stos %eax,%es:(%edi)
+83 e2 03               and    $0x3,%edx
+74 04                  je     28 <__GI_memset+0x28>
+aa                     stos   %al,%es:(%edi)
+4a                     dec    %edx
+75 fc                  jne    24 <__GI_memset+0x24>
+8b 44 24 08            mov    0x8(%esp),%eax
+5f                     pop    %edi
+c3                     ret
+*/


handle the multi-threaded init's exit() properly

With or without this patch, multi-threaded init's are not fully supported,
but do_exit() is completely wrong.  This becomes a real problem when we
support pid namespaces.

1. do_exit() panics when the main thread of /sbin/init exits. It should not
   until the whole thread group exits. Move the code below, under the
   "if (group_dead)" check.

   Note: this means that forget_original_parent() can use an already dead
   child_reaper()'s task_struct. This is OK for /sbin/init because

   	- do_wait() from alive sub-thread still can reap a zombie, we iterate
   	  over all sub-thread's ->children lists

   	- do_notify_parent() will wakeup some alive sub-thread because it sends
   	  the group-wide signal

   However, we should remove choose_new_parent()->BUG_ON(reaper->exit_state)
   for this.

2. We are playing games with ->nsproxy->pid_ns. This code is bogus today, and
   it has to be changed anyway when we really support pid namespaces, just
   remove it.

Signed-off-by: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@tv-sign.ru>
Roland McGrath <roland@redhat.com>
Cc: "Eric W. Biederman" <8a741aa8cbd77ebc4a56ddb528ce9fd15d42f034@xmission.com>
Cc: Sukadev Bhattiprolu <2ac48ee9b8f6042694a5d86ef56b8e10fe5327d1@us.ibm.com>
Cc: Serge Hallyn <dd6cacb2d07f0aa354aa6e74c149a3580e5a1db1@us.ibm.com>
Cc: Cedric Le Goater <2d8cace2254d4e43578d21933db015d84bcc468a@fr.ibm.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- kernel/exit.c
+++ kernel/exit.c
@@ -592,17 +592,6 @@
 	mmput(mm);
 }

-static inline void
-choose_new_parent(struct task_struct *p, struct task_struct *reaper)
-{
-	/*
-	 * Make sure we're not reparenting to ourselves and that
-	 * the parent is not a zombie.
-	 */
-	BUG_ON(p == reaper || reaper->exit_state);
-	p->real_parent = reaper;
-}
-
 static void
 reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
 {
@@ -710,7 +699,7 @@

 		if (father == p->real_parent) {
 			/* reparent with a reaper, real father it's us */
-			choose_new_parent(p, reaper);
+			p->real_parent = reaper;
 			reparent_thread(p, father, 0);
 		} else {
 			/* reparent ptraced task to its real parent */
@@ -731,7 +720,7 @@
 	}
 	list_for_each_safe(_p, _n, &father->ptrace_children) {
 		p = list_entry(_p, struct task_struct, ptrace_list);
-		choose_new_parent(p, reaper);
+		p->real_parent = reaper;
 		reparent_thread(p, father, 1);
 	}
 }
@@ -882,6 +871,14 @@
 static inline void check_stack_usage(void) {}
 #endif

+static inline void exit_child_reaper(struct task_struct *tsk)
+{
+	if (likely(tsk->group_leader != child_reaper(tsk)))
+		return;
+
+	panic("Attempted to kill init!");
+}
+
 fastcall NORET_TYPE void do_exit(long code)
 {
 	struct task_struct *tsk = current;
@@ -895,13 +892,6 @@
 		panic("Aiee, killing interrupt handler!");
 	if (unlikely(!tsk->pid))
 		panic("Attempted to kill the idle task!");
-	if (unlikely(tsk == child_reaper(tsk))) {
-		if (tsk->nsproxy->pid_ns != &init_pid_ns)
-			tsk->nsproxy->pid_ns->child_reaper = init_pid_ns.child_reaper;
-		else
-			panic("Attempted to kill init!");
-	}
-

 	if (unlikely(current->ptrace & PT_TRACE_EXIT)) {
 		current->ptrace_message = code;
@@ -951,6 +941,7 @@
 	}
 	group_dead = atomic_dec_and_test(&tsk->signal->live);
 	if (group_dead) {
+		exit_child_reaper(tsk);
 		hrtimer_cancel(&tsk->signal->real_timer);
 		exit_itimers(tsk->signal);
 	}


fileops: fix typos in `git_futils_creat_locked{,with_path}`

--- src/fileops.h
+++ src/fileops.h
@@ -45,12 +45,12 @@
 extern int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode_t mode);

 /**
- * Create an open a process-locked file
+ * Create and open a process-locked file
  */
 extern int git_futils_creat_locked(const char *path, const mode_t mode);

 /**
- * Create an open a process-locked file, while
+ * Create and open a process-locked file, while
  * also creating all the folders in its path
  */
 extern int git_futils_creat_locked_withpath(const char *path, const mode_t dirmode, const mode_t mode);


Removed unused functions.

Removed unused functions.

--- libcom/include/thrdpool.h
+++ libcom/include/thrdpool.h
@@ -79,19 +79,8 @@
 	{
 		std::lock_guard<std::mutex> guard(m_lock);
 		m_valid = false;
-		m_cv.notify_all();
-	}
-
-	void clear()
-	{
-		std::lock_guard<std::mutex> guard(m_lock);
 		while (!m_queue.empty())
 			m_queue.pop_back();
-	}
-
-	void notify_all()
-	{
-		std::lock_guard<std::mutex> guard(m_lock);
 		m_cv.notify_all();
 	}
 };
@@ -110,7 +99,7 @@
 		auto worker = [this] {
 			while (!m_done) {
 				fcn_type fcn;
-				m_queue.get(fcn);
+				this->m_queue.get(fcn);
 				(fcn)();
 			}
 		};


Use GDBus for delete_email call

Use GDBus for delete_email call

--- libeasclient/libeasmail.c
+++ libeasclient/libeasmail.c
@@ -1304,16 +1304,12 @@
 			       GCancellable *cancellable,
 			       GError **error)
 {
-	EasEmailHandlerPrivate *priv;
-	gboolean ret = TRUE;
-	DBusGProxy *proxy;
+	gboolean ret = FALSE;
 	gchar *ret_sync_key = NULL;
 	gchar **deleted_items_array = NULL;
 	// Build string array from items_deleted GSList
 	guint list_length = g_slist_length ( (GSList*) items_deleted);
 	int loop = 0;
-	guint cancel_handler_id;
-	guint request_id;

 	g_debug ("eas_mail_handler_delete_emails++");

@@ -1322,19 +1318,8 @@
 			     EAS_MAIL_ERROR,
 			     EAS_MAIL_ERROR_BADARG,
 			     "eas_mail_handler_sync_move_to_folder requires valid arguments");
-		ret = FALSE;
 		goto finish;
 	}
-
-	g_assert (self);
-	g_assert (sync_key);
-	g_assert (items_deleted);
-
-	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-	priv = self->priv;
-	proxy = priv->remoteEas;
-	request_id = priv->next_request_id++;

 	deleted_items_array = g_malloc0 ( (list_length + 1) * sizeof (gchar*));
 	if (!deleted_items_array) {
@@ -1349,33 +1334,14 @@
 		g_debug ("Deleted Id: [%s]", deleted_items_array[loop]);
 	}

-	if (cancellable) {
-		EasCancelInfo *cancel_info = g_new0 (EasCancelInfo, 1);	// freed on disconnect
-
-		cancel_info->handler = self;
-		cancel_info->request_id = request_id;
-		// connect to the "cancelled" signal
-		g_debug ("connect to cancellable");
-		cancel_handler_id = g_cancellable_connect (cancellable,
-							   G_CALLBACK (eas_mail_handler_cancel_mail_request),
-							   (gpointer) cancel_info,
-							   g_free);				// data destroy func
-	}
-
-	ret = dbus_g_proxy_call (proxy, "delete_email", error,
-				 G_TYPE_STRING, priv->account_uid,
-				 G_TYPE_STRING, sync_key,
-				 G_TYPE_STRING, folder_id,
-				 G_TYPE_STRV, deleted_items_array,
-				 G_TYPE_INVALID,
-				 G_TYPE_STRING, &ret_sync_key,
-				 G_TYPE_INVALID);
-
-	if (cancellable) {
-		// disconnect from cancellable
-		g_debug ("disconnect from cancellable");
-		g_cancellable_disconnect (cancellable, cancel_handler_id);
-	}
+	ret = eas_gdbus_mail_call (self, "delete_email",
+				   NULL, NULL,
+				   "(sss^as)", "(s)",
+				   NULL, error,
+				   self->priv->account_uid,
+				   sync_key, folder_id,
+				   deleted_items_array,
+				   &ret_sync_key);

 	// Clean up string array
 	for (loop = 0; loop < list_length; ++loop) {


env: fix insertion of non variable parts in result

When there is a variable used in the configuration with some text
following it, like `${VAR}-additional-text`, the additional text is not
carried over in the result. This is caused by accidentally overwriting
the variable holding the length of the original string and not copying
the remaining parts of the value into the buffer.

Signed-off-by: Dominik del Bondio <dfb31d4c34644619cd9b9177fb55f0c779954477@bitextender.com>

--- src/flb_env.c
+++ src/flb_env.c
@@ -125,6 +125,7 @@
     int i;
     int len;
     int v_len;
+    int e_len;
     int pre_var;
     int have_var = FLB_FALSE;
     char *env_var;
@@ -174,10 +175,15 @@
         /* Lookup the variable in our env-hash */
         env_var = flb_env_get(env, tmp);
         if (env_var) {
-            len = strlen(env_var);
-            buf_append(&buf, env_var, len);
+            e_len = strlen(env_var);
+            buf_append(&buf, env_var, e_len);
         }
         i += (v_start - (value + i)) + v_len;
+    }
+
+    /* Copy the remaining value into our buffer */
+    if (have_var == FLB_TRUE && (value + len) - (v_end + 1) > 0) {
+        buf_append(&buf, v_end + 1, (value + len) - (v_end + 1));
     }

     if (buf.len == 0) {


sds: fix double lookup of int2hex (#1995)

After int2hex lookup, c is greater than or equal to '0' = 48, so in the
second lookup, it overruns the int2hex array.

Signed-off-by: Zero King <d9f2455bf546fd6b8f50d2b59cf0a164036f6ec2@icloud.com>


Fixed issues with planar codec buffer alignment

Align width and height to next multiple of 4 to avoid issues with
internal buffer sizes.

--- libfreerdp/codec/planar.c
+++ libfreerdp/codec/planar.c
@@ -33,6 +33,8 @@

 #define TAG FREERDP_TAG("codec")

+#define ALIGN(val, align) ((val) % (align) == 0) ? (val) : ((val) + (align) - (val) % (align))
+
 static INLINE UINT32 planar_invert_format(BITMAP_PLANAR_CONTEXT* planar, BOOL alpha,
                                           UINT32 DstFormat)
 {
@@ -1483,8 +1485,8 @@
 		return FALSE;

 	context->bgr = FALSE;
-	context->maxWidth = width;
-	context->maxHeight = height;
+	context->maxWidth = ALIGN(width, 4);
+	context->maxHeight = ALIGN(height, 4);
 	context->maxPlaneSize = context->maxWidth * context->maxHeight;
 	context->nTempStep = context->maxWidth * 4;
 	free(context->planesBuffer);


sds: flb_sds_cat_utf8: fix utf-8 conversion

Signed-off-by: Manuel Luis Sanmartín Rozada <d2d99041023261f0bf06f308ab335351af069195@gmail.com>

--- src/flb_sds.c
+++ src/flb_sds.c
@@ -173,7 +173,7 @@
     int hex_bytes;
     uint32_t cp;
     uint32_t state = 0;
-    uint32_t c;
+    unsigned char c;
     const uint8_t *p;
     struct flb_sds *head;
     flb_sds_t tmp;
@@ -197,7 +197,7 @@
             head = FLB_SDS_HEADER(s);
         }

-        c = (uint32_t) str[i];
+        c = (unsigned char)str[i];
         if (c == '\\' || c == '"') {
             s[head->len++] = '\\';
             s[head->len++] = c;
@@ -243,10 +243,10 @@
             s[head->len++] = int2hex[ (unsigned char) ((c & 0xf0) >> 4)];
             s[head->len++] = int2hex[ (unsigned char) (c & 0x0f)];
         }
-        else if (c >= 0x80 && c <= 0xFFFF) {
+        else if (c >= 0x80) {
             hex_bytes = flb_utf8_len(str + i);
-            if (flb_sds_avail(s) < 6) {
-                tmp = flb_sds_increase(s, 2 + 6);
+            if (flb_sds_avail(s) < 10) {
+                tmp = flb_sds_increase(s, 10);
                 if (tmp == NULL) return NULL;
                 *sds = s = tmp;
                 head = FLB_SDS_HEADER(s);
@@ -264,41 +264,18 @@

             if (state != FLB_UTF8_ACCEPT) {
                 /* Invalid UTF-8 hex, just skip utf-8 bytes */
-                break;
-            }
-            else {
+                flb_warn("[pack] invalid UTF-8 bytes, skipping");
+                break;
+            }
+
+            if (cp <= 0xFFFF) {
                 s[head->len++] = '\\';
                 s[head->len++] = 'u';
                 s[head->len++] = int2hex[ (unsigned char) ((cp & 0xf000) >> 12)];
                 s[head->len++] = int2hex[ (unsigned char) ((cp & 0x0f00) >> 8)];
                 s[head->len++] = int2hex[ (unsigned char) ((cp & 0xf0) >> 4)];
                 s[head->len++] = int2hex[ (unsigned char) (cp & 0x0f)];
-            }
-            i += (hex_bytes - 1);
-        }
-        else if (c > 0xFFFF) {
-            hex_bytes = flb_utf8_len(str + i);
-            if (flb_sds_avail(s) < 10) {
-                tmp = flb_sds_increase(s, 10);
-                if (tmp == NULL) return NULL;
-                *sds = s = tmp;
-                head = FLB_SDS_HEADER(s);
-            }
-
-            state = FLB_UTF8_ACCEPT;
-            cp = 0;
-            for (b = 0; b < hex_bytes; b++) {
-                p = (const unsigned char *) str + i + b;
-                ret = flb_utf8_decode(&state, &cp, *p);
-                if (ret == 0) {
-                    break;
-                }
-            }
-
-            if (state != FLB_UTF8_ACCEPT) {
-                /* Invalid UTF-8 hex, just skip utf-8 bytes */
-                flb_warn("[pack] invalid UTF-8 bytes, skipping");
-                break;
+                i += (hex_bytes - 1);
             }
             else {
                 s[head->len++] = '\\';
@@ -311,8 +288,8 @@
                 s[head->len++] = int2hex[ (unsigned char) ((cp & 0x0f00) >> 8)];
                 s[head->len++] = int2hex[ (unsigned char) ((cp & 0xf0) >> 4)];
                 s[head->len++] = int2hex[ (unsigned char) (cp & 0x0f)];
-            }
-            i += (hex_bytes - 1);
+                i += (hex_bytes - 1);
+            }
         }
         else {
             s[head->len++] = c;


Added fallback to CMDTYPE_STREAM_SURFACE_BITS

Since our samples were incorrect, add a fallback with a log warnings
to the old CMDTYPE_STREAM_SURFACE_BITS by default behaviour.

--- libfreerdp/core/surface.c
+++ libfreerdp/core/surface.c
@@ -224,21 +224,26 @@

 BOOL update_write_surfcmd_surface_bits(wStream* s, const SURFACE_BITS_COMMAND* cmd)
 {
+	UINT16 cmdType;
 	if (!Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH))
 		return FALSE;

-	switch (cmd->cmdType)
+	cmdType = cmd->cmdType;
+	switch (cmdType)
 	{
 		case CMDTYPE_SET_SURFACE_BITS:
 		case CMDTYPE_STREAM_SURFACE_BITS:
 			break;
 		default:
-			WLog_ERR(TAG, "%s SURFACE_BITS_COMMAND->cmdType 0x%08" PRIx32 " not allowed.",
-			         cmd->cmdType);
-			return FALSE;
-	}
-
-	Stream_Write_UINT16(s, cmd->cmdType);
+			WLog_WARN(TAG,
+			          "SURFACE_BITS_COMMAND->cmdType 0x%04" PRIx16
+			          " not allowed, correcting to 0x%04" PRIx16,
+			          cmdType, CMDTYPE_STREAM_SURFACE_BITS);
+			cmdType = CMDTYPE_STREAM_SURFACE_BITS;
+			break;
+	}
+
+	Stream_Write_UINT16(s, cmdType);
 	Stream_Write_UINT16(s, cmd->destLeft);
 	Stream_Write_UINT16(s, cmd->destTop);
 	Stream_Write_UINT16(s, cmd->destRight);


strarray is separated from common so include the new header

--- libgit2-glib/ggit-utils.h
+++ libgit2-glib/ggit-utils.h
@@ -22,7 +22,7 @@
 #define __GGIT_UTILS_H__

 #include <glib-object.h>
-#include <git2/common.h>
+#include <git2/strarray.h>
 #include <git2/object.h>
 #include <git2/types.h>


Make sure to call gnome_mime_type_or_default when looking for `type'.

	* libgnome/gnome-metadata.c (get_worker): Make sure to call
	gnome_mime_type_or_default when looking for `type'.  Check mime
	type after application-installed information.

--- libgnome/gnome-metadata.c
+++ libgnome/gnome-metadata.c
@@ -886,8 +886,15 @@
 static char *
 run_file (const char *file)
 {
-	/* FIXME: implement.  */
+#if 0
+  /* This is what the code will look like once the magic functions are
+     ready.  */
+	extern const char *gnome_mime_type_from_magic (const char *); /* FIXME */
+	const char *type = gnome_mime_type_from_magic (file);
+	return type ? strdup (type) : NULL;
+#else
 	return NULL;
+#endif
 }

 /* Do all the work for _get and _get_fast.  */
@@ -896,6 +903,7 @@
 	    int is_fast)
 {
 	int type_size, r;
+	int is_type = 0;
 	char *type;

 	/* Phase 1: see if data exists in database.  */
@@ -914,12 +922,16 @@

 	if (! strcmp (name, "type")) {
 		/* We're trying to fetch the type, so there's no point
-		   trying the same requests again.  */
-		if (is_fast)
-			return GNOME_METADATA_NOT_FOUND;
-		type = run_file (file);
-		if (! type)
-			return GNOME_METADATA_NOT_FOUND;
+		   trying the same requests again below.  */
+
+		type = gnome_mime_type_or_default ((char *) file, NULL);
+		if (! type) {
+			if (is_fast)
+				return GNOME_METADATA_NOT_FOUND;
+			type = run_file (file);
+			if (! type)
+				return GNOME_METADATA_NOT_FOUND;
+		}
 		*size = strlen (type) + 1;
 		*buffer = type;
 		return 0;
@@ -936,15 +948,15 @@
 		goto got_type;
 	}

+	/* Try application-installed information.  */
+	if (! try_app_regexs (file, "type", &type_size, &type)) {
+		goto got_type;
+	}
+
 	/* See if `mime.types' has the answer.  */
-	type = gnome_mime_type_or_default ((char *)file, NULL);
+	type = gnome_mime_type_or_default ((char *) file, NULL);
 	if (type) {
 		type = strdup (type);
-		goto got_type;
-	}
-
-	/* Try application-installed information.  */
-	if (! try_app_regexs (file, "type", &type_size, &type)) {
 		goto got_type;
 	}


runtime: mark unwind functions general-regs-only on ARM

For https://gcc.gnu.org/PR89093.

Change-Id: Ic426b43d633c77104bda01d4e7835bc9ab4695ef
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/173657
Reviewed-by: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>

--- libgo/runtime/go-unwind.c
+++ libgo/runtime/go-unwind.c
@@ -411,7 +411,7 @@
 _Unwind_Reason_Code
 PERSONALITY_FUNCTION (_Unwind_State, struct _Unwind_Exception *,
 		      struct _Unwind_Context *)
-  __attribute__ ((no_split_stack, flatten));
+  __attribute__ ((no_split_stack, flatten, target ("general-regs-only")));

 _Unwind_Reason_Code
 PERSONALITY_FUNCTION (_Unwind_State state,
@@ -604,6 +604,9 @@
   __attribute__ ((no_split_stack));

 _Unwind_Reason_Code
+#ifdef __ARM_EABI_UNWINDER__
+__attribute__ ((target ("general-regs-only")))
+#endif
 __gccgo_personality_dummy (int version __attribute__ ((unused)),
 		      _Unwind_Action actions __attribute__ ((unused)),
 		      _Unwind_Exception_Class exception_class __attribute__ ((unused)),


Fix warning about pytaken_msg maybe being uninitialized (#551)

* Fix warning about pytaken_msg maybe being uninitialized

Signed-off-by: Shane Loretz <7fde345e8e2e22c78a1570a4807e4629866dc7de@osrfoundation.org>

* Consolidate pytaken_msg null check

Signed-off-by: Shane Loretz <7fde345e8e2e22c78a1570a4807e4629866dc7de@osrfoundation.org>

--- rclpy/src/rclpy/_rclpy.c
+++ rclpy/src/rclpy/_rclpy.c
@@ -3309,7 +3309,7 @@
   PyObject * pysubscription;
   PyObject * pymsg_type;
   PyObject * pyraw;
-  PyObject * pytaken_msg;
+  PyObject * pytaken_msg = NULL;

   if (!PyArg_ParseTuple(args, "OOO", &pysubscription, &pymsg_type, &pyraw)) {
     return NULL;
@@ -3352,10 +3352,10 @@

     pytaken_msg = rclpy_convert_to_py(taken_msg, pymsg_type);
     destroy_ros_message(taken_msg);
-    if (!pytaken_msg) {
-      // the function has set the Python error
-      return NULL;
-    }
+  }
+  if (!pytaken_msg) {
+    // the function has set the Python error
+    return NULL;
   }

   // make result tuple


moved doc comment

moved doc comment

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@14078 67ed7778-7388-44ab-90cf-0a291f65f57c

--- libgphoto2/gphoto2-list.c
+++ libgphoto2/gphoto2-list.c
@@ -225,13 +225,6 @@
         return (GP_OK);
 }

-/**
- * Sorts the \c list entries with respect to the names.
- *
- * \param list a #CameraList
- * \return a gphoto2 error code
- *
- **/
 static int
 cmp_list (const void *a, const void *b) {
         const struct _entry *ca = a;
@@ -240,6 +233,13 @@
         return strcmp (ca->name, cb->name);
 }

+/**
+ * Sorts the \c list entries with respect to the names.
+ *
+ * \param list a #CameraList
+ * \return a gphoto2 error code
+ *
+ **/
 int
 gp_list_sort (CameraList *list)
 {


Test 1000 iterations.

Test 1000 iterations.

--- khazad-test.c
+++ khazad-test.c
@@ -31,6 +31,13 @@
     printf("100 iter: ");
     print_block_hex(crypt_block, KHAZAD_BLOCK_SIZE);

+    for (i = 100; i < 1000; ++i)
+    {
+        khazad_crypt(crypt_block, encode_key_schedule);
+    }
+    printf("1000 iter: ");
+    print_block_hex(crypt_block, KHAZAD_BLOCK_SIZE);
+
     return 0;
 }


Make false continued packet handling consistent

A false continued packet occurs if the previous page ended at the
 end of a packet, with no sequence number gap and no continued data
 on that page, while the current page has the continued packet flag
 set.
Previously, if you drained all of the buffered packet data by
 repeatedly calling ogg_stream_packetout() after submitting the
 previous page but before submitting the current page, libogg would
 discard the continued data at the beggining of the current page.
However, if you left the previous page's data in the buffer, then
 libogg would happily return the continued data at the start of the
 current page as a separate packet when you eventually did call
 ogg_stream_packetout().

This patch makes libogg consistently discard this data.

--- src/framing.c
+++ src/framing.c
@@ -875,6 +875,7 @@
      some segments */
   if(continued){
     if(os->lacing_fill<1 ||
+       (os->lacing_vals[os->lacing_fill-1]&0xff)<255 ||
        os->lacing_vals[os->lacing_fill-1]==0x400){
       bos=0;
       for(;segptr<segments;segptr++){


fu-tool: Stop any running daemon over dbus before loading engine

This helps to prevent conflicts of the daemon trying to claim devices
at the same time as the tool.

--- src/fu-tool.c
+++ src/fu-tool.c
@@ -22,6 +22,11 @@
 #include "fu-smbios.h"
 #include "fu-util-common.h"
 #include "fu-debug.h"
+
+#define SYSTEMD_SERVICE			"org.freedesktop.systemd1"
+#define SYSTEMD_OBJECT_PATH		"/org/freedesktop/systemd1"
+#define SYSTEMD_MANAGER_INTERFACE	"org.freedesktop.systemd1.Manager"
+#define SYSTEMD_FWUPD_UNIT		"fwupd.service"

 /* this is only valid in this file */
 #define FWUPD_ERROR_INVALID_ARGS	(FWUPD_ERROR_LAST+1)
@@ -60,6 +65,60 @@
 	g_free (item->arguments);
 	g_free (item->description);
 	g_free (item);
+}
+
+static gboolean
+fu_util_start_engine (FuUtilPrivate *priv, GError **error)
+{
+#ifdef HAVE_SYSTEMD
+	g_autoptr(GDBusConnection) connection = NULL;
+	g_autoptr(GDBusProxy) proxy = NULL;
+	g_autoptr(GVariant) val = NULL;
+	g_autoptr(GError) error_local = NULL;
+
+	/* try to stop any already running daemon */
+	connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
+	if (connection == NULL)
+		return FALSE;
+	proxy = g_dbus_proxy_new_sync (connection,
+					G_DBUS_PROXY_FLAGS_NONE,
+					NULL,
+					SYSTEMD_SERVICE,
+					SYSTEMD_OBJECT_PATH,
+					SYSTEMD_MANAGER_INTERFACE,
+					NULL,
+					error);
+	if (proxy == NULL)
+		return FALSE;
+	val = g_dbus_proxy_call_sync (proxy,
+				      "GetUnit",
+				      g_variant_new ("(s)",
+						     SYSTEMD_FWUPD_UNIT),
+				      G_DBUS_CALL_FLAGS_NONE,
+				      -1,
+				      NULL,
+				      &error_local);
+	if (val == NULL) {
+		g_debug ("Unable to find %s: %s",
+			 SYSTEMD_FWUPD_UNIT,
+			 error_local->message);
+	} else {
+		g_clear_object (&val);
+		val = g_dbus_proxy_call_sync (proxy,
+					      "StopUnit",
+					      g_variant_new ("(ss)",
+							     SYSTEMD_FWUPD_UNIT,
+							     "replace"),
+					      G_DBUS_CALL_FLAGS_NONE,
+					      -1,
+					      NULL,
+					      error);
+		if (val == NULL)
+			return FALSE;
+	}
+
+#endif
+	return fu_engine_load (priv->engine, error);
 }

 static gint
@@ -270,7 +329,7 @@
 static gboolean
 fu_util_watch (FuUtilPrivate *priv, gchar **values, GError **error)
 {
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;
 	g_main_loop_run (priv->loop);
 	return TRUE;
@@ -318,7 +377,7 @@
 	gint fd;

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* check args */
@@ -361,7 +420,7 @@
 	g_autoptr(GPtrArray) devs = NULL;

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* print */
@@ -406,7 +465,7 @@
 	g_autoptr(GPtrArray) devs = NULL;

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* print */
@@ -512,7 +571,7 @@
 	}

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* get device */
@@ -599,7 +658,7 @@
 	g_autoptr(GPtrArray) install_tasks = NULL;

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* handle both forms */
@@ -697,7 +756,7 @@
 	g_autoptr(FuDeviceLocker) locker = NULL;

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* invalid args */
@@ -734,7 +793,7 @@
 	g_autoptr(FuDeviceLocker) locker = NULL;

 	/* load engine */
-	if (!fu_engine_load (priv->engine, error))
+	if (!fu_util_start_engine (priv, error))
 		return FALSE;

 	/* invalid args */


Fix new warp filter in the case wmmat[2] == 0

In this case, calculating the shear parameters fails
with a divide-by-zero error. So disable the new filter
in this case.

We also temporarily remove the asserts blocking use
of the old filter with debugging enabled.

Change-Id: I788ff51c3bc1d841eab1099881cc3b55038ae342

--- av1/common/warped_motion.c
+++ av1/common/warped_motion.c
@@ -676,6 +676,8 @@
   }
 }

+// Note: For an explanation of the warp algorithm, see the comment
+// above warp_plane()
 static void highbd_warp_plane(WarpedMotionParams *wm, uint8_t *ref8, int width,
                               int height, int stride, uint8_t *pred8, int p_col,
                               int p_row, int p_width, int p_height,
@@ -690,19 +692,29 @@
     int32_t tmp[15 * 8];
     int i, j, k, l, m;
     int32_t *mat = wm->wmmat;
-
-    int32_t alpha = mat[2] - (1 << WARPEDMODEL_PREC_BITS);
-    int32_t beta = mat[3];
-    int32_t gamma = ((int64_t)mat[4] << WARPEDMODEL_PREC_BITS) / mat[2];
-    int32_t delta = mat[5] -
-                    (((int64_t)mat[3] * mat[4] + (mat[2] / 2)) / mat[2]) -
-                    (1 << WARPEDMODEL_PREC_BITS);
+    int32_t alpha, beta, gamma, delta;
+
+    if (mat[2] == 0) {
+      // assert(0 &&
+      //   "Warped motion model is incompatible with new warp filter");
+      warp_plane_old(wm, ref, width, height, stride, pred, p_col, p_row,
+                     p_width, p_height, p_stride, subsampling_x, subsampling_y,
+                     x_scale, y_scale, ref_frm);
+      return;
+    }
+
+    alpha = mat[2] - (1 << WARPEDMODEL_PREC_BITS);
+    beta = mat[3];
+    gamma = ((int64_t)mat[4] << WARPEDMODEL_PREC_BITS) / mat[2];
+    delta = mat[5] - (((int64_t)mat[3] * mat[4] + (mat[2] / 2)) / mat[2]) -
+            (1 << WARPEDMODEL_PREC_BITS);
     uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
     uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);

     if ((4 * abs(alpha) + 7 * abs(beta) > (1 << WARPEDMODEL_PREC_BITS)) ||
         (4 * abs(gamma) + 7 * abs(delta) > (1 << WARPEDMODEL_PREC_BITS))) {
-      assert(0 && "Warped motion model is incompatible with new warp filter");
+      // assert(0 &&
+      //   "Warped motion model is incompatible with new warp filter");
       highbd_warp_plane_old(wm, ref8, width, height, stride, pred8, p_col,
                             p_row, p_width, p_height, p_stride, subsampling_x,
                             subsampling_y, x_scale, y_scale, bd, ref_frm);
@@ -893,17 +905,27 @@
     int32_t tmp[15 * 8];
     int i, j, k, l, m;
     int32_t *mat = wm->wmmat;
-
-    int32_t alpha = mat[2] - (1 << WARPEDMODEL_PREC_BITS);
-    int32_t beta = mat[3];
-    int32_t gamma = ((int64_t)mat[4] << WARPEDMODEL_PREC_BITS) / mat[2];
-    int32_t delta = mat[5] -
-                    (((int64_t)mat[3] * mat[4] + (mat[2] / 2)) / mat[2]) -
-                    (1 << WARPEDMODEL_PREC_BITS);
+    int32_t alpha, beta, gamma, delta;
+
+    if (mat[2] == 0) {
+      // assert(0 &&
+      //   "Warped motion model is incompatible with new warp filter");
+      warp_plane_old(wm, ref, width, height, stride, pred, p_col, p_row,
+                     p_width, p_height, p_stride, subsampling_x, subsampling_y,
+                     x_scale, y_scale, ref_frm);
+      return;
+    }
+
+    alpha = mat[2] - (1 << WARPEDMODEL_PREC_BITS);
+    beta = mat[3];
+    gamma = ((int64_t)mat[4] << WARPEDMODEL_PREC_BITS) / mat[2];
+    delta = mat[5] - (((int64_t)mat[3] * mat[4] + (mat[2] / 2)) / mat[2]) -
+            (1 << WARPEDMODEL_PREC_BITS);

     if ((4 * abs(alpha) + 7 * abs(beta) > (1 << WARPEDMODEL_PREC_BITS)) ||
         (4 * abs(gamma) + 7 * abs(delta) > (1 << WARPEDMODEL_PREC_BITS))) {
-      assert(0 && "Warped motion model is incompatible with new warp filter");
+      // assert(0 &&
+      //   "Warped motion model is incompatible with new warp filter");
       warp_plane_old(wm, ref, width, height, stride, pred, p_col, p_row,
                      p_width, p_height, p_stride, subsampling_x, subsampling_y,
                      x_scale, y_scale, ref_frm);


gateway: allow advertisement of zero bandwidth

Signed-off-by: Ferry Huberts <66e11f9f5d965b69497c7e73d5e808f8b13c1218@pelagic.nl>

--- src/gateway.c
+++ src/gateway.c
@@ -709,12 +709,10 @@
   if (olsr_cnf->smart_gw_active) {
     ip = (uint8_t *) &smart_gateway_netmask;

-    if (olsr_cnf->smart_gw_uplink > 0 && olsr_cnf->smart_gw_downlink > 0) {
-      /* the link is bi-directional with a non-zero bandwidth */
-      ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_LINKSPEED;
-      ip[GW_HNA_DOWNLINK] = serialize_gw_speed(olsr_cnf->smart_gw_downlink);
-      ip[GW_HNA_UPLINK] = serialize_gw_speed(olsr_cnf->smart_gw_uplink);
-    }
+    ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_LINKSPEED;
+    ip[GW_HNA_DOWNLINK] = serialize_gw_speed(olsr_cnf->smart_gw_downlink);
+    ip[GW_HNA_UPLINK] = serialize_gw_speed(olsr_cnf->smart_gw_uplink);
+
     if (olsr_cnf->ip_version == AF_INET6 && olsr_cnf->smart_gw_prefix.prefix_len > 0) {
       ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_IPV6PREFIX;
       ip[GW_HNA_V6PREFIXLEN] = olsr_cnf->smart_gw_prefix.prefix_len;


GBA SIO: Fix RCNT reading for mode

GBA SIO: Fix RCNT reading for mode

--- src/gba/sio.c
+++ src/gba/sio.c
@@ -29,7 +29,7 @@
 }

 static void _switchMode(struct GBASIO* sio) {
-	unsigned mode = ((sio->rcnt >> 14) & 0xC) | ((sio->siocnt >> 12) & 0x3);
+	unsigned mode = ((sio->rcnt & 0xC000) | (sio->siocnt & 0x3000)) >> 12;
 	enum GBASIOMode oldMode = sio->mode;
 	if (mode < 8) {
 		sio->mode = (enum GBASIOMode) (mode & 0x3);


simplify gen_csv

simplify gen_csv

--- src/gen_csv.c
+++ src/gen_csv.c
@@ -5,15 +5,14 @@
 #include <string.h>

 void showusage() {
-    fprintf(stderr, "\nusage: $ gen-csv NUM_LINES NUM_COLUMNS\n");
+    fprintf(stderr, "\nusage: $ gen-csv NUM_COLUMNS\n");
     exit(1);
 }

 int main(int argc, const char **argv) {
-    if (argc < 3)
+    if (argc < 2)
         showusage();
-    int num_lines = atoi(argv[1]);
-    int num_columns = atoi(argv[2]);
+    int num_columns = atoi(argv[1]);
     time_t t;
     int i, j, num_words, add_delimiter;
     char *words[1024 * 128];
@@ -29,7 +28,7 @@
         words[i++] = word;
     num_words = i;
     srand((unsigned) time(&t));
-    for (i = 0; i < num_lines; i++) {
+    while (1) {
         add_delimiter = 0;
         for (j = 0; j< num_columns; j++) {
             if (add_delimiter)


KDE SC 4.11.1

KDE SC 4.11.1

--- libkopete/kopeteversion.h
+++ libkopete/kopeteversion.h
@@ -14,10 +14,10 @@
 #ifndef _KOPETE_VERSION_H_
 #define _KOPETE_VERSION_H_

-#define KOPETE_VERSION_STRING "1.5.0"
+#define KOPETE_VERSION_STRING "1.5.1"
 #define KOPETE_VERSION_MAJOR 1
 #define KOPETE_VERSION_MINOR 5
-#define KOPETE_VERSION_RELEASE 0
+#define KOPETE_VERSION_RELEASE 1
 #define KOPETE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))

 #define KOPETE_VERSION \


glsl: Use a single bit for the dual-source blend index

The only values allowed are 0 and 1, and the value is checked before
assigning.

Valgrind massif results for a trimmed apitrace of dota2:

                  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
Before (32-bit): 74 40,580,119,657       69,186,544       63,506,327     5,680,217            0
After  (32-bit): 76 40,572,916,873       68,831,248       63,328,783     5,502,465            0

Before (64-bit): 89 36,822,971,897       96,526,616       88,735,296     7,791,320            0
After  (64-bit): 60 36,822,640,058       96,526,824       88,735,296     7,791,528            0

A real savings of 173KiB on 32-bit and no change on 64-bit.

Signed-off-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Reviewed-by: Kenneth Graunke <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>

--- src/glsl/ir.h
+++ src/glsl/ir.h
@@ -689,6 +689,15 @@
       unsigned must_be_shader_input:1;

       /**
+       * Output index for dual source blending.
+       *
+       * \note
+       * The GLSL spec only allows the values 0 or 1 for the index in \b dual
+       * source blending.
+       */
+      unsigned index:1;
+
+      /**
        * \brief Layout qualifier for gl_FragDepth.
        *
        * This is not equal to \c ir_depth_layout_none if and only if this
@@ -720,11 +729,6 @@
        * Vertex stream output identifier.
        */
       unsigned stream;
-
-      /**
-       * output index for dual source blending.
-       */
-      int index;

       /**
        * Initial binding point for a sampler, atomic, or UBO.