pkcs11: Adjusted data types to support 32 and 64 bit systems

--- src/pkcs11/slot-pcsc.h
+++ src/pkcs11/slot-pcsc.h
@@ -79,21 +79,21 @@
 #define FEATURE_GET_TLV_PROPERTIES			0x12
 #define FEATURE_CCID_ESC_COMMAND			0x13

-#pragma pack(push, 1)
+#pragma pack(1)
 typedef struct {
-	BYTE  bTimeOut;						/* Timeout is seconds (00 means use default timeout) */
-	BYTE  bTimeOut2; 					/* Timeout in seconds after first key stroke */
-	BYTE  bmFormatString; 				/* Formatting options */
-	BYTE  bmPINBlockString; 			/* bits 7-4 bit size of PIN length in APDU, bits 3-0 PIN block size in bytes after justification and formatting */
-	BYTE  bmPINLengthFormat; 			/* bits 7-5 RFU, bit 4 set if system units are bytes, clear if system units are bits, bits 3-0 PIN length position in system units */
-	WORD  wPINMaxExtraDigit; 			/* 0xXXYY where XX is minimum PIN size in digits and YY is maximum PIN size in digits */
-	BYTE  bEntryValidationCondition; 	/* Conditions under which PIN entry should be considered complete */
-	BYTE  bNumberMessage; 				/* Number of messages to display for PIN verification */
-	WORD  wLangID;						/* Language for messages */
-	BYTE  bMsgIndex; 					/* Message index (should be 00) */
-	BYTE  bTeoPrologue[3]; 				/* T=1 block prologue field to use (should be all zeros) */
-	DWORD ulDataLength; 				/* Length of Data to be sent to the ICC */
-	BYTE  abData[128]; 					/* Data to send to the ICC */
+	unsigned char bTimeOut;					/* Timeout is seconds (00 means use default timeout) */
+	unsigned char bTimeOut2; 					/* Timeout in seconds after first key stroke */
+	unsigned char bmFormatString; 				/* Formatting options */
+	unsigned char bmPINBlockString; 			/* bits 7-4 bit size of PIN length in APDU, bits 3-0 PIN block size in bytes after justification and formatting */
+	unsigned char bmPINLengthFormat; 			/* bits 7-5 RFU, bit 4 set if system units are bytes, clear if system units are bits, bits 3-0 PIN length position in system units */
+	unsigned short wPINMaxExtraDigit; 			/* 0xXXYY where XX is minimum PIN size in digits and YY is maximum PIN size in digits */
+	unsigned char bEntryValidationCondition; 	/* Conditions under which PIN entry should be considered complete */
+	unsigned char bNumberMessage; 				/* Number of messages to display for PIN verification */
+	unsigned short wLangID;					/* Language for messages */
+	unsigned char bMsgIndex; 					/* Message index (should be 00) */
+	unsigned char bTeoPrologue[3]; 			/* T=1 block prologue field to use (should be all zeros) */
+	unsigned int ulDataLength; 				/* Length of Data to be sent to the ICC */
+	unsigned char abData[128]; 				/* Data to send to the ICC */
 } PIN_VERIFY_DIRECT_STRUCTURE_t;
 #pragma pack()


runtime: better panic for send to nil channel

*Much* better on NaCl, where memory faults are deadly.

R=r
CC=golang-dev
http://codereview.appspot.com/2249041

--- src/pkg/runtime/chan.c
+++ src/pkg/runtime/chan.c
@@ -403,6 +403,9 @@
 	int32 o;
 	byte *ae;

+	if(c == nil)
+		panicstring("send to nil channel");
+
 	o = rnd(sizeof(c), c->elemalign);
 	ae = (byte*)&c + o;
 	chansend(c, ae, nil);
@@ -415,6 +418,9 @@
 {
 	int32 o;
 	byte *ae, *ap;
+
+	if(c == nil)
+		panicstring("send to nil channel");

 	o = rnd(sizeof(c), c->elemalign);
 	ae = (byte*)&c + o;


runtime: use explicit flag when finalizer goroutine is waiting

Avoids spurious wakeups during other sleeping by that goroutine.
Fixes issue 711.

R=r
CC=golang-dev
http://codereview.appspot.com/902041

--- src/pkg/runtime/mgc0.c
+++ src/pkg/runtime/mgc0.c
@@ -25,6 +25,8 @@

 static G *fing;
 static Finalizer *finq;
+static int32 fingwait;
+
 static void sweepblock(byte*, int64, uint32*, int32);
 static void runfinq(void);

@@ -306,8 +308,10 @@
 		// kick off or wake up goroutine to run queued finalizers
 		if(fing == nil)
 			fing = newproc1((byte*)runfinq, nil, 0, 0);
-		else if(fing->status == Gwaiting)
+		else if(fingwait) {
 			ready(fing);
+			fingwait = 0;
+		}
 	}
 	m->locks--;

@@ -340,6 +344,7 @@
 		f = finq;
 		finq = nil;
 		if(f == nil) {
+			fingwait = 1;
 			g->status = Gwaiting;
 			gosched();
 			continue;


Adjust recent PERL_SYS_INIT3 call to avoid platforms where it might fail, and to remove compilation warning. Backpatch the release 7.4

--- src/pl/plperl/plperl.c
+++ src/pl/plperl/plperl.c
@@ -1,7 +1,7 @@
 /**********************************************************************
  * plperl.c - perl as a procedural language for PostgreSQL
  *
- *	  $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.136.2.1 2009/06/04 16:00:11 adunstan Exp $
+ *	  $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.136.2.2 2009/06/05 20:32:15 adunstan Exp $
  *
  **********************************************************************/

@@ -388,6 +388,8 @@

 	int nargs = 3;

+	char *dummy_perl_env[1] = { NULL };
+
 #ifdef WIN32

 	/*
@@ -430,11 +432,19 @@
 	save_time = loc ? pstrdup(loc) : NULL;
 #endif

-
-#ifdef PERL_SYS_INIT3
+	/****
+	 * The perl API docs state that PERL_SYS_INIT3 should be called before
+	 * allocating interprters. Unfortunately, on some platforms this fails
+	 * in the Perl_do_taint() routine, which is called when the platform is
+	 * using the system's malloc() instead of perl's own. Other platforms,
+	 * notably Windows, fail if PERL_SYS_INIT3 is not called. So we call it
+	 * if it's available, unless perl is using the system malloc(), which is
+	 * true when MYMALLOC is set.
+	 */
+#if defined(PERL_SYS_INIT3) && !defined(MYMALLOC)
 	/* only call this the first time through, as per perlembed man page */
 	if (interp_state == INTERP_NONE)
-		PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL);
+		PERL_SYS_INIT3(&nargs, (char ***) &embedding, (char***)&dummy_perl_env);
 #endif

 	plperl_held_interp = perl_alloc();


os/kernel/binary_manager_verify.c : Modify the duplicated max bufsize calculation

There were duplicated max bufsize calculation, so removed the duplication to calculate once.

Signed-off-by: jeongchanKim <dd29dda359f9c9995ad03eb5d0e774929bcceb5c@samsung.com>

--- os/kernel/binary_manager/binary_manager_verify.c
+++ os/kernel/binary_manager/binary_manager_verify.c
@@ -167,8 +167,8 @@
 			bin_size = ((common_binary_header_t *)header_data)->bin_size;
 			crc_hash = ((common_binary_header_t *)header_data)->crc_hash;
 		}
-		size_t largest_size = mm_get_largest_freenode_size();
-		crc_bufsize = crc_bufsize < (largest_size / 2) ? crc_bufsize : (largest_size / 2);
+		size_t max_bufsize = mm_get_largest_freenode_size() / 2;
+		crc_bufsize = crc_bufsize < max_bufsize ? crc_bufsize : max_bufsize;
 		crc_buffer = (uint8_t *)kmm_malloc(crc_bufsize);
 		if (!crc_buffer) {
 			bmdbg("Fail to malloc buffer for checking crc, size %u\n", crc_bufsize);


Some minor formatting in the memoryinputstream.h

--- include/nex/system/memoryinputstream.h
+++ include/nex/system/memoryinputstream.h
@@ -32,7 +32,7 @@
      * @param size = The number of bytes to read.
      * @return the number of bytes red, or -1 on error.
      */
-    virtual int64 read(void*data, int64 size);
+    virtual int64 read(void* data, int64 size);

     /**
      * @brief Change the current reading position.


Reduce the number of experimental direct constructor calls.

It puts the function into binary in cases we don't want it for mobile platforms.
We want to generate this list later anyway.

Change-Id: I59be18b7b394254d845f5b2de02684c774510174

--- include/osl/detail/component-defines.h
+++ include/osl/detail/component-defines.h
@@ -14,28 +14,10 @@

 #define LO_URE_CURRENT_ENV 1 /*TODO*/

-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_lang_dot_RegistryServiceManager 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_lang_dot_RegistryServiceManager com_sun_star_comp_stoc_ORegistryServiceManager
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_lang_dot_ServiceManager 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_lang_dot_ServiceManager com_sun_star_comp_stoc_OServiceManager
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_loader_dot_SharedLibrary 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_loader_dot_SharedLibrary com_sun_star_comp_stoc_DLLComponentLoader
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_registry_dot_ImplementationRegistration 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_registry_dot_ImplementationRegistration com_sun_star_comp_stoc_ImplementationRegistration
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_registry_dot_NestedRegistry 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_registry_dot_NestedRegistry com_sun_star_comp_stoc_NestedRegistry
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_registry_dot_SimpleRegistry 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_registry_dot_SimpleRegistry com_sun_star_comp_stoc_SimpleRegistry
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_security_dot_AccessController 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_security_dot_AccessController com_sun_star_security_comp_stoc_AccessController
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_security_dot_Policy 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_security_dot_Policy com_sun_star_security_comp_stoc_FilePolicy
 #define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_xml_dot_sax_dot_FastParser 1 /*TODO*/
 #define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_xml_dot_sax_dot_FastParser com_sun_star_comp_extensions_xml_sax_FastParser
 #define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_xml_dot_sax_dot_Parser 1 /*TODO*/
 #define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_xml_dot_sax_dot_Parser com_sun_star_comp_extensions_xml_sax_ParserExpat
-#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_xml_dot_sax_dot_Writer 1 /*TODO*/
-#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_xml_dot_sax_dot_Writer com_sun_star_extensions_xml_sax_Writer

 #endif


delete the enable flag

delete the enable flag

--- fulanghua_ekf_2d/include/fulanghua_ekf_2d/pose_estimator.h
+++ fulanghua_ekf_2d/include/fulanghua_ekf_2d/pose_estimator.h
@@ -154,7 +154,6 @@

     bool publish_odom_topic_;
     bool publish_pose_topic_;
-    bool enable_gpos_meas_;
     double update_rate_;
     std::string output_frame_;
     std::string base_frame_;


[FIX] removed operator"" _mpz

[FIX] removed operator"" _mpz

--- cpp/includes/ecpy_native.h
+++ cpp/includes/ecpy_native.h
@@ -92,7 +92,7 @@
   }
   auto n = mpz_sizeinbase(m.get_mpz_t(), 2);
   EC_elem<E> G {P};
-  for (mpz_class i = 1_mpz << (n - 2); i != 0; i >>= 1) {
+  for (mpz_class i = mpz_class(1) << (n - 2); i != 0; i >>= 1) {
     curve.base.mul(ret, ret, ret);
     h(t, curve, G, G, Q);
     curve.base.mul(ret, ret, t);


zfs: wait in arc_lowmem only if curproc == pageproc

... otherwise the current thread might be holding ARC locks and thus run
into a deadlock.  This happens, for example, when a thread does memory
allocation in the ARC code and runs into KVA shortage.
Also, it really makes the most sense to wait in pageproc, so that the
results of ARC reclamation are seen before the page cache is acted upon.
In other cases where vm_lowmem is invoked, e.g. on KVA space shortage,
the callers perform multiple attempts (up to 8) and wait for rather
long intervals between them (up to 4 seconds), so ARC reclaim results
should become visible even without explicit waiting on the ARC thread.

Note that this is not a critical issue for typical ZFS usages where KVA
space should already be large enough.  On amd64 systems setting KVA size
to twice the physical memory size is known to mitigate KVA fragmentation
issues in practice.

Side note: perhaps vm_lowmem 'how' parameter should be used to
differentiate between causes of the event.

Reported by:	Nikolay Denev <ndenev@gmail.com>
MFC after:	19 days

--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -3792,8 +3792,16 @@
 	mutex_enter(&arc_reclaim_thr_lock);
 	needfree = 1;
 	cv_signal(&arc_reclaim_thr_cv);
-	while (needfree)
-		msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0);
+
+	/*
+	 * It is unsafe to block here in arbitrary threads, because we can come
+	 * here from ARC itself and may hold ARC locks and thus risk a deadlock
+	 * with ARC reclaim thread.
+	 */
+	if (curproc == pageproc) {
+		while (needfree)
+			msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0);
+	}
 	mutex_exit(&arc_reclaim_thr_lock);
 	mutex_exit(&arc_lowmem_lock);
 }


update DLA example for SSE4

update DLA example for SSE4

--- examples/dla/main.c
+++ examples/dla/main.c
@@ -1,6 +1,8 @@
 #include <stdlib.h>
 #include <time.h>
+
 #include "common/dbg.h"
+#include "config.h"

 #include "data/spatialgrid.h"
 #include "io/svg.h"
@@ -20,13 +22,6 @@
   float eps[2];
 } DLA;

