lib: tevent: make TEVENT_SIG_INCREMENT atomic.
commit60300459fe49a28bc151d9ae77c8fb1d388e25e1
authorJeremy Allison <jra@samba.org>
Wed, 30 Jul 2014 16:58:47 +0000 (30 09:58 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 21 Aug 2014 14:55:17 +0000 (21 16:55 +0200)
treef131364fd998cd011fbc8d19436cb7fddd4989a5
parent03e9c64e219729cad41c7488aa08fbc9a26ce09c
lib: tevent: make TEVENT_SIG_INCREMENT atomic.

On arm platforms incrementing a variable is not
an atomic operation, so may be interrupted by
signal processing (if a signal interrupts another
signal handler).

Use compiler built-ins to make this atomic.
__sync_fetch_and_add() works on gcc, llvm,
IBM xlC on AIX, and Intel icc (10.1 and
above).

atomic_add_32() works on Oracle Solaris.

Based on an inital patch from kamei@osstech.co.jp.

Bug #10640 - smbd is not responding - tevent_common_signal_handler() increments non-atomic variables

https://bugzilla.samba.org/show_bug.cgi?id=10640

Back-ported from master 536c799f00d7bdd6a574b6bdbc0e9c742eeef8b5

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
lib/replace/replace.h
lib/replace/wscript
lib/tevent/tevent_signal.c