Fix c99 compatibility: use __typeof__ instead of typeof in public headers

Reported-by: John Steele Scott <toojays@toojays.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix c99 compatibility: use __asm__ and __volatile__ in public headers

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: re-enable compatibility with autoconf < 2.64

> I tried to build the latest urcu (git master e51500) on a Centos 6.2 box, and got:
>
> jscott@dxi0-62:~/src/userspace-rcu$ make -j4
> CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /users/jscott/src/userspace-rcu/config/missing --run aclocal-1.11 -I
> +config
> CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /users/jscott/src/userspace-rcu/config/missing --run autoconf
>  cd . && /bin/sh /users/jscott/src/userspace-rcu/config/missing --run automake-1.11 --foreign
> configure:4010: error: possibly undefined macro: m4_ifnblank
>       If this token and others are legitimate, please use m4_pattern_allow.
>       See the Autoconf documentation.
> make: *** [configure] Error 1
> make: *** Waiting for unfinished jobs....
>
> Some digging showed that the macro m4_ifnblank requires autoconf 2.64. Centos 6.2 has autoconf 2.63. :(
>
> I just worked around it by reverting commit a767fd locally, then I can build fine.

Reported-by: John Steele Scott <toojays@toojays.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix inappropriate lib behavior: don't call exit()

Use abort() (implemented through the new urcu_die()) instead of exit(-1)
for unrecoverable errors.

Fixes #152

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Compatibility: remove bash-ismsm from test scripts

+= is not supported by all shells.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add MIPS support

[ Edit by Mathieu Desnoyers: add explanations about supported
MIPS architectures, extracted from conversation with Ralf Baechle:

* Supported architectures

Ralf Baechle (edited by Mathieu Desnoyers):

This code works on all MIPS architecture variants.  The memory barrier
instruction, SYNC, was introduced for MIPS II.  The original MIPS I
instruction set doesn't have SYNC nor SMP support in the processor
architecture itself so SMP required horrible kludges in the system
hardware.  I think it's safe to say that Linux/MIPS will never support
any of these MIPS I SMP systems.  In the unlikely case this happens
anyway, we have a (Linux) kernel emulation of the SYNC instruction.
Voila - full binary compatibility across all MIPS processors and the
oldest hardware pays the performance penalty.

* Choice of barrier for cmm_mb()/cmm_rmb()/cmm_wmb()

Ralf Baechle:
"RMI (aka Netlogic and now Broadcom) XLR processor cores can be
configured to permit LD-LD, LD-ST, ST-LD and ST-ST reordering; default
is only ST-ST reordering.  To allow Linux to eventually enable full
reordering cmm_mb(), cmm_rmb() and cmm_wmb() all should perform SYNC
and a compiler barrier."

* No-op choice for cmm_read_barrier_depends():

Ralf Baechle:
"Technically there is nothing in the MIPS architecture spec that would
keep a MIPS implementation from reordering as freely as an Alpha or
even more liberally.  In practice most do strong ordering.  However
there is no MIPS implementation that makes full use of all the rope
provided.  So in theory a paranoid implementation of
cmm_read_barrier_depends() for MIPS should perform a SYNC.  In reality
it's not necessary and no sane MIPS core designer would implement
something that would design a core that need a non-empty
cmm_read_barrier_depends().  The reason why my patch had an empty one
is that I was using the Alpha code as a template."

Mathieu Desnoyers:
Moreover, the Linux kernel chooses a no-op for MIPS
read_barrier_depends() implementation, so any MIPS architecture that
would be as weak as Alpha would break the Linux kernel before breaking
the userspace RCU library.

* No need to put ".set noreorder" in cmm_mb() inline assembly:

Ralf Baechle:
"Certain instructions such as SYNC won't get reordered." ]

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
CC: Paul McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: CAA_BUILD_BUG_ON should refer to CAA_BUILD_BUG_ON_ZERO

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu: add hint to DEFINE_URCU_TLS() for compound types

Just a hint.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu: fix compat_futex_noasync()

This patch fix two critical problems in the compatibility fallback of
compact_futex_noasync():

1) compat_futex_cond is not bound to any @uaddr, it services all @uaddr,
   if you wakeup only one thread(pthread_cond_signal), the @uaddr of
   this waking thread and the @uaddr of the woken-up thread may be different.
   The woken-up thread will very probably go to sleep again
   because his own condition is not true.

   *And* this waking thread(FUTEX_WAKE) wake up NOTHING.

2) If the caller want to wake up all waiting threads, he will use INT_MAX
   for @val, and:
                for (i = 0; i < INT_MAX; i++)
                        pthread_cond_signal(&compat_futex_cond);
   becomes almost infinity loop.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu: move busy-wait code and name it ___cds_wfq_node_sync_next()

This code which waits for a node's next pointer until it appears, will
be used many times, move it to a help function and name it
___cds_wfq_node_sync_next().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing entry to gitignore

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: rculfhash should be offline while waiting for resize to complete

Causes hang on destroy with urcu QSBR if destroy is called within a rcu
registered thread.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rculfhash API documentation: document destroy RCU read-lock constraint

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Update version to 0.7.4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>