-typedef struct {
-  CT_Vec3f *c;
-  CT_Vec3f *p;
-  float minD;
-  float radius;
-} DLA_Sel;
-
 // clang-format off
 static DLA dla = {
   .width  = 600,
@@ -37,9 +32,9 @@
 // clang-format on

 ct_inline CT_Vec3f *rand_particle(DLA *dla) {
-  return ct_set3fxyz(&dla->particles[dla->num++],
-                     ct_rand_normpos() * dla->width,
-                     ct_rand_normpos() * dla->height, 0);
+  return ct_floor3f_imm(ct_set3fxyz(&dla->particles[dla->num++],
+                                    ct_rand_normpos() * dla->width,
+                                    ct_rand_normpos() * dla->height, 0));
 }

 static void add_particle(DLA *dla) {
@@ -59,10 +54,16 @@
         }
       }
       if (c) {
+#ifdef CT_FEATURE_SSE4
+        p->mmval = (p->mmval - c->mmval) *
+                       _mm_rcp_ps(_mm_sqrt_ps(_mm_load1_ps(&minD))) +
+                   c->mmval;
+#else
         float t = 1.0f / sqrtf(minD);
         p->x    = c->x + t * (p->x - c->x);
         p->y    = c->y + t * (p->y - c->y);
-        p->z    = c->z;
+#endif
+        p->z = c->z;
         ct_spgrid_insert(&dla->accel, (float *)p, p);
         return;
       }


more mboot info

more mboot info

--- kernel/mboot.c
+++ kernel/mboot.c
@@ -89,22 +89,31 @@
         while (mmap < info->mmapAddress + info->mmapLength)
         {

-            screen_puts("Base 0x");
+            screen_puts("0x");

             if (mmap->baseHigh)
                 screen_puts_hex(mmap->baseHigh);

             screen_puts_hex(mmap->baseLow);

-            screen_puts(", Length 0x");
+            screen_puts("-0x");
+
+            screen_puts_hex(mmap->baseLow + mmap->lengthLow);
+
+            screen_puts(" (0x");

             if (mmap->lengthHigh)
                 screen_puts_hex(mmap->lengthHigh);

             screen_puts_hex(mmap->lengthLow);

-            screen_puts(", Type 0x");
-            screen_puts_hex(mmap->type);
+            screen_puts(" bytes) ");
+
+            if (mmap->type == 1)
+                screen_puts("Available");
+            else
+                screen_puts("Reserved");
+
             screen_puts("\n");

             mmap = (mboot_mmap_t *)((unsigned int)mmap + mmap->size + sizeof (unsigned int));


panic: clean up kernel/panic.c

panic: clean up kernel/panic.c

Impact: cleanup, no code changed

Clean up kernel/panic.c some more and make it more consistent.

LKML-Reference: <25a98d74f835781d10a50e43666176950541444d@novell.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- kernel/panic.c
+++ kernel/panic.c
@@ -8,19 +8,19 @@
  * This function is used through-out the kernel (including mm and fs)
  * to indicate a major problem.
  */
+#include <linux/debug_locks.h>
+#include <linux/interrupt.h>
+#include <linux/kallsyms.h>
+#include <linux/notifier.h>
 #include <linux/module.h>
+#include <linux/random.h>
+#include <linux/reboot.h>
+#include <linux/delay.h>
+#include <linux/kexec.h>
 #include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/reboot.h>
-#include <linux/notifier.h>
+#include <linux/sysrq.h>
 #include <linux/init.h>
-#include <linux/sysrq.h>
-#include <linux/interrupt.h>
 #include <linux/nmi.h>
-#include <linux/kexec.h>
-#include <linux/debug_locks.h>
-#include <linux/random.h>
-#include <linux/kallsyms.h>
 #include <linux/dmi.h>

 int panic_on_oops;
@@ -52,19 +52,15 @@
  *
  *	This function never returns.
  */
-
 NORET_TYPE void panic(const char * fmt, ...)
 {
-	long i;
 	static char buf[1024];
 	va_list args;
-#if defined(CONFIG_S390)
-	unsigned long caller = (unsigned long) __builtin_return_address(0);
-#endif
+	long i;

 	/*
-	 * It's possible to come here directly from a panic-assertion and not
-	 * have preempt disabled. Some functions called from here want
+	 * It's possible to come here directly from a panic-assertion and
+	 * not have preempt disabled. Some functions called from here want
 	 * preempt to be disabled. No point enabling it later though...
 	 */
 	preempt_disable();
@@ -99,19 +95,21 @@

 	if (panic_timeout > 0) {
 		/*
-	 	 * Delay timeout seconds before rebooting the machine.
-		 * We can't use the "normal" timers since we just panicked..
-	 	 */
-		printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
+		 * Delay timeout seconds before rebooting the machine.
+		 * We can't use the "normal" timers since we just panicked.
+		 */
+		printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout);
+
 		for (i = 0; i < panic_timeout*1000; ) {
 			touch_nmi_watchdog();
 			i += panic_blink(i);
 			mdelay(1);
 			i++;
 		}
-		/*	This will not be a clean reboot, with everything
-		 *	shutting down.  But if there is a chance of
-		 *	rebooting the system it will be rebooted.
+		/*
+		 * This will not be a clean reboot, with everything
+		 * shutting down.  But if there is a chance of
+		 * rebooting the system it will be rebooted.
 		 */
 		emergency_restart();
 	}
@@ -124,10 +122,15 @@
 	}
 #endif
 #if defined(CONFIG_S390)
-	disabled_wait(caller);
+	{
+		unsigned long caller;
+
+		caller = (unsigned long)__builtin_return_address(0);
+		disabled_wait(caller);
+	}
 #endif
 	local_irq_enable();
-	for (i = 0;;) {
+	for (i = 0; ; ) {
 		touch_softlockup_watchdog();
 		i += panic_blink(i);
 		mdelay(1);
@@ -140,23 +143,23 @@

 struct tnt {
-	u8 bit;
-	char true;
-	char false;
+	u8	bit;
+	char	true;
+	char	false;
 };

 static const struct tnt tnts[] = {
-	{ TAINT_PROPRIETARY_MODULE, 'P', 'G' },
-	{ TAINT_FORCED_MODULE, 'F', ' ' },
-	{ TAINT_UNSAFE_SMP, 'S', ' ' },
-	{ TAINT_FORCED_RMMOD, 'R', ' ' },
-	{ TAINT_MACHINE_CHECK, 'M', ' ' },
-	{ TAINT_BAD_PAGE, 'B', ' ' },
-	{ TAINT_USER, 'U', ' ' },
-	{ TAINT_DIE, 'D', ' ' },
-	{ TAINT_OVERRIDDEN_ACPI_TABLE, 'A', ' ' },
-	{ TAINT_WARN, 'W', ' ' },
-	{ TAINT_CRAP, 'C', ' ' },
+	{ TAINT_PROPRIETARY_MODULE,	'P', 'G' },
+	{ TAINT_FORCED_MODULE,		'F', ' ' },
+	{ TAINT_UNSAFE_SMP,		'S', ' ' },
+	{ TAINT_FORCED_RMMOD,		'R', ' ' },
+	{ TAINT_MACHINE_CHECK,		'M', ' ' },
+	{ TAINT_BAD_PAGE,		'B', ' ' },
+	{ TAINT_USER,			'U', ' ' },
+	{ TAINT_DIE,			'D', ' ' },
+	{ TAINT_OVERRIDDEN_ACPI_TABLE,	'A', ' ' },
+	{ TAINT_WARN,			'W', ' ' },
+	{ TAINT_CRAP,			'C', ' ' },
 };

 /**
@@ -193,7 +196,8 @@
 		*s = 0;
 	} else
 		snprintf(buf, sizeof(buf), "Not tainted");
-	return(buf);
+
+	return buf;
 }

 int test_taint(unsigned flag)
@@ -209,7 +213,8 @@

 void add_taint(unsigned flag)
 {
-	debug_locks = 0; /* can't trust the integrity of the kernel anymore */
+	/* can't trust the integrity of the kernel anymore: */
+	debug_locks = 0;
 	set_bit(flag, &tainted_mask);
 }
 EXPORT_SYMBOL(add_taint);
@@ -264,8 +269,8 @@
 }

 /*
- * Return true if the calling CPU is allowed to print oops-related info.  This
- * is a bit racy..
+ * Return true if the calling CPU is allowed to print oops-related info.
+ * This is a bit racy..
  */
 int oops_may_print(void)
 {
@@ -274,20 +279,22 @@

 /*
  * Called when the architecture enters its oops handler, before it prints
- * anything.  If this is the first CPU to oops, and it's oopsing the first time
- * then let it proceed.
- *
- * This is all enabled by the pause_on_oops kernel boot option.  We do all this
- * to ensure that oopses don't scroll off the screen.  It has the side-effect
- * of preventing later-oopsing CPUs from mucking up the display, too.
- *
- * It turns out that the CPU which is allowed to print ends up pausing for the
- * right duration, whereas all the other CPUs pause for twice as long: once in
- * oops_enter(), once in oops_exit().
+ * anything.  If this is the first CPU to oops, and it's oopsing the first
+ * time then let it proceed.
+ *
+ * This is all enabled by the pause_on_oops kernel boot option.  We do all
+ * this to ensure that oopses don't scroll off the screen.  It has the
+ * side-effect of preventing later-oopsing CPUs from mucking up the display,
+ * too.
+ *
+ * It turns out that the CPU which is allowed to print ends up pausing for
+ * the right duration, whereas all the other CPUs pause for twice as long:
+ * once in oops_enter(), once in oops_exit().
  */
 void oops_enter(void)
 {
-	debug_locks_off(); /* can't trust the integrity of the kernel anymore */
+	/* can't trust the integrity of the kernel anymore: */
+	debug_locks_off();
 	do_oops_enter_exit();
 }


KVM guest: Steal time accounting

KVM guest: Steal time accounting

This patch accounts steal time time in account_process_tick.
If one or more tick is considered stolen in the current
accounting cycle, user/system accounting is skipped. Idle is fine,
since the hypervisor does not report steal time if the guest
is halted.

Accounting steal time from the core scheduler give us the
advantage of direct acess to the runqueue data. In a later
opportunity, it can be used to tweak cpu power and make
the scheduler aware of the time it lost.

[avi: <asm/paravirt.h> doesn't exist on many archs]

Signed-off-by: Glauber Costa <f8b79557d19b40666ebe336545a0b6178af65685@redhat.com>
Acked-by: Rik van Riel <a21938f5d463ddf41aa718934c205ca2cce8ebbc@redhat.com>
Acked-by: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Tested-by: Eric B Munson <51d9dbd4ea8b7943d3deb397de3f8cbc23693656@mgebm.net>
CC: Jeremy Fitzhardinge <35cfe9f678a9e9bbdcf2f6e68cd105ce06d149b1@citrix.com>
CC: Anthony Liguori <0212dd00c21e75e861d960b0cf505645317aaa0b@us.ibm.com>
Signed-off-by: Avi Kivity <8f920f22884d6fea9df883843c4a8095a2e5ac6f@redhat.com>

--- kernel/sched.c
+++ kernel/sched.c
@@ -75,6 +75,9 @@
 #include <asm/tlb.h>
 #include <asm/irq_regs.h>
 #include <asm/mutex.h>
+#ifdef CONFIG_PARAVIRT
+#include <asm/paravirt.h>
+#endif

 #include "sched_cpupri.h"
 #include "workqueue_sched.h"
@@ -527,6 +530,9 @@

 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
 	u64 prev_irq_time;
+#endif
+#ifdef CONFIG_PARAVIRT
+	u64 prev_steal_time;
 #endif

 	/* calc_load related fields */
@@ -1952,6 +1958,18 @@
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(account_system_vtime);
+
+#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
+
+#ifdef CONFIG_PARAVIRT
+static inline u64 steal_ticks(u64 steal)
+{
+	if (unlikely(steal > NSEC_PER_SEC))
+		return div_u64(steal, TICK_NSEC);
+
+	return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
+}
+#endif

 static void update_rq_clock_task(struct rq *rq, s64 delta)
 {
@@ -3845,6 +3863,25 @@
 		cpustat->idle = cputime64_add(cpustat->idle, cputime64);
 }

+static __always_inline bool steal_account_process_tick(void)
+{
+#ifdef CONFIG_PARAVIRT
+	if (static_branch(&paravirt_steal_enabled)) {
+		u64 steal, st = 0;
+
+		steal = paravirt_steal_clock(smp_processor_id());
+		steal -= this_rq()->prev_steal_time;
+
+		st = steal_ticks(steal);
+		this_rq()->prev_steal_time += st * TICK_NSEC;
+
+		account_steal_time(st);
+		return st;
+	}
+#endif
+	return false;
+}
+
 #ifndef CONFIG_VIRT_CPU_ACCOUNTING

 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
@@ -3875,6 +3912,9 @@
 	cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
 	cputime64_t tmp = cputime_to_cputime64(cputime_one_jiffy);
 	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+
+	if (steal_account_process_tick())
+		return;

 	if (irqtime_account_hi_update()) {
 		cpustat->irq = cputime64_add(cpustat->irq, tmp);
@@ -3928,6 +3968,9 @@
 		irqtime_account_process_tick(p, user_tick, rq);
 		return;
 	}
+
+	if (steal_account_process_tick())
+		return;

 	if (user_tick)
 		account_user_time(p, cputime_one_jiffy, one_jiffy_scaled);


Added documentation for graph_bf_visitor header

--- include/votca/tools/graph_bf_visitor.h
+++ include/votca/tools/graph_bf_visitor.h
@@ -23,9 +23,12 @@
 #include <votca/tools/graphvisitor.h>
 #include <deque>
 #include <queue>
+
 /**
- * \brief A graph visitor that explores the graph, in a breadth first (BF)
- *        , and first in first out order.
+ * \brief A breadth first (BF) graph visitor
+ *
+ * This graph visitor will explore the vertices closest to the starting node
+ * first and proceed outwards.
  *
  */
 namespace votca {
@@ -40,6 +43,8 @@

     std::deque<std::queue<Edge>> edge_que_;

+    /// The core of the breadth first visitor is in how the edges are added
+    /// to the queue in this function
     void addEdges_(Graph& g, int vertex);
     Edge getEdge_(Graph g);
   public:


Oops, fix typo.

Oops, fix typo.

--- ldso/ldso/i386/dl-sysdep.h
+++ ldso/ldso/i386/dl-sysdep.h
@@ -76,6 +76,6 @@
 	do {
 		Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);

-		*reloc_addr =  load_off;
+		*reloc_addr += load_off;
 	} while (--relative_count);
 }


BUG: in SetFixedImage, a failure to check for NULL pointer caused crashes.

--- Code/Review/itkOptImageToImageMetric.h
+++ Code/Review/itkOptImageToImageMetric.h
@@ -163,11 +163,14 @@
   /** Connect the Fixed Image.  */
   void SetFixedImage( const FixedImageType * _arg)
     {
-    itkDebugMacro("setting FixedImage to " << _arg );
+    itkDebugMacro("Setting FixedImage to " << _arg );
     if( this ->m_FixedImage != _arg )
       {
       this->m_FixedImage = _arg;
-      m_FixedImageRegion = m_FixedImage->GetLargestPossibleRegion();
+      if (m_FixedImage)
+        {
+        m_FixedImageRegion = m_FixedImage->GetLargestPossibleRegion();
+        }
       this->Modified();
       }
     }


Fixed a documentation typo

Fixed a documentation typo

--- cpu/cc2430/dev/cc2430_rf.c
+++ cpu/cc2430/dev/cc2430_rf.c
@@ -234,7 +234,7 @@
   * Set MAC addresses
   *
   * \param pan The PAN address to set
-  * \param adde The short address to set
+  * \param addr The short address to set
   * \param ieee_addr The 64-bit IEEE address to set
   */
 void


sched: remove __rq_clock()

sched: remove __rq_clock()

remove the (now unused) __rq_clock() function.

Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- kernel/sched.c
+++ kernel/sched.c
@@ -361,13 +361,6 @@
 		__update_rq_clock(rq);
 }

