(drivers) lan91c111: Fix xmit

(drivers) lan91c111: Fix xmit

Now it sends the packet, and wireshark can see it. Howere, it's
corrupted for some reason.

--- src/drivers/net/lan91c111/lan91c111.c
+++ src/drivers/net/lan91c111/lan91c111.c
@@ -6,6 +6,7 @@
  */
 #include <errno.h>

+#include <kernel/printk.h>
 #include <kernel/irq.h>
 #include <mem/misc/pool.h>

@@ -111,6 +112,7 @@
 	uint16_t packet_num;
 	int i;
 	uint16_t *data;
+	uint16_t pointer;

 	_set_cmd(CMD_TX_ALLOC);

@@ -122,15 +124,36 @@

 	REG16_STORE(BANK_PNR, packet_num << 8);

-	/* TODO write pointer register. WTF it's 8 bit */
-
+	pointer = 0;
+	REG16_STORE(BANK_POINTER, pointer);
+
+	/* Write header */
+	pointer = 2;
+	REG16_STORE(BANK_POINTER, pointer);
+	REG16_STORE(BANK_DATA, (uint16_t) skb->len);
+	pointer = 4;
+	REG16_STORE(BANK_POINTER, pointer);
+
+	/* BANK_DATA register works as FIFO, so we just push
+	 * data with 16-bit writes */
 	data = (uint16_t*) skb_data_cast_in(skb->data);
 	for (i = 0; i < skb->len; i += 2) {
+		printk("driver writes [%d]=%x\n", pointer, *data);
 		/* This could be done with 32-bit writes,
 		 * but here we just use the usual macro */
 		REG16_STORE(BANK_DATA, *data);
 		data++;
+
+		/* Auto-increment for pointer register seems to
+		 * be unsupported by qemu-linaro, so we increment
+		 * it by hand */
+		pointer += 2;
+		REG16_STORE(BANK_POINTER, pointer);
 	}
+
+	/* Write control byte */
+	REG16_STORE(BANK_DATA, (1 << 4)); /* Set CRC */
+

 	_set_cmd(CMD_TX_ENQUEUE);

@@ -143,6 +166,7 @@
 static int lan91c111_open(struct net_device *dev) {
         _set_bank(0);
 	REG16_STORE(BANK_RCR, 0x0100); /* Enable RX interrupts */
+	REG16_STORE(BANK_TCR, 0x0001); /* Enable TX */
 	return 0;
 }


phenotype features (wip)

phenotype features (wip)

--- app/Model/subject/subject.h
+++ app/Model/subject/subject.h
@@ -34,7 +34,6 @@
     Q_PROPERTY(QList<QObject*> indicators READ indicators NOTIFY dataChanged)
     Q_PROPERTY(PhenotypesListModel* phenotypes READ phenotypes NOTIFY dataChanged)
     Q_PROPERTY(EventsListModel* events READ events NOTIFY dataChanged)
-    Q_PROPERTY(QList<QObject*> samples READ samples NOTIFY dataChanged)
     // Special "shortcut" properties for qml display
     Q_PROPERTY(QJsonObject subjectUI READ subjectUI NOTIFY dataChanged)
     Q_PROPERTY(QString searchField READ searchField NOTIFY dataChanged)


exercise all required POSIX pthread cancellation points

error: pathspec 'test/pthread/cancellation-points.c' did not match any file(s) known to git