-static u64 __rq_clock(struct rq *rq)
-{
-	__update_rq_clock(rq);
-
-	return rq->clock;
-}
-
 /*
  * The domain tree (rq->sd) is protected by RCU's quiescent state transition.
  * See detach_destroy_domains: synchronize_sched for details.


fix error

fix error

--- cpu/cc2538/dev/cc2538-rf.c
+++ cpu/cc2538/dev/cc2538-rf.c
@@ -961,7 +961,7 @@
     if(size != sizeof(rtimer_clock_t) || !dest) {
       return RADIO_RESULT_INVALID_VALUE;
     }
-    *(rtimer_clock_t*)dest = cc2538_sfd_rtime;
+    *(rtimer_clock_t*)dest = get_sfd_timestamp();
     return RADIO_RESULT_OK;
   }


Small note about improving the Client API

svn path=/trunk/KDE/kdenetwork/kopete/; revision=615570

--- protocols/messenger/libpapillon/include/Papillon/client.h
+++ protocols/messenger/libpapillon/include/Papillon/client.h
@@ -33,8 +33,8 @@

 // TODO APIDOX, add a reference about connector model.
 /**
- * @brief Client to Windows Live Messenger.
- * This is the main interface between the client application (ex: Kopete, papillon-telepathy, etc...) and
+ * @brief Client to Windows Live Messenger service.
+ * This is the main interface between the client application (ex: Kopete, telepathy-papillon, etc.) and
  * the Windows Live Messenger service.
  *
  * Papillon::Client need a valid Papillon::Connector objet to be used.
@@ -59,6 +59,7 @@

 	/**
 	 * @brief Create a new SecureStream ready to be used.
+	 *
 	 * You must delete the SecureStream instance yourself.
 	 *
 	 * @return the new SecureStream instance.
@@ -107,6 +108,7 @@
 	 */
 	void disconnected();

+	// TODO: Move those signals in Contact class
 	/**
 	 * Emitted when a contact change his status
 	 * @param contactId Contact ID
@@ -122,6 +124,8 @@
 	void contactStatusMessageChanged(const QString &contactId, const Papillon::StatusMessage &newStatusMessage);

 public slots:
+	// FIXME: Maybe merge connectToServer and setInitialOnlineStatus
+	// FIXME: Maybe remove login or put it in private section
 	/**
 	 * @brief Connect to Windows Live Messenger
 	 * If no arguments are passed, it use the default server and port used by
@@ -145,6 +149,7 @@
 	 */
 	void setInitialOnlineStatus(Papillon::OnlineStatus::Status status);

+	// TODO: Move these methods to ClientInfo or UserContact
 	/**
 	 * @brief Change our current online status
 	 * @param status Given online status


Fix an occurance of __attribute which should have been __attribute__
by converting the entire line to __packed.

ok kettenis@

--- compat/ibcs2/ibcs2_timeb.h
+++ compat/ibcs2/ibcs2_timeb.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ibcs2_timeb.h,v 1.5 2000/12/06 21:13:19 mickey Exp $	*/
+/*	$OpenBSD: ibcs2_timeb.h,v 1.6 2009/01/07 12:52:46 jsg Exp $	*/
 /*	$NetBSD: ibcs2_timeb.h,v 1.2 1996/05/03 17:05:34 christos Exp $	*/

 /*
@@ -39,7 +39,7 @@
 	unsigned short millitm;
 	short timezone;
 	short dstflag;
-} __attribute((__packed__));
+} __packed;

 #define xenix_timeb_len 10      /* packed struct */


drm-plugin: Segfault starting disabled connectors.

drm_device_add_monitor (device=0x8079790, connector=58, prefered_mode=0x0) at /usr/src/debug/drm-surfman-plugin/0+gitAUTOINC+3263678cd1-r0/git/plugins/drm/src/device.c:136
0xb7bfda7c in drm_monitors_scan (device=0x8079790) at /usr/src/debug/drm-surfman-plugin/0+gitAUTOINC+3263678cd1-r0/git/plugins/drm/src/monitor.c:106
0xb7bfaa33 in drm_device_init (path=0x8078ea0 "/dev/dri/card0", ops=0xb7c06db0 <i915_ops>)

LibDRM will not report connector modes:
    (modes == NULL && count_modes == 0)
if the connector has DPMS off.

Signed-off-by: Eric Chanudet <chanudete@ainfosec.com>

OXT-1674

--- plugins/drm/src/monitor.c
+++ plugins/drm/src/monitor.c
@@ -183,9 +183,18 @@
                     r->connectors[i], device->devnode, strerror(errno));
             continue;
         }
+
+        /* Disable DPMS now. LibDRM does not report prefered mode on disabled
+         * monitors. */
+        drmModeSetDpmsProp(device->fd, c, DRM_MODE_DPMS_ON);
+
         /* TODO: ok there's not many monitors for now... But complexity is pretty high
          *       there... Should be hash-tables really... */
         if (c->connection == DRM_MODE_CONNECTED) {
+            if (!c->count_modes) {
+                rc = -ENOENT;
+                break; /* The monitor does not report modes, skip it. */
+            }
             /* Either known or newly connected monitor. */
             if (!drm_device_add_monitor(device, c->connector_id, &c->modes[0])) {
                 rc = -ENOMEM;


kernel/sched: More nonatomic swap fixes

kernel/sched: More nonatomic swap fixes

Nonatomic swap strikes again.  These issues are all longstanding, but
were unmasked by the dlist work in commit d40b8ce1fb5a ("sys: dlist:
Add sys_dnode_is_linked") where list node pointers become nulls on
removal.

The previous fix was for a specific case where a timeslicing interrupt
would try to slice out the "wrong" current thread because the thread
has "just" pended itself.  That was incomplete, because the parallel
code in k_sleep() didn't flag itself the same way.

And beyond that, it turns out to be basically impossible (now that I'm
thinking about it correctly) to prevent interrupt code from calling
into the scheduler to suspend a "just pended but not quite" current
and/or preempt away to another thread.  In any of these cases, the
scheduler modifications to the state bits remain correct but the queue
nodes may be corrupt because the thread was already removed from the
ready queue.  So we have to test and correct this at the lowest level,
where a thread is being removed from a priq: check that it's (1) the
ready queue and not a waitq, (2) the current thread, and (3) already
marked suspended and thus not in the queue.

There are lots of existing issues filed in the last few months all
pointing to odd instability on ARM platforms.  I'm reasonably certain
this is the root cause for most or all of them.

Signed-off-by: Andy Ross <c70f9a6bf6ee0cd69c8af4ce5e6b131945769315@intel.com>

--- kernel/sched.c
+++ kernel/sched.c
@@ -619,6 +619,13 @@

 void _priq_dumb_remove(sys_dlist_t *pq, struct k_thread *thread)
 {
+#if defined(CONFIG_SWAP_NONATOMIC) && defined(CONFIG_SCHED_DUMB)
+	if (pq == &_kernel.ready_q.runq && thread == _current &&
+	    _is_thread_prevented_from_running(thread)) {
+		return;
+	}
+#endif
+
 	__ASSERT_NO_MSG(!_is_idle(thread));

 	sys_dlist_remove(&thread->base.qnode_dlist);
@@ -676,6 +683,12 @@

 void _priq_rb_remove(struct _priq_rb *pq, struct k_thread *thread)
 {
+#if defined(CONFIG_SWAP_NONATOMIC) && defined(CONFIG_SCHED_SCALABLE)
+	if (pq == &_kernel.ready_q.runq && thread == _current &&
+	    _is_thread_prevented_from_running(thread)) {
+		return;
+	}
+#endif
 	__ASSERT_NO_MSG(!_is_idle(thread));

 	rb_remove(&pq->tree, &thread->base.qnode_rb);
@@ -712,6 +725,12 @@

 ALWAYS_INLINE void _priq_mq_remove(struct _priq_mq *pq, struct k_thread *thread)
 {
+#if defined(CONFIG_SWAP_NONATOMIC) && defined(CONFIG_SCHED_MULTIQ)
+	if (pq == &_kernel.ready_q.runq && thread == _current &&
+	    _is_thread_prevented_from_running(thread)) {
+		return;
+	}
+#endif
 	int priority_bit = thread->base.prio - K_HIGHEST_THREAD_PRIO;

 	sys_dlist_remove(&thread->base.qnode_dlist);
@@ -893,6 +912,9 @@
 	struct k_spinlock local_lock = {};
 	k_spinlock_key_t key = k_spin_lock(&local_lock);

+#if defined(CONFIG_TIMESLICING) && defined(CONFIG_SWAP_NONATOMIC)
+	pending_current = _current;
+#endif
 	_remove_thread_from_ready_q(_current);
 	_add_thread_timeout(_current, ticks);


add rtc_time implementation for native

add rtc_time implementation for native

--- cpu/native/rtc/posix-rtc.c
+++ cpu/native/rtc/posix-rtc.c
@@ -68,3 +68,17 @@
         _native_in_syscall--;
     }
 }
+
+time_t rtc_time(struct timeval *time)
+{
+    if (native_rtc_enabled == 1) {
+        _native_in_syscall++;
+        if (gettimeofday(time, 0) == 0) {
+            errx(1, "rtc_time: gettimeofday: error");
+        }
+        _native_in_syscall--;
+    }
+    return time->tv_sec;
+}
+
+


Fix #3408: lengthen the idle GC time to 5s for GHC/GHCi.

--- compiler/parser/hschooks.c
+++ compiler/parser/hschooks.c
@@ -5,7 +5,6 @@
 */

 #include "Rts.h"
-#include "RtsFlags.h"

 #include "HsFFI.h"

@@ -22,6 +21,10 @@
     RtsFlags.GcFlags.maxStkSize         = 512*1024*1024 / sizeof(W_);
     RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
     RtsFlags.GcFlags.statsFile = stderr;
+
+    // See #3408: the default idle GC time of 0.3s is too short on
+    // Windows where we receive console events once per second or so.
+    RtsFlags.GcFlags.idleGCDelayTime = 5*1000;
 }

 void


restructure work

restructure work

--- kernel/shell.c
+++ kernel/shell.c
@@ -257,14 +257,13 @@
 void shell_init()
 {

+    shellStack = stack_create(shellBuffer, SHELL_BUFFER_SIZE);
+
     screen_puts("Fudge\n");
     screen_puts("Copyright (c) 2009 Jens Nyberg\n");
     screen_puts("Type 'help' for a list of commands.\n\n");

     shell_clear();
-
-    shellStack = stack_create(shellBuffer, SHELL_BUFFER_SIZE);
-
     shell_poll();

 }


stm32l1/timer: fix callback argument initialization

--- cpu/stm32l1/periph/timer.c
+++ cpu/stm32l1/periph/timer.c
@@ -56,7 +56,7 @@
     tim = _tim(dev);
     /* save callback */
     isr_ctx[dev].cb = cb;
-    isr_ctx[dev].cb = arg;
+    isr_ctx[dev].arg = arg;
     /* enable peripheral clock */
     RCC->APB1ENR |= (1 << timer_config[dev].rcc);
     /* reset timer and configure to up-counting mode */


[imcc] Converted todo items into RT tickets

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@21992 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/imcc/optimizer.c
+++ compilers/imcc/optimizer.c
@@ -47,7 +47,7 @@
  * cfg_optimize may be called multiple times during the construction of the
  * CFG depending on whether or not it finds anything to optimize.
  *
- * XXX: subst_constants ... rewrite e.g. add_i_ic_ic -- where does this happen?
+ * RT#46277: subst_constants ... rewrite e.g. add_i_ic_ic -- where does this happen?
  *
  * optimizer
  * ---------
@@ -56,7 +56,7 @@
  *
  * used_once ... deletes assignments, when LHS is unused
  * loop_optimization ... pulls invariants out of loops
- * TODO e.g. constant_propagation
+ * RT#46279 e.g. constant_propagation
  *
  * post_optimizer: currently pcc_optimize in pcc.c
  * ---------------
@@ -148,7 +148,7 @@

     if (IMCC_INFO(interp)->optimizer_level & OPT_PRE) {
         IMCC_info(interp, 2, "pre_optimize\n");
-        /* TODO integrate all in one pass */
+        /* RT#46281 integrate all in one pass */
         changed += strength_reduce(interp, unit);
         if (!IMCC_INFO(interp)->dont_optimize)
             changed += if_branch(interp, unit);
@@ -174,7 +174,7 @@
             return 1;
         if (branch_reorg(interp, unit))
             return 1;
-        /* XXX cfg / loop detection breaks e.g. in t/compiler/5_3 */
+        /* RT#46283 cfg / loop detection breaks e.g. in t/compiler/5_3 */
         if (unused_label(interp, unit))
             return 1;
         if (dead_code_remove(interp, unit))
@@ -1166,7 +1166,7 @@
 }

 /*
- * Removes unused labels. A label is unused if ... [XXX: finish this].
+ * Removes unused labels. A label is unused if ... [RT#46287: finish this].
  *
  * Returns TRUE if any optimizations were performed. Otherwise, returns
  * FALSE.
@@ -1402,7 +1402,7 @@
                 return reason=4,0;
             if (!strcmp(ins->op, "clone"))
                 return reason=4,0;
-            /* indexed set/get ??? XXX, as index is ok */
+            /* indexed set/get ??? RT#46289, as index is ok */
             if (0 && ! strcmp(ins->op, "set") && nregs != 2)
                 return reason=5,0;
             /*
@@ -1527,7 +1527,7 @@
         insert_ins(unit, (*ins)->prev, tmp);
     }
     ostat.invariants_moved++;
-    /* XXX CFG is changed here, which also means
+    /* RT#46291 CFG is changed here, which also means
      * that the life_info is wrong now
      * so, currently we calc CFG and life again */
     return 1;


basemixer: Remove pads associated with a port when it is unhandled

Change-Id: I2b419850aabd28eb575493df0caadf159ad328b6

--- kmsbasemixer.c
+++ kmsbasemixer.c
@@ -391,6 +391,32 @@
 }

 static void
+kms_base_mixer_remove_port_pad (KmsBaseMixer * mixer, gint id,
+    const gchar * pad_prefix)
+{
+  gchar *pad_name = g_strdup_printf ("%s%d", pad_prefix, id);
+  GstPad *pad = gst_element_get_static_pad (GST_ELEMENT (mixer), pad_name);
+
+  GST_DEBUG_OBJECT (mixer, "Trying to remove pad: %s -> %" GST_PTR_FORMAT,
+      pad_name, pad);
+
+  if (pad != NULL) {
+    gst_element_remove_pad (GST_ELEMENT (mixer), pad);
+    g_object_unref (pad);
+  }
+  g_free (pad_name);
+}
+
+static void
+kms_base_mixer_remove_port_pads (KmsBaseMixer * mixer, gint id)
+{
+  kms_base_mixer_remove_port_pad (mixer, id, AUDIO_SRC_PAD_PREFIX);
+  kms_base_mixer_remove_port_pad (mixer, id, AUDIO_SINK_PAD_PREFIX);
+  kms_base_mixer_remove_port_pad (mixer, id, VIDEO_SRC_PAD_PREFIX);
+  kms_base_mixer_remove_port_pad (mixer, id, VIDEO_SINK_PAD_PREFIX);
+}
+
+static void
 kms_base_mixer_unhandle_port (KmsBaseMixer * mixer, gint id)
 {
   KmsBaseMixerPortData *port_data;
@@ -406,7 +432,9 @@
   GST_DEBUG ("Removing element: %" GST_PTR_FORMAT, port_data->port);

   KMS_BASE_MIXER_LOCK (mixer);
-  // TODO: Unlink end_point from mixer
+
+  kms_base_mixer_remove_port_pads (mixer, id);
+
   g_hash_table_remove (mixer->priv->ports, &id);
   KMS_BASE_MIXER_UNLOCK (mixer);
 }


Got the emptyset singleton test to pass.

--- src/empty-set.c
+++ src/empty-set.c
@@ -21,9 +21,7 @@
 static void compilerkit_empty_set_finalize (GObject* object);
 static void compilerkit_empty_set_dispose (GObject* object);
 static GObject *compilerkit_empty_set_new (void);
-
-//static instance of EmptySet
-static	CompilerKitEmptySet* empty_set_instance;
+static GObject *compilerkit_empty_set_constructor (GType gtype, guint n_properties, GObjectConstructParam *properties);

 /**
  * compilerkit_empty_set_class_init:
@@ -36,14 +34,15 @@
 static void
 compilerkit_empty_set_class_init (CompilerKitEmptySetClass *klass)
 {
-  GObjectClass *g_object_class;
-
-  /* Get the parent gobject class */
-  g_object_class = G_OBJECT_CLASS(klass);
-
-  /* Hook finalization functions */
-  g_object_class->dispose = compilerkit_empty_set_dispose;   /* instance destructor, reverse of init */
-  g_object_class->finalize = compilerkit_empty_set_finalize; /* class finalization, reverse of class init */
+    GObjectClass *g_object_class;
+
+    /* Get the parent gobject class */
+    g_object_class = G_OBJECT_CLASS(klass);
+
+    g_object_class->constructor = compilerkit_empty_set_constructor;
+    /* Hook finalization functions */
+    g_object_class->dispose = compilerkit_empty_set_dispose;   /* instance destructor, reverse of init */
+    g_object_class->finalize = compilerkit_empty_set_finalize; /* class finalization, reverse of class init */
 }

 /**
@@ -73,6 +72,29 @@
 }

 /**
+ * compilerkit_empty_set_constructor:
+ * This overrides the default constructor for GObject to implement the singleton pattern.
+ * This borrows from: <http://blogs.gnome.org/xclaesse/2010/02/11/how-to-make-a-gobject-singleton/>
+ * @pre Unsure ;-)
+ * @param GType The GObject type to construct.
+ * @param gunit The number of properties (there aren't any here).
+ * @param GObjectConstructParam* A pointer to GObject properties (there aren't any here).
+ * @return A new reference to the single instance of CompilerKitEmptySet.
+ */
+static GObject *compilerkit_empty_set_constructor (GType gtype, guint n_properties, GObjectConstructParam *properties)
+{
+    // Static instance of EmptySet
+    static GObject *self = NULL;
+
+    if (self == NULL) {
+        self = G_OBJECT_CLASS (compilerkit_empty_set_parent_class)->constructor (gtype, n_properties, properties);
+        g_object_add_weak_pointer (self, (gpointer) &self);
+        return self;
+    }
+    return g_object_ref (self);
+}
+
+/**
  * compilerkit_empty_set_get_instance:
  * @fn compilerkit_empty_set_get_instance
  * @memberof CompilerKitEmptySet
@@ -83,12 +105,7 @@
  */
 GObject *compilerkit_empty_set_get_instance (void)
 {
-	if(empty_set_instance == NULL)
-	{
-		empty_set_instance = compilerkit_empty_set_new();
-	}
-
-	return COMPILERKIT_EMPTY_SET(empty_set_instance);
+    return compilerkit_empty_set_new ();
 }

 /**
@@ -102,7 +119,7 @@
 static void
 compilerkit_empty_set_finalize (GObject* object)
 {
-	//G_OBJECT_CLASS (compilerkit_empty_set_parent_class)->finalize (object);
+	G_OBJECT_CLASS (compilerkit_empty_set_parent_class)->finalize (object);
 }

 /**
@@ -116,7 +133,7 @@
 static void
 compilerkit_empty_set_dispose (GObject* object)
 {
-  //CompilerKitEmptySet *self = COMPILERKIT_EMPTY_SET (object);
-
-  //G_OBJECT_CLASS (compilerkit_empty_set_parent_class)->dispose (object);
+    CompilerKitEmptySet *self = COMPILERKIT_EMPTY_SET (object);
+
+    G_OBJECT_CLASS (compilerkit_empty_set_parent_class)->dispose (object);
 }


[PATCH (DirectFB)] inputdrivers: set DICAPS_KEYS/DIDCAPS_KEYS only for input devices with keys

DICAPS_KEYS/DIDCAPS_KEYS is set in DFBInputDeviceCapabilities for all linux
input devices that have the EV_KEY bit set: keyboards, buttons, or other
key-like devices. This patch sets DICAPS_KEYS/DIDCAPS_KEYS only for input
devices with keys.

Signed-off-by: Thouraya ANDOLSI <thouraya.andolsi@st.com>

Thanks!!!

--- inputdrivers/linux_input/linux_input.c
+++ inputdrivers/linux_input/linux_input.c
@@ -1067,12 +1067,6 @@
      if (test_bit( EV_KEY, evbit )) {
           int i;

-#ifndef DIRECTFB_DISABLE_DEPRECATED
-          info->desc.caps |= DICAPS_KEYS;
-#else
-          info->desc.caps |= DIDCAPS_KEYS;
-#endif
-
           /* get keyboard bits */
           ioctl( fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit );

@@ -1096,6 +1090,14 @@
           for (i=BTN_MOUSE; i<BTN_JOYSTICK; i++)
                if (test_bit( i, keybit ))
                     num_buttons++;
+
+          if (num_keys || num_ext_keys)
+#ifndef DIRECTFB_DISABLE_DEPRECATED
+               info->desc.caps |= DICAPS_KEYS;
+#else
+               info->desc.caps |= DIDCAPS_KEYS;
+#endif
+
      }

      if (test_bit( EV_REL, evbit )) {


net: bcmgenet: avoid unbalanced enable_irq_wake calls

Multiple enable_irq_wake() calls will keep increasing the IRQ
wake_depth, which ultimately leads to the following types of
situation:

1) enable Wake-on-LAN interrupt w/o password
2) enable Wake-on-LAN interrupt w/ password
3) enable Wake-on-LAN interrupt w/o password
4) disable Wake-on-LAN interrupt

After step 4), GENET would always wake-up the system no matter what
wake-up device we use, which is not what we want. Fix this by making
sure there are no unbalanced enable_irq_wake() calls.

Signed-off-by: Florian Fainelli <59190c1867e3222b932a0de3c668eb2d980d69a2@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


Oh the joys of calloc

Oh the joys of calloc

--- src/grammar_handlers.c
+++ src/grammar_handlers.c
@@ -88,8 +88,6 @@
 ASTNode* create_empty_manynodes(void) {
     ASTNode* manynodes = create_ast_node(NODE_MANYNODES);
     manynodes->nodes = calloc(1, sizeof(*manynodes->nodes));
-    manynodes->nodes->num_nodes = 0;
-    manynodes->nodes->nodes = NULL;

     return manynodes;
 }


input: handle button devices with just up/down keys as remote control

This is mostly useful for front panels which might just have
up/down/left/right and maybe a few more buttons. Now they are handled
as remote controls, too

Signed-off-by: André Draszik <4a4cb09e7b43b167f95b1dc166b9a7dec9f65d7c@st.com>

--- inputdrivers/linux_input/linux_input.c
+++ inputdrivers/linux_input/linux_input.c
@@ -990,10 +990,18 @@
           /* get keyboard bits */
           ioctl( fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit );

-	  /**  count typical keyboard keys only */
+          /* count typical keyboard keys only */
           for (i=KEY_Q; i<=KEY_M; i++)
                if (test_bit( i, keybit ))
                     num_keys++;
+
+          /* this might be a keyboard with just cursor keys, typically found
+             on front panels - handle as remote control and make sure not to
+             treat normal (full key) keyboards likewise */
+          if (!num_keys)
+               for (i=KEY_HOME; i<=KEY_PAGEDOWN; i++)
+                    if (test_bit( i, keybit ))
+                         num_ext_keys++;

           for (i=KEY_OK; i<KEY_CNT; i++)
                if (test_bit( i, keybit ))


cxgb3: use kvfree() in cxgb_free_mem()

cxgb3: use kvfree() in cxgb_free_mem()

Use kvfree() instead of open-coding it.

Signed-off-by: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org>
Cc: Santosh Raspatur <117a211f76f0aa5fbc9b7143b793fdbaf7088c03@chelsio.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


point3d: Optimize vec3 → point3d initializer

We call this a fair amount; we can shave some time by avoiding the
single channel reads in favour of a single memcpy.

--- src/graphene-point3d.c
+++ src/graphene-point3d.c
@@ -98,13 +98,11 @@
   return p;
 }