--- test/pthread/cancellation-points.c
+++ test/pthread/cancellation-points.c
@@ -0,0 +1,280 @@
+/*
+ * Make sure functions marked as cancellation points actually are.
+ * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html#tag_02_09_05
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <features.h>
+#include <sys/ipc.h>
+#include <sys/mman.h>
+#include <sys/msg.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <poll.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+
+/* take care of optional things ... */
+#define STUB(func, args) static void func args { sleep(0); }
+#if !defined(__UCLIBC__) || defined(__UCLIBC_AIO__)
+# include <aio.h>
+#else
+STUB(aio_suspend, (void *p, int n, const void *p2))
+#endif
+#if !defined(__UCLIBC__) || defined(__UCLIBC_STROPTS__)
+# include <stropts.h>
+#else
+STUB(getmsg, (int f, void *p, void *p2, void *p3))
+STUB(getpmsg, (int f, void *p, void *p2, void *p3, void *p4))
+STUB(putmsg, (int f, void *p, void *p2, void *p3))
+STUB(putpmsg, (int f, void *p, void *p2, void *p3, void *p4))
+#endif
+#if defined(__UCLIBC__)
+STUB(clock_nanosleep, (int i, int f, const void *p, void *p2))
+#endif
+
+int cnt;
+bool ready;
+
+void cancel_timeout(int sig)
+{
+	ready = false;
+}
+void cancel_thread_cleanup(void *arg)
+{
+	ready = false;
+}
+
+/* some funcs need some help as they wont take NULL args ... */
+const struct timespec zero_sec = { .tv_sec = 0, .tv_nsec = 0 };
+
+sem_t sem;
+void help_sem_setup(void)
+{
+	if (sem_init(&sem, 0, 1) == -1) {
+		perror("sem_init() failed");
+		exit(-1);
+	}
+}
+
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t mutex;
+void help_pthread_setup(void)
+{
+	pthread_mutex_init(&mutex, NULL);
+	pthread_mutex_lock(&mutex);
+}
+
+/* the pthread function that will call the cancellable function over and over */
+#define _MAKE_CANCEL_THREAD_FUNC_EX(func, sysfunc, args, setup) \
+void *cancel_thread_##func(void *arg) \
+{ \
+	if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) { \
+		perror("unable to set cancel type to deferred; something is seriously broken"); \
+		exit(-1); \
+	} \
+	pthread_cleanup_push(cancel_thread_cleanup, NULL); \
+	setup; \
+	ready = true; \
+	while (ready) \
+		sysfunc args; \
+	pthread_cleanup_pop(1); \
+	return NULL; \
+}
+#define MAKE_CANCEL_THREAD_FUNC_RE(func, sysfunc, args) _MAKE_CANCEL_THREAD_FUNC_EX(func, sysfunc, args, (void)0)
+#define MAKE_CANCEL_THREAD_FUNC_EX(func, args, setup)   _MAKE_CANCEL_THREAD_FUNC_EX(func, func, args, setup)
+#define MAKE_CANCEL_THREAD_FUNC(func, args)             _MAKE_CANCEL_THREAD_FUNC_EX(func, func, args, (void)0)
+
+MAKE_CANCEL_THREAD_FUNC(accept, (-1, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(aio_suspend, (NULL, 0, &zero_sec))
+MAKE_CANCEL_THREAD_FUNC(clock_nanosleep, (0, 0, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(close, (-1))
+MAKE_CANCEL_THREAD_FUNC(connect, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(creat, ("", 0))
+MAKE_CANCEL_THREAD_FUNC(fcntl, (0, F_SETLKW, NULL))
+MAKE_CANCEL_THREAD_FUNC(fdatasync, (-1))
+MAKE_CANCEL_THREAD_FUNC(fsync, (0))
+MAKE_CANCEL_THREAD_FUNC(getmsg, (-1, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(getpmsg, (-1, NULL, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(lockf, (-1, F_TEST, 0))
+MAKE_CANCEL_THREAD_FUNC(mq_receive, (0, NULL, 0, NULL))
+MAKE_CANCEL_THREAD_FUNC(mq_send, (0, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(mq_timedreceive, (0, NULL, 0, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(mq_timedsend, (0, NULL, 0, 0, NULL))
+MAKE_CANCEL_THREAD_FUNC(msgrcv, (-1, NULL, 0, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(msgsnd, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(msync, (NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(nanosleep, (NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(open, ("", 0))
+MAKE_CANCEL_THREAD_FUNC(pause, ())
+MAKE_CANCEL_THREAD_FUNC(poll, (NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(pread, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(pselect, (0, NULL, NULL, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC_EX(pthread_cond_timedwait, (&cond, &mutex, &zero_sec), help_pthread_setup())
+MAKE_CANCEL_THREAD_FUNC_EX(pthread_cond_wait, (&cond, &mutex), help_pthread_setup())
+/*MAKE_CANCEL_THREAD_FUNC_EX(pthread_join, (0, NULL))*/
+MAKE_CANCEL_THREAD_FUNC(pthread_testcancel, ())
+MAKE_CANCEL_THREAD_FUNC(putmsg, (-1, NULL, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(putpmsg, (-1, NULL, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(pwrite, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(read, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(readv, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(recv, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(recvfrom, (-1, NULL, 0, 0, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(recvmsg, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(select, (0, NULL, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC_EX(sem_timedwait, (&sem, &zero_sec), help_sem_setup())
+MAKE_CANCEL_THREAD_FUNC_EX(sem_wait, (&sem), help_sem_setup())
+MAKE_CANCEL_THREAD_FUNC(send, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(sendmsg, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(sendto, (-1, NULL, 0, 0, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(sigpause, (0))
+MAKE_CANCEL_THREAD_FUNC(sigsuspend, (NULL))
+MAKE_CANCEL_THREAD_FUNC(sigtimedwait, (NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(sigwait, (NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(sigwaitinfo, (NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(sleep, (0))
+MAKE_CANCEL_THREAD_FUNC(system, (""))
+MAKE_CANCEL_THREAD_FUNC(tcdrain, (-1))
+MAKE_CANCEL_THREAD_FUNC(usleep, (0))
+MAKE_CANCEL_THREAD_FUNC(wait, (NULL))
+MAKE_CANCEL_THREAD_FUNC(waitid, (0, 0, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(waitpid, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(write, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(writev, (-1, NULL, 0))
+
+/* test a few variations that should not cancel ... */
+MAKE_CANCEL_THREAD_FUNC_RE(fcntl_another, fcntl, (0, F_GETFD))
+
+/* main test that creates thread, cancels it, etc... */
+int _test_func(const char *func_name, void *(*func)(void*), const int should_cancel)
+{
+	int ret;
+	pthread_t cancel_thread_id;
+
+	++cnt;
+
+	printf("testing %-30s ", func_name);
+
+	printf(".");
+	if (signal(SIGALRM, cancel_timeout) == SIG_ERR) {
+		perror("unable to bind SIGALRM");
+		exit(-1);
+	}
+
+	printf(".");
+	ready = false;
+	pthread_create(&cancel_thread_id, NULL, func, NULL);
+
+	printf(".");
+	while (!ready)
+		sched_yield();
+
+	printf(".");
+	if (pthread_cancel(cancel_thread_id)) {
+		perror("unable to cancel thread");
+		exit(-1);
+	}
+
+	printf(".");
+	alarm(5);
+	while (ready)
+		sched_yield();
+
+	printf(".");
+	ret = (!!!alarm(0) == should_cancel);
+
+	if (ret)
+		printf(" failed ;(\n");
+	else
+		printf(" OK!\n");
+
+	return ret;
+}
+#define TEST_FUNC(f)    _test_func(#f, cancel_thread_##f, 1)
+#define TEST_FUNC_RE(f) _test_func(#f, cancel_thread_##f, 0)
+
+int main(int argc, char *argv[])
+{
+	int ret = 0;
+	setbuf(stdout, NULL);
+	cnt = 0;
+
+	ret += TEST_FUNC(accept);
+	ret += TEST_FUNC(aio_suspend);
+	ret += TEST_FUNC(clock_nanosleep);
+	ret += TEST_FUNC(close);
+	ret += TEST_FUNC(connect);
+	ret += TEST_FUNC(creat);
+	ret += TEST_FUNC(fcntl);
+	ret += TEST_FUNC(fdatasync);
+	ret += TEST_FUNC(fsync);
+	ret += TEST_FUNC(getmsg);
+	ret += TEST_FUNC(getpmsg);
+	ret += TEST_FUNC(lockf);
+	ret += TEST_FUNC(mq_receive);
+	ret += TEST_FUNC(mq_send);
+	ret += TEST_FUNC(mq_timedreceive);
+	ret += TEST_FUNC(mq_timedsend);
+	ret += TEST_FUNC(msgrcv);
+	ret += TEST_FUNC(msgsnd);
+	ret += TEST_FUNC(msync);
+	ret += TEST_FUNC(nanosleep);
+	ret += TEST_FUNC(open);
+	ret += TEST_FUNC(pause);
+	ret += TEST_FUNC(poll);
+	ret += TEST_FUNC(pread);
+	ret += TEST_FUNC(pselect);
+	ret += TEST_FUNC(pthread_cond_timedwait);
+	ret += TEST_FUNC(pthread_cond_wait);
+	/*ret += TEST_FUNC(pthread_join);*/
+	ret += TEST_FUNC(pthread_testcancel);
+	ret += TEST_FUNC(putmsg);
+	ret += TEST_FUNC(putpmsg);
+	ret += TEST_FUNC(pwrite);
+	ret += TEST_FUNC(read);
+	ret += TEST_FUNC(readv);
+	ret += TEST_FUNC(recv);
+	ret += TEST_FUNC(recvfrom);
+	ret += TEST_FUNC(recvmsg);
+	ret += TEST_FUNC(select);
+	ret += TEST_FUNC(sem_timedwait);
+	ret += TEST_FUNC(sem_wait);
+	ret += TEST_FUNC(send);
+	ret += TEST_FUNC(sendmsg);
+	ret += TEST_FUNC(sendto);
+	ret += TEST_FUNC(sigpause);
+	ret += TEST_FUNC(sigsuspend);
+	ret += TEST_FUNC(sigtimedwait);
+	ret += TEST_FUNC(sigwait);
+	ret += TEST_FUNC(sigwaitinfo);
+	ret += TEST_FUNC(sleep);
+	ret += TEST_FUNC(system);
+	ret += TEST_FUNC(tcdrain);
+	ret += TEST_FUNC(usleep);
+	ret += TEST_FUNC(wait);
+	ret += TEST_FUNC(waitid);
+	ret += TEST_FUNC(waitpid);
+	ret += TEST_FUNC(write);
+	ret += TEST_FUNC(writev);
+
+	ret += TEST_FUNC_RE(fcntl_another);
+
+	if (ret)
+		printf("!!! %i / %i tests failed\n", ret, cnt);
+
+	return ret;
+}


remove BTM_WBS_INCLUDED for bta_hf_client_version select

--- components/bt/host/bluedroid/bta/hf_client/bta_hf_client_main.c
+++ components/bt/host/bluedroid/bta/hf_client/bta_hf_client_main.c
@@ -232,11 +232,7 @@
     bta_hf_client_st_closing
 };

-#if BTM_WBS_INCLUDED
 const char *bta_hf_client_version = "1.6";
-#else
-const char *bta_hf_client_version = "1.5";
-#endif

 /* HF Client control block */
 #if BTA_DYNAMIC_MEMORY == FALSE


incr stat

incr stat

--- KERN/netinet/sctp_cc_functions.c
+++ KERN/netinet/sctp_cc_functions.c
@@ -507,6 +507,7 @@
 		}
 		/* Always drop the cwnd */
 		net->cwnd = (net->flight_size - (SCTP_DC_CC_L * net->mtu * num_pkt_lost));
+		SCTP_STAT_INCR(sctps_ecnereducedcwnd);
 	} else 	if (in_window == 0) {
 		if (i_announced < 4) {
 			printf("net->last_measured_rtt sec:%ld.%6.6ld\n",


Same version on Panther and Tiger.

Same version on Panther and Tiger.

--- KERN/nke/sctp_nke/Panther/SCTP.c
+++ KERN/nke/sctp_nke/Panther/SCTP.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Michael Tuexen, tuexen@fh-muenster.de,
+ * Copyright (C) 2004, 2005 Michael Tuexen, tuexen@fh-muenster.de,
  *
  * All rights reserved.
  *
@@ -30,18 +30,28 @@

 /*
  * TODO: - daemon for address reconfiguration.
- *       - provide an installer.
  */

+#ifndef SCTP_APPLE_FINE_GRAINED_LOCKING
 #include <sys/systm.h>
 #include <mach/mach_types.h>
+#endif

 #include <sys/sysctl.h>
 #include <netinet/in.h>
+#include <netinet/ip.h>
 #include <sys/protosw.h>
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+#include <sys/lock.h>
+#include <sys/domain.h>
+#else
 #include <sys/mbuf.h>
+#endif

 #include <net/route.h>
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+#include <sys/socketvar.h> /* needed by netinet/in_pcb.h */
+#endif
 #include <netinet/in_pcb.h>
 #include <netinet/sctp_pcb.h>
 #include <netinet/sctp.h>
@@ -111,9 +121,11 @@

 kern_return_t SCTP_start (kmod_info_t * ki, void * d) {

+	int err;
+#ifndef SCTP_APPLE_FINE_GRAINED_LOCKING
 	int s;
 	int funnel_state;
-	int err;
+#endif

 	old_pr4  = ip_protox [IPPROTO_SCTP];
 	old_pr6  = ip6_protox[IPPROTO_SCTP];
@@ -124,27 +136,40 @@
 	bzero(&sctp6_dgram,     sizeof(struct protosw));
 	bzero(&sctp6_seqpacket, sizeof(struct protosw));
 	bzero(&sctp6_stream,    sizeof(struct protosw));
-
-	sctp4_dgram.pr_type	     = SOCK_DGRAM;
-	sctp4_dgram.pr_domain 	     = &inetdomain;
+
+	sctp4_dgram.pr_type          = SOCK_DGRAM;
+	sctp4_dgram.pr_domain        = &inetdomain;
 	sctp4_dgram.pr_protocol      = IPPROTO_SCTP;
-	sctp4_dgram.pr_flags 	     = PR_ADDR_OPT|PR_WANTRCVD;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp4_dgram.pr_flags         = PR_WANTRCVD|PR_PCBLOCK|PR_PROTOLOCK;
+#else
+	sctp4_dgram.pr_flags         = PR_ADDR_OPT|PR_WANTRCVD;
+#endif
 	sctp4_dgram.pr_input         = sctp_input;
 	sctp4_dgram.pr_output        = 0;
 	sctp4_dgram.pr_ctlinput      = sctp_ctlinput;
 	sctp4_dgram.pr_ctloutput     = sctp_ctloutput;
-	sctp4_dgram.pr_ousrreq 	     = 0;
-	sctp4_dgram.pr_init 	     = sctp_init;
+	sctp4_dgram.pr_ousrreq       = 0;
+	sctp4_dgram.pr_init          = sctp_init;
 	sctp4_dgram.pr_fasttimo      = 0;
 	sctp4_dgram.pr_slowtimo      = 0;
 	sctp4_dgram.pr_drain         = sctp_drain;
 	sctp4_dgram.pr_sysctl        = 0;
-	sctp4_dgram.pr_usrreqs 	     = &sctp_usrreqs;
-
+	sctp4_dgram.pr_usrreqs       = &sctp_usrreqs;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp4_dgram.pr_lock          = sctp_lock;
+	sctp4_dgram.pr_unlock        = sctp_unlock;
+	sctp4_dgram.pr_getlock       = sctp_getlock;
+#endif
+
 	sctp4_seqpacket.pr_type	     = SOCK_SEQPACKET;
 	sctp4_seqpacket.pr_domain    = &inetdomain;
 	sctp4_seqpacket.pr_protocol  = IPPROTO_SCTP;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp4_seqpacket.pr_flags     = PR_WANTRCVD|PR_PCBLOCK|PR_PROTOLOCK;
+#else
 	sctp4_seqpacket.pr_flags     = PR_ADDR_OPT|PR_WANTRCVD;
+#endif
 	sctp4_seqpacket.pr_input     = sctp_input;
 	sctp4_seqpacket.pr_output    = 0;
 	sctp4_seqpacket.pr_ctlinput  = sctp_ctlinput;
@@ -156,11 +181,20 @@
 	sctp4_seqpacket.pr_drain     = sctp_drain;
 	sctp4_seqpacket.pr_sysctl    = 0;
 	sctp4_seqpacket.pr_usrreqs   = &sctp_usrreqs;
-
-	sctp4_stream.pr_type	     = SOCK_STREAM;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp4_seqpacket.pr_lock      = sctp_lock;
+	sctp4_seqpacket.pr_unlock    = sctp_unlock;
+	sctp4_seqpacket.pr_getlock   = sctp_getlock;
+#endif
+
+	sctp4_stream.pr_type         = SOCK_STREAM;
 	sctp4_stream.pr_domain       = &inetdomain;
 	sctp4_stream.pr_protocol     = IPPROTO_SCTP;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp4_stream.pr_flags        = PR_CONNREQUIRED|PR_WANTRCVD|PR_PCBLOCK|PR_PROTOLOCK;
+#else
 	sctp4_stream.pr_flags        = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD;
+#endif
 	sctp4_stream.pr_input        = sctp_input;
 	sctp4_stream.pr_output       = 0;
 	sctp4_stream.pr_ctlinput     = sctp_ctlinput;
@@ -172,27 +206,45 @@
 	sctp4_stream.pr_drain        = sctp_drain;
 	sctp4_stream.pr_sysctl       = 0;
 	sctp4_stream.pr_usrreqs      = &sctp_usrreqs;
-
-	sctp6_dgram.pr_type	     = SOCK_DGRAM;
-	sctp6_dgram.pr_domain 	     = &inet6domain;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp4_stream.pr_lock         = sctp_lock;
+	sctp4_stream.pr_unlock       = sctp_unlock;
+	sctp4_stream.pr_getlock      = sctp_getlock;
+#endif
+
+	sctp6_dgram.pr_type          = SOCK_DGRAM;
+	sctp6_dgram.pr_domain        = &inet6domain;
 	sctp6_dgram.pr_protocol      = IPPROTO_SCTP;
-	sctp6_dgram.pr_flags 	     = PR_ADDR_OPT|PR_WANTRCVD;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp6_dgram.pr_flags         = PR_WANTRCVD|PR_PCBLOCK|PR_PROTOLOCK;
+#else
+	sctp6_dgram.pr_flags         = PR_ADDR_OPT|PR_WANTRCVD;
+#endif
 	sctp6_dgram.pr_input         = (void (*) (struct mbuf *, int)) sctp6_input;
 	sctp6_dgram.pr_output        = 0;
 	sctp6_dgram.pr_ctlinput      = sctp6_ctlinput;
 	sctp6_dgram.pr_ctloutput     = sctp_ctloutput;
-	sctp6_dgram.pr_ousrreq 	     = 0;
-	sctp6_dgram.pr_init 	     = 0;
+	sctp6_dgram.pr_ousrreq       = 0;
+	sctp6_dgram.pr_init          = 0;
 	sctp6_dgram.pr_fasttimo      = 0;
 	sctp6_dgram.pr_slowtimo      = 0;
 	sctp6_dgram.pr_drain         = sctp_drain;
 	sctp6_dgram.pr_sysctl        = 0;
-	sctp6_dgram.pr_usrreqs 	     = &sctp6_usrreqs;
-
-	sctp6_seqpacket.pr_type	     = SOCK_SEQPACKET;
+	sctp6_dgram.pr_usrreqs       = &sctp6_usrreqs;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp6_dgram.pr_lock          = sctp_lock;
+	sctp6_dgram.pr_unlock        = sctp_unlock;
+	sctp6_dgram.pr_getlock       = sctp_getlock;
+#endif
+
+	sctp6_seqpacket.pr_type      = SOCK_SEQPACKET;
 	sctp6_seqpacket.pr_domain    = &inet6domain;
 	sctp6_seqpacket.pr_protocol  = IPPROTO_SCTP;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp6_seqpacket.pr_flags     = PR_WANTRCVD|PR_PCBLOCK|PR_PROTOLOCK;
+#else
 	sctp6_seqpacket.pr_flags     = PR_ADDR_OPT|PR_WANTRCVD;
+#endif
 	sctp6_seqpacket.pr_input     = (void (*) (struct mbuf *, int)) sctp6_input;
 	sctp6_seqpacket.pr_output    = 0;
 	sctp6_seqpacket.pr_ctlinput  = sctp6_ctlinput;
@@ -204,11 +256,20 @@
 	sctp6_seqpacket.pr_drain     = sctp_drain;
 	sctp6_seqpacket.pr_sysctl    = 0;
 	sctp6_seqpacket.pr_usrreqs   = &sctp6_usrreqs;
-
-	sctp6_stream.pr_type	     = SOCK_STREAM;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp6_seqpacket.pr_lock      = sctp_lock;
+	sctp6_seqpacket.pr_unlock    = sctp_unlock;
+	sctp6_seqpacket.pr_getlock   = sctp_getlock;
+#endif
+
+	sctp6_stream.pr_type         = SOCK_STREAM;
 	sctp6_stream.pr_domain       = &inet6domain;
 	sctp6_stream.pr_protocol     = IPPROTO_SCTP;
-	sctp6_stream.pr_flags        = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD|PR_LISTEN;
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp6_stream.pr_flags        = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_PCBLOCK|PR_PROTOLOCK;
+#else
+	sctp6_seqpacket.pr_flags     = PR_ADDR_OPT|PR_WANTRCVD;
+#endif
 	sctp6_stream.pr_input        = (void (*) (struct mbuf *, int)) sctp6_input;
 	sctp6_stream.pr_output       = 0;
 	sctp6_stream.pr_ctlinput     = sctp6_ctlinput;
@@ -220,10 +281,20 @@
 	sctp6_stream.pr_drain        = sctp_drain;
 	sctp6_stream.pr_sysctl       = 0;
 	sctp6_stream.pr_usrreqs      = &sctp6_usrreqs;
-
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	sctp6_stream.pr_lock         = sctp_lock;
+	sctp6_stream.pr_unlock       = sctp_unlock;
+	sctp6_stream.pr_getlock      = sctp_getlock;
+#endif
+
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	lck_mtx_lock(inetdomain.dom_mtx);
+	lck_mtx_lock(inet6domain.dom_mtx);
+#else
 	funnel_state = thread_funnel_set(network_flock, TRUE);
 	s            = splnet();
-
+#endif
+
 	err  = net_add_proto(&sctp4_dgram,     &inetdomain);
 	err |= net_add_proto(&sctp4_seqpacket, &inetdomain);
 	err |= net_add_proto(&sctp4_stream,    &inetdomain);
@@ -232,14 +303,24 @@
 	err |= net_add_proto(&sctp6_stream,    &inet6domain);

 	if (err) {
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+		lck_mtx_unlock(inet6domain.dom_mtx);
+		lck_mtx_unlock(inetdomain.dom_mtx);
+#else
 		splx(s);
 		thread_funnel_set(network_flock, funnel_state);
+#endif
 		printf("SCTP NKE: Not all protocol handlers could be installed.\n");
 		return KERN_FAILURE;
 	}
-
+
 	ip_protox[IPPROTO_SCTP]  = &sctp4_dgram;
 	ip6_protox[IPPROTO_SCTP] = &sctp6_dgram;
+
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	lck_mtx_unlock(inet6domain.dom_mtx);
+	lck_mtx_unlock(inetdomain.dom_mtx);
+#endif

 	sysctl_register_oid(&sysctl__net_inet_sctp);
 	sysctl_register_oid(&sysctl__net_inet_sctp_sendspace);
@@ -279,9 +360,12 @@
 #ifdef SCTP_DEBUG
 	sysctl_register_oid(&sysctl__net_inet_sctp_debug);
 #endif
+
+#ifndef SCTP_APPLE_FINE_GRAINED_LOCKING
 	splx(s);
 	thread_funnel_set(network_flock, funnel_state);
-
+#endif
+
 	printf("SCTP NKE: NKE loaded.\n");
 	return KERN_SUCCESS;
 }
@@ -289,19 +373,30 @@

 kern_return_t SCTP_stop (kmod_info_t * ki, void * d) {

+#ifndef SCTP_APPLE_FINE_GRAINED_LOCKING
 	int s;
 	int funnel_state;
+#endif
 	int err;

+#ifndef SCTP_APPLE_FINE_GRAINED_LOCKING
 	funnel_state = thread_funnel_set(network_flock, TRUE);
 	s = splnet();
-
+#endif
+
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	lck_rw_lock_exclusive(sctppcbinfo.ipi_ep_mtx);
+#endif
 	if (!LIST_EMPTY(&sctppcbinfo.listhead)) {
-		splx(s);
-		thread_funnel_set(network_flock, funnel_state);
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+		lck_rw_done(sctppcbinfo.ipi_ep_mtx);
+#endif
 		printf("SCTP NKE: There are still SCTP enpoints. NKE not unloaded\n");
 		return KERN_FAILURE;
 	}
+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	lck_rw_done(sctppcbinfo.ipi_ep_mtx);
+#endif

 	sysctl_unregister_oid(&sysctl__net_inet_sctp_sendspace);
 	sysctl_unregister_oid(&sysctl__net_inet_sctp_recvspace);
@@ -342,6 +437,10 @@
 #endif
 	sysctl_unregister_oid(&sysctl__net_inet_sctp);

+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	lck_mtx_lock(inetdomain.dom_mtx);
+	lck_mtx_lock(inet6domain.dom_mtx);
+#endif
 	ip_protox[IPPROTO_SCTP]  = old_pr4;
 	ip6_protox[IPPROTO_SCTP] = old_pr6;

@@ -352,8 +451,13 @@
 	err |= net_del_proto(sctp6_seqpacket.pr_type, sctp6_seqpacket.pr_protocol, &inet6domain);
 	err |= net_del_proto(sctp6_stream.pr_type,    sctp6_stream.pr_protocol,    &inet6domain);

+#ifdef SCTP_APPLE_FINE_GRAINED_LOCKING
+	lck_mtx_unlock(inet6domain.dom_mtx);
+	lck_mtx_unlock(inetdomain.dom_mtx);
+#else
 	splx(s);
 	thread_funnel_set(network_flock, funnel_state);
+#endif

 	if (err) {
 		printf("SCTP NKE: Not all protocol handlers could be removed.\n");


r300g: Remove unused variable.

r300g: Remove unused variable.

--- src/gallium/drivers/r300/r300_state.c
+++ src/gallium/drivers/r300/r300_state.c
@@ -1183,7 +1183,6 @@
                                                unsigned count,
                                                const struct pipe_vertex_element* attribs)
 {
-    struct r300_context *r300 = r300_context(pipe);
     struct r300_screen* r300screen = r300_screen(pipe->screen);
     struct r300_vertex_element_state *velems;
     unsigned i, size;


r300g: fix updating the tiling flags for the framebuffer state

--- src/gallium/drivers/r300/r300_state.c
+++ src/gallium/drivers/r300/r300_state.c
@@ -614,13 +614,12 @@
         r300->scissor_state.dirty = TRUE;
     }

+    r300_fb_update_tiling_flags(r300, r300->fb_state.state, state);
+
     memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));

     r300->fb_state.size = (10 * state->nr_cbufs) + (2 * (4 - state->nr_cbufs)) +
                           (state->zsbuf ? 10 : 0) + 8;
-
-    r300_fb_update_tiling_flags(r300, r300->fb_state.state, state);
-

     /* Polygon offset depends on the zbuffer bit depth. */
     if (state->zsbuf && r300->polygon_offset_enabled) {


r300g: split the vertex buffer alignment validation

--- src/gallium/drivers/r300/r300_state.c
+++ src/gallium/drivers/r300/r300_state.c
@@ -1118,6 +1118,20 @@
         return;
     }

+    /* Check if the stride is aligned to the size of DWORD. */
+    for (i = 0; i < count; i++) {
+        if (buffers[i].buffer) {
+            if (buffers[i].stride % 4 != 0) {
+                // XXX Shouldn't we align the buffer?
+                fprintf(stderr, "r300_set_vertex_buffers: "
+                        "Unaligned buffer stride %i isn't supported.\n",
+                        buffers[i].stride);
+                assert(0);
+                abort();
+            }
+        }
+    }
+
     for (i = 0; i < count; i++) {
         /* Why, yes, I AM casting away constness. How did you know? */
         vbo = (struct pipe_vertex_buffer*)&buffers[i];
@@ -1159,22 +1173,6 @@
         draw_flush(r300->draw);
         draw_set_vertex_buffers(r300->draw, count, buffers);
     }
-}
-
-static boolean r300_validate_aos(struct r300_context *r300)
-{
-    struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
-    struct pipe_vertex_element *velem = r300->velems->velem;
-    int i;
-
-    /* Check if formats and strides are aligned to the size of DWORD. */
-    for (i = 0; i < r300->velems->count; i++) {
-        if (vbuf[velem[i].vertex_buffer_index].stride % 4 != 0 ||
-            util_format_get_blocksize(velem[i].src_format) % 4 != 0) {
-            return FALSE;
-        }
-    }
-    return TRUE;
 }

 static void r300_draw_emit_attrib(struct r300_context* r300,
@@ -1346,6 +1344,7 @@
     struct r300_context *r300 = r300_context(pipe);
     struct r300_screen* r300screen = r300_screen(pipe->screen);
     struct r300_vertex_element_state *velems;
+    unsigned i, size;

     assert(count <= PIPE_MAX_ATTRIBS);
     velems = CALLOC_STRUCT(r300_vertex_element_state);
@@ -1354,6 +1353,20 @@
         memcpy(velems->velem, attribs, sizeof(struct pipe_vertex_element) * count);

         if (r300screen->caps->has_tcl) {
+            /* Check if the format is aligned to the size of DWORD. */
+            for (i = 0; i < count; i++) {
+                size = util_format_get_blocksize(attribs[i].src_format);
+
+                if (size % 4 != 0) {
+                    /* XXX Shouldn't we align the format? */
+                    fprintf(stderr, "r300_create_vertex_elements_state: "
+                            "Unaligned format %s:%i isn't supported\n",
+                            util_format_name(attribs[i].src_format), size);
+                    assert(0);
+                    abort();
+                }
+            }
+
             r300_vertex_psc(velems);
         } else {
             memset(&r300->vertex_info, 0, sizeof(struct vertex_info));
@@ -1380,12 +1393,6 @@
     if (r300->draw) {
         draw_flush(r300->draw);
         draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
-    }
-
-    if (!r300_validate_aos(r300)) {
-        /* XXX We should fallback using draw. */
-        assert(0);
-        abort();
     }

     UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);


r600g: handle R16G16B16_FLOAT and R32G32B32_FLOAT in translate_colorswap

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=50318

Signed-off-by: Kai Wasserbäch <31ea678c44dc4e8e22ccfd165592dd71a30e46ae@dev.carbon-project.org>

--- src/gallium/drivers/r600/r600_state.c
+++ src/gallium/drivers/r600/r600_state.c
@@ -281,6 +281,8 @@
 	case PIPE_FORMAT_R16G16_FLOAT:
 	case PIPE_FORMAT_R16G16_UINT:
 	case PIPE_FORMAT_R16G16_SINT:
+	case PIPE_FORMAT_R16G16B16_FLOAT:
+	case PIPE_FORMAT_R32G32B32_FLOAT:
 	case PIPE_FORMAT_R32_UINT:
 	case PIPE_FORMAT_R32_SINT:
 	case PIPE_FORMAT_R32_FLOAT:


vc4: Initialize the various qreg arrays when allocating them.

This is particularly important for outputs, where we try to MOV the whole
vec4 to the VPM, even if only 1-3 components had been set up.  It might
also be important for temporaries, if the shader reads components before
writing them.

--- src/gallium/drivers/vc4/vc4_program.c
+++ src/gallium/drivers/vc4/vc4_program.c
@@ -73,12 +73,16 @@
         if (*size >= decl_size)
                 return;

+        uint32_t old_size = *size;
         *size = MAX2(*size * 2, decl_size);
         *regs = reralloc(c, *regs, struct qreg, *size);
         if (!*regs) {
                 fprintf(stderr, "Malloc failure\n");
                 abort();
         }
+
+        for (uint32_t i = old_size; i < *size; i++)
+                (*regs)[i] = c->undef;
 }

 static struct qreg


gallium: remove explicit __STDC_.*_MACROS defines

Analogous to previous commits.

Signed-off-by: Emil Velikov <f20878473f414da183da19ee25c8722cc1d711e4@collabora.com>
Reviewed-by: Eric Engestrom <de0b63cf2dfb1fae8ed3c3b4244856a05677d4f0@imgtec.com>
Reviewed-by: Jose Fonseca <61b5a29db2c0650f7c8510f93eece059c1b09320@vmware.com>

--- src/gallium/include/pipe/p_compiler.h
+++ src/gallium/include/pipe/p_compiler.h
@@ -60,9 +60,6 @@
  * Alternative stdint.h and stdbool.h headers are supplied in include/c99 for
  * systems that lack it.
  */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
 #include <stdint.h>
 #include <stdbool.h>


st/dri: replace calls to dup(2) with fcntl(F_DUPFD_CLOEXEC)

Without this fix, duplicated file descriptors leak into child processes.
See commit aaac913e901229d11a1894f6aaf646de6b1a542c for one instance
where the same fix was employed.

Cc: <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Signed-off-by: Matt Whitlock <974f068c1a0f77888ff3f4e29cc3ce5ddb2d9058@mattwhitlock.name>
Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>

--- src/gallium/state_trackers/dri/dri2.c
+++ src/gallium/state_trackers/dri/dri2.c
@@ -30,6 +30,7 @@

 #include <xf86drm.h>
 #include <dlfcn.h>
+#include <fcntl.h>
 #include "GL/mesa_glinterop.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
@@ -1877,7 +1878,7 @@

    sPriv->driverPrivate = (void *)screen;

-   if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
+   if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;

    if (pipe_loader_drm_probe_fd(&screen->dev, fd))
@@ -1960,7 +1961,7 @@

    sPriv->driverPrivate = (void *)screen;

-   if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
+   if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;

    if (pipe_loader_sw_probe_kms(&screen->dev, fd))


r600g: set back to correct codepaths.

r600g: set back to correct codepaths.

Jerome please use git diff and git show before pushing.

--- src/gallium/targets/dri-r600/target.c
+++ src/gallium/targets/dri-r600/target.c
@@ -4,7 +4,7 @@
 #include "r600/drm/r600_drm_public.h"
 #include "r600/r600_public.h"

-#if 0
+#if 1
 static struct pipe_screen *
 create_screen(int fd)
 {


Fix byte encoding macros.

Fix byte encoding macros.

--- src/google/protobuf/io/coded_stream.h
+++ src/google/protobuf/io/coded_stream.h
@@ -782,8 +782,7 @@
 }

 inline bool CodedInputStream::ReadLittleEndian32(uint32* value) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   if (GOOGLE_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) {
     memcpy(value, buffer_, sizeof(*value));
     Advance(sizeof(*value));
@@ -797,8 +796,7 @@
 }

 inline bool CodedInputStream::ReadLittleEndian64(uint64* value) {
-#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) && \
-    defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(PROTOBUF_LITTLE_ENDIAN)
   if (GOOGLE_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) {
     memcpy(value, buffer_, sizeof(*value));
     Advance(sizeof(*value));


Added missing friend declarations for inv(const PrecsionMatrix &).

--- src/invlib/algebra/precision_matrix.h
+++ src/invlib/algebra/precision_matrix.h
@@ -125,11 +125,12 @@
         return tmp;
     }

-    friend const Matrix& inv<Matrix>(PrecisionMatrix &A);
+    friend const Matrix & inv<Matrix>(PrecisionMatrix &A);
+    friend const Matrix & inv<Matrix>(const PrecisionMatrix &A);

 private:

-    const Matrix& A;
+    const Matrix &A;

 };

@@ -146,7 +147,7 @@
 <
 typename Matrix
 >
-const Matrix& inv(PrecisionMatrix<Matrix> &A)
+const Matrix & inv(PrecisionMatrix<Matrix> &A)
 {
     return A.A;
 }
@@ -155,7 +156,7 @@
 <
 typename Matrix
 >
-const Matrix& inv(const PrecisionMatrix<Matrix> &A)
+const Matrix & inv(const PrecisionMatrix<Matrix> &A)
 {
     return A.A;
 }


Missing properties

Missing properties

--- src/ios/APPLocalNotificationOptions.h
+++ src/ios/APPLocalNotificationOptions.h
@@ -33,6 +33,9 @@
 @property (readonly, getter=repeatInterval) NSCalendarUnit repeatInterval;
 @property (readonly, getter=userInfo) NSDictionary* userInfo;

+@property (readonly, getter=alertTitle) NSString* alertTitle;
+@property (readonly, getter=category) NSString* category;
+
 // If it's a repeating notification
 - (BOOL) isRepeating;


Create ungets.c

Create ungets.c

error: pathspec 'March-31st-2016/K-and-R/ungets.c' did not match any file(s) known to git

--- March-31st-2016/K-and-R/ungets.c
+++ March-31st-2016/K-and-R/ungets.c
@@ -0,0 +1,34 @@
+#include <string.h>
+#include <stdio.h>
+
+/* K&R C (Dennis M. Ritchie & Brian W. Kernighan)
+ Exercise 4-7. Write a routine ungets(s) that will push back an entire string onto the input.
+*/
+
+#define BUFFER_SIZE	256
+
+const char* ungets(const char* s, FILE* stream) {
+	if (!s) return NULL;
+	for (size_t i = strlen(s); i > 0; --i) {
+		ungetc(s[i - 1], stream);
+	}
+	return s;
+}
+
+int main(void) {
+
+	char buffer[BUFFER_SIZE] = { 0 };
+
+	char c = 0;
+	char d = 0;
+
+	while (1)
+	{
+		fgets(buffer, BUFFER_SIZE, stdin);
+		printf("%s\n", buffer);
+		ungets(buffer, stdin);
+	}
+
+    getchar();
+    return 0;
+}


A few more edits before I head out.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@7460 3a8e244f-b0f2-452b-bcba-4c88e055c3ca

--- test/studies/hpcc/FFT/bradc/dfft.c
+++ test/studies/hpcc/FFT/bradc/dfft.c
@@ -214,7 +214,7 @@
       wk3r = wk1r - 2 * wk2r * wk1i;
       wk3i = 2 * wk2r * wk1r - wk1i;

-      printf("  btrfly(j + 8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
+      printf("  btrfly(j+8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
       btrfly (j + 8, wk1r, wk1i, - wk2i, wk2r, wk3r, wk3i, a, b, c, d);
 } }

@@ -238,7 +238,7 @@
 #pragma mta use 100 streams
 #pragma mta assert no dependence
   for (j = m; j < l + m; j += 2) {
-    printf("    btrfly(j=%d, wk1r = %g, wk1r = %g, 0.0, 1.0, -wk1r, wk1r, a, b, c, d)\n", j, wk1r, wk1r, -wk1r, wk1r);
+    printf("    btrfly(j=%d, wk1r=%g, wk1r=%g, 0.0, 1.0, -wk1r=%g, wk1r=%g, a, b, c, d)\n", j, wk1r, wk1r, -wk1r, wk1r);
     btrfly(j, wk1r, wk1r, 0.0, 1.0, - wk1r, wk1r, a, b, c, d);
   }
 }
@@ -254,7 +254,7 @@
   double *c = a + l + l;
   double *d = a + l + l + l;

-  printf("cftmd0(n=%d, l=%d, a, w)\n", n, l);
+  printf("  cftmd0(n=%d, l=%d, a, w)\n", n, l);
   cftmd0(n, l, a, w);

 #pragma mta use 100 streams
@@ -269,7 +269,7 @@
       double wk3i = 2 * wk2i * wk1r - wk1i;

       for (j = k; j < l + k; j += 2) {
-        printf("btrfly(j=%d, wk1r=%g, wk1i=%g, wk2r=%g, wk2i=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i);
+        printf("  btrfly(j=%d, wk1r=%g, wk1i=%g, wk2r=%g, wk2i=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i);
         btrfly (j, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, a, b, c, d);
       }

@@ -279,7 +279,7 @@
       wk3i = 2 * wk2r * wk1r - wk1i;

       for (j = k + m; j < l + k + m; j += 2) {
-        printf("btrfly(j + 8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
+        printf("  btrfly(j+8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
         btrfly (j, wk1r, wk1i, - wk2i, wk2r, wk3r, wk3i, a, b, c, d);
       }
 } }
@@ -318,7 +318,7 @@
 #pragma mta use 100 streams
 #pragma mta assert no dependence
       for (j = k + m; j < k + m + l; j += 2) {
-        printf("  btrfly(j + 8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
+        printf("  btrfly(j+8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
         btrfly (j, wk1r, wk1i, - wk2i, wk2r, wk3r, wk3i, a, b, c, d);
       }

@@ -366,7 +366,7 @@
       double wk3r = wk1r - 2 * wk2r * wk1i;
       double wk3i = 2 * wk2r * wk1r - wk1i;

-      printf("  btrfly(j + 8=%d + 8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
+      printf("  btrfly(j+8=%d+8, wk1r=%g, wk1i=%g, -wk2i=%g, wk2r=%g, wk3r=%g, wk3i=%g, a, b, c, d);\n", j, wk1r, wk1i, -wk2i, wk2r, wk3r, wk3i);
       btrfly (j + k + m, wk1r, wk1i, - wk2i, wk2r, wk3r, wk3i, a, b, c, d);

 } } }
@@ -382,11 +382,11 @@
   i = 4; l = 8;

   for ( ; i <= logn / 2; i += 2, l *= 4) {
-    printf("cftmd1(n = %d, l = %d)\n", n, l, a, w);
+    printf("cftmd1(n=%d, l=%d, a, w)\n", n, l, a, w);
     cftmd1(n, l, a, w);
   }
   for ( ; i <= logn - 1; i += 2, l *= 4) {
-    printf("cftmd2(n = %d, l = %d)\n", n, l, a, w);
+    printf("cftmd2(n=%d, l=%d, a, w)\n", n, l, a, w);
     cftmd2(n, l, a, w);
   }

@@ -401,7 +401,7 @@
 #pragma mta assert no dependence
      for (j = 0; j < l; j += 2)
        btrfly(j, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, a, b, c, d);
-       printf("btrfly(j = %d, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, a, b, c, d);\n");
+       printf("btrfly(j=%d, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, a, b, c, d);\n");
   } else {
     printf("l << 2 != n\n");


Made initializeGL virtual for adding initialization code in subclasses.

--- NQVTKGui/Viewports/NQVTKWidget.h
+++ NQVTKGui/Viewports/NQVTKWidget.h
@@ -41,7 +41,7 @@
 	void cameraUpdated(NQVTK::Camera *cam);

 protected:
-	void initializeGL();
+	virtual void initializeGL();
 	void resizeGL(int w, int h);
 	void paintGL();


test: add const

test: add const

--- test/unit/core/test-table-cursor.c
+++ test/unit/core/test-table-cursor.c
@@ -24,7 +24,7 @@
 #include "../lib/grn-assertions.h"

 void data_table(void);
-void test_table(gpointer data);
+void test_table(gconstpointer data);
 void data_normalize(void);
 void test_normalize(gconstpointer data);

@@ -101,7 +101,7 @@
 }

 void
-test_table(gpointer data)
+test_table(gconstpointer data)
 {
   grn_obj *table;
   grn_obj_flags flags = gcut_data_get_int(data, "flags");


Improved doxygen.

Improved doxygen.

--- OpenSim/Simulation/Model/Frame.h
+++ OpenSim/Simulation/Model/Frame.h
@@ -134,40 +134,46 @@
     const SimTK::Transform&
         getTransformInGround(const SimTK::State& state) const;

-    /** The spatial velocity V_GF {omega; v} of this Frame in ground.
-        It can be used to compute the velocity of any stationary point on F,
-        located at r_F (Vec3), in ground, G, as:
+    /** The spatial velocity V_GF {omega; v} of this Frame, measured with
+        respect to and expressed in the ground frame. It can be used to compute
+        the velocity of any stationary point on F, located at r_F (Vec3), in
+        ground, G, as:
             v_G = V_GF[1] + SimTK::cross(V_GF[0], r_F);
         Is only valid at Stage::Velocity or higher. */
     const SimTK::SpatialVec&
         getVelocityInGround(const SimTK::State& state) const;

-    /** The angular velocity of this Frame in ground.
-        @see getVelocityInGround() */
+    /** The angular velocity of this Frame, measured with respect to and
+        expressed in the ground frame (i.e., the first half of the SpatialVec
+        returned by getVelocityInGround()). */
     const SimTK::Vec3&
         getAngularVelocityInGround(const SimTK::State& state) const;

-    /** The linear velocity of this Frame in ground.
-        @see getVelocityInGround() */
+    /** The linear velocity of this Frame, measured with respect to and
+        expressed in the ground frame (i.e., the second half of the SpatialVec
+        returned by getVelocityInGround()). */
     const SimTK::Vec3&
         getLinearVelocityInGround(const SimTK::State& state) const;

-    /** The spatial acceleration A_GF {alpha; a} of this Frame in ground.
-        It can also be used to compute the acceleration of any stationary point
-        on F, located at r_F (Vec3), in ground, G, as:
+    /** The spatial acceleration A_GF {alpha; a} of this Frame, measured with
+        respect to and expressed in the ground frame. It can also be used to
+        compute the acceleration of any stationary point on F, located at r_F
+        (Vec3), in ground, G, as:
             a_G = A_GF[1] + SimTK::cross(A_GF[0], r_F) +
                   SimTK::cross(V_GF[0], SimTK::cross(V_GF[0], r_F));
         Is only valid at Stage::Acceleration or higher. */
     const SimTK::SpatialVec&
         getAccelerationInGround(const SimTK::State& state) const;

-    /** The angular acceleration of this Frame in ground.
-        @see getAccelerationInGround() */
+    /** The angular acceleration of this Frame, measured with respect to and
+        expressed in the ground frame (i.e., the first half of the SpatialVec
+        returned by getAccelerationInGround()). */
     const SimTK::Vec3&
         getAngularAccelerationInGround(const SimTK::State& state) const;

-    /** The linear acceleration of this Frame in ground.
-        @see getAccelerationInGround() */
+    /** The linear acceleration of this Frame, measured with respect to and
+        expressed in the ground frame (i.e., the second half of the SpatialVec
+        returned by getAccelerationInGround()). */
     const SimTK::Vec3&
         getLinearAccelerationInGround(const SimTK::State& state) const;


Doxygen changes only.

Doxygen changes only.

git-svn-id: 9e047e1e624cce0a2485e750063112e834f85522@7334 fc29be9c-2cb0-420d-b520-73dbd18add6e

--- OpenSim/Simulation/Model/Probe.h
+++ OpenSim/Simulation/Model/Probe.h
@@ -68,8 +68,9 @@
         "'differentiate', 'scale'");

     OpenSim_DECLARE_PROPERTY(operation_parameter, double,
-        "For 'integrate' this is the initial condition, for 'scale' "
-        "this is the scale factor.");
+        "Parameter that is required for some operations only. "
+        "For 'integrate' operation_parameter is the initial condition, "
+        "for 'scale' operation_parameter is the scale factor.");
     /**@}**/

 //=============================================================================
@@ -96,17 +97,23 @@
     void setOperationParameter(double operation_parameter);

-    /** Returns the column labels for the probe values for reporting. */
+    /** Returns the column labels for the probe values for reporting.
+        Note that in OpenSim 3.0, only scalar values are returned, so
+        developers will need to call getRecordLabels.get(0) to return
+        the probe label.*/
     Array<std::string> getRecordLabels() const;

-    /** Returns the probe values after being operated on. */
+    /** Returns the probe values post-operation.
+        Note that in OpenSim 3.0, only scalar values are returned, so
+        developers will need to call getRecordValues.get(0) to return
+        the value of the probe (after the operation has been performed)*/
     Array<double> getRecordValues(const SimTK::State& state) const;

 #ifndef SWIG
     // This is the Probe interface that must be implemented by concrete Probe
     // objects.

-    /**Computes the probe value (this is the scalar value of the probe prior to any operation being performed on it.
+    /**Computes the probe value pre-operation (i.e., prior to any operation being performed on it).
        Probe value is computed at the SimTK::Report Stage.
        This method must be overridden for each subclass Probe.


Update D0 analysis in pp@5TeV 2017

Update D0 analysis in pp@5TeV 2017

--- PWGHF/vertexingHF/AliHFSystErr.h
+++ PWGHF/vertexingHF/AliHFSystErr.h
@@ -228,6 +228,7 @@
   void InitD0toKpi2010ppLowPtAn();
   void InitD0toKpi2010ppPass4();
   void InitD0toKpi2015pp5TeV();
+  void InitD0toKpi2017pp5TeV();
   void InitD0toKpi2017pp5TeVLowPtAn();
   void InitD0toKpi2011PbPb07half();
   void InitD0toKpi2010PbPb020();


ENH: file no longer needed on oSX

ENH: file no longer needed on oSX

--- Parallel/vtkOSXParallelTclInit.c
+++ Parallel/vtkOSXParallelTclInit.c
@@ -1,8 +0,0 @@
-//-----  This hack needed to compile using gcc3 on OSX until new stdc++.dylib
-#include <stdio.h>
-void oft_initPar()
-{
-  extern void _ZNSt8ios_base4InitC4Ev();
-  _ZNSt8ios_base4InitC4Ev();
-}
-


staging: unisys: fix typecast spacing in iochannel.h

Fix all the spaces between typecasts and their targets in iochannel.h.

Signed-off-by: Benjamin Romer <aa4f04c7a9e9354d8d7625bad3543e518d310003@unisys.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/unisys/common-spar/include/channels/iochannel.h
+++ drivers/staging/unisys/common-spar/include/channels/iochannel.h
@@ -204,7 +204,7 @@
 #endif				/* MAX_MACADDR_LEN */

 #define ETH_IS_LOCALLY_ADMINISTERED(Address) \
-	(((u8 *) (Address))[0] & ((u8) 0x02))
+	(((u8 *)(Address))[0] & ((u8) 0x02))
 #define NIC_VENDOR_ID 0x0008000B

 /* various types of scsi task mgmt commands  */
@@ -368,16 +368,16 @@
 	do {								\
 		memset(buf, 0,						\
 		       MINNUM(len,					\
-			      (unsigned int) NO_DISK_INQUIRY_RESULT_LEN)); \
-		buf[2] = (u8) SCSI_SPC2_VER;				\
+			      (unsigned int)NO_DISK_INQUIRY_RESULT_LEN)); \
+		buf[2] = (u8)SCSI_SPC2_VER;				\
 		if (lun == 0) {						\
-			buf[0] = (u8) lun0notpresent;			\
-			buf[3] = (u8) DEV_HISUPPORT;			\
+			buf[0] = (u8)lun0notpresent;			\
+			buf[3] = (u8)DEV_HISUPPORT;			\
 		} else							\
-			buf[0] = (u8) notpresent;			\
-		buf[4] = (u8) (						\
+			buf[0] = (u8)notpresent;			\
+		buf[4] = (u8)(						\
 			MINNUM(len,					\
-			       (unsigned int) NO_DISK_INQUIRY_RESULT_LEN) - 5);	\
+			       (unsigned int)NO_DISK_INQUIRY_RESULT_LEN) - 5);\
 		if (len >= NO_DISK_INQUIRY_RESULT_LEN) {		\
 			buf[8] = 'D';					\
 			buf[9] = 'E';					\
@@ -762,9 +762,9 @@
 				offsetof(type, clientString);		\
 			memcpy(chan->clientString, clientStr,		\
 			       MINNUM(clientStrLen,			\
-				      (u32) (MAX_CLIENTSTRING_LEN - 1))); \
+				      (u32)(MAX_CLIENTSTRING_LEN - 1))); \
 			chan->clientString[MINNUM(clientStrLen,		\
-						  (u32) (MAX_CLIENTSTRING_LEN \
+						  (u32)(MAX_CLIENTSTRING_LEN \
 							 - 1))]		\
 				= '\0';					\
 		}							\
@@ -888,8 +888,8 @@
 		if (index >= max_pi_arr_entries)
 			return 0;
 		pi_arr[index].pi_pfn = inp_pfn;
-		pi_arr[index].pi_off = (u16) inp_off;
-		pi_arr[index].pi_len = (u16) inp_len;
+		pi_arr[index].pi_off = (u16)inp_off;
+		pi_arr[index].pi_len = (u16)inp_len;
 		    return index + 1;
 	}

@@ -907,7 +907,7 @@
 		else {
 			pi_arr[index + i].pi_off = 0;
 			pi_arr[index + i].pi_len =
-			    (u16) MINNUM(len, (u32) PI_PAGE_SIZE);
+			    (u16)MINNUM(len, (u32)PI_PAGE_SIZE);
 		}
 	}
 	return index + i;


Sync FBSDID.

Sync FBSDID.

--- KERN/netinet/sctp_asconf.c
+++ KERN/netinet/sctp_asconf.c
@@ -32,7 +32,7 @@

 #ifdef __FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.c 236391 2012-06-01 08:26:50Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.c 236515 2012-06-03 14:54:50Z tuexen $");
 #endif

 #include <netinet/sctp_os.h>


Must drag along the window_cum ack on all the nets

--- KERN/netinet/sctp_indata.c
+++ KERN/netinet/sctp_indata.c
@@ -3811,6 +3811,10 @@

 	/* First setup for CC stuff */
 	TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
+		if (SCTP_TSN_GT(cumack, net->cwr_window_tsn)) {
+			/* Drag along the window_tsn for cwr's */
+			net->cwr_window_tsn = cumack;
+		}
 		net->prev_cwnd = net->cwnd;
 		net->net_ack = 0;
 		net->net_ack2 = 0;
@@ -4499,6 +4503,10 @@
 	 * destination address basis.
 	 */
 	TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
+		if (SCTP_TSN_GT(cum_ack, net->cwr_window_tsn)) {
+			/* Drag along the window_tsn for cwr's */
+			net->cwr_window_tsn = cumack;
+		}
 		net->prev_cwnd = net->cwnd;
 		net->net_ack = 0;
 		net->net_ack2 = 0;


Sync with SnowLeopard

Sync with SnowLeopard

--- KERN/netinet/sctp_indata.c
+++ KERN/netinet/sctp_indata.c
@@ -373,7 +373,6 @@
 	int cntDel;
 	struct sctp_queued_to_read *control, *ctl, *nctl;

-I_AM_HERE;
 	if (stcb == NULL)
 		return;

@@ -404,7 +403,6 @@
 	}
 	SCTP_TCB_LOCK_ASSERT(stcb);
 	TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
-printf("Considering TSN %X.\n", chk->rec.data.TSN_seq);
 		if (chk->rec.data.TSN_seq != (asoc->tsn_last_delivered + 1)) {
 			/* Can't deliver more :< */
 			return;
@@ -2679,7 +2677,6 @@
 						      last_chunk)) {
 				num_chunks++;
 			}
-sctp_print_mapping_array(asoc);
 			if (abort_flag)
 				return (2);


Sync with upstream.

Sync with upstream.

--- KERN/netinet/sctp_os_bsd.h
+++ KERN/netinet/sctp_os_bsd.h
@@ -32,7 +32,7 @@

 #ifdef __FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_os_bsd.h 279888 2015-03-11 15:21:39Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_os_bsd.h 279889 2015-03-11 15:40:29Z tuexen $");
 #endif

 #ifndef _NETINET_SCTP_OS_BSD_H_
@@ -462,7 +462,10 @@
 /* get the socket type */
 #define SCTP_SO_TYPE(so)	((so)->so_type)
 #if (__FreeBSD_version >= 1100046)
-/* Use a macro for renaming sb_cc to sb_ccc */
+/* Use a macro for renaming sb_cc to sb_acc.
+ * Initially sb_ccc was used, but this broke select() when used
+ * with SCTP sockets.
+ */
 #define sb_cc sb_acc
 #endif
 /* reserve sb space for a socket */


Use CSUM_SCTP_IPV6.

Use CSUM_SCTP_IPV6.

--- KERN/netinet/sctp_output.c
+++ KERN/netinet/sctp_output.c
@@ -4648,7 +4648,7 @@
 			SCTP_STAT_INCR(sctps_sendnocrc);
 #else
 #if defined(__FreeBSD__) && __FreeBSD_version >= 800000
-			m->m_pkthdr.csum_flags = CSUM_SCTP;
+			m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
 			m->m_pkthdr.csum_data = 0;
 			SCTP_STAT_INCR(sctps_sendhwcrc);
 #else
@@ -11356,7 +11356,7 @@
 			SCTP_STAT_INCR(sctps_sendnocrc);
 #else
 #if defined(__FreeBSD__) && __FreeBSD_version >= 800000
-			mout->m_pkthdr.csum_flags = CSUM_SCTP;
+			mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
 			mout->m_pkthdr.csum_data = 0;
 			SCTP_STAT_INCR(sctps_sendhwcrc);
 #else
@@ -12532,7 +12532,7 @@
 			SCTP_STAT_INCR(sctps_sendnocrc);
 #else
 #if defined(__FreeBSD__) && __FreeBSD_version >= 800000
-			mout->m_pkthdr.csum_flags = CSUM_SCTP;
+			mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
 			mout->m_pkthdr.csum_data = 0;
 			SCTP_STAT_INCR(sctps_sendhwcrc);
 #else
@@ -12860,7 +12860,7 @@
 			SCTP_STAT_INCR(sctps_sendnocrc);
 #else
 #if defined(__FreeBSD__) && __FreeBSD_version >= 800000
-			mout->m_pkthdr.csum_flags = CSUM_SCTP;
+			mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
 			mout->m_pkthdr.csum_data = 0;
 			SCTP_STAT_INCR(sctps_sendhwcrc);
 #else


fix panic when freeing chain in add_cookie() when we exhaust system mbufs

--- KERN/netinet/sctp_output.c
+++ KERN/netinet/sctp_output.c
@@ -2156,10 +2156,8 @@
 	}
 	sig = sctp_get_mbuf_for_msg(SCTP_SECRET_SIZE, 0, M_DONTWAIT, 1, MT_DATA);
 	if (sig == NULL) {
-		/* no space */
+		/* no space, so free the entire chain */
 		sctp_m_freem(mret);
-		sctp_m_freem(copy_init);
-		sctp_m_freem(copy_initack);
 		return (NULL);
 	}
 	sig->m_len = 0;


Ok memset the outbound hb for now.

Ok memset the outbound hb for now.

--- KERN/netinet/sctp_output.c
+++ KERN/netinet/sctp_output.c
@@ -9687,7 +9687,7 @@
 	atomic_add_int(&chk->whoTo->ref_count, 1);
 	/* Now we have a mbuf that we can fill in with the details */
 	hb = mtod(chk->data, struct sctp_heartbeat_chunk *);
-
+	memset(hb, 0, sizeof(struct sctp_heartbeat_chunk));
 	/* fill out chunk header */
 	hb->ch.chunk_type = SCTP_HEARTBEAT_REQUEST;
 	hb->ch.chunk_flags = 0;


remove hipass.c

remove hipass.c

--- src/hipass.c
+++ src/hipass.c
@@ -1,12 +0,0 @@
-int main (int argc, char **argv) {
-	float RC = 1.0/(CUTOFF*2*3.14);
-	float dt = 1.0/SAMPLE_RATE;
-	float alpha = RC/(RC + dt);
-	float filteredArray[numSamples];
-	filteredArray[0] = data.recordedSamples[0];
-    for (i = 1; i<numSamples; i++){
-        filteredArray[i] = alpha * (filteredArray[i-1] + data.recordedSamples[i] - data.recordedSamples[i-1]);
-    }
-    data.recordedSamples = filteredArray;
-
-


Fix a typo in ideviceprovision error message

--- tools/ideviceprovision.c
+++ tools/ideviceprovision.c
@@ -56,7 +56,7 @@
 	printf("           \tstores them into the existing directory specified by PATH.\n");
 	printf("           \tThe files will be stored as UUID.mobileprovision\n");
 	printf("  copy UUID PATH  Retrieves the provisioning profile identified by UUID\n");
-	printf("           \tfrom the device and stores it into the exisiting directory\n");
+	printf("           \tfrom the device and stores it into the existing directory\n");
 	printf("           \tspecified by PATH. The file will be stored as UUID.mobileprovision.\n");
 	printf("  remove UUID\tRemoves the provisioning profile identified by UUID.\n");
 	printf("  remove-all\tRemoves all installed provisioning profiles.\n");


Send control chunks also when no net is specified.

--- KERN/netinet/sctp_output.c
+++ KERN/netinet/sctp_output.c
@@ -8199,7 +8199,7 @@
 			if (chk->rec.chunk_id.id != SCTP_ASCONF) {
 				continue;
 			}
-			if (chk->whoTo != net) {
+			if ((chk->whoTo != NULL) && (chk->whoTo != net)) {
 				/*
 				 * No, not sent to the network we are
 				 * looking at
@@ -8289,6 +8289,10 @@
 				 */
 				no_data_chunks = 1;
 				chk->sent = SCTP_DATAGRAM_SENT;
+				if (chk->whoTo == NULL) {
+					chk->whoTo = net;
+					atomic_add_int(&net->ref_count, 1);
+				}
 				chk->snd_count++;
 				if (mtu == 0) {
 					/*
@@ -8389,7 +8393,7 @@
 					goto skip_net_check;
 				}
 			}
-			if (chk->whoTo != net) {
+			if ((chk->whoTo != NULL) && (chk->whoTo != net)) {
 				/*
 				 * No, not sent to the network we are
 				 * looking at
@@ -8519,6 +8523,10 @@
 						SCTP_STAT_INCR(sctps_sendecne);
 					}
 					chk->sent = SCTP_DATAGRAM_SENT;
+					if (chk->whoTo == NULL) {
+						chk->whoTo = net;
+						atomic_add_int(&net->ref_count, 1);
+					}
 					chk->snd_count++;
 				}
 				if (mtu == 0) {


use new dns and dbl apis

use new dns and dbl apis

--- src/hndlrs.c
+++ src/hndlrs.c
@@ -934,26 +934,24 @@
 	int *pbContinueChecks;
 }cpr_t;

-int dblCheckCallbackHlo(const char *pDbl, const char *pDomain, unsigned ip, void *pData)
-{	cpr_t *pcpr = (cpr_t *)pData;
+int dblCheckCallbackHlo(const dblcb_t *pDblcb)
+{	cpr_t *pcpr = (cpr_t *)pDblcb->pDblq->pCallbackData;
 	SMFICTX *ctx = pcpr->ctx;
 	mlfiPriv *priv = MLFIPRIV;

-	if((ip&0xffffff00) == 0x7f000100)
-	{
-		mlfi_debug(priv->pSessionUuidStr,"HLO dbl_check '%s' - listed - %u.%u.%u.%u via '%s'\n" ,priv->helo
-			,((ip&0xff000000)>>24) ,((ip&0x00ff0000)>>16) ,((ip&0x0000ff00)>>8) ,((ip&0x000000ff))
-			,pDbl
-			);
-
-		mlfi_setreply(ctx,550,"5.7.1","Rejecting due to security policy - Blacklisted host, Please see: %s#blacklistedhostdbl",gPolicyUrl);
-		asprintf(pcpr->ppReason,"Blacklisted host DBL '%s' via '%s'",priv->helo,pDbl);
-		mlfi_status_debug(priv,pcpr->prs,LOG_REJECTED_STR,*pcpr->ppReason,"mlfi_hndlrs: Blacklisted host DBL\n");
-		free(*pcpr->ppReason);
-		*pcpr->pbContinueChecks = 0;
-	}
-
-	return *pcpr->pbContinueChecks; // again
+	mlfi_debug(priv->pSessionUuidStr,"HLO dbl_check '%s' - listed - %s via '%s'\n"
+		,pDblcb->pDblq->pDomain
+		,pDblcb->pDblResult
+		,pDblcb->pDbl
+		);
+
+	mlfi_setreply(ctx, 550, "5.7.1", "Rejecting due to security policy - Blacklisted host, Please see: %s#blacklistedhostdbl", gPolicyUrl);
+	asprintf(pcpr->ppReason, "Blacklisted host DBL '%s' via '%s'", pDblcb->pDblResult, pDblcb->pDbl);
+	mlfi_status_debug(priv, pcpr->prs, LOG_REJECTED_STR, *pcpr->ppReason, "mlfi_hndlrs: Blacklisted host DBL\n");
+	free(*pcpr->ppReason);
+	*pcpr->pbContinueChecks = 0;
+
+	return 0; // not again
 }

 #ifdef SUPPORT_GEOIP
@@ -1162,8 +1160,8 @@
 		// The HLO MTA hostname should resolve to an ip address
 		if(continue_checks
 			&& gMtaHostChk
-			&& !dns_query_rr_a(priv->presstate,"%s",priv->helo)
-			&& !dns_query_rr_aaaa(priv->presstate,"%s",priv->helo)
+			&& !dns_query_rr(priv->presstate, ns_t_a, "%s", priv->helo)
+			&& !dns_query_rr(priv->presstate, ns_t_aaaa, "%s", priv->helo)
 			)
 		{
 			mlfi_setreply(ctx,550,"5.7.1","Rejecting due to security policy - Invalid hostname '%s', Please see: %s#invalidhostname",priv->helo,gPolicyUrl);
@@ -1217,13 +1215,19 @@
 			&& gMtaHostChk
 		)
 		{	cpr_t cpr;
+			dblq_t dblq;

 			cpr.ctx = ctx;
 			cpr.prs = &rs;
 			cpr.ppReason = &reason;
 			cpr.pbContinueChecks = &continue_checks;

-			dbl_check_all(priv->presstate,priv->helo,&dblCheckCallbackHlo,&cpr);
+			dblq.pDomain = priv->helo;
+			dblq.pCallbackFn = &dblCheckCallbackHlo;
+			dblq.pCallbackData = &cpr;
+			dblq.pCallbackPolicyFn = &dbl_callback_policy_std;
+
+			dbl_check_all(priv->presstate, &dblq);
 			continue_checks = (rs == SMFIS_CONTINUE);
 			if(continue_checks)
 				mlfi_debug(priv->pSessionUuidStr,"HLO dbl_check '%s' - not listed\n",priv->helo);
@@ -1454,26 +1458,24 @@
 	return(rc);
 }

-int dblCheckCallbackBody(const char *pDbl, const char *pDomain, unsigned ip, void *pData)
-{	cpr_t *pcpr = (cpr_t *)pData;
+int dblCheckCallbackBody(const dblcb_t *pDblcb)
+{	cpr_t *pcpr = (cpr_t *)pDblcb->pDblq->pCallbackData;
 	SMFICTX *ctx = pcpr->ctx;
 	mlfiPriv *priv = MLFIPRIV;

-	if((ip&0xffffff00) == 0x7f000100)
-	{
-		mlfi_debug(priv->pSessionUuidStr,"dbl_check '%s' - listed - %u.%u.%u.%u\n" ,pDomain
-			,((ip&0xff000000)>>24) ,((ip&0x00ff0000)>>16) ,((ip&0x0000ff00)>>8) ,((ip&0x000000ff))
-			);
-
-		mlfi_setreply(ctx,550,"5.7.1","Rejecting due to security policy - Blacklisted body host, Please see: %s#bodyurldbl",gPolicyUrl);
-		asprintf(pcpr->ppReason,"Body URL DBL host '%s' via '%s'",pDomain,pDbl);
-		mlfi_status_debug(priv,pcpr->prs,LOG_REJECTED_STR,*pcpr->ppReason,"mlfi_eom: Body URL DBL host\n");
-		free(*pcpr->ppReason);
-		*pcpr->prs = SMFIS_REJECT;
-		*pcpr->pbContinueChecks = 0;
-	}
-
-	return *pcpr->pbContinueChecks; // again
+	mlfi_debug(priv->pSessionUuidStr, "dbl_check '%s' - listed - %s\n"
+		,pDblcb->pDblq->pDomain
+		,pDblcb->pDblResult
+		);
+
+	mlfi_setreply(ctx, 550, "5.7.1", "Rejecting due to security policy - Blacklisted body host, Please see: %s#bodyurldbl", gPolicyUrl);
+	asprintf(pcpr->ppReason, "Body URL DBL host '%s' via '%s'", pDblcb->pDblq->pDomain, pDblcb->pDbl);
+	mlfi_status_debug(priv, pcpr->prs, LOG_REJECTED_STR, *pcpr->ppReason, "mlfi_eom: Body URL DBL host\n");
+	free(*pcpr->ppReason);
+	*pcpr->prs = SMFIS_REJECT;
+	*pcpr->pbContinueChecks = 0;
+
+	return 0; // not again
 }

 typedef struct _lcbh_t
@@ -1529,7 +1531,14 @@
 #ifdef SUPPORT_DBL
 			if(*pLcbh->cpr.pbContinueChecks) // if BL testing passes
 			{
-				dbl_check_all(priv->presstate,pStr,&dblCheckCallbackBody,&pLcbh->cpr);
+				dblq_t dblq;
+
+				dblq.pDomain = pStr;
+				dblq.pCallbackFn = &dblCheckCallbackBody;
+				dblq.pCallbackData = &pLcbh->cpr;
+				dblq.pCallbackPolicyFn = &dbl_callback_policy_std;
+
+				dbl_check_all(priv->presstate, &dblq);
 				if(*pLcbh->cpr.pbContinueChecks)
 					mlfi_debug(priv->pSessionUuidStr,"dbl_check '%s' - not listed\n",pStr);
 			}


nothing playing is not an error

nothing playing is not an error

--- hgd/hgd-netd.c
+++ hgd/hgd-netd.c
@@ -137,7 +137,7 @@
 	playing = hgd_get_playing_item();
 	if (playing == NULL) {
 		hgd_sock_send_line(sess->sock_fd, "ok|0");
-		return (-1);
+		return (0);
 	}

 	xasprintf(&reply, "ok|1|%d|%s|%s",


Remove unused public API to_span_ptr (#964)

--- api/include/opentelemetry/trace/span.h
+++ api/include/opentelemetry/trace/span.h
@@ -185,13 +185,5 @@
   virtual bool IsRecording() const noexcept = 0;
 };

-template <class SpanType, class TracerType>
-nostd::shared_ptr<trace::Span> to_span_ptr(TracerType *objPtr,
-                                           nostd::string_view name,
-                                           const trace::StartSpanOptions &options)
-{
-  return nostd::shared_ptr<trace::Span>{new (std::nothrow) SpanType{*objPtr, name, options}};
-}
-
 }  // namespace trace
 OPENTELEMETRY_END_NAMESPACE


Bluetooth: Controller: Add defines for ext adv header field offsets

Add defines for Extended Advertising Common Extended Payload
Format field offsets.

Signed-off-by: Vinayak Kariappa Chettimada <e780c9f87dc729ad454f47292ad82c8652353064@nordicsemi.no>

--- subsys/bluetooth/controller/ll_sw/ull_adv_internal.h
+++ subsys/bluetooth/controller/ll_sw/ull_adv_internal.h
@@ -125,12 +125,14 @@
 #define ULL_ADV_PDU_HDR_FIELD_AD_DATA   BIT(9)

 /* helper defined for field offsets in the hdr_set_clear interfaces */
-#define ULL_ADV_HDR_DATA_LEN_OFFSET      0
-#define ULL_ADV_HDR_DATA_LEN_SIZE        1
-#define ULL_ADV_HDR_DATA_ACAD_PTR_OFFSET 1
-#define ULL_ADV_HDR_DATA_ACAD_PTR_SIZE   (sizeof(uint8_t *))
-#define ULL_ADV_HDR_DATA_DATA_PTR_OFFSET 1
-#define ULL_ADV_HDR_DATA_DATA_PTR_SIZE   (sizeof(uint8_t *))
+#define ULL_ADV_HDR_DATA_LEN_OFFSET         0
+#define ULL_ADV_HDR_DATA_LEN_SIZE           1
+#define ULL_ADV_HDR_DATA_AUX_PTR_PTR_OFFSET 1
+#define ULL_ADV_HDR_DATA_AUX_PTR_PTR_SIZE   (sizeof(uint8_t *))
+#define ULL_ADV_HDR_DATA_ACAD_PTR_OFFSET    1
+#define ULL_ADV_HDR_DATA_ACAD_PTR_SIZE      (sizeof(uint8_t *))
+#define ULL_ADV_HDR_DATA_DATA_PTR_OFFSET    1
+#define ULL_ADV_HDR_DATA_DATA_PTR_SIZE      (sizeof(uint8_t *))

 /* helper function to set/clear common extended header format fields */
 uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv,


fix free

fix free

--- simplememdb/simplememdb.c
+++ simplememdb/simplememdb.c
@@ -713,9 +713,10 @@
                 }
                 free(value);
             }
-            free(key);
             send_reply = 1;
         }
+
+        free(key);

         c++;
         if (c == limit) {


Reduced scale of buildings to allow better view of the streets.

--- src/examples/layer2/engine.h
+++ src/examples/layer2/engine.h
@@ -126,7 +126,7 @@
       city_mesh = new CityMesh();
       streetList = &city->streetsList;

-      city->calculateBuildingsAreas(0.9);
+      city->calculateBuildingsAreas(0.75);
       buildingAreaList = &city->buildingAreaList;
       vec4 dimensions;
       vec4 center;


bind needs the socket lock removed before being called implicitly from listen() otherwise its a LOR.

--- KERN/netinet/sctp_usrreq.c
+++ KERN/netinet/sctp_usrreq.c
@@ -5279,15 +5279,16 @@
 	}
 	if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) {
 		/* We must do a bind. */
+		SOCK_UNLOCK(so);
 		SCTP_INP_RUNLOCK(inp);
 		if ((error = sctp_inpcb_bind(so, NULL, p))) {
 			/* bind error, probably perm */
-			SOCK_UNLOCK(so);
 #if defined(__NetBSD__) || defined(__OpenBSD__)
 			splx(s);
 #endif
 			return (error);
 		}
+		SOCK_LOCK(so);
 	} else {
 		SCTP_INP_RUNLOCK(inp);
 	}


sysrepocfg BUGFIX do not check ext deps when parsing files

Sysrepo will check all dependencies when an actual
operation is executed.

Fixes #1593

--- src/executables/sysrepocfg.c
+++ src/executables/sysrepocfg.c
@@ -272,7 +272,7 @@
     struct lyd_node *data;
     int r, flags;

-    flags = LYD_OPT_CONFIG | (not_strict ? 0 : LYD_OPT_STRICT);
+    flags = LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS | (not_strict ? 0 : LYD_OPT_STRICT);
     if (step_load_data(sess, file_path, format, flags, &data)) {
         return EXIT_FAILURE;
     }
@@ -345,8 +345,8 @@
     struct lyd_node *data;

     if (file_path) {
-        /* just apply an edit form a file */
-        flags = LYD_OPT_EDIT | (not_strict ? 0 : LYD_OPT_STRICT);
+        /* just apply an edit from a file */
+        flags = LYD_OPT_EDIT | LYD_OPT_NOEXTDEPS | (not_strict ? 0 : LYD_OPT_STRICT);
         if (step_load_data(sess, file_path, format, flags, &data)) {
             return EXIT_FAILURE;
         }
@@ -425,7 +425,7 @@
     }

     /* load the file */
-    flags = LYD_OPT_RPC | (not_strict ? 0 : LYD_OPT_STRICT);
+    flags = LYD_OPT_RPC | LYD_OPT_NOEXTDEPS | (not_strict ? 0 : LYD_OPT_STRICT);
     if (step_load_data(sess, file_path, format, flags, &input)) {
         return EXIT_FAILURE;
     }
@@ -474,7 +474,7 @@
     }

     /* load the file */
-    flags = LYD_OPT_NOTIF | (not_strict ? 0 : LYD_OPT_STRICT);
+    flags = LYD_OPT_NOTIF | LYD_OPT_NOEXTDEPS | (not_strict ? 0 : LYD_OPT_STRICT);
     if (step_load_data(sess, file_path, format, flags, &notif)) {
         return EXIT_FAILURE;
     }
@@ -499,7 +499,7 @@

     if (file_path) {
         /* load the file */
-        flags = LYD_OPT_CONFIG | (not_strict ? 0 : LYD_OPT_STRICT);
+        flags = LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS | (not_strict ? 0 : LYD_OPT_STRICT);
         if (step_load_data(sess, file_path, format, flags, &data)) {
             return EXIT_FAILURE;
         }


*** empty log message ***

*** empty log message ***

--- KERN/netinet/sctp_usrreq.c
+++ KERN/netinet/sctp_usrreq.c
@@ -155,7 +155,8 @@
 unsigned int sctp_path_rtx_max_default = SCTP_DEF_MAX_SEND/2;
 unsigned int sctp_nr_outgoing_streams_default = SCTP_OSTREAM_INITIAL;
 unsigned int sctp_cmt_on_off = 0;
-unsigned int sctp_early_fr = 1;
+unsigned int sctp_cmt_sockopt_on_off = 0;
+unsigned int sctp_early_fr = 0;
 unsigned int sctp_early_fr_msec = SCTP_MINFR_MSEC_TIMER;
 unsigned int sctp_use_rttvar_cc = 0;
 int sctp_says_check_for_deadlock = 0;


enable sysrepoctl logging

enable sysrepoctl logging

--- src/executables/sysrepoctl.c
+++ src/executables/sysrepoctl.c
@@ -1031,6 +1031,7 @@
     printf("Available operation-options:\n");
     printf("  -h, --help             Prints usage help.\n");
     printf("  -v, --version          Prints version.\n");
+    printf("  -L, --level            Set verbosity level of logging ([0 - 4], 0 = all logging turned off).\n");
     printf("  -l, --list             Lists YANG modules installed in sysrepo.\n");
     printf("  -i, --install          Installs specified schema into sysrepo (--yang or --yin must be specified).\n");
     printf("  -I, --init             Initializes already installed YANG/YIN schema (--module must be specified).\n");
@@ -1064,6 +1065,7 @@
 main(int argc, char* argv[])
 {
     int c = 0, operation = 0;
+    int log_level = -1;
     char *feature_name = NULL;
     char *yang = NULL, *yin = NULL, *module = NULL, *revision = NULL;
     char *owner = NULL, *permissions = NULL;
@@ -1074,6 +1076,7 @@
     struct option longopts[] = {
        { "help",            no_argument,       NULL, 'h' },
        { "version",         no_argument,       NULL, 'v' },
+       { "level",           required_argument, NULL, 'L' },
        { "list",            no_argument,       NULL, 'l' },
        { "install",         no_argument,       NULL, 'i' },
        { "init",            no_argument,       NULL, 'I' },
@@ -1093,7 +1096,7 @@
        { 0, 0, 0, 0 }
     };

-    while ((c = getopt_long(argc, argv, "hvliIuce:d:g:n:m:r:o:p:s:0:W;", longopts, NULL)) != -1) {
+    while ((c = getopt_long(argc, argv, "hvLliIuce:d:g:n:m:r:o:p:s:0:W;", longopts, NULL)) != -1) {
         switch (c) {
             case 'h':
                 srctl_print_help();
@@ -1102,6 +1105,9 @@
             case 'v':
                 srctl_print_version();
                 exit(EXIT_SUCCESS);
+                break;
+            case 'L':
+                log_level = atoi(optarg);
                 break;
             case 'l':
             case 'i':
@@ -1159,6 +1165,12 @@
         }
     }

+    /* set log levels */
+    sr_log_stderr(SR_LL_ERR);
+    sr_log_syslog(SR_LL_NONE);
+    if ((log_level >= SR_LL_NONE) && (log_level <= SR_LL_DBG)) {
+        sr_log_stderr(log_level);
+    }
     ly_set_log_clb(srctl_ly_log_cb, 0);

     switch (operation) {


Cast away an alignment error for FreeBSD and OpenBSD.

--- src/if-bsd.c
+++ src/if-bsd.c
@@ -679,7 +679,8 @@
 	if (rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) {
 		const struct sockaddr_dl *sdl;

-		sdl = (const struct sockaddr_dl*)rti_info[RTAX_GATEWAY];
+		sdl = (const struct sockaddr_dl*)
+			(const void *)rti_info[RTAX_GATEWAY];
 		if (sdl->sdl_alen != 0)
 			rt->rt_dflags |= RTDF_GATELINK;
 	} else if (rtm->rtm_flags & RTF_GATEWAY)


tools/lib/atusb-common.c (atusb_interrupt_wait): fix embarrassing build failure

--- tools/lib/atusb-common.c
+++ tools/lib/atusb-common.c
@@ -221,7 +221,7 @@
 		return 0;

 	res = usb_bulk_read(dsc->dev, 1,
-	    (char *) &buf, sizeof(buf), timeout_ms < 0 : 0 : timeout_ms);
+	    (char *) &buf, sizeof(buf), timeout_ms < 0 ? 0 : timeout_ms);
 	if (res == -ETIMEDOUT)
 		return 0;
 	if (res < 0) {


set var to NULL to avoid warnings

set var to NULL to avoid warnings

git-svn-id: 5106888552098ed18bfd59dec88465247fe3820e@1743 a8f5125c-1e01-0410-8897-facf34644b8e

--- src/imlib2.c
+++ src/imlib2.c
@@ -49,7 +49,7 @@
     void *bytes = NULL;
 	char *from_format = "BGRA";
     PyObject *data = NULL;
-    Imlib_Image *image;
+    Imlib_Image *image = NULL;
     Image_PyObject *o;

     if (!PyArg_ParseTuple(args, "(ii)|Osi", &w, &h, &data, &from_format, &copy))


perf evlist: Improve the strerror_mmap method

Considering the per user locked pages limit, improve the message when a
user uses multiple simultaneous perf mmap calls:

When the request is more than the current maximum:

  [acme@ssdandy linux]$ trace -m 128 usleep 1
  Error: Operation not permitted.
  Hint:  Check /proc/sys/kernel/perf_event_mlock_kb (516 kB) setting.
  Hint:  Tried using 516 kB.
  Hint:  Try 'sudo sh -c "echo 1032 > /proc/sys/kernel/perf_event_mlock_kb"', or
  Hint:  Try using a smaller -m/--mmap-pages value.
  [acme@ssdandy linux]$

And when the limit is less than that:

  [acme@ssdandy linux]$ trace -m 512 usleep 1
  Error: Operation not permitted.
  Hint:  Check /proc/sys/kernel/perf_event_mlock_kb (2056 kB) setting.
  Hint:  Tried using 2052 kB.
  Hint:  Try using a smaller -m/--mmap-pages value.
  [acme@ssdandy linux]$

Cc: Adrian Hunter <41bb5944f244750b7cf0394140496972a3f1bee3@intel.com>
Cc: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@suse.de>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Don Zickus <3c9a8cec2f33672bf03519b05ce2324e6cf5717a@redhat.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Link: 0c310f0dfcb28525464e3625ef8f8867b6d24df5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>


SiLabs: Fix incorrect TX active conditional in serial_api

Part of condition to detect active TX was not only incorrect
but also not needed in the first place. TX active state is
now always detected only via active TXBL/TXC interrupt.

--- libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/serial_api.c
+++ libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/serial_api.c
@@ -1663,9 +1663,6 @@
  */
 uint8_t serial_tx_active(serial_t *obj)
 {
-    if(!serial_writable(obj))
-        return false;
-
     if(LEUART_REF_VALID(obj->serial.periph.leuart)) {
         return (obj->serial.periph.leuart->IEN & (LEUART_IEN_TXBL|LEUART_IEN_TXC)) ? true : false;
     } else {


tools/tpm2_nvincrement: Redo tool layout

Fixes #2418

Signed-off-by: Imran Desai <d01faadd01d89088a38277c634ffb396f2b368f8@intel.com>

--- tools/tpm2_nvincrement.c
+++ tools/tpm2_nvincrement.c
@@ -8,6 +8,9 @@

 typedef struct tpm_nvincrement_ctx tpm_nvincrement_ctx;
 struct tpm_nvincrement_ctx {
+    /*
+     * Inputs
+     */
     struct {
         const char *ctx_path;
         const char *auth_str;
@@ -16,13 +19,114 @@

     TPM2_HANDLE nv_index;

+    /*
+     * Outputs
+     */
+
+    /*
+     * Parameter hashes
+     */
     char *cp_hash_path;
+    TPM2B_DIGEST *cphash;
+    TPM2B_DIGEST cp_hash;
+    bool is_command_dispatch;
 };
+
 static tpm_nvincrement_ctx ctx;

+static tool_rc nv_increment(ESYS_CONTEXT *ectx) {
+
+    tool_rc rc = tpm2_nv_increment(ectx, &ctx.auth_hierarchy.object,
+    ctx.nv_index, ctx.cphash);
+    if (rc != tool_rc_success) {
+        LOG_ERR("Failed to increment NV counter at index 0x%X", ctx.nv_index);
+    }
+
+    return rc;
+}
+
+static tool_rc process_output(ESYS_CONTEXT *ectx) {
+
+    UNUSED(ectx);
+    /*
+     * 1. Outputs that do not require TPM2_CC_<command> dispatch
+     */
+    bool is_file_op_success = true;
+    if (ctx.cp_hash_path) {
+        is_file_op_success = files_save_digest(&ctx.cp_hash, ctx.cp_hash_path);
+
+        if (!is_file_op_success) {
+            return tool_rc_general_error;
+        }
+    }
+
+    tool_rc rc = tool_rc_success;
+    if (!ctx.is_command_dispatch) {
+        return rc;
+    }
+
+    /*
+     * 2. Outputs generated after TPM2_CC_<command> dispatch
+     */
+
+    return tool_rc_success;
+}
+
+static tool_rc process_inputs(ESYS_CONTEXT *ectx) {
+
+    /*
+     * 1. Object and auth initializations
+     */
+
+    /*
+     * 1.a Add the new-auth values to be set for the object.
+     */
+
+    /*
+     * 1.b Add object names and their auth sessions
+     */
+
+    /* Object #1 */
+    tool_rc rc = tpm2_util_object_load_auth(ectx, ctx.auth_hierarchy.ctx_path,
+            ctx.auth_hierarchy.auth_str, &ctx.auth_hierarchy.object, false,
+            TPM2_HANDLE_FLAGS_NV | TPM2_HANDLE_FLAGS_O | TPM2_HANDLE_FLAGS_P);
+    if (rc != tool_rc_success) {
+        LOG_ERR("Invalid handle authorization");
+    }
+
+    /*
+     * 2. Restore auxiliary sessions
+     */
+
+    /*
+     * 3. Command specific initializations
+     */
+
+    /*
+     * 4. Configuration for calculating the pHash
+     */
+
+    /*
+     * 4.a Determine pHash length and alg
+     */
+    ctx.cphash = ctx.cp_hash_path ? &ctx.cp_hash : 0;
+
+    /*
+     * 4.b Determine if TPM2_CC_<command> is to be dispatched
+     */
+    ctx.is_command_dispatch = ctx.cp_hash_path ? false : true;
+
+    return rc;
+}
+
+static tool_rc check_options(ESYS_CONTEXT *ectx) {
+
+    return tool_rc_success;
+}
+
 static bool on_arg(int argc, char **argv) {
-    /* If the user doesn't specify an authorization hierarchy use the index
-     * passed to -x/--index for the authorization index.
+    /*
+     * If the user doesn't specify an authorization hierarchy use the index
      */
     if (!ctx.auth_hierarchy.ctx_path) {
         ctx.auth_hierarchy.ctx_path = argv[0];
@@ -56,7 +160,7 @@
     };

     *opts = tpm2_options_new("C:P:", ARRAY_LEN(topts), topts, on_option, on_arg,
-            0);
+        0);

     return *opts != NULL;
 }
@@ -65,44 +169,59 @@

     UNUSED(flags);

-    tool_rc rc = tpm2_util_object_load_auth(ectx, ctx.auth_hierarchy.ctx_path,
-            ctx.auth_hierarchy.auth_str, &ctx.auth_hierarchy.object, false,
-            TPM2_HANDLE_FLAGS_NV | TPM2_HANDLE_FLAGS_O | TPM2_HANDLE_FLAGS_P);
-    if (rc != tool_rc_success) {
-        LOG_ERR("Invalid handle authorization");
-        return rc;
-    }
-
-    if (!ctx.cp_hash_path) {
-        rc = tpm2_nv_increment(ectx, &ctx.auth_hierarchy.object, ctx.nv_index, NULL);
-        if (rc != tool_rc_success) {
-            LOG_ERR("Failed to increment NV counter at index 0x%X", ctx.nv_index);
-        }
-        return rc;
-    }
-
-    TPM2B_DIGEST cp_hash = { .size = 0 };
-    rc = tpm2_nv_increment(ectx, &ctx.auth_hierarchy.object, ctx.nv_index,
-        &cp_hash);
-    if (rc != tool_rc_success) {
-        return rc;
-    }
-
-    bool result = files_save_digest(&cp_hash, ctx.cp_hash_path);
-    if (!result) {
-        rc = tool_rc_general_error;
-    }
+    /*
+     * 1. Process options
+     */
+    tool_rc rc = check_options(ectx);
+    if (rc != tool_rc_success) {
+        return rc;
+    }
+
+    /*
+     * 2. Process inputs
+     */
+    rc = process_inputs(ectx);
+    if (rc != tool_rc_success) {
+        return rc;
+    }
+
+    /*
+     * 3. TPM2_CC_<command> call
+     */
+    rc = nv_increment(ectx);
+    if (rc != tool_rc_success) {
+        return rc;
+    }
+
+    /*
+     * 4. Process outputs
+     */
+    return process_output(ectx);
+}
+
+static tool_rc tpm2_tool_onstop(ESYS_CONTEXT *ectx) {
+
+    UNUSED(ectx);
+    /*
+     * 1. Free objects
+     */
+
+    /*
+     * 2. Close authorization sessions
+     */
+    tool_rc rc = tool_rc_success;
+    tool_rc tmp_rc = tpm2_session_close(&ctx.auth_hierarchy.object.session);
+    if (tmp_rc != tool_rc_success) {
+        rc = tmp_rc;
+    }
+
+    /*
+     * 3. Close auxiliary sessions
+     */

     return rc;
 }

-static tool_rc tpm2_tool_onstop(ESYS_CONTEXT *ectx) {
-    UNUSED(ectx);
-    if (!ctx.cp_hash_path) {
-        return tpm2_session_close(&ctx.auth_hierarchy.object.session);
-    }
-    return tool_rc_success;
-}
-
 // Register this tool with tpm2_tool.c
-TPM2_TOOL_REGISTER("nvincrement", tpm2_tool_onstart, tpm2_tool_onrun, tpm2_tool_onstop, NULL)
+TPM2_TOOL_REGISTER("nvincrement", tpm2_tool_onstart, tpm2_tool_onrun,
+    tpm2_tool_onstop, NULL)


Added L_* to tests for single tests

Added L_* to tests for single tests

--- tests/utils.h
+++ tests/utils.h
@@ -71,16 +71,24 @@
 #  include "../src/log.h"
 #  define RETURN(x) { Log::finish(); return x; }
 #else
-#  define L_TEST(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_DEBUG(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_INFO(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_NOTICE(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_WARNING(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_ERR(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_CRIT(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_ALERT(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_EMERG(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
-#  define L_EXC(obj, fmt, args...) fprintf(stderr, fmt "\n", args)
+template <typename... Args>
+inline void log(std::string fmt, Args&&... args) {
+	fmt.push_back('\n');
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-security"
+	fprintf(stderr, fmt.c_str(), std::forward<Args>(args)...);
+#pragma clang diagnostic pop
+}
+#  define L_TEST(obj, args...) log(args)
+#  define L_DEBUG(obj, args...) log(args)
+#  define L_INFO(obj, args...) log(args)
+#  define L_NOTICE(obj, args...) log(args)
+#  define L_WARNING(obj, args...) log(args)
+#  define L_ERR(obj, args...) log(args)
+#  define L_CRIT(obj, args...) log(args)
+#  define L_ALERT(obj, args...) log(args)
+#  define L_EMERG(obj, args...) log(args)
+#  define L_EXC(obj, args...) log(args)
 #  define RETURN(x) { return x; }
 #endif


glu/sgi: Fix memory leak in gluBuild2DMipmapLevelsCore. (cherry picked from commit 0d89f3dc7ff3f89ba8d5d664253730485bca35e2)

--- src/glu/sgi/libutil/mipmap.c
+++ src/glu/sgi/libutil/mipmap.c
@@ -4349,6 +4349,7 @@
 	    glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
 	    glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
 	    glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+	    free(srcImage);
 	    return GLU_OUT_OF_MEMORY;
 	  }
 	}


Improve action-namespace example

Improve action-namespace example

This needs to have some space around the button for the popover
to show up.

--- examples/action-namespace.c
+++ examples/action-namespace.c
@@ -81,6 +81,7 @@
     return;

   win = gtk_application_window_new (GTK_APPLICATION (app));
+  gtk_window_set_default_size (GTK_WINDOW (win), 200, 300);

   doc_actions = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (doc_actions), doc_entries, G_N_ELEMENTS (doc_entries), win);
@@ -110,7 +111,8 @@
   gtk_button_set_label (GTK_BUTTON (button), "Menu");
   gtk_widget_insert_action_group (button, "doc", G_ACTION_GROUP (doc_actions));
   gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (button_menu));
-
+  gtk_widget_set_halign (GTK_WIDGET (button), GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (GTK_WIDGET (button), GTK_ALIGN_START);
   gtk_container_add (GTK_CONTAINER (win), button);
   gtk_container_set_border_width (GTK_CONTAINER (win), 12);
   gtk_widget_show_all (win);


Add support for GCC 3.3

Add support for GCC 3.3

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@6865 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/PassManagerT.h
+++ lib/VMCore/PassManagerT.h
@@ -130,8 +130,8 @@
   typedef typename Traits::BatcherClass BatcherClass;
   typedef typename Traits::ParentClass   ParentClass;

-  friend typename Traits::PassClass;
-  friend typename Traits::SubPassClass;
+  friend class PassManagerTraits<UnitType>::PassClass;
+  friend class PassManagerTraits<UnitType>::SubPassClass;
   friend class Traits;
   friend class ImmutablePass;


Print the unit along with the value.

Print the unit along with the value.

--- examples/benchmark/client.c
+++ examples/benchmark/client.c
@@ -173,7 +173,7 @@
 	printf("Received %" PRId64 " messages and %" PRId64 " bytes\n", cycles, bytes);
 	printf("It took %.04f seconds\n", elapsed);
 	printf("Average data rate: %.04f MB/s\n", bytes / elapsed / 1024 / 1024);
-	printf("Average packet rate: %.04f\n", cycles / elapsed);
+	printf("Average packet rate: %.04f\n packets/s", cycles / elapsed);
 	return (EXIT_SUCCESS);

 error:


Allow ImmutablePass's to require other immutable passes and to be initialized

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@5630 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/PassManagerT.h
+++ lib/VMCore/PassManagerT.h
@@ -530,7 +530,33 @@
     //
     setAnalysisResolver(IP, this);
     ImmutablePasses.push_back(IP);
+
+    // All Required analyses should be available to the pass as it initializes!
+    // Here we fill in the AnalysisImpls member of the pass so that it can
+    // successfully use the getAnalysis() method to retrieve the implementations
+    // it needs.
+    //
+    IP->AnalysisImpls.clear();
+    IP->AnalysisImpls.reserve(AU.getRequiredSet().size());
+    for (std::vector<const PassInfo *>::const_iterator
+           I = AU.getRequiredSet().begin(),
+           E = AU.getRequiredSet().end(); I != E; ++I) {
+      Pass *Impl = getAnalysisOrNullUp(*I);
+      if (Impl == 0) {
+        std::cerr << "Analysis '" << (*I)->getPassName()
+                  << "' used but not available!";
+        assert(0 && "Analysis used but not available!");
+      } else if (PassDebugging == Details) {
+        if ((*I)->getPassName() != std::string(Impl->getPassName()))
+          std::cerr << "    Interface '" << (*I)->getPassName()
+                    << "' implemented by '" << Impl->getPassName() << "'\n";
+      }
+      IP->AnalysisImpls.push_back(std::make_pair(*I, Impl));
+    }

+    // Initialize the immutable pass...
+    IP->initializePass();
+
     // Add this pass to the currently available set...
     if (const PassInfo *PI = IP->getPassInfo()) {
       CurrentAnalyses[PI] = IP;


save a bunch of mallocs/frees

save a bunch of mallocs/frees

--- src/graviton/server/server.c
+++ src/graviton/server/server.c
@@ -345,23 +345,18 @@
   GError *error = NULL;
   const gchar *request_id;
   GravitonService *service;
-  gchar **rpc_method_name;
-  gchar *method_name;
+  const gchar *method_name;
   gchar *service_name;
   GVariant *method_result;

   builder = json_builder_new ();

   request_id = json_object_get_string_member (request, "id");
-  rpc_method_name = g_strsplit (json_object_get_string_member (request,
-                                                               "method"), ".",
-                                0);
-
-  service_name = g_strdup (rpc_method_name[0]);
-  method_name = g_strdup (rpc_method_name[1]);
-  g_strfreev (rpc_method_name);
-
-  g_debug ("Looking for service %s", service_name);
+  service_name = strdup (json_object_get_string_member (request, "method"));
+  g_debug ("Looking to call %s", service_name);
+  method_name = strchr (service_name, '.') + 1;
+  service_name[method_name - service_name - 1] = 0;
+

   service =
     graviton_service_get_subservice (GRAVITON_SERVICE (self->priv->plugins),
@@ -395,9 +390,6 @@
                                                                param->data), NULL,
                                        &error);
           g_hash_table_replace (args, g_strdup (param->data), param_value);
-          gchar *display = g_variant_print (param_value, TRUE);
-          g_debug ("Setting param %s to %s", (gchar*)param->data, display);
-          g_free (display);
           param = g_list_next (param);
         }
         g_list_free (param_names);
@@ -419,7 +411,6 @@
   }

 out:
-  g_free (method_name);
   g_free (service_name);
   builder = json_builder_new ();
   json_builder_begin_object (builder);


[PengePeopleTile] Use an NbtkBin to ensure correct layering with overlay

--- penge/penge-people-tile.c
+++ penge/penge-people-tile.c
@@ -33,6 +33,7 @@
 struct _PengePeopleTilePrivate {
     ClutterActor *body;
     ClutterActor *icon;
+    NbtkWidget *bin;
     NbtkWidget *primary_text;
     NbtkWidget *secondary_text;
     NbtkWidget *details_overlay;
@@ -85,7 +86,7 @@
     case PROP_BODY:
       if (priv->body)
       {
-        clutter_container_remove_actor (CLUTTER_CONTAINER (object),
+        clutter_container_remove_actor (CLUTTER_CONTAINER (priv->bin),
                                         priv->body);
       }

@@ -94,23 +95,8 @@
       if (!priv->body)
         return;

-      nbtk_table_add_actor (NBTK_TABLE (object),
-                            priv->body,
-                            0,
-                            0);
-      clutter_container_child_set (CLUTTER_CONTAINER (object),
-                                   priv->body,
-                                   "y-align",
-                                   0.0,
-                                   "x-align",
-                                   0.0,
-                                   "row-span",
-                                   2,
-                                   "y-fill",
-                                   TRUE,
-                                   "y-expand",
-                                   TRUE,
-                                   NULL);
+      nbtk_bin_set_child (NBTK_BIN (priv->bin),
+                          priv->body);

       break;
@@ -288,6 +274,21 @@
   PengePeopleTilePrivate *priv = GET_PRIVATE (self);
   ClutterActor *tmp_text;
   ClutterAlpha *alpha;
+
+  priv->bin = nbtk_bin_new ();
+  nbtk_bin_set_fill (NBTK_BIN (priv->bin), TRUE, TRUE);
+  nbtk_table_add_actor (NBTK_TABLE (self),
+                        (ClutterActor *)priv->bin,
+                        0,
+                        0);
+  clutter_container_child_set (CLUTTER_CONTAINER (self),
+                               (ClutterActor *)priv->bin,
+                               "y-align", 0.0,
+                               "x-align", 0.0,
+                               "row-span", 2,
+                               "y-fill", TRUE,
+                               "y-expand", TRUE,
+                               NULL);

   priv->primary_text = nbtk_label_new ("Primary text");
   nbtk_widget_set_style_class_name (priv->primary_text,


* Fix normalization for systems that have not tanhl function

--- src/classifiers/winnow.c
+++ src/classifiers/winnow.c
@@ -274,7 +274,7 @@
          * As some implementations of libm does not support tanhl, try to use
          * tanh
          */
-        max = tanh ((double) score);
+        max = tanh ((double) max);
 #endif
 		sumbuf = memory_pool_alloc (task->task_pool, 32);
 		rspamd_snprintf (sumbuf, 32, "%.2F", max);
@@ -570,7 +570,7 @@
          * As some implementations of libm does not support tanhl, try to use
          * tanh
          */
-        *sum = tanh ((double) score);
+        *sum = tanh ((double) max);
 #endif
 	}
 	return TRUE;


zdtm: handle a partial read/write in socket-tcp

Signed-off-by: Andrey Vagin <74c05afa918858348d6db8037d82fa8124870113@openvz.org>
Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>

--- test/zdtm/live/static/socket-tcp.c
+++ test/zdtm/live/static/socket-tcp.c
@@ -12,14 +12,42 @@

 static int port = 8880;

-#define BUF_SIZE 1024
+#define BUF_SIZE 4096
+
+int read_data(int fd, unsigned char *buf, int size)
+{
+	int cur = 0;
+	int ret;
+	while (cur != size) {
+		ret = read(fd, buf + cur, size - cur);
+		if (ret <= 0)
+			return -1;
+		cur += ret;
+	}
+
+	return 0;
+}
+
+int write_data(int fd, const unsigned char *buf, int size)
+{
+	int cur = 0;
+	int ret;
+
+	while (cur != size) {
+		ret = write(fd, buf + cur, size - cur);
+		if (ret <= 0)
+			return -1;
+		cur += ret;
+	}
+
+	return 0;
+}

 int main(int argc, char **argv)
 {
 	unsigned char buf[BUF_SIZE];
 	int fd, fd_s;
 	pid_t extpid;
-	int res;
 	uint32_t crc;
 	int pfd[2];

@@ -45,16 +73,15 @@
 		if (fd < 0)
 			return 1;

-		res = read(fd, buf, BUF_SIZE);
-		if (res != BUF_SIZE) {
-			err("read less then have to: %d instead of %d", res, BUF_SIZE);
+		if (read_data(fd, buf, BUF_SIZE)) {
+			err("read less then have to");
 			return 1;
 		}
 		if (datachk(buf, BUF_SIZE, &crc))
 			return 2;

 		datagen(buf, BUF_SIZE, &crc);
-		if (write(fd, buf, BUF_SIZE) < BUF_SIZE) {
+		if (write_data(fd, buf, BUF_SIZE)) {
 			err("can't write");
 			return 1;
 		}
@@ -88,14 +115,13 @@
 	test_waitsig();

 	datagen(buf, BUF_SIZE, &crc);
-	if (write(fd, buf, BUF_SIZE) < BUF_SIZE) {
+	if (write_data(fd, buf, BUF_SIZE)) {
 		err("can't write");
 		return 1;
 	}

-	res = read(fd, buf, BUF_SIZE);
-	if (res != BUF_SIZE) {
-		err("read less then have to: %d instead of %d", res, BUF_SIZE);
+	if (read_data(fd, buf, BUF_SIZE)) {
+		err("read less then have to");
 		return 1;
 	}
 	if (datachk(buf, BUF_SIZE, &crc))


Fix boostrap only support 1 param. (#1377)

--- skynet-src/skynet_start.c
+++ skynet-src/skynet_start.c
@@ -235,7 +235,17 @@
 	int sz = strlen(cmdline);
 	char name[sz+1];
 	char args[sz+1];
-	sscanf(cmdline, "%s %s", name, args);
+	int arg_pos;
+	sscanf(cmdline, "%s", name);
+	arg_pos = strlen(name);
+	if (arg_pos < sz) {
+		while(cmdline[arg_pos] == ' ') {
+			arg_pos++;
+		}
+		strncpy(args, cmdline + arg_pos, sz);
+	} else {
+		args[0] = '\0';
+	}
 	struct skynet_context *ctx = skynet_context_new(name, args);
 	if (ctx == NULL) {
 		skynet_error(NULL, "Bootstrap error : %s\n", cmdline);


Update configuration.h

Update configuration.h

Updated for better performances

--- RedPitayaSDK/inc/configuration.h
+++ RedPitayaSDK/inc/configuration.h
@@ -9,6 +9,7 @@

 /*** Pre-compiling Options ***/
 #define DECIMATE8 ON
+#define EXTERNAL_TRIGGER OFF

 /*** Global Variables impacted by the options ***/
 #if(!DECIMATE8)


Update sgemm_kernel_8x4_haswell.c

Update sgemm_kernel_8x4_haswell.c


the lua API is a nightmare

the lua API is a nightmare

--- sol/compatibility/5.1.0.h
+++ sol/compatibility/5.1.0.h
@@ -158,11 +158,11 @@
     return ls->s;
 }

-inline int luaL_loadbufferx(lua_State* L, const char* buff, size_t size, const char* name, const char* mode) {
+inline int luaL_loadbufferx(lua_State* L, const char* buff, size_t size, const char* name, const char*) {
     kepler_lua_compat_get_string_view ls;
     ls.s = buff;
     ls.size = size;
-    return lua_load(L, kepler_lua_compat_get_string, &ls, name, mode);
+    return lua_load(L, kepler_lua_compat_get_string, &ls, name/*, mode*/);
 }

 #endif /* Lua 5.1 */


fixed bug in tailcall module preserve

fixed bug in tailcall module preserve

--- vm/jit_x86.c
+++ vm/jit_x86.c
@@ -632,7 +632,7 @@

 	XPush_r(TMP2);
 	XRet();
-
+
 	END_BUFFER;
 }

@@ -777,12 +777,8 @@
 	XJump(JNeq,jerr);

 	if( mode == TAIL_CALL ) {
-		// get the pc from stack and pop eip as well
-		XMov_rp(TMP,Esp,FIELD(1));
+		// pop PC and EIP from the stack
 		stack_pop(Esp,2);
-		// replace PC and Module only on stack
-		XMov_pr(CSP,FIELD(-3),TMP);
-		get_var_p(CSP,FIELD(0),VModule);

 		set_var_p(VModule,ACC,FIELD(4)); // vm->module = acc->module
 		set_var_p(VEnv,ACC,FIELD(3)); // vm->env = acc->env
@@ -1462,7 +1458,7 @@

 	// prepare args
 	XPush_r(right?REG_TMP:REG_ACC);
-	if( op == OP_SET ) {
+	if( op == OP_SET ) {
 		XMov_rp(TMP2,Esp,FIELD(3));
 		XPush_r(TMP2);
 	}
@@ -1635,7 +1631,7 @@
 	case AccField: {
 		int *jerr1, *jerr2, *jend1, *loop;
 		char *jend2, *start;
-
+
 		is_int(ACC,true,jerr1);
 		XMov_rp(TMP,ACC,FIELD(0));
 		XCmp_rb(TMP,VAL_OBJECT);
@@ -1647,7 +1643,7 @@
 		XMov_rp(TMP,VM,FIELD(1));
 		XPush_r(TMP);
 		XMov_rc(TMP,CONST(otable_find));
-		XCall_r(TMP);
+		XCall_r(TMP);
 		XCmp_rc(ACC,0);
 		XJump(JNeq,jend1);
 		stack_pop(Esp,1);
@@ -2051,7 +2047,7 @@
 			stack_pop(SP,i);
 		} else {
 			char *start;
-			int *loop;
+			int *loop;
 			XMov_rc(TMP2,(p+1));
 			start = buf.c;
 			XMov_rp(TMP,SP,FIELD(0));
@@ -2178,11 +2174,11 @@
 			t->target = (int)((int_val*)(int_val)p - ctx->module->code);
 			t->next = ctx->traps;
 			ctx->traps = t;
-
+
 		}
 		// neko_setup_trap(vm)
 		XPush_r(ACC);
-		XPush_r(VM);
+		XPush_r(VM);
 		XMov_rc(TMP,CONST(neko_setup_trap));
 		begin_call();
 		XCall_r(TMP);


fix linux gc headers

fix linux gc headers

--- vm/threads.c
+++ vm/threads.c
@@ -41,13 +41,22 @@

 #else

+#include <stdlib.h>
 #include <pthread.h>
+#include <gc/gc_version.h>
+
 struct _mt_local {
 	pthread_key_t key;
 };
 struct _mt_lock {
 	pthread_mutex_t lock;
 };
+
+extern int GC_pthread_create(
+	pthread_t *new_thread,
+	const pthread_attr_t *attr,
+	void *(*start_routine)(void *), void *arg
+);

 #endif


[ALSA] hda-codec - Fix reordering of surround channels

HDA Codec driver
- Fixed the reordering of surround channels.
  Originally reported by Nicolas GRAZIANO <nicolas.graziano@wanadoo.fr>.

- Show the selected ssid when debug option is set.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/hda/hda_codec.c
+++ sound/pci/hda/hda_codec.c
@@ -1541,8 +1541,11 @@
 		for (c = tbl; c->modelname || c->pci_subvendor; c++) {
 			if (c->pci_subvendor == subsystem_vendor &&
 			    (! c->pci_subdevice /* all match */||
-			     (c->pci_subdevice == subsystem_device)))
+			     (c->pci_subdevice == subsystem_device))) {
+				snd_printdd(KERN_INFO "hda_codec: PCI %x:%x, codec config %d is selected\n",
+					    subsystem_vendor, subsystem_device, c->config);
 				return c->config;
+			}
 		}
 	}
 	return -1;
@@ -1803,11 +1806,25 @@
 				cfg->line_out_pins[j] = nid;
 			}

-	/* Swap surround and CLFE: the association order is front/CLFE/surr/back */
-	if (cfg->line_outs >= 3) {
+	/* Reorder the surround channels
+	 * ALSA sequence is front/surr/clfe/side
+	 * HDA sequence is:
+	 *    4-ch: front/surr  =>  OK as it is
+	 *    6-ch: front/clfe/surr
+	 *    8-ch: front/clfe/side/surr
+	 */
+	switch (cfg->line_outs) {
+	case 3:
 		nid = cfg->line_out_pins[1];
 		cfg->line_out_pins[1] = cfg->line_out_pins[2];
 		cfg->line_out_pins[2] = nid;
+		break;
+	case 4:
+		nid = cfg->line_out_pins[1];
+		cfg->line_out_pins[1] = cfg->line_out_pins[3];
+		cfg->line_out_pins[3] = cfg->line_out_pins[2];
+		cfg->line_out_pins[2] = nid;
+		break;
 	}

 	return 0;


Upstream: read handler cleared on upstream finalization.

With "proxy_ignore_client_abort off" (the default), upstream module changes
r->read_event_handler to ngx_http_upstream_rd_check_broken_connection().
If the handler is not cleared during upstream finalization, it can be
triggered later, causing unexpected effects, if, for example, a request
was redirected to a different location using error_page or X-Accel-Redirect.
In particular, it makes "proxy_ignore_client_abort on" non-working after
a redirection in a configuration like this:

    location = / {
        error_page 502 = /error;
        proxy_pass http://127.0.0.1:8082;
    }

    location /error {
        proxy_pass http://127.0.0.1:8083;
        proxy_ignore_client_abort on;
    }

It is also known to cause segmentation faults with aio used, see
http://mailman.nginx.org/pipermail/nginx-ru/2015-August/056570.html.

Fix is to explicitly set r->read_event_handler to ngx_http_block_reading()
during upstream finalization, similar to how it is done in the request body
reading code and in the limit_req module.

--- src/http/ngx_http_upstream.c
+++ src/http/ngx_http_upstream.c
@@ -4366,6 +4366,8 @@
         u->buffer.last = u->buffer.pos;
     }

+    r->read_event_handler = ngx_http_block_reading;
+
     if (rc == NGX_DECLINED) {
         return;
     }


null check

null check

--- examples/ldns-verify-zone.c
+++ examples/ldns-verify-zone.c
@@ -155,6 +155,8 @@
 	ldns_status status;
 	ldns_rr_list *good_keys;
 	ldns_status result = LDNS_STATUS_OK;
+
+	if (!rrset->rrs) return LDNS_STATUS_OK;

 	rrset_rrs = ldns_rr_list_new();
 	cur_rr = rrset->rrs;


ALSA: hda - Revert the codec probe at control-creation errors

Revert the codec probe instead of returning the error to the driver
when any error occurs at creating the control elements.
The control element conflict can be non-fatal in many cases,
especially if it comes from the digital-only codec.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/hda/hda_codec.c
+++ sound/pci/hda/hda_codec.c
@@ -1434,7 +1434,6 @@
 }
 EXPORT_SYMBOL_HDA(snd_hda_ctl_add);

-#ifdef CONFIG_SND_HDA_RECONFIG
 /* Clear all controls assigned to the given codec */
 void snd_hda_ctls_clear(struct hda_codec *codec)
 {
@@ -1529,7 +1528,6 @@
 	hda_unlock_devices(card);
 	return 0;
 }
-#endif /* CONFIG_SND_HDA_RECONFIG */

 /* create a virtual master control and add slaves */
 int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
@@ -2392,8 +2390,16 @@

 	list_for_each_entry(codec, &bus->codec_list, list) {
 		int err = snd_hda_codec_build_controls(codec);
-		if (err < 0)
-			return err;
+		if (err < 0) {
+			printk(KERN_ERR "hda_codec: cannot build controls"
+			       "for #%d (error %d)\n", codec->addr, err);
+			err = snd_hda_codec_reset(codec);
+			if (err < 0) {
+				printk(KERN_ERR
+				       "hda_codec: cannot revert codec\n");
+				return err;
+			}
+		}
 	}
 	return 0;
 }


ALSA: hda - allow up to 4 HDMI devices

ALSA: hda - allow up to 4 HDMI devices

The new Intel HDMI codec supports 2 independant HDMI/DisplayPort pipes.
We'll be exporting them as 2 pcm devices. So bump up the allowed number
of HDMI devices.

Signed-off-by: Wu Fengguang <24f7fe9d205c8a9f6ade0c2894e14303ca16087f@intel.com>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/hda/hda_codec.c
+++ sound/pci/hda/hda_codec.c
@@ -2889,7 +2889,7 @@
 	static int audio_idx[HDA_PCM_NTYPES][5] = {
 		[HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 },
 		[HDA_PCM_TYPE_SPDIF] = { 1, -1 },
-		[HDA_PCM_TYPE_HDMI]  = { 3, -1 },
+		[HDA_PCM_TYPE_HDMI]  = { 3, 7, 8, 9, -1 },
 		[HDA_PCM_TYPE_MODEM] = { 6, -1 },
 	};
 	int i;


[ALSA] Fix a typo in position_fix module option type

HDA Intel driver
Fixed a typo in the type of position_fix module option.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/hda/hda_intel.c
+++ sound/pci/hda/hda_intel.c
@@ -61,7 +61,7 @@
 MODULE_PARM_DESC(enable, "Enable Intel HD audio interface.");
 module_param_array(model, charp, NULL, 0444);
 MODULE_PARM_DESC(model, "Use the given board model.");
-module_param_array(position_fix, bool, NULL, 0444);
+module_param_array(position_fix, int, NULL, 0444);
 MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF).");

 MODULE_LICENSE("GPL");