-static graphene_point3d_t *
-graphene_point3d_init_from_simd4f (graphene_point3d_t *p,
-                                   graphene_simd4f_t   v)
-{
-  p->x = graphene_simd4f_get_x (v);
-  p->y = graphene_simd4f_get_y (v);
-  p->z = graphene_simd4f_get_z (v);
+static inline graphene_point3d_t *
+graphene_point3d_init_from_simd4f (graphene_point3d_t      *p,
+                                   const graphene_simd4f_t  v)
+{
+  graphene_simd4f_dup_3f (v, &p[0]);

   return p;
 }


Removed [[nodiscard]] annotation

Removed [[nodiscard]] annotation

--- src/BabylonCpp/include/babylon/states/stencil_state.h
+++ src/BabylonCpp/include/babylon/states/stencil_state.h
@@ -39,22 +39,22 @@
   void apply(GL::IGLRenderingContext& gl);

 protected:
-  [[nodiscard]] bool get_isDirty() const;
-  [[nodiscard]] unsigned int get_stencilFunc() const;
+  bool get_isDirty() const;
+  unsigned int get_stencilFunc() const;
   void set_stencilFunc(unsigned int value);
-  [[nodiscard]] int get_stencilFuncRef() const;
+  int get_stencilFuncRef() const;
   void set_stencilFuncRef(int value);
-  [[nodiscard]] unsigned int get_stencilFuncMask() const;
+  unsigned int get_stencilFuncMask() const;
   void set_stencilFuncMask(unsigned int value);
-  [[nodiscard]] unsigned int get_stencilOpStencilFail() const;
+  unsigned int get_stencilOpStencilFail() const;
   void set_stencilOpStencilFail(unsigned int value);
-  [[nodiscard]] unsigned int get_stencilOpDepthFail() const;
+  unsigned int get_stencilOpDepthFail() const;
   void set_stencilOpDepthFail(unsigned int value);
-  [[nodiscard]] unsigned int get_stencilOpStencilDepthPass() const;
+  unsigned int get_stencilOpStencilDepthPass() const;
   void set_stencilOpStencilDepthPass(unsigned int value);
-  [[nodiscard]] unsigned int get_stencilMask() const;
+  unsigned int get_stencilMask() const;
   void set_stencilMask(unsigned int value);
-  [[nodiscard]] bool get_stencilTest() const;
+  bool get_stencilTest() const;
   void set_stencilTest(bool value);

 public:


Fix mistakes in samples/monster.c

Fix mistakes in samples/monster.c

--- samples/monster/monster.c
+++ samples/monster/monster.c
@@ -86,9 +86,6 @@
         //
         // Note that the Equipment union only take up one argument in C, where
         // C++ takes a type and an object argument.
-        //
-        // Also note that unlike C++ we do not use `&pos` because `pos`
-        // is already a reference type.
         ns(Monster_create_as_root(B, &pos, mana, hp, name, inventory, ns(Color_Red),
                              weapons, equipped));

@@ -182,7 +179,6 @@
         ns(Weapon_damage_add(B, 3));
         ns(Monster_weapons_push_end(B));
         ns(Monster_weapons_push_start(B));
-        ns(Monster_weapons_push_start(B));
         ns(Weapon_name_create_str(B, "Axe"));
         ns(Weapon_damage_add(B, 5));
         axe = *ns(Monster_weapons_push_end(B));


i40e: remove extra register write

i40e: remove extra register write

This write done at the end of VF reset and should not be performed here.

Change-ID: I4d89813b68c6173184293868a6f26cf559bc2405
Signed-off-by: Mitch Williams <acfbed6236bdabd688e979c4a715822951672d73@intel.com>
Signed-off-by: Jesse Brandeburg <e6047e445db6578741afb14ef640164ef6b65e4f@intel.com>
Signed-off-by: Aaron Brown <4723df1d9a4136f7b76e1bf6434e33afc91d2139@intel.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


Unused code removal.

Unused code removal.

svn path=/trunk/libavg/; revision=5233

--- src/graphics/Pixel32.h
+++ src/graphics/Pixel32.h
@@ -57,7 +57,6 @@
     void operator +=(const Pixel32 pix);
     void operator -=(const Pixel32 pix);
     Pixel32 operator *(float f) const;
-    operator unsigned int() const;

     // Simple and fast 'distance' between two pixels. Just adds the
     // distances between the color components and treats colors
@@ -198,11 +197,6 @@
           (unsigned char)(f*getG()),
           (unsigned char)(f*getB()));
 }
-
-inline Pixel32::operator unsigned int() const
-{
-    return *(unsigned int*)(m_Data);
-}

 }
 #endif


i40evf: don't lie to ethtool

i40evf: don't lie to ethtool

Don't tell ethtool that the VF can do 10GbaseT, when it really has no
idea what its link speed is. Set the supported values to 0 instead.
Suggested by Ben Hutchings.

CC: Ben Hutchings <73675debcd8a436be48ec22211dcf44fe0df0a64@decadent.org.uk>
Change-ID: Iceb0d8af68fe5d8dc13224366979ba701ba89c39
Signed-off-by: Mitch Williams <acfbed6236bdabd688e979c4a715822951672d73@intel.com>
Tested-by: Sibai Li <7b32709b4fa5663a47e0d1f9518bcee0920157c8@intel.com>
Signed-off-by: Jeff Kirsher <87e35f5be20bb3e67f4ba6b86f5f6be3085b1b3a@intel.com>


brcmfmac: cleanup helper functions in sdio probe path

Moving code from helper functions to the calling function
as it makes code easier to read.

Reviewed-by: Hante Meuleman <31ca5aa57e9f47a38c33f2797b138069dfa82656@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <d101f7ec36e185d305862a92a05a9a0c1b62aa38@broadcom.com>
Signed-off-by: Arend van Spriel <06447fbe43693466d3293d0b5eaeeb2efd3d7d3a@broadcom.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>


brcmfmac: add missing curly braces in brcmf_fws_txstatus_suppressed()

The 0-day testing from Fenguang Wu issued the following warning:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master
head:   4b074b07625f603d40d4d04937f8874a00415dc4
commit: 1e86d69662d7d86360624f74bbe1b5fa1b8ffb13
    [33/59] brcmfmac: Update fwsignal to fix out of order tx.

>> drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1393:2-56:
    code aligned with following code on line 1394

vim +1393 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c

84bcc0c3  1387 	}
84bcc0c3  1388
84bcc0c3  1389 	entry->generation = genbit;
84bcc0c3  1390
2747e5f7  1391 	ret = brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
2747e5f7  1392 	if (ret == 0)
1e86d696 @1393 		brcmf_skb_htod_tag_set_field(skb, GENERATION, ..
1e86d696 @1394 		brcmf_skbcb(skb)->htod_seq = seq;
1e86d696  1395 		if (brcmf_skb_htod_seq_get_field(skb, FROMFW)) {
1e86d696  1396 			brcmf_skb_htod_seq_set_field(skb, ..
1e86d696  1397 			brcmf_skb_htod_seq_set_field(skb, ..

This warning is valid and the if statement needs curly braces here.

Reported-by: Fengguang Wu <24f7fe9d205c8a9f6ade0c2894e14303ca16087f@intel.com>
Reviewed-by: Hante Meuleman <31ca5aa57e9f47a38c33f2797b138069dfa82656@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <d101f7ec36e185d305862a92a05a9a0c1b62aa38@broadcom.com>
Signed-off-by: Arend van Spriel <06447fbe43693466d3293d0b5eaeeb2efd3d7d3a@broadcom.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>


From Fed: effc++ warning.

From Fed:
effc++ warning.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@33299 27541ba8-7e3a-0410-8455-c3a389f83636

--- core/metautils/inc/TClassEdit.h
+++ core/metautils/inc/TClassEdit.h
@@ -70,6 +70,7 @@

    private:
       TSplitType(const TSplitType&); // intentionally not implemented
+      TSplitType &operator=(const TSplitType &); // intentionally not implemented
    };

    std::string CleanType (const char *typeDesc,int mode = 0,const char **tail=0);


ADD: Fixed wrong SPI pins and added more functional pins

--- ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c
+++ ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c
@@ -33,9 +33,10 @@
     { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB27) },

     // SPI pins
-    { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA02) },
-    { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA03) },
-    { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA00) },
+    { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB02) },
+    { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB03) },
+    { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB00) },
+    { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PB01) },

     // I2C pins
     { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA16) },
@@ -51,19 +52,35 @@
     { MP_ROM_QSTR(MP_QSTR_TFT_SS),  MP_ROM_PTR(&pin_PB21) },
     { MP_ROM_QSTR(MP_QSTR_TFT_DC),  MP_ROM_PTR(&pin_PC06) },
     { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT),  MP_ROM_PTR(&pin_PC05) },
+    { MP_ROM_QSTR(MP_QSTR_TFT_RESET),  MP_ROM_PTR(&pin_PC07) },

-    // Special named pins
+    // SD Card
+    { MP_OBJ_NEW_QSTR(MP_QSTR_SD_MISO),  MP_ROM_PTR(&pin_PC18) },
+    { MP_OBJ_NEW_QSTR(MP_QSTR_SD_MOSI),  MP_ROM_PTR(&pin_PC16) },
+    { MP_OBJ_NEW_QSTR(MP_QSTR_SD_SCK),  MP_ROM_PTR(&pin_PC17) },
+    { MP_ROM_QSTR(MP_QSTR_SD_SS),  MP_ROM_PTR(&pin_PC19) },
+    { MP_ROM_QSTR(MP_QSTR_SD_DET),  MP_ROM_PTR(&pin_PC21) },
+
+    // Switch
     { MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_UP),  MP_ROM_PTR(&pin_PD20) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_LEFT),  MP_ROM_PTR(&pin_PD12) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_RIGHT),  MP_ROM_PTR(&pin_PD09) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_DOWN),  MP_ROM_PTR(&pin_PD08) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_PRESS),  MP_ROM_PTR(&pin_PD10) },
+
+    // Button
     { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_1),  MP_ROM_PTR(&pin_PC26) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_2),  MP_ROM_PTR(&pin_PC27) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_3),  MP_ROM_PTR(&pin_PC28) },
+
+    // Special named pins
     { MP_OBJ_NEW_QSTR(MP_QSTR_LIGHT),  MP_ROM_PTR(&pin_PD01) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_BUZZER),  MP_ROM_PTR(&pin_PD11) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_IR),  MP_ROM_PTR(&pin_PB31) },
+    { MP_OBJ_NEW_QSTR(MP_QSTR_MIC),  MP_ROM_PTR(&pin_PC30) },
+    { MP_ROM_QSTR(MP_QSTR_GYROSCOPE_SCL),  MP_ROM_PTR(&pin_PA12) },
+    { MP_ROM_QSTR(MP_QSTR_GYROSCOPE_SDA),  MP_ROM_PTR(&pin_PA13) },
+    { MP_ROM_QSTR(MP_QSTR_GYROSCOPE_INT),  MP_ROM_PTR(&pin_PC21) },

     // Comm objects
     { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },


FrequencyIn: do not raise in interrupt handler

--- ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
+++ ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
@@ -82,7 +82,8 @@
     #ifdef SAM_D5X_E5X
     NVIC_EnableIRQ(EIC_0_IRQn + self->channel);
     #endif
-    mp_raise_RuntimeError(translate("Frequency captured is above capability. Capture Paused."));
+    // Frequency captured is above capability. Capture paused.
+    // We can't raise an error here; we're in an interrupt handler.
 }

 void frequencyin_interrupt_handler(uint8_t index) {


core: Updated documentation of GrlMediaSourceResultCb

Signed-off-by: Juan A. Suarez Romero <af79b5692270b306571bb1d8bbe0285ae3ac93d9@igalia.com>

--- src/grl-media-source.h
+++ src/grl-media-source.h
@@ -83,7 +83,7 @@
  * @source: a media source
  * @operation_id: operation identifier
  * @media: (transfer full): a data transfer object
- * @remaining: the number of remaining #GrlMedia to process
+ * @remaining: the number of remaining #GrlMedia to process, or -1 if it is unknown
  * @user_data: user data passed to the used method
  * @error: (not-error) (type uint): possible #GError generated at processing
  *


解决pecl的方法名区分大小写

解决pecl的方法名区分大小写

--- pecl/SlightPHP_globals.c
+++ pecl/SlightPHP_globals.c
@@ -51,6 +51,8 @@
 	if (VCWD_REALPATH(Z_STRVAL(file_name), resolved_path_buff)) {
 		ret = SlightPHP_loadFile((char*)&resolved_path_buff TSRMLS_CC);
 		return ret;
+	}else{
+		debug("file[%s] not exists",Z_STRVAL(file_name));
 	}
 	return FAILURE;
 }
@@ -71,7 +73,6 @@
 			}
     	}
 	}
-	debug("file[%s] not exists",file_name);
 	return FAILURE;
 }
 int SlightPHP_run(zval*zone,zval*class_name,zval*method,zval**return_value, int param_count,zval ** params[] TSRMLS_DC){
@@ -112,12 +113,9 @@
 			if(rt) zval_dtor(rt);
 		}

-		if(zend_hash_exists(&Z_OBJCE_P(object)->function_table, Z_STRVAL(real_method_zval), Z_STRLEN(real_method_zval)+1)){
-			if(call_user_function_ex(&Z_OBJCE_P(object)->function_table, &object, &real_method_zval, return_value, param_count, params, 0,NULL TSRMLS_CC)!=SUCCESS){
-			}else{
-			}
+		if(call_user_function_ex(&Z_OBJCE_P(object)->function_table, &object, &real_method_zval, return_value, param_count, params, 0,NULL TSRMLS_CC)!=SUCCESS){
+			debug("method[%s] not exists in class[%s]",Z_STRVAL(real_method_zval),Z_STRVAL(real_classname_zval));
 		}else{
-			debug("method[%s] not exists in class[%s]",Z_STRVAL(real_method_zval),Z_STRVAL(real_classname_zval));
 			return FAILURE;
 		}
 		FREE_ZVAL(object);


halcmd: change flow to ease cleanup

halcmd: change flow to ease cleanup

Future code that has to clean up allocated memory will need
a flow control structure that always reaches the next statement beyond
the case statement.  Provide the necessary structure.

--- src/hal/utils/halcmd.c
+++ src/hal/utils/halcmd.c
@@ -317,6 +317,7 @@
             return -EINVAL;
         }
     } else {
+	int result = -EINVAL;
 	int is_optional = command->type & A_OPTIONAL,
 	    is_plus = command->type & A_PLUS,
 	    nargs = command->type & 0xff,
@@ -350,62 +351,64 @@

 	switch(nargs | is_plus) {
 	case A_ZERO: {
-	    return command->func();
+	    result = command->func();
 	    break;
 	}

 	case A_PLUS: {
 	    int(*f)(char **args) = (int(*)(char**))command->func;
-	    return f(REST(1));
+	    result = f(REST(1));
 	    break;
 	}

 	case A_ONE: {
 	    int(*f)(char *arg) = (int(*)(char*))command->func;
-	    return f(ARG(1));
+	    result = f(ARG(1));
 	    break;
 	}

 	case A_ONE | A_PLUS: {
 	    int(*f)(char *arg, char **rest) =
                 (int(*)(char*,char**))command->func;
-	    return f(ARG(1), REST(2));
+	    result = f(ARG(1), REST(2));
 	    break;
 	}

 	case A_TWO: {
 	    int(*f)(char *arg, char *arg2) =
                 (int(*)(char*,char*))command->func;
-	    return f(ARG(1), ARG(2));
+	    result = f(ARG(1), ARG(2));
 	    break;
 	}

 	case A_TWO | A_PLUS: {
 	    int(*f)(char *arg, char *arg2, char **rest) =
                 (int(*)(char*,char*,char**))command->func;
-	    return f(ARG(1), ARG(2), REST(3));
+	    result = f(ARG(1), ARG(2), REST(3));
 	    break;
 	}

 	case A_THREE: {
 	    int(*f)(char *arg, char *arg2, char *arg3) =
                 (int(*)(char*,char*,char*))command->func;
-	    return f(ARG(1), ARG(2), ARG(3));
+	    result = f(ARG(1), ARG(2), ARG(3));
 	    break;
 	}

 	case A_THREE | A_PLUS: {
 	    int(*f)(char *arg, char *arg2, char *arg3, char **rest) =
                 (int(*)(char*,char*,char*,char**))command->func;
-	    return f(ARG(1), ARG(2), ARG(3), REST(4));
+	    result = f(ARG(1), ARG(2), ARG(3), REST(4));
 	    break;
 	}

 	default:
 	    halcmd_error("BUG: unchandled case: command=%s type=0x%x",
 		command->name, command->type);
-	    return -EINVAL;
-	}
+	    result = -EINVAL;
+	}
+
+        return result;
     }
 }


Use MaxClients instead of hard-coded 64

Use MaxClients instead of hard-coded 64

--- projects/engine/src/include/Networking/NetworkTypes.h
+++ projects/engine/src/include/Networking/NetworkTypes.h
@@ -22,7 +22,7 @@

 		template <typename Stream> bool Serialize(Stream & stream)
 		{
-			serialize_int(stream, m_playerID, 0, 64);
+			serialize_int(stream, m_playerID, 0, yojimbo::MaxClients);
 			serialize_bool(stream, m_connect);
 			return true;
 		}
@@ -42,7 +42,7 @@
 		template <typename Stream> bool Serialize(Stream & stream)
 		{
 			int numOtherPlayers = static_cast<int>(m_otherPlayers.size());
-			serialize_int(stream, numOtherPlayers, 0, 64);
+			serialize_int(stream, numOtherPlayers, 0, yojimbo::MaxClients);

 			if (Stream::IsReading)
 			{
@@ -51,7 +51,7 @@

 			for (int i = 0; i < numOtherPlayers; ++i)
 			{
-				serialize_int(stream, m_otherPlayers[i], 0, 64);
+				serialize_int(stream, m_otherPlayers[i], 0, yojimbo::MaxClients);
 			}

 			return true;


qemu: drop unused variable

qemu: drop unused variable

The g_auto conversion made clang realize the variable is unused:
../../src/qemu/qemu_domain.c:10349:36: error: unused variable
    'cfg' [-Werror,-Wunused-variable]
    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);

Signed-off-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>
Fixes: 20fa2bc6e52e01feaf39d12d38bcf8eaec4c9a46

--- src/qemu/qemu_domain.c
+++ src/qemu/qemu_domain.c
@@ -10346,8 +10346,6 @@
                                  virDomainDiskDefPtr disk,
                                  qemuDomainLogContextPtr logCtxt)
 {
-    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
-
     if (disk->rawio == VIR_TRISTATE_BOOL_YES)
         qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES,
                            logCtxt);


tools, update rtctest.c to verify passage of time

rtctest.c checks to see if PIE is functioning by testing if 20 interrupts occur
at rates from 2HZ to 64HZ.  While this check is good, it does not check to
see if the correct amount of time has actually passed.  This misses
situations where the RTC may be operating at a higher or lower frequency
than expected.

This patch introduces a simple check to verify if the time passed is
less than 10% of what was programmed into the RTC.

Signed-off-by: Prarit Bhargava <fe4655370dc87a32329d591d6e8472329333dfad@redhat.com>
Acked-by: John Stultz <33837adfb53316eae44aad04041e1240088d76fd@linaro.org>
Cc: b2ce64d5587c02f12e367eac59751145a0660c51@lwn.net
Cc: 2c98ab252b0688038c565f7a1df1d99710e84d7a@googlegroups.com
Cc: 720929ea79be81617af4e0222565cf72ea2ee041@vger.kernel.org
Cc: f0b9bd96bf07bfecc189c62159960134588fafe5@towertech.it
Cc: fe4655370dc87a32329d591d6e8472329333dfad@redhat.com
Cc: 33837adfb53316eae44aad04041e1240088d76fd@linaro.org
Cc: c62751f8c6ce7eb0639cab80a821801931863a4b@osg.samsung.com
Signed-off-by: Shuah Khan <c62751f8c6ce7eb0639cab80a821801931863a4b@osg.samsung.com>

--- tools/testing/selftests/timers/rtctest.c
+++ tools/testing/selftests/timers/rtctest.c
@@ -36,6 +36,7 @@
 	unsigned long tmp, data;
 	struct rtc_time rtc_tm;
 	const char *rtc = default_rtc;
+	struct timeval start, end, diff;

 	switch (argc) {
 	case 2:
@@ -230,12 +231,24 @@
 		}

 		for (i=1; i<21; i++) {
+			gettimeofday(&start, NULL);
 			/* This blocks */
 			retval = read(fd, &data, sizeof(unsigned long));
 			if (retval == -1) {
 				perror("read");
 				exit(errno);
 			}
+			gettimeofday(&end, NULL);
+			timersub(&end, &start, &diff);
+			if (diff.tv_sec > 0 ||
+			    diff.tv_usec > ((1000000L / tmp) * 1.10)) {
+				fprintf(stderr, "\nPIE delta error: %ld.%06ld should be close to 0.%06ld\n",
+				       diff.tv_sec, diff.tv_usec,
+				       (1000000L / tmp));
+				fflush(stdout);
+				exit(-1);
+			}
+
 			fprintf(stderr, " %d",i);
 			fflush(stderr);
 			irqcount++;


added struct for message sending

added struct for message sending

--- distributed-programming/pflink.c
+++ distributed-programming/pflink.c
@@ -21,8 +21,12 @@
 #include <arpa/inet.h>
 #include "pflink.h"
 #define MAX_SIZE 80
-int Deliver(int port){
-
+struct Message {
+	int id;
+	char text[50];
+};
+int SendTo(int port){
+
 }
 int
 BindSocketInNewProc(int port)
@@ -31,6 +35,8 @@
 	struct sockaddr_in cli_addr, serv_addr;
 	char		string    [MAX_SIZE];
 	int		len;
+	struct Message messages[50];
+
 	pid_t		pid = fork();
 	if (pid == -1) {
 		printf("Fork fail");


[Any] dummy;

[Any] dummy;

--- src/headers/util/Any.h
+++ src/headers/util/Any.h
@@ -24,6 +24,7 @@
 #include <iostream>
 #include <sstream>
 #include <string>
+

 namespace Susi {
 	namespace Util {


protex x_state with mutex

protex x_state with mutex

CID:26953

--- samples/pd/ambix_write~.c
+++ samples/pd/ambix_write~.c
@@ -527,10 +527,14 @@
 static void ambix_write_start(t_ambix_write *x) {
   /* start making output.  If we're in the "startup" state change
      to the "running" state. */
-  if (x->x_state == STATE_STARTUP)
+  pthread_mutex_lock(&x->x_mutex);
+  if (x->x_state == STATE_STARTUP) {
     x->x_state = STATE_STREAM;
-  else
+    pthread_mutex_unlock(&x->x_mutex);
+  } else {
+    pthread_mutex_unlock(&x->x_mutex);
     pd_error(x, "ambix_write: start requested with no prior 'open'");
+  }
 }

 static void ambix_write_stop(t_ambix_write *x) {


Missing "else".

Missing "else".

--- crypto/rsa/rsa_oaep_test.c
+++ crypto/rsa/rsa_oaep_test.c
@@ -272,8 +272,7 @@
 	    printf("OAEP decryption (encrypted data) failed!\n");
 	    err=1;
 	    }
-
-	if (memcmp(ctext, ctext_ex, num) == 0)
+	else if (memcmp(ctext, ctext_ex, num) == 0)
 	    {
 	    printf("OAEP test vector %d passed!\n", v);
 	    goto next;


qemuDomainBuildNamespace: Make @devPath const

The @devPath variable is not modifiable. It merely just points to
string containing path where private devtmpfs is being
constructed. Make it const so it doesn't look weird that it's not
freed.

Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>
Reviewed-by: Pavel Mores <e8e79a41a9b826cd47122238a26f8527b5f610bc@redhat.com>

--- src/qemu/qemu_domain.c
+++ src/qemu/qemu_domain.c
@@ -15176,7 +15176,7 @@
                          virDomainObjPtr vm)
 {
     struct qemuDomainCreateDeviceData data;
-    char *devPath = NULL;
+    const char *devPath = NULL;
     char **devMountsPath = NULL, **devMountsSavePath = NULL;
     size_t ndevMountsPath = 0, i;
     int ret = -1;


Changed Perspective matrix

Changed Perspective matrix

--- HandmadeMath.h
+++ HandmadeMath.h
@@ -706,16 +706,22 @@
     return(Result);
 }

+#define HMM_PI 3.14159265358979323846
+
 HMMDEF mat4
 Perspective(float FOV, float AspectRatio, float Near, float Far)
 {
+    double Radians = FOV / 2 * HMM_PI / 180;
+    double Sine = sin(Radians);
+    double Cotangent = cos(Radians) / Sine;
+
+    double DeltaZ = Far - Near;
+
     mat4 Result = Mat4d(1.0f);
-
-    Result.Elements[0][0] = 1.0f / (AspectRatio  * tan(FOV / 2.0f));
-    Result.Elements[1][1] = 1.0f / tan(FOV / 2.0f);
-    Result.Elements[2][3] = -1.0f;
-    Result.Elements[2][2] = -(Far + Near) / (Far - Near);
-    Result.Elements[3][2] = -(2.0f * Far * Near) / (Far - Near);
+    Result.Elements[0][0] = (float)Cotangent / AspectRatio;
+    Result.Elements[1][1] = (float)Cotangent;
+    Result.Elements[2][2] = (float)(-(Far + Near) / DeltaZ);
+    Result.Elements[3][3] = 0;

     return(Result);
 }


Windows version of grid_proxy_destroy didn't work properly because of a file attribute problem

--- gsi/proxy/proxy_utils/source/programs/grid_proxy_destroy.c
+++ gsi/proxy/proxy_utils/source/programs/grid_proxy_destroy.c
@@ -285,6 +285,10 @@
         fprintf(stderr, "Would remove %s\n", filename ? filename : "(null)");
     else
     {
+        #ifdef WIN32
+        _chmod(filename, S_IREAD|S_IWRITE);
+        #endif
+
         f = open(filename, O_RDWR);
         if (f)
         {


- Handle timeouts from recv(2) properly.
- Increase timeout to 8 seconds (should be made configurable).

Reported by:	Ulrich Spoerlein <uspoerlein@gmail.com>
Reported by:	Christian Laursen <xi@borderworlds.dk>
PR:		kern/104829
MFC after:	1 week

--- sbin/ggate/shared/ggate.c
+++ sbin/ggate/shared/ggate.c
@@ -250,8 +250,12 @@
 ssize_t
 g_gate_recv(int s, void *buf, size_t len, int flags)
 {
-
-	return (recv(s, buf, len, flags));
+	ssize_t done;
+
+	do {
+		done = recv(s, buf, len, flags);
+	} while (done == -1 && errno == EAGAIN);
+	return (done);
 }

 int nagle = 1;
@@ -280,7 +284,7 @@
 	bsize = sndbuf;
 	if (setsockopt(sfd, SOL_SOCKET, SO_SNDBUF, &bsize, sizeof(bsize)) == -1)
 		g_gate_xlog("setsockopt(SO_SNDBUF): %s.", strerror(errno));
-	tv.tv_sec = 1;
+	tv.tv_sec = 8;
 	tv.tv_usec = 0;
 	if (setsockopt(sfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) {
 		g_gate_log(LOG_ERR, "setsockopt(SO_SNDTIMEO) error: %s.",


qemu: Create new qemuDomainDeviceDefValidateControllerPCI()

The existing function is renamed and called from the new one, so
that even while we're in the process of implementing new checks
all the existing ones will be performed.

Signed-off-by: Andrea Bolognani <3ada0bee826c753786fdbba72243dfba997094cf@redhat.com>
Reviewed-by: Laine Stump <c23361c43fbf79fed83e8b76173707b083d6caf5@laine.org>

--- src/qemu/qemu_domain.c
+++ src/qemu/qemu_domain.c
@@ -4268,9 +4268,9 @@

 static int
-qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *controller,
-                                         const virDomainDef *def,
-                                         virQEMUCapsPtr qemuCaps)
+qemuDomainDeviceDefValidateControllerPCIOld(const virDomainControllerDef *controller,
+                                            const virDomainDef *def,
+                                            virQEMUCapsPtr qemuCaps)
 {
     virDomainControllerModelPCI model = controller->model;
     const virDomainPCIControllerOpts *pciopts;
@@ -4544,6 +4544,29 @@
     }

     return 0;
+}
+
+
+static int
+qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
+                                         const virDomainDef *def,
+                                         virQEMUCapsPtr qemuCaps)
+
+{
+    const virDomainPCIControllerOpts *pciopts = &cont->opts.pciopts;
+    const char *model = virDomainControllerModelPCITypeToString(cont->model);
+    const char *modelName = virDomainControllerPCIModelNameTypeToString(pciopts->modelName);
+
+    if (!model) {
+        virReportEnumRangeError(virDomainControllerModelPCI, cont->model);
+        return -1;
+    }
+    if (!modelName) {
+        virReportEnumRangeError(virDomainControllerPCIModelName, pciopts->modelName);
+        return -1;
+    }
+
+    return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
 }


qemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs

--- src/qemu/qemu_driver.c
+++ src/qemu/qemu_driver.c
@@ -5016,7 +5016,8 @@

     virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
-    virDomainDefPtr persistentDef = NULL;
+    virDomainDefPtr def;
+    virDomainDefPtr persistentDef;
     virCgroupPtr cgroup_vcpu = NULL;
     int ret = -1;
     qemuDomainObjPrivatePtr priv;
@@ -5024,7 +5025,6 @@
     virDomainPinDefPtr *newVcpuPin = NULL;
     virBitmapPtr pcpumap = NULL;
     virQEMUDriverConfigPtr cfg = NULL;
-    virCapsPtr caps = NULL;
     virObjectEventPtr event = NULL;
     char paramField[VIR_TYPED_PARAM_FIELD_LENGTH] = "";
     char *str = NULL;
@@ -5043,26 +5043,22 @@
     if (virDomainPinVcpuFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
         goto cleanup;

-    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
-        goto cleanup;
-
     if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;

-    if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
-                                        &persistentDef) < 0)
+    if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
         goto endjob;

     priv = vm->privateData;

-    if ((flags & VIR_DOMAIN_AFFECT_LIVE) && vcpu >= vm->def->vcpus) {
+    if (def && vcpu >= def->vcpus) {
         virReportError(VIR_ERR_INVALID_ARG,
                        _("vcpu %d is out of range of live cpu count %d"),
-                       vcpu, vm->def->vcpus);
+                       vcpu, def->vcpus);
         goto endjob;
     }

-    if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && vcpu >= persistentDef->vcpus) {
+    if (persistentDef && vcpu >= persistentDef->vcpus) {
         virReportError(VIR_ERR_INVALID_ARG,
                        _("vcpu %d is out of range of persistent cpu count %d"),
                        vcpu, persistentDef->vcpus);
@@ -5078,21 +5074,20 @@
         goto endjob;
     }

-    if (flags & VIR_DOMAIN_AFFECT_LIVE) {
-
+    if (def) {
         if (priv->vcpupids == NULL) {
             virReportError(VIR_ERR_OPERATION_INVALID,
                            "%s", _("cpu affinity is not supported"));
             goto endjob;
         }

-        if (vm->def->cputune.vcpupin) {
-            newVcpuPin = virDomainPinDefCopy(vm->def->cputune.vcpupin,
-                                             vm->def->cputune.nvcpupin);
+        if (def->cputune.vcpupin) {
+            newVcpuPin = virDomainPinDefCopy(def->cputune.vcpupin,
+                                             def->cputune.nvcpupin);
             if (!newVcpuPin)
                 goto endjob;

-            newVcpuPinNum = vm->def->cputune.nvcpupin;
+            newVcpuPinNum = def->cputune.nvcpupin;
         } else {
             if (VIR_ALLOC(newVcpuPin) < 0)
                 goto endjob;
@@ -5126,12 +5121,12 @@
             }
         }

-        if (vm->def->cputune.vcpupin)
-            virDomainPinDefArrayFree(vm->def->cputune.vcpupin,
-                                     vm->def->cputune.nvcpupin);
-
-        vm->def->cputune.vcpupin = newVcpuPin;
-        vm->def->cputune.nvcpupin = newVcpuPinNum;
+        if (def->cputune.vcpupin)
+            virDomainPinDefArrayFree(def->cputune.vcpupin,
+                                     def->cputune.nvcpupin);
+
+        def->cputune.vcpupin = newVcpuPin;
+        def->cputune.nvcpupin = newVcpuPinNum;
         newVcpuPin = NULL;

         if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
@@ -5150,8 +5145,7 @@
         event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
     }

-    if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
-
+    if (persistentDef) {
         if (!persistentDef->cputune.vcpupin) {
             if (VIR_ALLOC(persistentDef->cputune.vcpupin) < 0)
                 goto endjob;
@@ -5187,7 +5181,6 @@
         qemuDomainEventQueue(driver, event);
     VIR_FREE(str);
     virBitmapFree(pcpumap);
-    virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
 }


fixed compilation error

fixed compilation error

--- examples/sky/rssi-scanner.c
+++ examples/sky/rssi-scanner.c
@@ -28,7 +28,7 @@
  *
  * This file is part of the Contiki operating system.
  *
- * $Id: rssi-scanner.c,v 1.2 2009/04/25 22:38:00 joxe Exp $
+ * $Id: rssi-scanner.c,v 1.3 2011/01/12 20:00:48 joxe Exp $
  */

 /**
@@ -57,8 +57,8 @@
   /* fine graied channel - can we even read other channels with CC2420 ? */
   f = c + 302 + 0x4000;

-  FASTSPI_SETREG(CC2420_FSCTRL, f);
-  FASTSPI_STROBE(CC2420_SRXON);
+  CC2420_WRITE_REG(CC2420_FSCTRL, f);
+  CC2420_STROBE(CC2420_SRXON);
 }

 static void


add provisoric beam_elements.h file to the convenience include file

--- sixtracklib/sixtracklib.h
+++ sixtracklib/sixtracklib.h
@@ -19,6 +19,7 @@
 #include "sixtracklib/common/impl/block_type.h"
 #include "sixtracklib/common/block_drift.h"
 #include "sixtracklib/common/impl/block_drift_type.h"
+#include "sixtracklib/common/beam_elements.h"
 #include "sixtracklib/common/particles.h"
 #include "sixtracklib/common/impl/particles_type.h"
 #include "sixtracklib/common/particles_sequence.h"


Clarified licence

Clarified licence

--- include/BALL/SCORING/COMPONENTS/fragmentationalSolvation.h
+++ include/BALL/SCORING/COMPONENTS/fragmentationalSolvation.h
@@ -1,21 +1,3 @@
-/* fragmentationalSolvation.h
-*
-* Copyright (C) 2011 Marcel Schumann
-*
-* This program free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 3 of the License, or (at
-* your option) any later version.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, see <http://www.gnu.org/licenses/>.
-*/
-
 // ----------------------------------------------------
 // $Maintainer: Marcel Schumann $
 // $Authors: Marcel Schumann $


git-svn-id: http://svn.seqan.de/seqan/trunk@4616 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/projects/library/seqan/find_motif/frequency_distribution.h
+++ seqan/projects/library/seqan/find_motif/frequency_distribution.h
@@ -98,14 +98,7 @@
 		return *this;
 	}

-	friend FrequencyDistribution
-	operator + (FrequencyDistribution const & lhs_, FrequencyDistribution const & rhs_)
-	{
-		FrequencyDistribution ret(lhs_);
-		ret+=rhs_;
-
-		return ret;
-	}
+

 	FrequencyDistribution &
 	operator -= (FrequencyDistribution const & other_)
@@ -118,15 +111,6 @@
 		return *this;
 	}

-	friend FrequencyDistribution
-	operator - (FrequencyDistribution const & lhs_, FrequencyDistribution const & rhs_)
-	{
-		FrequencyDistribution ret(lhs_);
-		ret-=rhs_;
-
-		return ret;
-	}
-
 	template<typename TType>
 	FrequencyDistribution &
 	operator *= (TType value_)
@@ -139,16 +123,6 @@
 		return *this;
 	}

-	template<typename TType>
-	friend FrequencyDistribution
-	operator * (FrequencyDistribution const & fd_, TType value_)
-	{
-		FrequencyDistribution ret(fd_);
-		ret*=value_;
-
-		return ret;
-	}
-
 	template<typename TPos>
 	inline TSpec &
 	operator [] (TPos index_)
@@ -163,21 +137,55 @@
 		return frequency_list[index_];
 	}

-    friend inline std::ostream &
-	operator << (std::ostream & ostr, FrequencyDistribution & fd_)
-	{
-		for(unsigned int i=0; i<SIZE; ++i)
-		{
-			ostr.width(15);
-			ostr << std::left << fd_.frequency_list[i];
-		}
-
-		return ostr;
-	}

 //____________________________________________________________________________________________

 };
+
+template <typename TValue, typename TSpec>
+FrequencyDistribution<TValue, TSpec>
+operator + (FrequencyDistribution<TValue, TSpec> const & lhs_, FrequencyDistribution<TValue, TSpec> const & rhs_)
+{
+	FrequencyDistribution<TValue, TSpec> ret(lhs_);
+	ret+=rhs_;
+
+	return ret;
+}
+
+
+template <typename TValue, typename TSpec>
+FrequencyDistribution<TValue, TSpec>
+operator - (FrequencyDistribution<TValue, TSpec> const & lhs_, FrequencyDistribution<TValue, TSpec> const & rhs_)
+{
+	FrequencyDistribution<TValue, TSpec> ret(lhs_);
+	ret-=rhs_;
+
+	return ret;
+}
+
+template <typename TValue, typename TSpec, typename TType>
+FrequencyDistribution<TValue, TSpec>
+operator * (FrequencyDistribution<TValue, TSpec> const & fd_, TType value_)
+{
+	FrequencyDistribution<TValue, TSpec> ret(fd_);
+	ret*=value_;
+
+	return ret;
+}
+
+template <typename TValue, typename TSpec>
+inline std::ostream &
+operator << (std::ostream & ostr, FrequencyDistribution<TValue, TSpec> & fd_)
+{
+	for(unsigned int i=0; i<FrequencyDistribution<TValue, TSpec>::SIZE; ++i)
+	{
+		ostr.width(15);
+		ostr << std::left << fd_.frequency_list[i];
+	}
+
+	return ostr;
+}
+

 //////////////////////////////////////////////////////////////////////////////
 //Metafunctions


add Node.TypeCheckNode api

add Node.TypeCheckNode api

--- src/package/MiniKonoha.Syntax/Syntax_glue.c
+++ src/package/MiniKonoha.Syntax/Syntax_glue.c
@@ -390,13 +390,13 @@
 // --------------------------------------------------------------------------
 /* Node(Stmt) */

-//## boolean Node.TypeCheckNode(Symbol key, Object type, int policy);
+//## Node Node.TypeCheckNode(Symbol key, Object type, int policy);
 static KMETHOD Node_TypeCheckNode(KonohaContext *kctx, KonohaStack *sfp)
 {
 	ksymbol_t key = (ksymbol_t)sfp[1].intValue;
 	KClass *type = kObject_class(sfp[2].asObject);
 	int policy = sfp[3].intValue;
-	KReturnUnboxValue(kNode_IsError(SUGAR TypeCheckNodeByName(kctx, sfp[0].asNode, key, kNode_ns(sfp[0].asNode), type, policy)));
+	KReturn(SUGAR TypeCheckNodeByName(kctx, sfp[0].asNode, key, kNode_ns(sfp[0].asNode), type, policy));
 }

 ////## Node Node.newNode(Token[] tokenList, int s, int e);
@@ -548,7 +548,7 @@
 		_Public, _F(Node_GetParentNode), KType_Node, KType_Node, KMethodName_("GetParentNode"), 0,

 		_Public, _F(Node_opEQ), KType_boolean, KType_Node, KMethodName_("=="), 1, KType_Node, KFieldName_("other"),
-		_Public, _F(Node_TypeCheckNode), KType_boolean, KType_Node, KMethodName_("TypeCheckNode"), 4, TP_kw, TP_ns, TP_type, TP_pol,
+		_Public, _F(Node_TypeCheckNode), KType_Node, KType_Node, KMethodName_("TypeCheckNode"), 3, TP_kw, TP_type, TP_pol,
 //		_Public, _F(Node_newNode), KType_Node, KType_Node, KMethodName_("newNode"), 3, TP_tokens, TP_begin, TP_end,
 		_Public, _F(Node_SetType), KType_void, KType_Node, KMethodName_("SetType"), 1, TP_type,
 		_Public|_Im, _F(Node_GetType), KType_int, KType_Node, KMethodName_("GetType"), 0,


Various fixes for things in blaster

Various fixes for things in blaster

--- src/tasks/train_blaster.c
+++ src/tasks/train_blaster.c
@@ -278,7 +278,7 @@
     current_accel.distance        = truth.distance;  // does not change
     current_accel.speed           = truth.speed + (speed_delta / 2); // fudge
     current_accel.direction       = truth.direction; // hmmm
-    current_accel.next_location   = locs[i];
+    current_accel.next_location   = truth.next_location;
     current_accel.next_distance   = truth.next_distance;
     current_accel.next_timestamp  = time + start_time;
     current_accel.next_speed      = to_speed;
@@ -402,7 +402,7 @@
     current_accel.distance          = truth.next_distance; // does not change
     current_accel.speed             = truth.speed - (speed_delta / 2); // fudge
     current_accel.direction         = truth.direction;     // hmmm
-    current_accel.next_location     = locs[i];
+    current_accel.next_location     = truth.next_location;
     current_accel.next_distance     = truth.next_distance;
     current_accel.next_timestamp    = time + stop_time;
     current_accel.next_speed        = to_speed;
@@ -493,11 +493,20 @@
     truth.next_location.offset = 0; // TODO: is this right?
     // truth.next_timestamp    = I don't fucking know; // I don't need to know

-    // TODO: maybe we need to setup the sensor polling guys here?
-    //       or maybe do it later in acceleration
-    //       or just wait until we hit another sensor
-    // NIK HALP!
-
+    // https://www.youtube.com/watch?v=gAYL5H46QnQ
+    assert(ctxt->console_cancel >= 0,
+           "[%s] Console cancel courier not ready to rock!",
+           ctxt->name);
+    const blaster_req_type cancel = BLASTER_CONSOLE_CANCEL;
+    const int cresult = Reply(ctxt->console_cancel,
+                              (char*)&cancel, sizeof(blaster_req_type));
+    assert(cresult == 0,
+           "[%s] Failed to send message to console cancel courier (%d)",
+           ctxt->name, cresult);
+    ctxt->console_cancel = -1;
+
+
+    // now we can try and update the UI to flip the next expected sensor
     physics_update_tracking_ui(ctxt, 0);

     ctxt->master_message = true;
@@ -670,10 +679,14 @@
                                    const int timestamp) {

     // do not process the event if it has been overridden by a future event
-    if (!blaster_kill_courier(ctxt->acceleration_courier, courier_tid))
+    if (blaster_kill_courier(ctxt->acceleration_courier, courier_tid)) {
+        ctxt->acceleration_courier = -1;
+    }
+    else {
+        log("[%s] Killing overridden acceleration courier", ctxt->name);
+        ctxt->acceleration_courier = -1;
         return;
-    else
-        ctxt->acceleration_courier = -1;
+    }

     last_accel                         = current_accel;
     current_accel.event                = EVENT_ACCELERATION;
@@ -1182,15 +1195,16 @@
     result       = Send(tid, (char*)c_init, sizeof(c_init), NULL, 0);
     assert(result == 0, "Failed to setup train console! (%d)", result);

-    tid = Create(TRAIN_COURIER_PRIORITY, courier);
-    if (tid < 0) ABORT("[%s] Failed creating train console cancel (%d)",
-                       ctxt->name, tid);
-    int cancel = BLASTER_CONSOLE_CANCEL;
+    const int cancel = BLASTER_CONSOLE_CANCEL;
     courier_package console_pack = {
         .receiver = tid,
         .size     = -(int)sizeof(cancel),
         .message  = (char*)&cancel
     };
+
+    tid = Create(TRAIN_COURIER_PRIORITY, courier);
+    if (tid < 0) ABORT("[%s] Failed creating train console cancel (%d)",
+                       ctxt->name, tid);
     result = Send(tid,
                   (char*)&console_pack, sizeof(console_pack),
                   NULL, 0);


empty sender queue when server end closed, and fix bug

--- src/epoll_mgr.c
+++ src/epoll_mgr.c
@@ -140,7 +140,7 @@
 		node->next = NULL;
 		node->prev = NULL;
 		// give it back to receive buffer pool
-		rcv_pool.push(node);
+		list_push(&rcv_pool, node);
 	}
 	sockinfo[fd].fd = 0;
 	sockinfo[fd].type = 0;
@@ -165,10 +165,23 @@
 #endif
 		exit(EXIT_FAILURE);
 	}
+	node_t *node = NULL;
 	slot_t *slot = &svr_hash.slots[pos];
 	pthread_spin_lock(&slot->lock);
+	// assertion 'slot->data != NULL' is always true
 	if(slot->data != NULL) {
 		svr_t *svr = (svr_t*)(slot->data);
+		// empty send queue
+		while((node = list_pop(&svr->queue)) != NULL) {
+			// clear receive buffer
+			memset(node->data, 0, sizeof(rcv_buf_t));
+			// clear bidirectional pointer
+			node->next = NULL;
+			node->prev = NULL;
+			// give node back to recieve buffer pool
+			list_push(&svr->queue, node);
+		}
+		// set disconnect flag
 		svr->connected = 0;
 	}
 	pthread_spin_unlock(&slot->lock);


qemu: remove writing to QEMU log file for rename operation

The rename operation only works on inactive virtual machines,
but it none the less writes to the log file used by the QEMU
processes. This log file is not intended to provide a general
purpose audit trail of operations performed on VMs. The audit
subsystem has recording of important operations. If we want
to extend that to cover all significant public APIs that is
a valid thing to consider, but we shouldn't arbitrarily log
specific APIs into the QEMU log file in the meantime.

Signed-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

--- src/qemu/qemu_driver.c
+++ src/qemu/qemu_driver.c
@@ -19917,10 +19917,6 @@
     virObjectEventPtr event_new = NULL;
     virObjectEventPtr event_old = NULL;
     int ret = -1;
-    int logfile = -1;
-    char ebuf[1024];
-    char *timestamp;
-    char *rename_log_msg = NULL;
     char *new_dom_name = NULL;
     char *old_dom_name = NULL;
     char *old_dom_cfg_file = NULL;
@@ -19986,11 +19982,6 @@
     if (VIR_STRDUP(new_dom_name, new_name) < 0)
         goto endjob;

-    if (virAsprintf(&rename_log_msg, ": domain %s has been renamed to %s\n",
-                    vm->def->name, new_name) < 0) {
-        goto endjob;
-    }
-
     if (!(old_dom_cfg_file = virDomainConfigFile(cfg->configDir,
                                                  vm->def->name))) {
         goto endjob;
@@ -19998,9 +19989,6 @@

     if (virDomainObjListRenameAddNew(driver->domains, vm, new_name) < 0)
         goto endjob;
-
-    if ((logfile = qemuDomainCreateLog(driver, vm, true)) < 0)
-        goto rollback;

     event_old = virDomainEventLifecycleNewFromObj(vm,
                                             VIR_DOMAIN_EVENT_UNDEFINED,
@@ -20029,17 +20017,6 @@
                                               VIR_DOMAIN_EVENT_DEFINED,
                                               VIR_DOMAIN_EVENT_DEFINED_RENAMED);

-    /* Write message to the log. */
-    if ((timestamp = virTimeStringNow()) != NULL) {
-        if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
-            safewrite(logfile, rename_log_msg,
-                      strlen(rename_log_msg)) < 0) {
-            VIR_WARN("Unable to write timestamp to logfile: %s",
-                     virStrerror(errno, ebuf, sizeof(ebuf)));
-        }
-        VIR_FREE(timestamp);
-    }
-
     /* Success, domain has been renamed. */
     ret = 0;

@@ -20047,15 +20024,10 @@
     qemuDomainObjEndJob(driver, vm);

  cleanup:
-    if (VIR_CLOSE(logfile) < 0) {
-        VIR_WARN("Unable to close logfile: %s",
-                 virStrerror(errno, ebuf, sizeof(ebuf)));
-    }
     virDomainObjEndAPI(&vm);
     VIR_FREE(old_dom_cfg_file);
     VIR_FREE(old_dom_name);
     VIR_FREE(new_dom_name);
-    VIR_FREE(rename_log_msg);
     qemuDomainEventQueue(driver, event_old);
     qemuDomainEventQueue(driver, event_new);
     virObjectUnref(cfg);


imap: fix missing-command check
It's impossible for the command's pointer to be NULL at this point.
Previously, the command_find() would have returned NULL, but this check
presumably short-circuits that search in the trivial case, so has some
real use.

Signed-off-by: Phil Carmody <e888d2bd6f13f82caa51a37c03d034c76f661ba3@dovecot.fi>

--- src/imap/imap-client.c
+++ src/imap/imap-client.c
@@ -813,8 +813,8 @@

 	client->input_skip_line = TRUE;

-	if (cmd->name == '\0') {
-		/* command not given - cmd_func is already NULL. */
+	if (cmd->name[0] == '\0') {
+		/* command not given - cmd->func is already NULL. */
 	} else if ((command = command_find(cmd->name)) != NULL) {
 		cmd->func = command->func;
 		cmd->cmd_flags = command->flags;


drivers: ec_host_cmd_periph: remove @return doc for void funcs

For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <d94e04d205b5962d7873a139ef298b03c1717f72@intel.com>

--- include/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.h
+++ include/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.h
@@ -22,8 +22,6 @@
  * will override the first callback installation.
  *
  * @param cb Callback that is called when device would send data to host.
- *
- * @return N/A
  */
 void ec_host_cmd_periph_sim_install_send_cb(ec_host_cmd_periph_api_send cb);


Fixed code reading data from freed pointer.

Related to coverit CID 10331.

free call being executed over pointer, before the
LogError which used it.

Signed-off-by: Richard Maciel <53a1d88320a92db6ddbc22bd99f66cf1c8f80da0@linux.vnet.ibm.com>

--- src/tcs/tcs_evlog_imaem.c
+++ src/tcs/tcs_evlog_imaem.c
@@ -293,9 +293,9 @@
 				event->rgbEvent = malloc(event->ulEventLength + 1);
 				if (event->rgbEvent == NULL) {
 					free(event->rgbPcrValue);
-					free(event);
 					LogError("malloc of %u bytes failed.",
 							event->ulEventLength);
+					free(event);
 					result = TCSERR(TSS_E_OUTOFMEMORY);
 					goto done;
 				}


add smoke/test1.c

add smoke/test1.c

darcs-hash:20080812155728-c1f02-4f81aa3abe796ee260d28940cb70c5606b2cdfd1.gz

error: pathspec 'test/suite/smoke/test1.c' did not match any file(s) known to git

--- test/suite/smoke/test1.c
+++ test/suite/smoke/test1.c
@@ -0,0 +1,4 @@
+typedef int bar;
+int foo() {
+  return 2 * (bar) 3.0;
+}


qemu: cpu hotplug: Set vcpu state directly in the new structure

Avoid using virDomainDefSetVcpus when we can set it directly in the
structure.

--- src/qemu/qemu_driver.c
+++ src/qemu/qemu_driver.c
@@ -4764,6 +4764,7 @@
                          unsigned int vcpu)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
+    virDomainVcpuInfoPtr vcpuinfo;
     int ret = -1;
     int rc;
     int oldvcpus = virDomainDefGetVcpus(vm->def);
@@ -4773,6 +4774,15 @@
     char *mem_mask = NULL;
     virDomainNumatuneMemMode mem_mode;

+    if (!(vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu)))
+        return -1;
+
+    if (vcpuinfo->online) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("vCPU '%u' is already online"), vcpu);
+        return -1;
+    }
+
     qemuDomainObjEnterMonitor(driver, vm);

     rc = qemuMonitorSetCPU(priv->mon, vcpu, true);
@@ -4788,7 +4798,7 @@
     if (rc < 0)
         goto cleanup;

-    ignore_value(virDomainDefSetVcpus(vm->def, oldvcpus + 1));
+    vcpuinfo->online = true;

     if (ncpupids < 0)
         goto cleanup;
@@ -4864,12 +4874,22 @@
                          unsigned int vcpu)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
+    virDomainVcpuInfoPtr vcpuinfo;
     int ret = -1;
     int rc;
     int oldvcpus = virDomainDefGetVcpus(vm->def);
     pid_t *cpupids = NULL;
     int ncpupids = 0;

+    if (!(vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu)))
+        return -1;
+
+    if (!vcpuinfo->online) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("vCPU '%u' is already offline"), vcpu);
+        return -1;
+    }
+
     qemuDomainObjEnterMonitor(driver, vm);

     rc = qemuMonitorSetCPU(priv->mon, vcpu, false);
@@ -4893,7 +4913,7 @@
         goto cleanup;
     }

-    ignore_value(virDomainDefSetVcpus(vm->def, oldvcpus - 1));
+    vcpuinfo->online = false;

     if (qemuDomainDelCgroupForThread(priv->cgroup,
                                      VIR_CGROUP_THREAD_VCPU, vcpu) < 0)


Function name must have changed.

Function name must have changed.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@2448 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- config/gen/platform/ansi.c
+++ config/gen/platform/ansi.c
@@ -27,7 +27,7 @@
 {
     /* unable to provide this level of precision under ANSI-C, so just fall
        back to intval time for this. */
-    Parrot_warn_c(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_floatval_time not accurate");
+    Parrot_warn(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_floatval_time not accurate");
     return (FLOATVAL)Parrot_intval_time();
 }

@@ -39,7 +39,7 @@
 void
 Parrot_sleep(unsigned int seconds)
 {
-    Parrot_warn_c(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_sleep not implemented");
+    Parrot_warn(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_sleep not implemented");
     return;
 }

@@ -50,7 +50,7 @@
 void
 Parrot_setenv(const char *name, const char *value)
 {
-    Parrot_warn_c(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_setenv not implemented");
+    Parrot_warn(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_setenv not implemented");
     return;
 }

@@ -62,7 +62,7 @@
 void *
 Parrot_dlopen(const char *filename)
 {
-    Parrot_warn_c(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_dlopen not implemented");
+    Parrot_warn(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_dlopen not implemented");
     return NULL;
 }

@@ -85,7 +85,7 @@
 void *
 Parrot_dlsym(void *handle, const char *symbol)
 {
-    Parrot_warn_c(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_dlsym not implemented");
+    Parrot_warn(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_dlsym not implemented");
     return NULL;
 }

@@ -97,7 +97,7 @@
 int
 Parrot_dlclose(void *handle)
 {
-    Parrot_warn_c(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_dlclose not implemented");
+    Parrot_warn(NULL, PARROT_WARNINGS_PLATFORM_FLAG, "Parrot_dlclose not implemented");
     return 0;
 }


minor typo fix in doxygen comments

minor typo fix in doxygen comments

--- include/kernels/CardiacKirchhoffIncompressibilityPenalty.h
+++ include/kernels/CardiacKirchhoffIncompressibilityPenalty.h
@@ -17,7 +17,7 @@
  * Kernel for adding a penalty term to a variable's residual for enforcing incompressibility.
  *
  * The kernel implements \f$\gamma(\psi_i,J-1)\f$ with
- * \f$J=\mathrm{det}\mathbf{F}=\mathrm{det}\frac{\partial x_M}{\partial X_M}\f$,
+ * \f$J=\mathrm{det}\mathbf{F}=\mathrm{det}\frac{\partial x_M}{\partial X_N}\f$,
  * the displaced coordinates \f$x_{M=1\ldots3}\f$ and
  * the coordinates in the reference frame \f$X_{N=1\ldots3}\f$.
  *