uatomic/x86: Remove redundant memory barriers master
authorOlivier Dion <odion@efficios.com>
Tue, 22 Aug 2023 20:23:17 +0000 (16:23 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Apr 2024 20:12:02 +0000 (16:12 -0400)
When liburcu is configured to _not_ use atomic builtins, the
implementation of atomic operations is done using inline assembler for
each architecture.

Because we control the emitted assembler, we know whether specific
operations (e.g. lock; cmpxchg) already have an implicit memory barrier.
In those cases, emitting an explicit cmm_smp_mb() before/after the
operation is redundant and hurts performance.

Remove those redundant barriers on x86.

Change-Id: Ic1f6cfe9c2afe250946549cf6187f8fa88f5b009
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
533 files changed:
.gitignore
.gitreview
ChangeLog
CodingStyle [deleted file]
CodingStyle.md [new file with mode: 0644]
LICENSE [deleted file]
LICENSE.md [new file with mode: 0644]
LICENSES/Autoconf-exception-2.0.txt [new file with mode: 0644]
LICENSES/BSD-2-Clause.txt [new file with mode: 0644]
LICENSES/CC-BY-4.0.txt [new file with mode: 0644]
LICENSES/CC0-1.0.txt [new file with mode: 0644]
LICENSES/FSFAP.txt [new file with mode: 0644]
LICENSES/GPL-2.0-only.txt [new file with mode: 0644]
LICENSES/GPL-2.0-or-later.txt [new file with mode: 0644]
LICENSES/GPL-3.0-or-later.txt [new file with mode: 0644]
LICENSES/LGPL-2.1-only.txt [new file with mode: 0644]
LICENSES/LGPL-2.1-or-later.txt [new file with mode: 0644]
LICENSES/LicenseRef-Autoconf-exception-macro.txt [new file with mode: 0644]
LICENSES/LicenseRef-Boehm-GC.txt [new file with mode: 0644]
LICENSES/MIT.txt [new file with mode: 0644]
Makefile.am
README.md
bootstrap
configure.ac
doc/Makefile.am
doc/cds-api.md
doc/examples/Makefile.am
doc/examples/Makefile.examples.template
doc/examples/dist-files/Makefile
doc/examples/hlist/Makefile
doc/examples/hlist/Makefile.cds_hlist_add_head_rcu
doc/examples/hlist/Makefile.cds_hlist_del_rcu
doc/examples/hlist/Makefile.cds_hlist_for_each_entry_rcu
doc/examples/hlist/Makefile.cds_hlist_for_each_rcu
doc/examples/hlist/cds_hlist_add_head_rcu.c
doc/examples/hlist/cds_hlist_del_rcu.c
doc/examples/hlist/cds_hlist_for_each_entry_rcu.c
doc/examples/hlist/cds_hlist_for_each_rcu.c
doc/examples/lfstack/Makefile
doc/examples/lfstack/Makefile.cds_lfs_pop_all_blocking
doc/examples/lfstack/Makefile.cds_lfs_pop_blocking
doc/examples/lfstack/Makefile.cds_lfs_push
doc/examples/lfstack/cds_lfs_pop_all_blocking.c
doc/examples/lfstack/cds_lfs_pop_blocking.c
doc/examples/lfstack/cds_lfs_push.c
doc/examples/list/Makefile
doc/examples/list/Makefile.cds_list_add_rcu
doc/examples/list/Makefile.cds_list_add_tail_rcu
doc/examples/list/Makefile.cds_list_del_rcu
doc/examples/list/Makefile.cds_list_for_each_entry_rcu
doc/examples/list/Makefile.cds_list_for_each_rcu
doc/examples/list/Makefile.cds_list_replace_rcu
doc/examples/list/cds_list_add_rcu.c
doc/examples/list/cds_list_add_tail_rcu.c
doc/examples/list/cds_list_del_rcu.c
doc/examples/list/cds_list_for_each_entry_rcu.c
doc/examples/list/cds_list_for_each_rcu.c
doc/examples/list/cds_list_replace_rcu.c
doc/examples/rculfhash/Makefile
doc/examples/rculfhash/Makefile.cds_lfht_add
doc/examples/rculfhash/Makefile.cds_lfht_add_replace
doc/examples/rculfhash/Makefile.cds_lfht_add_unique
doc/examples/rculfhash/Makefile.cds_lfht_del
doc/examples/rculfhash/Makefile.cds_lfht_destroy
doc/examples/rculfhash/Makefile.cds_lfht_for_each_entry_duplicate
doc/examples/rculfhash/Makefile.cds_lfht_lookup
doc/examples/rculfhash/cds_lfht_add.c
doc/examples/rculfhash/cds_lfht_add_replace.c
doc/examples/rculfhash/cds_lfht_add_unique.c
doc/examples/rculfhash/cds_lfht_del.c
doc/examples/rculfhash/cds_lfht_destroy.c
doc/examples/rculfhash/cds_lfht_for_each_entry_duplicate.c
doc/examples/rculfhash/cds_lfht_lookup.c
doc/examples/rculfhash/jhash.h
doc/examples/rculfqueue/Makefile
doc/examples/rculfqueue/Makefile.cds_lfq_dequeue
doc/examples/rculfqueue/Makefile.cds_lfq_enqueue
doc/examples/rculfqueue/cds_lfq_dequeue.c
doc/examples/rculfqueue/cds_lfq_enqueue.c
doc/examples/urcu-flavors/Makefile
doc/examples/urcu-flavors/Makefile.bp
doc/examples/urcu-flavors/Makefile.mb
doc/examples/urcu-flavors/Makefile.membarrier
doc/examples/urcu-flavors/Makefile.qsbr
doc/examples/urcu-flavors/Makefile.signal [deleted file]
doc/examples/urcu-flavors/bp.c
doc/examples/urcu-flavors/mb.c
doc/examples/urcu-flavors/membarrier.c
doc/examples/urcu-flavors/qsbr.c
doc/examples/urcu-flavors/signal.c [deleted file]
doc/examples/wfcqueue/Makefile
doc/examples/wfcqueue/Makefile.cds_wfcq_dequeue
doc/examples/wfcqueue/Makefile.cds_wfcq_enqueue
doc/examples/wfcqueue/Makefile.cds_wfcq_splice
doc/examples/wfcqueue/cds_wfcq_dequeue.c
doc/examples/wfcqueue/cds_wfcq_enqueue.c
doc/examples/wfcqueue/cds_wfcq_splice.c
doc/examples/wfstack/Makefile
doc/examples/wfstack/Makefile.cds_wfs_pop
doc/examples/wfstack/Makefile.cds_wfs_pop_all_blocking
doc/examples/wfstack/Makefile.cds_wfs_push
doc/examples/wfstack/cds_wfs_pop.c
doc/examples/wfstack/cds_wfs_pop_all_blocking.c
doc/examples/wfstack/cds_wfs_push.c
doc/rcu-api.md
doc/solaris-build.md
doc/uatomic-api.md
extras/Makefile.am
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu-bp.so.6.xml
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu-cds.so.6.xml
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu-common.so.6.xml
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu-mb.so.6.xml
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu-qsbr.so.6.xml
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu-signal.so.6.xml
extras/abi/0.10/x86_64-pc-linux-gnu/liburcu.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-bp.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-cds.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-common.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-mb.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-memb.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-qsbr.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu-signal.so.6.xml
extras/abi/0.11/x86_64-pc-linux-gnu/liburcu.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-bp.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-cds.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-common.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-mb.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-memb.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-qsbr.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu-signal.so.6.xml
extras/abi/0.12/x86_64-pc-linux-gnu/liburcu.so.6.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-bp.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-cds.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-common.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-mb.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-memb.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-qsbr.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-signal.so.8.xml
extras/abi/0.13/x86_64-pc-linux-gnu/liburcu.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-bp.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-cds.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-common.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-mb.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-memb.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-qsbr.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu-signal.so.8.xml
extras/abi/0.14/x86_64-pc-linux-gnu/liburcu.so.8.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu-bp.so.4.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu-cds.so.4.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu-common.so.4.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu-mb.so.4.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu-qsbr.so.4.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu-signal.so.4.xml
extras/abi/0.9/x86_64-pc-linux-gnu/liburcu.so.4.xml
extras/abi/README [deleted file]
extras/abi/README.md [new file with mode: 0644]
extras/abi/dump_abi.sh
gpl-2.0.txt [deleted file]
include/Makefile.am
include/urcu-bp.h
include/urcu-call-rcu.h
include/urcu-defer.h
include/urcu-flavor.h
include/urcu-pointer.h
include/urcu-qsbr.h
include/urcu.h
include/urcu/annotate.h [new file with mode: 0644]
include/urcu/arch.h
include/urcu/arch/aarch64.h
include/urcu/arch/alpha.h
include/urcu/arch/arm.h
include/urcu/arch/gcc.h
include/urcu/arch/generic.h
include/urcu/arch/hppa.h
include/urcu/arch/ia64.h
include/urcu/arch/loongarch.h [new file with mode: 0644]
include/urcu/arch/m68k.h
include/urcu/arch/mips.h
include/urcu/arch/nios2.h
include/urcu/arch/ppc.h
include/urcu/arch/riscv.h
include/urcu/arch/s390.h
include/urcu/arch/sparc64.h
include/urcu/arch/tile.h
include/urcu/arch/x86.h
include/urcu/assert.h
include/urcu/call-rcu.h
include/urcu/cds.h
include/urcu/compiler.h
include/urcu/config.h.in
include/urcu/debug.h
include/urcu/defer.h
include/urcu/flavor.h
include/urcu/futex.h
include/urcu/hlist.h
include/urcu/lfstack.h
include/urcu/list.h
include/urcu/map/clear.h
include/urcu/map/urcu-bp.h
include/urcu/map/urcu-mb.h
include/urcu/map/urcu-memb.h
include/urcu/map/urcu-qsbr.h
include/urcu/map/urcu-signal.h [deleted file]
include/urcu/map/urcu.h
include/urcu/pointer.h
include/urcu/rcuhlist.h
include/urcu/rculfhash.h
include/urcu/rculfqueue.h
include/urcu/rculfstack.h
include/urcu/rculist.h
include/urcu/ref.h
include/urcu/static/lfstack.h
include/urcu/static/pointer.h
include/urcu/static/rculfqueue.h
include/urcu/static/rculfstack.h
include/urcu/static/urcu-bp.h
include/urcu/static/urcu-common.h
include/urcu/static/urcu-mb.h
include/urcu/static/urcu-memb.h
include/urcu/static/urcu-qsbr.h
include/urcu/static/urcu-signal-nr.h [deleted file]
include/urcu/static/urcu-signal.h [deleted file]
include/urcu/static/urcu.h
include/urcu/static/wfcqueue.h
include/urcu/static/wfqueue.h
include/urcu/static/wfstack.h
include/urcu/syscall-compat.h
include/urcu/system.h
include/urcu/tls-compat.h
include/urcu/uatomic.h
include/urcu/uatomic/aarch64.h
include/urcu/uatomic/alpha.h
include/urcu/uatomic/arm.h
include/urcu/uatomic/builtins-generic.h [new file with mode: 0644]
include/urcu/uatomic/builtins.h [new file with mode: 0644]
include/urcu/uatomic/gcc.h
include/urcu/uatomic/generic.h
include/urcu/uatomic/hppa.h
include/urcu/uatomic/ia64.h
include/urcu/uatomic/loongarch.h [new file with mode: 0644]
include/urcu/uatomic/m68k.h
include/urcu/uatomic/mips.h
include/urcu/uatomic/nios2.h
include/urcu/uatomic/ppc.h
include/urcu/uatomic/riscv.h
include/urcu/uatomic/s390.h
include/urcu/uatomic/sparc64.h
include/urcu/uatomic/tile.h
include/urcu/uatomic/x86.h
include/urcu/uatomic_arch.h
include/urcu/urcu-bp.h
include/urcu/urcu-futex.h
include/urcu/urcu-mb.h
include/urcu/urcu-memb.h
include/urcu/urcu-poll.h [new file with mode: 0644]
include/urcu/urcu-qsbr.h
include/urcu/urcu-signal.h [deleted file]
include/urcu/urcu.h
include/urcu/urcu_ref.h
include/urcu/wfcqueue.h
include/urcu/wfqueue.h
include/urcu/wfstack.h
lgpl-2.1.txt [deleted file]
lgpl-relicensing.md [new file with mode: 0644]
lgpl-relicensing.txt [deleted file]
m4/ae_cc_atomic_builtins.m4 [new file with mode: 0644]
m4/ae_config_feature.m4
m4/ae_pprint.m4 [new file with mode: 0644]
m4/ax_append_compile_flags.m4
m4/ax_append_flag.m4
m4/ax_c___attribute__.m4
m4/ax_check_compile_flag.m4
m4/ax_cxx_compile_stdcxx.m4
m4/ax_pthread.m4
m4/ax_require_defined.m4
m4/pprint.m4 [deleted file]
scripts/urcu-api-list.sh
src/Makefile.am
src/compat-getcpu.h
src/compat-rand.h [deleted file]
src/compat_arch.c
src/compat_futex.c
src/lfstack.c
src/liburcu-bp.pc.in
src/liburcu-cds.pc.in
src/liburcu-mb.pc.in
src/liburcu-memb.pc.in
src/liburcu-qsbr.pc.in
src/liburcu-signal.pc.in [deleted file]
src/liburcu.pc.in
src/rculfhash-internal.h
src/rculfhash-mm-chunk.c
src/rculfhash-mm-mmap.c
src/rculfhash-mm-order.c
src/rculfhash.c
src/rculfqueue.c
src/rculfstack.c
src/urcu-bp.c
src/urcu-call-rcu-impl.h
src/urcu-defer-impl.h
src/urcu-die.h
src/urcu-pointer.c
src/urcu-poll-impl.h [new file with mode: 0644]
src/urcu-qsbr.c
src/urcu-utils.h
src/urcu-wait.h
src/urcu.c
src/wfcqueue.c
src/wfqueue.c
src/wfstack.c
src/workqueue.c
src/workqueue.h
tests/Makefile.am
tests/benchmark/Makefile.am
tests/benchmark/common-states.c [new file with mode: 0644]
tests/benchmark/common-states.h [new file with mode: 0644]
tests/benchmark/hashtable_1_seconds.tap
tests/benchmark/hashtable_30_seconds.tap
tests/benchmark/hashtable_3_seconds.tap
tests/benchmark/run-urcu-tests.sh
tests/benchmark/runhash.sh
tests/benchmark/runpaul-phase1.sh
tests/benchmark/runpaul-phase2.sh
tests/benchmark/runpaul-phase3.sh
tests/benchmark/runpaul-phase4.sh
tests/benchmark/runpaul-phase5.sh
tests/benchmark/runpaul-phase6.sh
tests/benchmark/runpaul-phase7.sh
tests/benchmark/runtests-batch.sh
tests/benchmark/runtests.sh
tests/benchmark/subphase4.sh
tests/benchmark/test_cycles_per_loop.c
tests/benchmark/test_looplen.c
tests/benchmark/test_mutex.c
tests/benchmark/test_perthreadlock.c
tests/benchmark/test_perthreadlock_timing.c
tests/benchmark/test_rwlock.c
tests/benchmark/test_rwlock_timing.c
tests/benchmark/test_urcu.c
tests/benchmark/test_urcu_assign.c
tests/benchmark/test_urcu_bp.c
tests/benchmark/test_urcu_defer.c
tests/benchmark/test_urcu_gc.c
tests/benchmark/test_urcu_hash.c
tests/benchmark/test_urcu_hash.h
tests/benchmark/test_urcu_hash_rw.c
tests/benchmark/test_urcu_hash_unique.c
tests/benchmark/test_urcu_lfq.c
tests/benchmark/test_urcu_lfs.c
tests/benchmark/test_urcu_lfs_rcu.c
tests/benchmark/test_urcu_qsbr.c
tests/benchmark/test_urcu_qsbr_gc.c
tests/benchmark/test_urcu_qsbr_timing.c
tests/benchmark/test_urcu_timing.c
tests/benchmark/test_urcu_wfcq.c
tests/benchmark/test_urcu_wfq.c
tests/benchmark/test_urcu_wfs.c
tests/benchmark/urcu_1_seconds.tap
tests/benchmark/urcu_30_seconds.tap
tests/benchmark/urcu_3_seconds.tap
tests/common/Makefile.am
tests/common/api.h
tests/common/compat-rand.h [new file with mode: 0644]
tests/common/debug-yield.c
tests/common/debug-yield.h
tests/common/thread-id.h
tests/regression/Makefile.am
tests/regression/rcutorture.h
tests/regression/test_rcutorture_urcu_bp_perf_global.tap
tests/regression/test_rcutorture_urcu_bp_perf_global_cxx.tap
tests/regression/test_rcutorture_urcu_bp_perf_percpu.tap
tests/regression/test_rcutorture_urcu_bp_perf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_bp_perf_perthread.tap
tests/regression/test_rcutorture_urcu_bp_perf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_bp_rperf_global.tap
tests/regression/test_rcutorture_urcu_bp_rperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_bp_rperf_percpu.tap
tests/regression/test_rcutorture_urcu_bp_rperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_bp_rperf_perthread.tap
tests/regression/test_rcutorture_urcu_bp_rperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_bp_stress_global.tap
tests/regression/test_rcutorture_urcu_bp_stress_global_cxx.tap
tests/regression/test_rcutorture_urcu_bp_stress_percpu.tap
tests/regression/test_rcutorture_urcu_bp_stress_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_bp_stress_perthread.tap
tests/regression/test_rcutorture_urcu_bp_stress_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_bp_uperf_global.tap
tests/regression/test_rcutorture_urcu_bp_uperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_bp_uperf_percpu.tap
tests/regression/test_rcutorture_urcu_bp_uperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_bp_uperf_perthread.tap
tests/regression/test_rcutorture_urcu_bp_uperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_mb_perf_global.tap
tests/regression/test_rcutorture_urcu_mb_perf_global_cxx.tap
tests/regression/test_rcutorture_urcu_mb_perf_percpu.tap
tests/regression/test_rcutorture_urcu_mb_perf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_mb_perf_perthread.tap
tests/regression/test_rcutorture_urcu_mb_perf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_mb_rperf_global.tap
tests/regression/test_rcutorture_urcu_mb_rperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_mb_rperf_percpu.tap
tests/regression/test_rcutorture_urcu_mb_rperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_mb_rperf_perthread.tap
tests/regression/test_rcutorture_urcu_mb_rperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_mb_stress_global.tap
tests/regression/test_rcutorture_urcu_mb_stress_global_cxx.tap
tests/regression/test_rcutorture_urcu_mb_stress_percpu.tap
tests/regression/test_rcutorture_urcu_mb_stress_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_mb_stress_perthread.tap
tests/regression/test_rcutorture_urcu_mb_stress_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_mb_uperf_global.tap
tests/regression/test_rcutorture_urcu_mb_uperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_mb_uperf_percpu.tap
tests/regression/test_rcutorture_urcu_mb_uperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_mb_uperf_perthread.tap
tests/regression/test_rcutorture_urcu_mb_uperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_perf_global.tap
tests/regression/test_rcutorture_urcu_membarrier_perf_global_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_perf_percpu.tap
tests/regression/test_rcutorture_urcu_membarrier_perf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_perf_perthread.tap
tests/regression/test_rcutorture_urcu_membarrier_perf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_rperf_global.tap
tests/regression/test_rcutorture_urcu_membarrier_rperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_rperf_percpu.tap
tests/regression/test_rcutorture_urcu_membarrier_rperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_rperf_perthread.tap
tests/regression/test_rcutorture_urcu_membarrier_rperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_stress_global.tap
tests/regression/test_rcutorture_urcu_membarrier_stress_global_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_stress_percpu.tap
tests/regression/test_rcutorture_urcu_membarrier_stress_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_stress_perthread.tap
tests/regression/test_rcutorture_urcu_membarrier_stress_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_uperf_global.tap
tests/regression/test_rcutorture_urcu_membarrier_uperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_uperf_percpu.tap
tests/regression/test_rcutorture_urcu_membarrier_uperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_membarrier_uperf_perthread.tap
tests/regression/test_rcutorture_urcu_membarrier_uperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_perf_global.tap
tests/regression/test_rcutorture_urcu_qsbr_perf_global_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_perf_percpu.tap
tests/regression/test_rcutorture_urcu_qsbr_perf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_perf_perthread.tap
tests/regression/test_rcutorture_urcu_qsbr_perf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_rperf_global.tap
tests/regression/test_rcutorture_urcu_qsbr_rperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_rperf_percpu.tap
tests/regression/test_rcutorture_urcu_qsbr_rperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_rperf_perthread.tap
tests/regression/test_rcutorture_urcu_qsbr_rperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_stress_global.tap
tests/regression/test_rcutorture_urcu_qsbr_stress_global_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_stress_percpu.tap
tests/regression/test_rcutorture_urcu_qsbr_stress_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_stress_perthread.tap
tests/regression/test_rcutorture_urcu_qsbr_stress_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_uperf_global.tap
tests/regression/test_rcutorture_urcu_qsbr_uperf_global_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_uperf_percpu.tap
tests/regression/test_rcutorture_urcu_qsbr_uperf_percpu_cxx.tap
tests/regression/test_rcutorture_urcu_qsbr_uperf_perthread.tap
tests/regression/test_rcutorture_urcu_qsbr_uperf_perthread_cxx.tap
tests/regression/test_rcutorture_urcu_signal_perf_global.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_perf_global_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_perf_percpu.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_perf_percpu_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_perf_perthread.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_perf_perthread_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_rperf_global.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_rperf_global_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_rperf_percpu.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_rperf_percpu_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_rperf_perthread.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_rperf_perthread_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_stress_global.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_stress_global_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_stress_percpu.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_stress_percpu_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_stress_perthread.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_stress_perthread_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_uperf_global.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_uperf_global_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_uperf_percpu.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_uperf_percpu_cxx.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_uperf_perthread.tap [deleted file]
tests/regression/test_rcutorture_urcu_signal_uperf_perthread_cxx.tap [deleted file]
tests/regression/test_urcu_fork.c
tests/regression/test_urcu_fork_cxx.cpp
tests/regression/urcutorture.c
tests/regression/urcutorture_cxx.cpp
tests/unit/Makefile.am
tests/unit/get_cpu_mask_from_sysfs_cxx.cpp
tests/unit/get_max_cpuid_from_sysfs_cxx.cpp
tests/unit/test_arch.c
tests/unit/test_arch_cxx.cpp
tests/unit/test_build.c
tests/unit/test_build_cxx.cpp
tests/unit/test_get_cpu_mask_from_sysfs
tests/unit/test_get_cpu_mask_from_sysfs_cxx
tests/unit/test_get_max_cpuid_from_mask_cxx.cpp
tests/unit/test_get_max_cpuid_from_sysfs
tests/unit/test_get_max_cpuid_from_sysfs_cxx
tests/unit/test_get_possible_cpus_array_len_cxx.cpp
tests/unit/test_lfstack.c [new file with mode: 0644]
tests/unit/test_uatomic.c
tests/unit/test_uatomic_cxx.cpp
tests/unit/test_urcu_multiflavor-bp.c
tests/unit/test_urcu_multiflavor-bp_cxx.cpp
tests/unit/test_urcu_multiflavor-mb.c
tests/unit/test_urcu_multiflavor-mb_cxx.cpp
tests/unit/test_urcu_multiflavor-memb.c
tests/unit/test_urcu_multiflavor-memb_cxx.cpp
tests/unit/test_urcu_multiflavor-qsbr.c
tests/unit/test_urcu_multiflavor-qsbr_cxx.cpp
tests/unit/test_urcu_multiflavor-signal.c [deleted file]
tests/unit/test_urcu_multiflavor-signal_cxx.cpp [deleted file]
tests/unit/test_urcu_multiflavor.c
tests/unit/test_urcu_multiflavor.h
tests/unit/test_urcu_multiflavor_cxx.cpp
tests/unit/test_urcu_multiflavor_single_unit.c
tests/unit/test_urcu_multiflavor_single_unit_cxx.cpp
tests/unit/test_wfcqueue.c [new file with mode: 0644]
tests/unit/test_wfqueue.c [new file with mode: 0644]
tests/unit/test_wfstack.c [new file with mode: 0644]
tests/unit/urcu-asm.c
tests/unit/urcu-asm_cxx.cpp
tests/utils/Makefile.am
tests/utils/env.sh.in
tests/utils/tap.h
tests/utils/tap.sh
tests/utils/utils.sh

index cbb033286e49f4400a16d03e0df1e9c3684f7abe..8b3a2abaac85ae3c923689feb4caf886ef003c68 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2009-2022 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 tests/api.h
 
 
index 84299ac79fdb26d30603dd20e9a7275654230dae..c197662b927e429fd66aef19a38b491fd1b145b5 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2020 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 [gerrit]
 host=review.lttng.org
 port=29418
index c9c64b81797f6e5946cbbb6428c2995458cf46f5..a7fd3497dbf9d213876c1eed188a4b669ebe9dcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,89 @@
+# SPDX-FileCopyrightText: 2011-2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: CC-BY-4.0
+
+2023-02-14 Userspace RCU 0.14.0
+       * Fix: urcu-bp: only teardown call-rcu worker in destructor
+       * Fix: rculfhash: urcu_die() takes positive error value
+       * Fix: call_rcu: teardown default call_rcu worker on application exit
+       * Fix: join worker thread in call_rcu_data_free
+       * Docs: clarify grace period polling API
+       * Document grace period polling in rcu-api.md
+       * Implement poll rcu stress test in rcutorture
+       * urcu-memb,mb,signal: Implement grace period polling
+       * Fix: auto-resize hash table destroy deadlock
+       * Fix building on MSYS2
+       * rculfhash: Include rculfhash-internal.h from local directory
+       * Remove "Darwin" from "should also work on list"
+       * Merge branch 'adah1972-improve-md'
+       * Add semicolons at the end of function prototypes
+       * Wrap a file name in backticks
+       * Wrap command-line options in backticks
+       * Fix a wrong format
+       * Wrap URLs in angle brackets
+       * Fix Markdown issues
+       * Fix: Always check pthread_create for failures
+       * Disable signals in URCU background threads
+       * Fix: futex.h: include headers outside extern C
+       * Fix: add missing unused attribute to _rcu_dereference
+       * Fix: change method used by _rcu_dereference to strip type constness
+       * Fix: remove type constness in URCU_FORCE_CAST's C++ version
+       * Move extern "C" down in include/urcu/urcu-bp.h
+       * fix: ifdef linux specific cpu count compat
+       * Add unit tests for possible_cpus_array_len
+       * fix: sysconf(_SC_NPROCESSORS_CONF) can be less than max cpu id
+       * Fix: revise obsolete command in README.md
+       * Fix: workqueue: remove unused variable "ret"
+       * Fix: urcu-qsbr: futex wait: handle spurious futex wakeups
+       * Fix: urcu: futex wait: handle spurious futex wakeups
+       * Fix: urcu-wait: futex wait: handle spurious futex wakeups
+       * Fix: defer_rcu: futex wait: handle spurious futex wakeups
+       * Fix: call_rcu: futex wait: handle spurious futex wakeups
+       * Fix: workqueue: futex wait: handle spurious futex wakeups
+       * Fix: Use %lu rather than %ld to print count
+       * Update ABI definition files
+       * Bump version current and age
+       * alpha: allocate membarrier system call number
+       * Bump version to 0.14.0-pre
+       * Improved test framework
+       * rculfhash: introduce cds_lfht_node_init_deleted
+       * Fix: changelog: v0.13.0 was released in 2021
+       * cleanup: i386 arch detection
+       * fix: properly detect 'cmpxchg' on x86-32
+       * fix: use urcu-tls compat with c++ compiler
+       * Fix typo
+       * fix: remove autoconf features default value in help message
+       * fix: add missing pkgconfig file for memb flavour lib
+       * Cleanup: Tests: Remove useless pre-C99 compatibility code from tap.h
+       * Document C99 and C++11 requirement in README.md
+       * Always use '__thread' for Thread local storage except on MSVC
+       * Fix: powerpc32: transparent unions alter calling convention
+       * fix: don't use C++ thread_local on MacOs
+       * wfcqueue API: implement overloaded wrappers with templates
+       * wfcqueue: combine C++ API cds_wfcq_head_cast with overloading
+       * wfstack C++ API: implement overloaded wrappers with templates
+       * lfstack C++ API: implement overloaded wrappers with templates
+       * wfstack: combine C++ API cds_wfs_stack_cast with overloading
+       * lfstack: combine C++ API cds_lfs_stack_cast with overloading
+       * fix: test_build tap plan
+       * Test C++ build of list head init
+       * Fix order of initializers in CDS_LIST_HEAD_INIT
+       * unit tests: test wfcqueue, wfstack, lfstack empty check functions in C++
+       * wfcqueue: implement C++ API based on function overloading
+       * wfstack: implement C++ API based on function overloading
+       * lfstack: implement C++ API based on function overloading
+       * Fix tap.h: remove extra semicolon in pass/fail macros
+       * Add C++ build tests
+       * Build and run regression and unit tests as C++ programs
+       * Add --enable-Werror configure switch
+       * Add `urcu_posix_assert()` as `assert()` replacement
+       * Rename `urcu_assert()` to `urcu_assert_debug()`
+       * cleanup: spelling fixes in comments
+       * Make temporary variable in _rcu_dereference non-const
+       * (tls-ie2) Fix: x86 and s390: uatomic __hp() macro C++ support
+       * Fix: x86 and s390: uatomic __hp() macro clang support
+       * Fix: x86 and s390 uatomic: __hp() macro warning with gcc 11
+
 2021-06-03 Userspace RCU 0.13.0
        * Document known ABI issue in README.md
        * Add serialized ABI definition files
diff --git a/CodingStyle b/CodingStyle
deleted file mode 100644 (file)
index 5a33e8d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Userspace RCU Coding Style
-
-The coding style used for this project follows the Linux kernel
-guide lines. Please refer to:
-
-- Linux kernel Documentation/CodingStyle document for details,
-- Linux kernel scripts/checkpatch.pl for a script which verify the patch
-  coding style.
-
-Mathieu Desnoyers, May 30, 2012
diff --git a/CodingStyle.md b/CodingStyle.md
new file mode 100644 (file)
index 0000000..d2ad79a
--- /dev/null
@@ -0,0 +1,16 @@
+<!--
+SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
+# Userspace RCU Coding Style
+
+The coding style used for this project follows the Linux kernel
+guide lines. Please refer to:
+
+- Linux kernel Documentation/CodingStyle document for details,
+- Linux kernel scripts/checkpatch.pl for a script which verify the patch
+  coding style.
+
+Mathieu Desnoyers, May 30, 2012
diff --git a/LICENSE b/LICENSE
deleted file mode 100644 (file)
index a06fdcc..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,63 +0,0 @@
-Userspace RCU library licensing
-Mathieu Desnoyers
-September 3, 2012
-
-
-* LGPLv2.1
-
-The library part is distributed under LGPLv2.1 or later. See lgpl-2.1.txt for
-license details. Refer to the individual file headers for details.
-
-LGPL-compatible source code can statically use the library header using :
-
-#define _LGPL_SOURCE
-#include <urcu.h>
-
-Dynamic-only linking with the LGPL library is used if _LGPL_SOURCE is not
-defined. It permits relinking with newer versions of the library, which is
-required by the LGPL license.
-
-See lgpl-relicensing.txt for details.
-
-
-* MIT-style license :
-
-xchg() primitive has been rewritten from scratch starting from atomic_ops 1.2
-which has a MIT-style license that is intended to allow use in both free and
-proprietary software:
-       http://www.hpl.hp.com/research/linux/atomic_ops/LICENSING.txt
-       http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
-
-This MIT-style license (BSD like) apply to:
-
-uatomic/gcc.h
-uatomic/unknown.h
-uatomic/generic.h
-uatomic/sparc64.h
-uatomic/arm.h
-uatomic/ppc.h
-uatomic/x86.h
-uatomic.h
-
-MIT/X11 (BSD like) license apply to:
-
-compiler.h
-arch/s390.h
-uatomic/alpha.h
-uatomic/mips.h
-uatomic/nios2.h
-uatomic/s390.h
-system.h
-
-
-* GPLv2
-
-Library test code is distributed under the GPLv2 license. See gpl-2.0.txt for
-license details. See headers of individual files under tests/ for details.
-
-
-* GPLv3 (or later)
-
-The following build-related macro is under GPLv3 (or later):
-
-m4/ax_tls.m4
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644 (file)
index 0000000..6a5d204
--- /dev/null
@@ -0,0 +1,64 @@
+# Userspace RCU library licensing
+
+This project is compliant with the [REUSE](https://reuse.software/spec/)
+specification, each file contains [SPDX](https://spdx.org/specifications) tags,
+the full licenses can be found in the `LICENSES/` directory.
+
+
+## Library code
+
+The library part is distributed under `LGPL-2.1-or-later`. See
+`LICENSES/LGPL-2.1-or-later.txt` for license details. Refer to the individual
+file headers for details.
+
+LGPL-compatible source code can statically use the library header using :
+
+````
+#define _LGPL_SOURCE
+#include <urcu.h>
+````
+
+Dynamic-only linking with the LGPL library is used if `_LGPL_SOURCE` is not
+defined. It permits relinking with newer versions of the library, which is
+required by the LGPL license.
+
+See `lgpl-relicensing.md` for details.
+
+
+## Headers
+
+Most headers are also distributed under `LGPL-2.1-or-later`, some include code
+from `atomic_ops` and are distributed under `Boehm-GC` and some others are
+distributed under `MIT`. Refer to the individual file headers for details.
+
+xchg() primitive has been rewritten from scratch starting from `atomic_ops 1.2`
+which has a MIT-style license that is intended to allow use in both free and
+proprietary software:
+
+````
+http://www.hpl.hp.com/research/linux/atomic_ops/LICENSING.txt
+http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
+````
+
+
+## Tests
+
+Library test code is distributed under the `GPL-2.0-only` license. See
+`LICENSES/GPL-2.0-only.txt` for license details. See headers of individual
+files under `tests/` for details.
+
+
+## Documentation
+
+The documentation is distributed under the `CC-BY-4.0` license.
+
+
+## Build system
+
+Build system related files are mostly distributed under the `MIT` license. See
+headers of individual files for details.
+
+
+## Generated data files
+
+Generated data files are distributed under the `CC-1.0` license.
diff --git a/LICENSES/Autoconf-exception-2.0.txt b/LICENSES/Autoconf-exception-2.0.txt
new file mode 100644 (file)
index 0000000..00cddeb
--- /dev/null
@@ -0,0 +1,5 @@
+As a special exception, the Free Software Foundation gives unlimited permission to copy, distribute and modify the configure scripts that are the output of Autoconf. You need not follow the terms of the GNU General Public License when using or distributing such scripts, even though portions of the text of Autoconf appear in them. The GNU General Public License (GPL) does govern all other use of the material that constitutes the Autoconf program.
+
+Certain portions of the Autoconf source text are designed to be copied (in certain cases, depending on the input) into the output of Autoconf. We call these the "data" portions. The rest of the Autoconf source text consists of comments plus executable code that decides which of the data portions to output in any given case. We call these comments and executable code the "non-data" portions. Autoconf never copies any of the non-data portions into its output.
+
+This special exception to the GPL applies to versions of Autoconf released by the Free Software Foundation. When you make and distribute a modified version of Autoconf, you may extend this special exception to the GPL to apply to your modified version as well, *unless* your modified version has the potential to copy into its output some of the text that was the non-data portion of the version that you started with. (In other words, unless your change moves or copies text from the non-data portions to the data portions.) If your modification has such potential, you must delete any notice of this special exception to the GPL from your modified version.
diff --git a/LICENSES/BSD-2-Clause.txt b/LICENSES/BSD-2-Clause.txt
new file mode 100644 (file)
index 0000000..5f662b3
--- /dev/null
@@ -0,0 +1,9 @@
+Copyright (c) <year> <owner> 
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSES/CC-BY-4.0.txt b/LICENSES/CC-BY-4.0.txt
new file mode 100644 (file)
index 0000000..13ca539
--- /dev/null
@@ -0,0 +1,156 @@
+Creative Commons Attribution 4.0 International
+
+ Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
+
+Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
+
+Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+
+Section 1 – Definitions.
+
+     a.        Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
+
+     b.        Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
+
+     c.        Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
+
+     d.        Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
+
+     e.        Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
+
+     f.        Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
+
+     g.        Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
+
+     h.        Licensor means the individual(s) or entity(ies) granting rights under this Public License.
+
+     i.        Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
+
+     j.        Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
+
+     k.        You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
+
+Section 2 – Scope.
+
+     a.        License grant.
+
+          1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
+
+               A. reproduce and Share the Licensed Material, in whole or in part; and
+
+               B. produce, reproduce, and Share Adapted Material.
+
+          2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
+
+          3. Term. The term of this Public License is specified in Section 6(a).
+
+          4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
+
+          5. Downstream recipients.
+
+               A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
+
+               B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
+
+          6.  No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
+
+b. Other rights.
+
+          1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
+
+          2. Patent and trademark rights are not licensed under this Public License.
+
+          3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
+
+Section 3 – License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+     a.        Attribution.
+
+          1. If You Share the Licensed Material (including in modified form), You must:
+
+               A. retain the following if it is supplied by the Licensor with the Licensed Material:
+
+                    i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
+
+                    ii. a copyright notice;
+
+                    iii. a notice that refers to this Public License;
+
+                    iv.        a notice that refers to the disclaimer of warranties;
+
+                    v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
+
+               B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
+
+               C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
+
+          2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
+
+          3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
+
+          4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
+
+Section 4 – Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+     a.        for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
+
+     b.        if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
+
+     c.        You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+
+Section 5 – Disclaimer of Warranties and Limitation of Liability.
+
+     a.        Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
+
+     b.        To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
+
+     c.        The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
+
+Section 6 – Term and Termination.
+
+     a.        This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
+
+     b.        Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
+
+          1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
+
+          2. upon express reinstatement by the Licensor.
+
+     c.        For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
+
+     d.        For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
+
+     e.        Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
+
+Section 7 – Other Terms and Conditions.
+
+     a.        The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
+
+     b.        Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
+
+Section 8 – Interpretation.
+
+     a.        For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
+
+     b.        To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
+
+     c.        No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
+
+     d.        Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
+
+Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt
new file mode 100644 (file)
index 0000000..0e259d4
--- /dev/null
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+    HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+  i. the right to reproduce, adapt, distribute, perform, display,
+     communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+     likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+     subject to the limitations in paragraph 4(a), below;
+  v. rights protecting the extraction, dissemination, use and reuse of data
+     in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+     European Parliament and of the Council of 11 March 1996 on the legal
+     protection of databases, and under any national implementation
+     thereof, including any amended or successor version of such
+     directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+     world based on applicable law or treaty, and any national
+     implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+    surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+    warranties of any kind concerning the Work, express, implied,
+    statutory or otherwise, including without limitation warranties of
+    title, merchantability, fitness for a particular purpose, non
+    infringement, or the absence of latent or other defects, accuracy, or
+    the present or absence of errors, whether or not discoverable, all to
+    the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+    that may apply to the Work or any use thereof, including without
+    limitation any person's Copyright and Related Rights in the Work.
+    Further, Affirmer disclaims responsibility for obtaining any necessary
+    consents, permissions or other rights required for any use of the
+    Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+    party to this document and has no duty or obligation with respect to
+    this CC0 or use of the Work.
diff --git a/LICENSES/FSFAP.txt b/LICENSES/FSFAP.txt
new file mode 100644 (file)
index 0000000..32bc8a8
--- /dev/null
@@ -0,0 +1 @@
+Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.  This file is offered as-is, without any warranty.
diff --git a/LICENSES/GPL-2.0-only.txt b/LICENSES/GPL-2.0-only.txt
new file mode 100644 (file)
index 0000000..17cb286
--- /dev/null
@@ -0,0 +1,117 @@
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+     a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+     b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+
+     c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+     a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+     b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+     c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+     one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
+
+     This program is 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+     Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
+
+     Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
diff --git a/LICENSES/GPL-2.0-or-later.txt b/LICENSES/GPL-2.0-or-later.txt
new file mode 100644 (file)
index 0000000..17cb286
--- /dev/null
@@ -0,0 +1,117 @@
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+     a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+     b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+
+     c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+     a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+     b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+     c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+     one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
+
+     This program is 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+     Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
+
+     Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt
new file mode 100644 (file)
index 0000000..f6cdd22
--- /dev/null
@@ -0,0 +1,232 @@
+GNU GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+
+Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The GNU General Public License is a free, copyleft license for software and other kinds of works.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
+
+To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
+
+Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS
+
+0. Definitions.
+
+“This License” refers to version 3 of the GNU General Public License.
+
+“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
+
+“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
+
+To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
+
+A “covered work” means either the unmodified Program or a work based on the Program.
+
+To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
+
+To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
+
+An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
+
+1. Source Code.
+The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
+
+A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
+
+The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
+
+The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same work.
+
+2. Basic Permissions.
+All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
+
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
+
+When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
+
+4. Conveying Verbatim Copies.
+You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
+
+5. Conveying Modified Source Versions.
+You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
+
+     a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
+
+     b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
+
+     c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
+
+     d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
+
+A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
+
+6. Conveying Non-Source Forms.
+You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
+
+     a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
+
+     b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
+
+     c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
+
+     d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
+
+     e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
+
+A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
+
+A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
+
+“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
+
+The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
+
+Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
+
+7. Additional Terms.
+“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
+
+     a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
+
+     b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
+
+     c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
+
+     d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
+
+     e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
+
+     f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
+
+All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
+
+8. Termination.
+You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
+
+9. Acceptance Not Required for Having Copies.
+You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
+
+10. Automatic Licensing of Downstream Recipients.
+Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
+
+An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
+
+11. Patents.
+A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
+
+A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
+
+In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
+
+A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
+
+12. No Surrender of Others' Freedom.
+If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
+
+13. Use with the GNU Affero General Public License.
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
+
+14. Revised Versions of this License.
+The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+
+15. Disclaimer of Warranty.
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. Limitation of Liability.
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+17. Interpretation of Sections 15 and 16.
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
+
+     <one line to give the program's name and a brief idea of what it does.>
+     Copyright (C) <year>  <name of author>
+
+     This program is 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 <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
+
+     <program>  Copyright (C) <year>  <name of author>
+     This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+     This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
+
+You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
+
+The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/LICENSES/LGPL-2.1-only.txt b/LICENSES/LGPL-2.1-only.txt
new file mode 100644 (file)
index 0000000..c9aa530
--- /dev/null
@@ -0,0 +1,175 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+
+Version 2.1, February 1999
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
+
+When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
+
+To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
+
+Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
+
+When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
+
+We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
+
+For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+     a) The modified work must itself be a software library.
+
+     b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
+
+     c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
+
+     d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
+
+(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
+
+Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
+
+You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
+
+     a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
+
+     b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
+
+     c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
+
+     d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
+
+     e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
+
+For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
+
+7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
+
+     a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
+
+     b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
+
+11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Libraries
+
+If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).
+
+To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+     one line to give the library's name and an idea of what it does.
+     Copyright (C) year  name of author
+
+     This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+
+     This library 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 Lesser General Public License for more details.
+
+     You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in
+the library `Frob' (a library for tweaking knobs) written
+by James Random Hacker.
+
+signature of Ty Coon, 1 April 1990
+Ty Coon, President of Vice
+That's all there is to it!
diff --git a/LICENSES/LGPL-2.1-or-later.txt b/LICENSES/LGPL-2.1-or-later.txt
new file mode 100644 (file)
index 0000000..c9aa530
--- /dev/null
@@ -0,0 +1,175 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+
+Version 2.1, February 1999
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
+
+When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
+
+To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
+
+Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
+
+When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
+
+We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
+
+For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+     a) The modified work must itself be a software library.
+
+     b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
+
+     c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
+
+     d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
+
+(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
+
+Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
+
+You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
+
+     a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
+
+     b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
+
+     c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
+
+     d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
+
+     e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
+
+For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
+
+7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
+
+     a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
+
+     b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
+
+11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Libraries
+
+If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).
+
+To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+     one line to give the library's name and an idea of what it does.
+     Copyright (C) year  name of author
+
+     This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+
+     This library 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 Lesser General Public License for more details.
+
+     You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in
+the library `Frob' (a library for tweaking knobs) written
+by James Random Hacker.
+
+signature of Ty Coon, 1 April 1990
+Ty Coon, President of Vice
+That's all there is to it!
diff --git a/LICENSES/LicenseRef-Autoconf-exception-macro.txt b/LICENSES/LicenseRef-Autoconf-exception-macro.txt
new file mode 100644 (file)
index 0000000..8b5b467
--- /dev/null
@@ -0,0 +1,12 @@
+As a special exception, the respective Autoconf Macro's copyright owner
+gives unlimited permission to copy, distribute and modify the configure
+scripts that are the output of Autoconf when processing the Macro. You
+need not follow the terms of the GNU General Public License when using
+or distributing such scripts, even though portions of the text of the
+Macro appear in them. The GNU General Public License (GPL) does govern
+all other use of the material that constitutes the Autoconf Macro.
+
+This special exception to the GPL applies to versions of the Autoconf
+Macro released by the Autoconf Archive. When you make and distribute a
+modified version of the Autoconf Macro, you may extend this special
+exception to the GPL to apply to your modified version as well.
diff --git a/LICENSES/LicenseRef-Boehm-GC.txt b/LICENSES/LicenseRef-Boehm-GC.txt
new file mode 100644 (file)
index 0000000..95427c0
--- /dev/null
@@ -0,0 +1,12 @@
+Copyright (c) ...
+
+THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+
+Permission is hereby granted to use or copy this program
+for any purpose,  provided the above notices are retained on all copies.
+Permission to modify the code and to distribute modified code is granted,
+provided the above notices are retained, and a notice that the code was
+modified is included with the above copyright notice.
+
+A few files have other copyright holders.
diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt
new file mode 100644 (file)
index 0000000..2071b23
--- /dev/null
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) <year> <copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
index 613e1cd58c0e13b44e003075984059c00dd65642..539a2ca3ad34c2aa7ddc84b075ce7666d4a6d550 100644 (file)
@@ -1,15 +1,30 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 ACLOCAL_AMFLAGS=-I m4
 
 SUBDIRS = include src doc tests extras
 
-dist_doc_DATA = LICENSE \
-               README.md
-
-dist_noinst_DATA = CodingStyle
+dist_doc_DATA = \
+       LICENSE.md \
+       README.md
 
-EXTRA_DIST = gpl-2.0.txt \
-       lgpl-2.1.txt \
-       lgpl-relicensing.txt
+EXTRA_DIST = \
+       CodingStyle.md \
+       lgpl-relicensing.md \
+       LICENSES/Autoconf-exception-2.0.txt \
+       LICENSES/BSD-2-Clause.txt \
+       LICENSES/CC0-1.0.txt \
+       LICENSES/CC-BY-4.0.txt \
+       LICENSES/FSFAP.txt \
+       LICENSES/GPL-2.0-only.txt \
+       LICENSES/GPL-2.0-or-later.txt \
+       LICENSES/LGPL-2.1-only.txt \
+       LICENSES/LGPL-2.1-or-later.txt \
+       LICENSES/LicenseRef-Autoconf-exception-macro.txt \
+       LICENSES/LicenseRef-Boehm-GC.txt \
+       LICENSES/MIT.txt
 
 .PHONY: short_bench long_bench regtest check-loop
 short_bench:
index 2fe14c3db756394d2cdf2c09ebe5e1b018c89324..d868ac491c50152662c25c4ffe48723f32f15cf7 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,3 +1,9 @@
+<!--
+SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
 Userspace RCU Implementation
 ============================
 
@@ -51,12 +57,12 @@ Currently, the following architectures are supported:
   - hppa/PA-RISC
   - m68k
   - RISC-V
+  - LoongArch
 
 Tested on:
 
   - Linux all architectures
-  - FreeBSD 8.2/8.3/9.0/9.1/10.0 i386/amd64
-  - Solaris 10/11 i386
+  - FreeBSD 13 i386/amd64
   - Cygwin i386/amd64
   - MacOS amd64/arm64
 
@@ -65,17 +71,19 @@ Should also work on:
   - Android
   - NetBSD 5
   - OpenBSD
+  - Solaris
 
 (more testing needed before claiming support for these OS).
 
-Linux ARM depends on running a Linux kernel 2.6.15 or better, GCC 4.4 or
-better.
 
-The C compiler used needs to support at least C99. The C++ compiler used
-needs to support at least C++11.
+Toolchain support
+-----------------
 
-The GCC compiler versions 3.3, 3.4, 4.0, 4.1, 4.2, 4.3, 4.4 and 4.5 are
-supported, with the following exceptions:
+The C compiler used needs to support at least C99. The C++ compiler used needs
+to support at least C++11. The oldest GCC version officialy supported and
+tested is 4.8.
+
+Older GCC versions might still work with the following exceptions:
 
   - GCC 3.3 and 3.4 have a bug that prevents them from generating volatile
     accesses to offsets in a TLS structure on 32-bit x86. These versions are
@@ -96,6 +104,10 @@ Clang version 3.0 (based on LLVM 3.0) is supported.
 Glibc >= 2.4 should work but the older version we test against is
 currently 2.17.
 
+
+Build system
+------------
+
 For developers using the Git tree:
 
 This source tree is based on the autotools suite from GNU to simplify
@@ -159,7 +171,6 @@ There are multiple flavors of liburcu available:
   - `memb`,
   - `qsbr`,
   - `mb`,
-  - `signal`,
   - `bp`.
 
 The API members start with the prefix `urcu_<flavor>_`, where
@@ -204,15 +215,6 @@ and reader sides. This results in faster grace-period detection, but
 results in slower reads.
 
 
-### Usage of `liburcu-signal`
-
-  1. `#include <urcu/urcu-signal.h>`
-  2. Link the application with `-lurcu-signal`
-
-Version of the library that requires a signal, typically `SIGUSR1`. Can
-be overridden with `-DSIGRCU` by modifying `Makefile.build.inc`.
-
-
 ### Usage of `liburcu-bp`
 
   1. `#include <urcu/urcu-bp.h>`
@@ -250,11 +252,19 @@ protected pointer.
 After, `urcu_<flavor>_synchronize_rcu()` must be called. When it
 returns, the old values are not in usage anymore.
 
+As an alternative to `urcu_<flavor>_synchronize_rcu()`,
+it is also possible to use the urcu polling mechanism to wait for a
+grace period to elapse. This can be done by using
+`urcu_<flavor>_start_poll_synchronize_rcu()`
+to start the grace period polling, and then invoke
+`urcu_<flavor>_poll_state_synchronize_rcu()`, which returns true if
+the grace period has completed, false otherwise.
+
 
 ### Usage of `liburcu-defer`
 
   - Follow instructions for either `liburcu-memb`, `liburcu-qsbr`,
-    `liburcu-mb`, `liburcu-signal`, or `liburcu-bp` above.
+    `liburcu-mb`, or `liburcu-bp` above.
     The `liburcu-defer` functionality is pulled into each of
     those library modules.
   - Provides `urcu_<flavor>_defer_rcu()` primitive to enqueue delayed
@@ -273,7 +283,7 @@ Its API is currently experimental. It may change in future library releases.
 ### Usage of `urcu-call-rcu`
 
   - Follow instructions for either `liburcu-memb`, `liburcu-qsbr`,
-    `liburcu-mb`, `liburcu-signal`, or `liburcu-bp` above.
+    `liburcu-mb`, or `liburcu-bp` above.
     The `urcu-call-rcu` functionality is pulled into each of
     those library modules.
   - Provides the `urcu_<flavor>_call_rcu()` primitive to enqueue delayed
@@ -291,13 +301,6 @@ Its API is currently experimental. It may change in future library releases.
 
 ### Being careful with signals
 
-The `liburcu-signal` library uses signals internally. The signal handler is
-registered with the `SA_RESTART` flag. However, these signals may cause
-some non-restartable system calls to fail with `errno = EINTR`. Care
-should be taken to restart system calls manually if they fail with this
-error. A list of non-restartable system calls may be found in
-`signal(7)`.
-
 Read-side critical sections are allowed in a signal handler,
 except those setup with `sigaltstack(2)`, with `liburcu-memb` and
 `liburcu-mb`. Be careful, however, to disable these signals
@@ -421,6 +424,10 @@ still being used to iterate on a hash table.
 This option alters the rculfhash ABI. Make sure to compile both library
 and application with matching configuration.
 
+### Usage of `--enable-compiler-atomic-builtins`
+
+Building liburcu with `--enable-compiler-atomic-builtins` implements the uatomic
+API with the compiler atomic builtins if supported.
 
 Make targets
 ------------
@@ -469,3 +476,18 @@ Contacts
 
 You can contact the maintainers on the following mailing list:
 `lttng-dev@lists.lttng.org`.
+
+IRC channel: [#lttng](irc://irc.oftc.net/lttng) on the OFTC network
+
+Bug tracker: [Userspace RCU bug tracker](https://bugs.lttng.org/projects/urcu)
+
+Code review: [_userspace-rcu_ project](https://review.lttng.org/q/project:userspace-rcu) on LTTng Review
+
+Continuous integration: [Userspace RCU](https://ci.lttng.org/view/Liburcu/) on LTTng's CI
+
+GitHub mirror: [urcu/userspace-rcu](https://github.com/urcu/userspace-rcu)
+
+Patches are principally submitted and reviewed on [LTTng Review](https://review.lttng.org),
+but may also be submitted to the [mailing list](mailto:lttng-dev@lists.lttng.org)
+with the subject prefix `PATCH urcu` or by pull request on the
+[GitHub mirror](https://github.com/urcu/userspace-rcu).
index f278ad91b1559a9a743afe903ceeb7bb9c82b275..47a85ff608d48cc8549d32c6e3b8c4416862b85f 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,8 @@
 #!/bin/sh
+
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
 #
-# SPDX-License-Identifier: LGPL-2.1-only
+# SPDX-License-Identifier: MIT
 
 set -x
 if [ ! -d "config" ]; then
index f074735b09a64dfc3625a787ee10595a6fe1ba41..2807932258549ab93b012862a8063785748a16fa 100644 (file)
@@ -6,7 +6,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 # Project version information
 m4_define([urcu_version_major], [0])
-m4_define([urcu_version_minor], [14])
+m4_define([urcu_version_minor], [15])
 m4_define([urcu_version_patch], [0])
 m4_define([urcu_version_dev_stage], [-pre])
 m4_define([urcu_version], urcu_version_major[.]urcu_version_minor[.]urcu_version_patch[]urcu_version_dev_stage)
@@ -51,7 +51,7 @@ AM_SILENT_RULES([yes])
 ##                               ##
 
 AS_CASE([$host],
-  [*-cygwin*], [LT_NO_UNDEFINED="-no-undefined"]
+  [*-cygwin* | *-msys*], [LT_NO_UNDEFINED="-no-undefined"]
 )
 
 
@@ -71,6 +71,10 @@ AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not s
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 
+# Check if the selected C compiler supports atomic builtins
+AE_CC_ATOMIC_BUILTINS
+
+
 ##                     ##
 ## C++ compiler checks ##
 ##                     ##
@@ -230,6 +234,16 @@ AE_FEATURE([rcu-debug], [Enable internal debugging self-checks. Introduces a per
 AE_FEATURE_DEFAULT_DISABLE
 AE_FEATURE([cds-lfht-iter-debug], [Enable extra debugging checks for lock-free hash table iterator traversal. Alters the rculfhash ABI. Make sure to compile both library and application with matching configuration.])
 
+# Use compiler atomic builtins, when disabled use our legacy uatomic implementation.
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([compiler-atomic-builtins], [Enable the use of compiler atomic builtins.])
+
+# emit legacy memory barriers
+# Enable by default
+AE_FEATURE_DEFAULT_ENABLE
+AE_FEATURE([legacy-mb], [Disable legacy memory barriers.])
+
 # When given, add -Werror to WARN_CFLAGS and WARN_CXXFLAGS.
 # Disabled by default
 AE_FEATURE_DEFAULT_DISABLE
@@ -259,6 +273,13 @@ AE_IF_FEATURE_ENABLED([cds-lfht-iter-debug], [
   AC_DEFINE([CONFIG_CDS_LFHT_ITER_DEBUG], [1], [Enable extra debugging checks for lock-free hash table iterator traversal. Alters the rculfhash ABI. Make sure to compile both library and application with matching configuration.])
 ])
 
+AE_IF_FEATURE_ENABLED([compiler-atomic-builtins], [
+  AC_DEFINE([CONFIG_RCU_USE_ATOMIC_BUILTINS], [1], [Use compiler atomic builtins.])
+])
+
+AE_IF_FEATURE_ENABLED([legacy-mb], [
+  AC_DEFINE([CONFIG_RCU_EMIT_LEGACY_MB], [1], [Emit legacy memory barriers that were documented in the APIs.])
+])
 
 ##                                                                          ##
 ## Set automake variables for optional feature conditionnals in Makefile.am ##
@@ -268,6 +289,17 @@ AE_IF_FEATURE_ENABLED([cds-lfht-iter-debug], [
 AM_CONDITIONAL([ENABLE_EXAMPLES], AE_IS_FEATURE_ENABLED([shared]))
 
 
+##                                          ##
+## Check for optional features dependencies ##
+##                                          ##
+
+
+AE_IF_FEATURE_ENABLED([compiler-atomic-builtins], [
+  AS_IF([test "x$ae_cv_cc_atomic_builtins" != xyes], [
+     AC_MSG_ERROR([The compiler does not support atomic builtins.])
+  ])
+])
+
 ##                                             ##
 ## Substitute variables for use in Makefile.am ##
 ##                                             ##
@@ -313,7 +345,6 @@ AC_CONFIG_FILES([
        src/liburcu-qsbr.pc
        src/liburcu-mb.pc
        src/liburcu-memb.pc
-       src/liburcu-signal.pc
 ])
 
 AC_CONFIG_FILES([tests/utils/env.sh],[chmod +x tests/utils/env.sh])
@@ -325,50 +356,58 @@ AC_OUTPUT
 # Mini-report on what will be built.
 #
 
-PPRINT_INIT
-PPRINT_SET_INDENT(1)
-PPRINT_SET_TS(38)
+AE_PPRINT_INIT
+AE_PPRINT_SET_INDENT(1)
+AE_PPRINT_SET_TS(38)
 
 AS_ECHO
-AS_ECHO("${PPRINT_COLOR_BLDBLU}Userspace-RCU $PACKAGE_VERSION${PPRINT_COLOR_RST}")
+AS_ECHO("${AE_PPRINT_COLOR_BLDBLU}Userspace-RCU $PACKAGE_VERSION${AE_PPRINT_COLOR_RST}")
 AS_ECHO
 
-PPRINT_SUBTITLE([Features])
+AE_PPRINT_SUBTITLE([Features])
 
-PPRINT_PROP_STRING([Target architecture], $host_cpu)
+AE_PPRINT_PROP_STRING([Target architecture], $host_cpu)
 
 # SMP support enabled/disabled
 AE_IS_FEATURE_ENABLED([smp-support]) && value=1 || value=0
-PPRINT_PROP_BOOL([SMP support], $value)
+AE_PPRINT_PROP_BOOL([SMP support], $value)
 
 # TLS
 AE_IS_FEATURE_ENABLED([compiler-tls]) && value="compiler TLS" || value="pthread_getspecific()"
-PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
+AE_PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
 
 # clock_gettime() available
 test "x$ac_cv_search_function_clock_gettime" != "xno" && value=1 || value=0
-PPRINT_PROP_BOOL([clock_gettime()], $value)
+AE_PPRINT_PROP_BOOL([clock_gettime()], $value)
 
 # Require membarrier
 AE_IS_FEATURE_ENABLED([sys-membarrier-fallback]) && value=0 || value=1
-PPRINT_PROP_BOOL([Require membarrier], $value)
+AE_PPRINT_PROP_BOOL([Require membarrier], $value)
 
 # RCU debug enabled/disabled
 AE_IS_FEATURE_ENABLED([rcu-debug]) && value=1 || value=0
-PPRINT_PROP_BOOL([Internal debugging], $value)
+AE_PPRINT_PROP_BOOL([Internal debugging], $value)
 
 # rculfhash iterator debug enabled/disabled
 AE_IS_FEATURE_ENABLED([cds-lfht-iter-debug]) && value=1 || value=0
-PPRINT_PROP_BOOL([Lock-free HT iterator debugging], $value)
+AE_PPRINT_PROP_BOOL([Lock-free HT iterator debugging], $value)
+
+AE_PPRINT_PROP_BOOL([Multi-flavor support], 1)
+
+# atomic builtins enabled/disabled
+AE_IS_FEATURE_ENABLED([compiler-atomic-builtins]) && value=1 || value=0
+AE_PPRINT_PROP_BOOL([Use compiler atomic builtins], $value)
 
-PPRINT_PROP_BOOL([Multi-flavor support], 1)
+# legacy memory barriers
+AE_IS_FEATURE_ENABLED([legacy-mb]) && value=1 || value=0
+AE_PPRINT_PROP_BOOL([Emit legacy memory barriers], $value)
 
 report_bindir="`eval eval echo $bindir`"
 report_libdir="`eval eval echo $libdir`"
 
 # Print the bindir and libdir this 'make install' will install into.
 AS_ECHO
-PPRINT_SUBTITLE([Install directories])
-PPRINT_PROP_STRING([Binaries], [$report_bindir])
-PPRINT_PROP_STRING([Libraries], [$report_libdir])
+AE_PPRINT_SUBTITLE([Install directories])
+AE_PPRINT_PROP_STRING([Binaries], [$report_bindir])
+AE_PPRINT_PROP_STRING([Libraries], [$report_libdir])
 
index cf2e902c7c0210e94408ee749837283b2a71b1b0..19a27097a0632f63502402c2edd20ed74ae78aa3 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 SUBDIRS = examples
 
 dist_doc_DATA = rcu-api.md \
index 3d313b78e9d41cc5a40f8f381a244c4b864d6867..9940a366bbe9e42f68ecc0406aeb210026b2ee3d 100644 (file)
@@ -1,3 +1,9 @@
+<!--
+SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
 Userspace RCU Concurrent Data Structures (CDS) API
 ==================================================
 
index 20463812866b31a592152141e9dd417ee7655d0d..81691692ed5a77aac6132058bd72f7347642ad55 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 doc_examplesdir = ${docdir}/examples
 
 doc_examples_urcu_flavorsdir = ${doc_examplesdir}/urcu-flavors
@@ -7,12 +11,10 @@ dist_doc_examples_urcu_flavors_DATA = \
        urcu-flavors/Makefile.qsbr \
        urcu-flavors/Makefile.mb \
        urcu-flavors/Makefile.membarrier \
-       urcu-flavors/Makefile.signal \
        urcu-flavors/Makefile.bp \
        urcu-flavors/qsbr.c \
        urcu-flavors/mb.c \
        urcu-flavors/membarrier.c \
-       urcu-flavors/signal.c \
        urcu-flavors/bp.c
 
 dist_doc_examples_DATA = \
index e6196f53104f37796a03fd83320541a436710b32..21cac7b93dfd431a3f0b02bbf27eb652023952c3 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 LOCAL_CFLAGS := -g -O2 -Wall
index 08f37283b65bf06b76bf17a912331d6eaa91c44b..676d9b30d7455e9e86eebad4736a15f79f6fb06c 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index 4256035ea75adfe573eac26872d55c73b69cd945..c06be16a6666ee94458c371c8925d887a3d983df 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index f1bf7d79ba0295e6555825e00f5a964dd29b60d6..1f225fd0e9aeec3a9f46c656ba558b59f37c063c 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_hlist_add_head_rcu
index 642b04de4818243278110a30c0ff46e6fc9b79df..e042ffac59f9eb3276d1ddcd33452d33dc4c623a 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_hlist_del_rcu
index 035ecbfe3661cb4cc646a16f93436f79cc47a52f..86380a51efa9594df8f867b2eedbe197ba7d91f6 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_hlist_for_each_entry_rcu
index 23d0a0c2484f20ba8ef4506abe48b10324ddae35..9b40d8a9601c856ee00211d0d7ee164faaa8b975 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_hlist_for_each_rcu
index 3aece5ef1cdc55ed87d615e3fcde51fd29392f20..6087bae8b2d4ac524106c847e45c90b71ce057b3 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to add into a non-circular linked-list safely
  * against concurrent RCU traversals.
  */
index 28b6c42e62c552e2df00bf007d00eff775794fd1..1ef229f61a9d6e2c2a621b80ab6111f3bd1732c5 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to remove from a non-circular linked-list
  * safely against concurrent RCU traversals.
  */
index 1be4ac512b384c686f7444ff53c1ac812a6bce33..bf675fd809233d8c86ea7414e1d8a6bf583f0ca0 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to do a non-circular RCU linked list
  * traversal, safely against concurrent RCU updates.
  */
index 1628c669dec1d40d67bfe2b5b52bc2f3e2f9db1f..464205400c7938edcfda2171cb962d66afaabbe7 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to do a non-circular RCU linked list
  * traversal, safely against concurrent RCU updates.
  * cds_hlist_for_each_rcu() iterates on struct cds_hlist_node, and thus,
index 42398ed2b23ee3c20e8f8eba79efc99ca4517609..189a7bd996d75c7f3b3d6f6a4cecbbc87ccef973 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index 9ee48d5b5dab3de2c6ac896d32896c4c891a235f..07a07d7bf1f019245c81f65d1a5b4d2ba52db1bd 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfs_pop_all_blocking
index da434587d40ccf28730fbea08ef463feb578468d..f5fa1c868963df6752d8d593a23b8decb2c3a07c 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfs_pop_blocking
index a2078c4f1d927def7efc1aea4c21e7d5ecf90081..8908afe2e12d7022efaa64063128eda43220e2aa 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfs_push
index f6fcfb73221a62f92eecea30b7a94cc6832ed292..290fe8096f9c6c987f19ce2469d5780db27e2d00 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to pop all nodes from a lfstack.
  */
 
index f356423da6a4a0811fccf924ea2321f9b013d372..25d6381bb582df70c89c54f3eb652ddc8e8419ea 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to pop nodes from a lfstack.
  */
 
index bdb160ff5ac18cac87b4a62e734c0b95cdd8c85c..b3c5b933f0cf8b9a0b2aa80ed25aa515b720b83b 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to push nodes into a lfstack.
  */
 
index 79a09e313ad6bff1934b936e7e1d30977e021f21..034a59315a3952069a14ace68ad31e2173885021 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index faf2c948c19a02cc6d9d5ce5502d25eec11def12..91ab9039af9be9e72083514600984cd1ed6c1359 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_list_add_rcu
index 30310242c5f199328db01f17535e37b661bc21a6..6a60c03fa79d08894ecb68f915acdde3c2ff446b 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_list_add_tail_rcu
index 74cef2b6e54b479981bdcb1ec7e0efaf26c3cbc1..1509267c262c7474df3461336b7cb96338808863 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_list_del_rcu
index 911301e07e9602ab9dc4d66d9b85041392c72875..af0805693bad53957c5760ca9dc166198db0d3ef 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_list_for_each_entry_rcu
index 2f2f02fefd77a3c64b8c3a03e5754d15d08b7557..54bb040a12b8f43de7de5ca76a51d2cf493344b6 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_list_for_each_rcu
index 5e130b350063c99365124f1f1630980da9f271ef..a7cc56d97f283d653204f336c53babf8f71bd147 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_list_replace_rcu
index 3eb062a9f7c9f3a308c77aac1b73f9183bbbf79a..13da5b39cf51efd9b5c6855704a28b8900cbdcb7 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to add into a linked-list safely against
  * concurrent RCU traversals.
  */
index f7490aff4b3edfcb6ffa2c7d43557cb31b763af6..475cf6624a5ca65f2a0068a86da006eb77f2ea8f 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to add into tail of a linked-list safely
  * against concurrent RCU traversals.
  */
index d6b3ab0f4c6e3815e079f46ea9bbe443d0888087..b4e4c137246238cbef1e1b43ac0862d26cf40d3d 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to remove from a linked-list safely against
  * concurrent RCU traversals.
  */
index 5deb4a561bd96abb3400d4b40aa08fa62aa157e8..ef9e954bf2f309465f14b38c84435954b6ebd997 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to do a RCU linked list traversal, safely
  * against concurrent RCU updates.
  */
index 2e66719f64a7c149c887b8f5c1eab12b1ee5ce83..044aa5efeb7b9f3ace93e2677ad4bf273d78efb6 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to do a RCU linked list traversal, safely
  * against concurrent RCU updates. cds_list_for_each_rcu() iterates on
  * struct cds_list_head, and thus, either caa_container_of() or
index aa6161c25810d57db5947244e897ad6927f377f1..d17084b661993f86d66af6b50b262ddba40416b9 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to replace a node within a linked-list safely
  * against concurrent RCU traversals.
  */
index c64f40a85cbc4080b8b9fdbb8ec18b2e363c1c83..29b28f7d8bb7e8690de0a5f4addf12b80fadb05b 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index 9fab2b66ae1daec70e3d56b1abf9f7a5ec06c958..45333f5579db8199899766646186a16f7fcf32c3 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_add
index dcd253abff41952ff61f7635f15e4ec125931d68..6147a414fbcda5bb9ce66ef34994f323cad09fc8 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_add_replace
index c74c61e21aac825dc6f8fbbc241c32502e8b46d2..a1772d32efce9c30c83e355fbb14fcd1dc650722 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_add_unique
index 6377490739c49af2f9ae15965f23408e377c2d54..982b0f788789524bba0ec70722bfe59439229102 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_del
index d79789391a30879525981e2bb953e5d0e47f4d9e..deda37af1d085d681d7371ad782c506bbba1b174 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_destroy
index 7020b143222ef96c1e05892b923bc6c0d210d4d6..fd5d38dfa1bc068c010dc5aa54778a4441130ea1 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_for_each_entry_duplicate
index 79eb6c492a77356c56d641ae683d92c98ef6bb8b..8330c9ca22198e51fefb3b710a3eb03660fc6238 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfht_lookup
index 67b00f40fc0a775fd0d388b84036331279f83525..927e38d99c24dba7ecf8ef667f549d0b3c631ca2 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to add nodes (allowing duplicate keys) into a
  * RCU lock-free hash table.
  * This hash table requires using a RCU scheme.
index 363ea5b60c62118a55ef59291dcc67ff2391bea7..ecab5708c6cff3620ca2b906d1b7da8c6701b319 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to add nodes into a RCU lock-free hash table
  * with cds_lfht_add_replace(), which replaces existing nodes with the
  * same key if found.
index d6044c244492e17bab204c6b43b863971198e862..326e19b135f2471fee702899985d29c6544e5844 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to add unique nodes into a RCU lock-free hash
  * table. We use a "seqnum" field to show which node is staying in the
  * hash table. This hash table requires using a RCU scheme.
index 9dab8a50f249c8eb0fbe3c6dbaba5518079b6f5b..4eb3486e5833da4d11333b5977d49ccb312a5421 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to remove nodes from a RCU lock-free hash table.
  * This hash table requires using a RCU scheme.
  */
index 56b9df65359f903759df99ad87e77c9aa5bc93e0..f0c8219f9194c1fda16330e2498e2d5606f6f3ad 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to use cds_lfht_destroy() to clear memory used
  * by a a RCU lock-free hash table. This hash table requires using a
  * RCU scheme.
index 00ebfa1a476b9adc9b046abd64dd21cad6e0f82f..14f39e1f8ba32534dd79bee243645205ba46ab78 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to iterate on duplicate keys within a RCU
  * lock-free hash table. This hash table requires using a RCU scheme.
  */
index 8eeacf70bbfadd1383a58b1a5732ee3105131ac0..6b06095df1631f0a0640837a72cf0aac58985ec4 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to lookup keys within a RCU lock-free hash
  * table. This hash table requires using a RCU scheme.
  */
index f50a0dac64216601a1c75a8bebc5ef411e085b01..23812ce246d6c0fb4c8c77bc384d46dfcf44bfd9 100644 (file)
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _JHASH_H
 #define _JHASH_H
 
@@ -6,20 +10,7 @@
 #endif
 
 /*
- * jhash.h
- *
  * Example hash function.
- *
- * Copyright 2009-2012 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
  */
 
 /*
index b964d2322d52e8541e00b86d0cbf620593f316c0..445a3ad9783290a6cc83d51cd741bc0ae143ce1d 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index c08387356908f9ced7a86ce6f4d9ed34fc187fde..e893b5b8818e0dab90a314002729a0614b69d4aa 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfq_dequeue
index b8f1ff5663de18c9f65dcf7a45995e7ec8606e01..c84c5c4b6c9dfe53158ac447e60e8e619ef6227b 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_lfq_enqueue
index e81e105bbaaa7cf9d61e409da24299a5100af180..67d766a6c6a16f2b1ec0e4816e834057c4b006f7 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to dequeue nodes from a RCU lock-free queue.
  * This queue requires using a RCU scheme.
  */
index 12024676a3af7ef362ce2aa7f2a777427d1845cb..b0ea03053772362bdc849de2994cf07bb780f0d2 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to enqueue nodes into a RCU lock-free queue.
  * This queue requires using a RCU scheme.
  */
index fedadb2ad638035e61c489efa75c00687b8ba92f..6738eafb11cf761557fd1a1338f407029d574884 100644 (file)
@@ -1,21 +1,13 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
        $(AM_V_at)$(MAKE) -f Makefile.qsbr
        $(AM_V_at)$(MAKE) -f Makefile.mb
        $(AM_V_at)$(MAKE) -f Makefile.membarrier
-       $(AM_V_at)$(MAKE) -f Makefile.signal
        $(AM_V_at)$(MAKE) -f Makefile.bp
 
 .PHONY: clean
@@ -23,5 +15,4 @@ clean:
        $(AM_V_at)$(MAKE) -f Makefile.qsbr clean
        $(AM_V_at)$(MAKE) -f Makefile.mb clean
        $(AM_V_at)$(MAKE) -f Makefile.membarrier clean
-       $(AM_V_at)$(MAKE) -f Makefile.signal clean
        $(AM_V_at)$(MAKE) -f Makefile.bp clean
index 5170f02253caba40e31337c222bdd69adc41439d..b42fe4dd67932f29c68f8ea654339ea31048087c 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = bp
index 7a4e2f9b40b3fbb5fade79acb655cff27e11d056..b5d9ffbd7df5b2f148adf6fad043428348cd15cd 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = mb
index 977078e39a929680584704f9ac059874c978357e..64dfceb4ab6d688c5aa268b0cbd628eb7f256a9b 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = membarrier
index dc28ddd72c975a04f6438bdd72539cedbc0fd3f0..b50ce82f2ff98c0865a574cacd771dfd70cc7a1e 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = qsbr
diff --git a/doc/examples/urcu-flavors/Makefile.signal b/doc/examples/urcu-flavors/Makefile.signal
deleted file mode 100644 (file)
index 6e2c0db..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
-#
-# This makefile is purposefully kept simple to support GNU and BSD make.
-
-EXAMPLE_NAME = signal
-
-SOURCES = $(EXAMPLE_NAME).c
-OBJECTS = $(EXAMPLE_NAME).o
-BINARY = $(EXAMPLE_NAME)
-LIBS = -lurcu-signal
-
-include ../Makefile.examples.template
index 9032b9b98b7bb8072347d22760bfc75491890950..d42373386633f0a6c724d31a69c902a6ee1e058e 100644 (file)
@@ -1,20 +1,6 @@
-/*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -46,7 +32,7 @@ int add_node(uint64_t v)
 {
        struct mynode *node;
 
-       node = calloc(sizeof(*node), 1);
+       node = calloc(1, sizeof(*node));
        if (!node)
                return -1;
        node->value = v;
index 5280598eb0a9a69659b5068e96ba44eff32af3ce..7069c248fef60a538d6f3623ccc87771e8d34d1a 100644 (file)
@@ -1,20 +1,6 @@
-/*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -47,7 +33,7 @@ int add_node(uint64_t v)
 {
        struct mynode *node;
 
-       node = calloc(sizeof(*node), 1);
+       node = calloc(1, sizeof(*node));
        if (!node)
                return -1;
        node->value = v;
index 2e8473421a6aa16f902013e6e542100c59b6a2f6..73b9bd8edd124922430dd677e5f508c04f4669db 100644 (file)
@@ -1,20 +1,6 @@
-/*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -47,7 +33,7 @@ int add_node(uint64_t v)
 {
        struct mynode *node;
 
-       node = calloc(sizeof(*node), 1);
+       node = calloc(1, sizeof(*node));
        if (!node)
                return -1;
        node->value = v;
index 661ecae481d483f1f45c49944e253503748c3cd7..ca00933a1a88ba4640640c4b6cd2bd5cb3e36c7e 100644 (file)
@@ -1,20 +1,6 @@
-/*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -46,7 +32,7 @@ int add_node(uint64_t v)
 {
        struct mynode *node;
 
-       node = calloc(sizeof(*node), 1);
+       node = calloc(1, sizeof(*node));
        if (!node)
                return -1;
        node->value = v;
diff --git a/doc/examples/urcu-flavors/signal.c b/doc/examples/urcu-flavors/signal.c
deleted file mode 100644 (file)
index c0a35b9..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include <urcu/urcu-signal.h>  /* Signal-based RCU flavor */
-#include <urcu/rculist.h>      /* List example */
-#include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
-
-/*
- * Example showing how to use the signal-based Userspace RCU flavor.
- *
- * This is a mock-up example where updates and RCU traversals are
- * performed by the same thread to keep things simple on purpose.
- */
-
-static CDS_LIST_HEAD(mylist);
-
-struct mynode {
-       uint64_t value;
-       struct cds_list_head node;      /* linked-list chaining */
-       struct rcu_head rcu_head;       /* for call_rcu() */
-};
-
-static
-int add_node(uint64_t v)
-{
-       struct mynode *node;
-
-       node = calloc(sizeof(*node), 1);
-       if (!node)
-               return -1;
-       node->value = v;
-       cds_list_add_rcu(&node->node, &mylist);
-       return 0;
-}
-
-static
-void rcu_free_node(struct rcu_head *rh)
-{
-       struct mynode *node = caa_container_of(rh, struct mynode, rcu_head);
-
-       free(node);
-}
-
-int main(void)
-{
-       uint64_t values[] = { 42, 36, 24, };
-       unsigned int i;
-       int ret;
-       struct mynode *node, *n;
-
-       /*
-        * Each thread need using RCU read-side need to be explicitly
-        * registered.
-        */
-       urcu_signal_register_thread();
-
-       /*
-        * Adding nodes to the linked-list. Safe against concurrent
-        * RCU traversals, require mutual exclusion with list updates.
-        */
-       for (i = 0; i < CAA_ARRAY_SIZE(values); i++) {
-               ret = add_node(values[i]);
-               if (ret)
-                       goto end;
-       }
-
-       /*
-        * We need to explicitly mark RCU read-side critical sections
-        * with rcu_read_lock() and rcu_read_unlock(). They can be
-        * nested. Those are no-ops for the QSBR flavor.
-        */
-       urcu_signal_read_lock();
-
-       /*
-        * RCU traversal of the linked list.
-        */
-       cds_list_for_each_entry_rcu(node, &mylist, node) {
-               printf("Value: %" PRIu64 "\n", node->value);
-       }
-       urcu_signal_read_unlock();
-
-       /*
-        * Removing nodes from linked list. Safe against concurrent RCU
-        * traversals, require mutual exclusion with list updates.
-        */
-       cds_list_for_each_entry_safe(node, n, &mylist, node) {
-               cds_list_del_rcu(&node->node);
-               /*
-                * call_rcu() will ensure that the handler
-                * "rcu_free_node" is executed after a grace period.
-                * call_rcu() can be called from RCU read-side critical
-                * sections.
-                */
-               urcu_signal_call_rcu(&node->rcu_head, rcu_free_node);
-       }
-
-       /*
-        * We can also wait for a quiescent state by calling
-        * synchronize_rcu() rather than using call_rcu(). It is usually
-        * a slower approach than call_rcu(), because the latter can
-        * batch work. Moreover, call_rcu() can be called from a RCU
-        * read-side critical section, but synchronize_rcu() should not.
-        */
-       urcu_signal_synchronize_rcu();
-
-       sleep(1);
-
-       /*
-        * Waiting for previously called call_rcu handlers to complete
-        * before program exits, or in library destructors, is a good
-        * practice.
-        */
-       urcu_signal_barrier();
-
-end:
-       urcu_signal_unregister_thread();
-       return ret;
-}
index 4f0338ecf34bba453ea9bf81aa619f978ba47874..317985d830572bc2affbb3534d59cbd9b5773544 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index 4f80a718affcdcb858fd2a247f89319dac829fb8..bbb303ded2f34eaa507a0d9751ef9c200b30fcfd 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_wfcq_dequeue
index aef5105e32b7632672a25f541822040fc66b65bb..1145756837a9c84ab439eef0aa99b742cf569c16 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_wfcq_enqueue
index 76b9f0a0689faa345940a027c9125c2c1f8a55ac..17da52abe94a7617624e5f6c46577a9f3ca344d9 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_wfcq_splice
index 41a7baad890d1be01de950f8ebc1f155ebb03d6a..01a34a5f434738d86bb116a7ca08fadf9e1e6ef2 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to dequeue nodes from a wfcqueue.
  */
 
index 850eea8b5e5fa817fe8ef902d4f2144000b7c48c..374ca72c9791d268b58cfeef1561b2a9040f9550 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to enqueue nodes into a wfcqueue.
  */
 
index cb6f76bb06be30e641961c87712d62bd18d18e37..5e369e83291e234a9af34a33c21f46c418e85243 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to splice nodes from a source wfcqueue A into
  * a destination wfcqueue B.
  */
index 098fb94f206aeb27ec683187975cb60ada6f913a..a0be0dabc6a6e6e88ba3ca6b4bbf9d82d0452692 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 all:
index 24df9510f04e0c4f78cebd4a8c111581cee53aef..69e91ff11aa56ed9b12abd1ddaf0426c52507730 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_wfs_pop
index 452fd9c8d02970ec594d102e46d62b48c508b2c1..164c89bb629f0830972331b96702da218eddb4f9 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_wfs_pop_all_blocking
index 43f96c13d2f4a440d1441ab2ff49b92fd60355ea..e29a35f37e7bc6c8e5e697bda85ee45276495a32 100644 (file)
@@ -1,14 +1,7 @@
-# Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-#
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-#
-# Permission is hereby granted to use or copy this program for any
-# purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is
-# granted, provided the above notices are retained, and a notice that
-# the code was modified is included with the above copyright notice.
+# SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
+# SPDX-License-Identifier: MIT
+
 # This makefile is purposefully kept simple to support GNU and BSD make.
 
 EXAMPLE_NAME = cds_wfs_push
index 68b81b9bbdc4e98be213fae3c8422e8ae2c908a3..93809ef4b7aa4e9217df5327254f9b97d40c884e 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to pop nodes from a wfstack.
  */
 
index 794ced154008064c7eeb4285ff09225a16afcc06..a9cc4ca01cabe83c352b5ab00dc42d2cda35715a 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to pop all nodes from a wfstack.
  */
 
index 42bc5ec4655ffdde18255748a7979f1e945eae9a..69eb6ca09844eb3b428359393f478177580020a6 100644 (file)
@@ -1,15 +1,8 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Copyright (C) 2013  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any
- * purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is
- * granted, provided the above notices are retained, and a notice that
- * the code was modified is included with the above copyright notice.
- *
  * This example shows how to push nodes into a wfstack.
  */
 
index e8ec0228731361b17d558f1236c6e61dea63ad05..b305fcfa5bf4cf176a2e1cde1a55b5d75b7b941b 100644 (file)
@@ -1,3 +1,9 @@
+<!--
+SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
 Userspace RCU API
 =================
 
@@ -60,6 +66,31 @@ started: this is not a reader-writer lock. The duration
 actually waited is called an RCU grace period.
 
 
+```c
+struct urcu_gp_poll_state start_poll_synchronize_rcu(void);
+```
+
+Provides a handle for checking if a new grace period has started
+and completed since the handle was obtained. It returns a
+`struct urcu_gp_poll_state` handle that can be used with
+`poll_state_synchronize_rcu` to check, by polling, if the
+associated grace period has completed.
+
+`start_poll_synchronize_rcu` must only be called from
+registered RCU read-side threads. For the QSBR flavor, the
+caller must be online.
+
+
+```c
+bool poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
+```
+
+Checks if the grace period associated with the
+`struct urcu_gp_poll_state` handle has completed. If the grace
+period has completed, the function returns true. Otherwise,
+it returns false.
+
+
 ```c
 void call_rcu(struct rcu_head *head,
               void (*func)(struct rcu_head *head));
index 8baf305b1264fc1e86be30b8577d22116504bb70..1a0c68c42cad5e95f73bd21001b63909577c6a6a 100644 (file)
@@ -1,3 +1,9 @@
+<!--
+SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
 # Solaris support
 ## Solaris 10
 ### Dependencies
index 0962399d78292b7959c606b131903b1b35f66aee..642170857a1e2a4d260267c10b5dcf6892ebb5b7 100644 (file)
@@ -1,3 +1,9 @@
+<!--
+SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
 Userspace RCU Atomic Operations API
 ===================================
 
@@ -52,7 +58,8 @@ An atomic read-modify-write operation that performs this
 sequence of operations atomically: check if `addr` contains `old`.
 If true, then replace the content of `addr` by `new`. Return the
 value previously contained by `addr`. This function implies a full
-memory barrier before and after the atomic operation.
+memory barrier before and after the atomic operation on success.
+On failure, no memory order is guaranteed.
 
 
 ```c
index 8a9d7fd73976e809d8097b0c89155b6910a1cee2..514c889c1ee6a23c03e7428c7b67a2f9de419f40 100644 (file)
@@ -1,4 +1,6 @@
-# SPDX-License-Identifier: LGPL-2.1-only
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
 
 # Directories added to EXTRA_DIST will be recursively copied to the distribution.
 EXTRA_DIST = $(srcdir)/abi
index 3cc0c5d7b7e3835b8a692dcf170f3fde5accf986..044f276b8c6703d9eca51dcb3a52ca912c34a9e1 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-bp.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index fa9cb0079e1ffa91086947d27502a83d63524806..bcdb9db37b40c8999bcf562e42148dac51b5d8ed 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-cds.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4773d91eed60643f7bc58746b876233896805426..e7aef91deb94b83afd51244cfe209c8ffc07ca5e 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-common.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 6971fb89910ac4aae541f9fa13bdb10c34d26ef6..3ce07d1e8a87759dbc5cba26215c8cc727b84dca 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-mb.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index ebd5c9d38ca80cb9043d400b4e1279281be09977..c1ee1962308de84236866e63d2ade1cdc750de68 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-qsbr.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index b8067a4d3bf0b897520c293b278f9c6d92206d51..4f9ffcc59e67a312cea1f2a4d0195e97e1d0b257 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-signal.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 190cc371c9af3736f8a8d38fd06722f98d3488c8..566ccbf293756e4c2f0d3455fff99aa3593090d9 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 442aef00cffa7059a402d15e0f8578ab3bec1cb8..312bc93f99acb225c0fafa79d78151cdfcc2bed3 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-bp.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 5bad4df0a3d0209f4a84aa6ca14c8035859b2023..a085bee96f28509b4bdceb95bd6d890be93fda3a 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-cds.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4773d91eed60643f7bc58746b876233896805426..e7aef91deb94b83afd51244cfe209c8ffc07ca5e 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-common.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4f7b9f6b7f7699ddf25d668e87d9a4a1542f51d2..400eb0b8ace071b579c21be2b0028f66a36d5bf0 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-mb.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4947c353dcaac73830a2c687121c9c6b4db86786..e22c57827b7a0605ba59f8e4737cc5b9928c791b 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-memb.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 56238332b2d9fbeabcc4eddb78bed35cdf85f10b..f0b9ce60b0bebe1cd526c511cdd0548db370f657 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-qsbr.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index d9a5f3e68c788647fb430484dcbe96c0c4566624..feaa997d5a01fcde49a4efafcc3020426f3f0bd1 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-signal.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 70873c85e64a796ce30e593a21757693849f9304..3d42cd2877056acdd9ed6ec0764fd4b60b0beccc 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 184b474513b8b843a18cfa4077593665c9d81b17..df3f029971ae0677559d043170ba5e34228a4097 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-bp.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 05706128086f2af12fa112e2ece46beff02add61..ccfe923f923739e80cf39077ab6fd8e350341a6c 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-cds.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4773d91eed60643f7bc58746b876233896805426..e7aef91deb94b83afd51244cfe209c8ffc07ca5e 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-common.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4f7b9f6b7f7699ddf25d668e87d9a4a1542f51d2..400eb0b8ace071b579c21be2b0028f66a36d5bf0 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-mb.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 4947c353dcaac73830a2c687121c9c6b4db86786..e22c57827b7a0605ba59f8e4737cc5b9928c791b 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-memb.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 56238332b2d9fbeabcc4eddb78bed35cdf85f10b..f0b9ce60b0bebe1cd526c511cdd0548db370f657 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-qsbr.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index d9a5f3e68c788647fb430484dcbe96c0c4566624..feaa997d5a01fcde49a4efafcc3020426f3f0bd1 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-signal.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 70873c85e64a796ce30e593a21757693849f9304..3d42cd2877056acdd9ed6ec0764fd4b60b0beccc 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu.so.6'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 6351359e3f405590a00b513cdedaefc1d299ffbc..7bc53cb78b4c0a1be37fa0dc15dde7a7bfc74bd8 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-bp.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index a63b64141d84f79c2dc2c324df424497401c7b06..ae03526048b25c2b6fc8bbd2e36d9aa832e7a047 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-cds.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index ed2a046da8556582f3f536883221c41490482405..33bf1df100b3d6d310010c6ccbfb68aac9d3144d 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-common.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index e0344f195b49d15fc8360d4cfcd3a6482355373c..5ad4e9d9d2e62c7202132fdbbd42c418208f9ca1 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-mb.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index d6ff85d5a06ed3e55a39101322794d278a61a21f..ba5db9b1ac84181b1de12cc6579a7b97ba862d7f 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-memb.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index e6fc5726ce02020cc07dadb996827cedc7a96259..0e350cc89f9ad4e490b3940a239ed1f8f17ea9df 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-qsbr.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index c7c0ef5f5b0c0533e5e18c891cfcc8149d06fbe2..2aea31056a7bc3637cc4457b7aeaca27c368481f 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-signal.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index c0d117d864ebe938cb62dcd681c8cb9bece8a884..709f7843f830eac6a1e5fe510b2b2fa7201fde8d 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu.so.8'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index e08a087bd0c8e043e89830b669142dfbc08efa4a..2bd8607d14ad8037bcf0eff37d4e31163987a66b 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-bp.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 99cc6b425089b6ed166768a6d003e6557c7393e1..b0cb83cbe558dca669e978e9e7058e109ae2a3ae 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-cds.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index c4c1e4135fef2a71301df076e753e606f57617dd..95bd3636a07a6283a41c06d25e9b89d3bfcb5802 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-common.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index f2334dbdad43dbc7a754c102521a3c6fdc624acb..d8e736d5213c864d81a65d13397b2569437b7598 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-mb.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index d89fa85a313a3cd354bea228f2db213030778002..7df5cada985bfd6d174acc738f1ead20c52273f1 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-memb.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 1c4f199d8449fde567557612e61c85eddeb409aa..848eb7a7bb2e75ae0134653bc35dec513c1dc9aa 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-qsbr.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index bca453bf6eca84c84fc5d7e0bd1be1b375f4b538..032143234183ba8d5a0d3c07b2781fd0f289c6d7 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-signal.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index d70810ebe1234e8dfe9145864e84e26e6fb142c4..e9bfeaad3bd78631ff22474e4f04e7f4eeea95b8 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu.so.8'>
+<!--
+SPDX-FileCopyrightText: 2022 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index bb66e839e235e30b6b80d15da7f93067835d258d..0ee16cbaa6a83186ac3aa15095aac5b0b6b113ba 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-bp.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='liburcu-common.so.4'/>
     <dependency name='libpthread.so.0'/>
index 3e8b63f1cff7b60e38139f992f77ebc3c58f94aa..58a6a9b9e8914deec12c56b11e5c2c48f96bc421 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-cds.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='liburcu-common.so.4'/>
     <dependency name='libpthread.so.0'/>
index 38e5b4c4c20bdd74dd94439ad068a066cb3b9b26..73fe288430f709a39d3dc61ef3c7e2d222b8a0f7 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-common.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='libpthread.so.0'/>
     <dependency name='libc.so.6'/>
index 29012e856206e81020783571a6ce4a90623b45e4..e09bed297dcf0fadf09500c04ea2eb55373313fc 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-mb.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='liburcu-common.so.4'/>
     <dependency name='libpthread.so.0'/>
index 79872eb1fbbf3f40f60930baa3dd89405ab86537..ad6c8ec65ad33c32ccdba0f78c3853b6b700bb61 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-qsbr.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='liburcu-common.so.4'/>
     <dependency name='libpthread.so.0'/>
index 228800cc19aa2d075816a5537804773e3e1846c3..f61bc436adaa896f37507b236444e316f2389d98 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu-signal.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='liburcu-common.so.4'/>
     <dependency name='libpthread.so.0'/>
index d0ad5045571545d4a0963a55e773dc44e674b4a3..612689bb3d98e9f087eda7ffbc1f90b87ea0956a 100644 (file)
@@ -1,4 +1,9 @@
 <abi-corpus architecture='elf-amd-x86_64' soname='liburcu.so.4'>
+<!--
+SPDX-FileCopyrightText: 2021 EfficiOS Inc.
+
+SPDX-License-Identifier: CC0-1.0
+-->
   <elf-needed>
     <dependency name='liburcu-common.so.4'/>
     <dependency name='libpthread.so.0'/>
diff --git a/extras/abi/README b/extras/abi/README
deleted file mode 100644 (file)
index 52bbd04..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-This directory contains the serialized ABI definitions for a typical build of
-the liburcu libraries. This information is extracted using libabigail
-(https://sourceware.org/libabigail/).
-
-The artefacts used to generate these were built with CFLAGS="-O0 -ggdb" on an
-Ubuntu 18.04 x86_64 system.
-
-You can compare the serialized ABI with a shared object to check for breaking
-changes. For example, here we compare an in-tree built version of
-liburcu-memb.so with the serialized ABI of stable-0.13 :
-
-  abidiff \
-    extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-memb.so.8.xml \
-    src/.libs/liburcu-memb.so
diff --git a/extras/abi/README.md b/extras/abi/README.md
new file mode 100644 (file)
index 0000000..a7242a2
--- /dev/null
@@ -0,0 +1,24 @@
+<!--
+SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
+# Userspace-RCU ABI definitions
+
+This directory contains the serialized ABI definitions for a typical build of
+the liburcu libraries. This information is extracted using
+[libabigail](https://sourceware.org/libabigail/).
+
+The artefacts used to generate these were built with **CFLAGS="-O0 -ggdb"** on
+an Ubuntu 18.04 x86_64 system.
+
+You can compare the serialized ABI with a shared object to check for breaking
+changes. For example, here we compare an in-tree built version of
+**liburcu-memb.so** with the serialized ABI of stable-0.13 :
+
+````
+abidiff \
+  extras/abi/0.13/x86_64-pc-linux-gnu/liburcu-memb.so.8.xml \
+  src/.libs/liburcu-memb.so
+````
index e8aedcb13883b970b91c4d838a48ccd33a9fe5d4..a7bd5fda4c9ffcca25b51b7cd32298c1c7ba804a 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/bash
+
+# SPDX-FileCopyrightText: 2021 Michael Jeanson <mjeanson@efficios.com>
+#
 # SPDX-License-Identifier: GPL-2.0-only
 
 set -eu
@@ -11,11 +14,20 @@ ARGS=(
        "--no-corpus-path" # Do not put the path in the abi-corpus
 )
 
+# Older version of the reuse tool are a bit dumb, split the tags string to make
+# it happy.
+spdx="SPDX"
+copyright="FileCopyrightText"
+license="License-Identifier"
+
 for lib in "${INDIR}"/liburcu*.so.?
 do
        abidw "${ARGS[@]}" --out-file "${OUTDIR}/$(basename "$lib").xml" "$lib"
 
        # Clean the full paths
        sed -i "s#$(pwd)/##g" "${OUTDIR}/$(basename "$lib").xml"
+
+       # Add SPDX headers
+       sed -i "2 i <!--\n${spdx}-${copyright}: $(date +%Y) EfficiOS Inc.\n\n${spdx}-${license}: CC0-1.0\n-->" "${OUTDIR}/$(basename "$lib").xml"
 done
 
diff --git a/gpl-2.0.txt b/gpl-2.0.txt
deleted file mode 100644 (file)
index d511905..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is 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 2 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, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
index b55bcf0271290e6e440c5b66ce87089dd5903063..4c32a4cd7d0cf499273dcf86303cb1346de36af1 100644 (file)
@@ -1,4 +1,9 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 nobase_include_HEADERS = \
+       urcu/annotate.h \
        urcu/arch/aarch64.h \
        urcu/arch/alpha.h \
        urcu/arch/arm.h \
@@ -7,6 +12,7 @@ nobase_include_HEADERS = \
        urcu/arch.h \
        urcu/arch/hppa.h \
        urcu/arch/ia64.h \
+       urcu/arch/loongarch.h \
        urcu/arch/m68k.h \
        urcu/arch/mips.h \
        urcu/arch/nios2.h \
@@ -33,7 +39,6 @@ nobase_include_HEADERS = \
        urcu/map/urcu-mb.h \
        urcu/map/urcu-memb.h \
        urcu/map/urcu-qsbr.h \
-       urcu/map/urcu-signal.h \
        urcu/pointer.h \
        urcu/rcuhlist.h \
        urcu/rculfhash.h \
@@ -51,8 +56,6 @@ nobase_include_HEADERS = \
        urcu/static/urcu-mb.h \
        urcu/static/urcu-memb.h \
        urcu/static/urcu-qsbr.h \
-       urcu/static/urcu-signal.h \
-       urcu/static/urcu-signal-nr.h \
        urcu/static/wfcqueue.h \
        urcu/static/wfqueue.h \
        urcu/static/wfstack.h \
@@ -63,11 +66,14 @@ nobase_include_HEADERS = \
        urcu/uatomic/alpha.h \
        urcu/uatomic_arch.h \
        urcu/uatomic/arm.h \
+       urcu/uatomic/builtins.h \
+       urcu/uatomic/builtins-generic.h \
        urcu/uatomic/gcc.h \
        urcu/uatomic/generic.h \
        urcu/uatomic.h \
        urcu/uatomic/hppa.h \
        urcu/uatomic/ia64.h \
+       urcu/uatomic/loongarch.h \
        urcu/uatomic/m68k.h \
        urcu/uatomic/mips.h \
        urcu/uatomic/nios2.h \
@@ -84,10 +90,10 @@ nobase_include_HEADERS = \
        urcu/urcu-memb.h \
        urcu/urcu-qsbr.h \
        urcu/urcu_ref.h \
-       urcu/urcu-signal.h \
        urcu/wfcqueue.h \
        urcu/wfqueue.h \
-       urcu/wfstack.h
+       urcu/wfstack.h \
+       urcu/urcu-poll.h
 
 # Don't distribute generated headers
 nobase_nodist_include_HEADERS = urcu/config.h
index acafee2290b70cc56e9a1aae9b13c163b0b305a2..5f17e12652f2b9a22bbaf37233698a884422b064 100644 (file)
@@ -1,2 +1,6 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #define URCU_API_MAP
 #include <urcu/urcu-bp.h>
index 162bc561329440fc9390e7cfa40b233191adcd2e..2d994e5d3ba5b722875383a6f82a414973017304 100644 (file)
@@ -1 +1,5 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #include <urcu/call-rcu.h>
index e097d45f664c7f8c321d77f106af3208c47da1c9..cd6bd9b54c32c03807cfc9c06cc8a8eb1a33eda4 100644 (file)
@@ -1 +1,5 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #include <urcu/defer.h>
index aca264d77d65e4b83e4057505b50e039ecf27f79..dbd70eb18cd3e261384f7e8cbb64487df58628d1 100644 (file)
@@ -1 +1,5 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #include <urcu/flavor.h>
index 97aed984e189e95840f3290d39d7658183281841..2e61c4d1cc05aa6b6e04dba6184c2b633f5a3329 100644 (file)
@@ -1 +1,5 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #include <urcu/pointer.h>
index 43d95a9b2d31cc34135ee4ec3cac52f5971f7041..1a0d0a1f47fb1db7aa78c3942d94c8e52aafc07b 100644 (file)
@@ -1,2 +1,6 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #define URCU_API_MAP
 #include <urcu/urcu-qsbr.h>
index 5599961736f06bf80c98cc41db3c2752268d0c3e..0bd5f23f7879523df39ead40a714ea4c7d49823f 100644 (file)
@@ -1,2 +1,6 @@
+// SPDX-FileCopyrightText: 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #define URCU_API_MAP
 #include <urcu/urcu.h>
diff --git a/include/urcu/annotate.h b/include/urcu/annotate.h
new file mode 100644 (file)
index 0000000..f0955a0
--- /dev/null
@@ -0,0 +1,163 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef _URCU_ANNOTATE_H
+#define _URCU_ANNOTATE_H
+
+/*
+ * urcu/annotate.h
+ *
+ * Userspace RCU - annotation header.
+ */
+
+/*
+ * WARNING!
+ *
+ * This API is highly experimental. There is zero guarantees of stability
+ * between releases.
+ *
+ * You have been warned.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <urcu/compiler.h>
+
+enum cmm_annotate {
+       CMM_ANNOTATE_VOID,
+       CMM_ANNOTATE_LOAD,
+       CMM_ANNOTATE_STORE,
+       CMM_ANNOTATE_MB,
+};
+
+typedef enum cmm_annotate cmm_annotate_t __attribute__((unused));
+
+#define cmm_annotate_define(name)              \
+       cmm_annotate_t name = CMM_ANNOTATE_VOID
+
+#ifdef CMM_SANITIZE_THREAD
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+extern void __tsan_acquire(void *);
+extern void __tsan_release(void *);
+# ifdef __cplusplus
+}
+# endif
+
+# define cmm_annotate_die(msg)                                         \
+       do {                                                            \
+               fprintf(stderr,                                         \
+                       "(" __FILE__ ":%s@%u) Annotation ERROR: %s\n",  \
+                       __func__, __LINE__, msg);                       \
+               abort();                                                \
+       } while (0)
+
+/* Only used for typechecking in macros. */
+static inline cmm_annotate_t cmm_annotate_dereference(cmm_annotate_t *group)
+{
+       return *group;
+}
+
+# define cmm_annotate_group_mb_acquire(group)                          \
+       do {                                                            \
+               switch (cmm_annotate_dereference(group)) {              \
+               case CMM_ANNOTATE_VOID:                                 \
+                       break;                                          \
+               case CMM_ANNOTATE_LOAD:                                 \
+                       break;                                          \
+               case CMM_ANNOTATE_STORE:                                \
+                       cmm_annotate_die("store for acquire group");    \
+                       break;                                          \
+               case CMM_ANNOTATE_MB:                                   \
+                       cmm_annotate_die(                               \
+                               "redundant mb for acquire group"        \
+                                       );                              \
+                       break;                                          \
+               }                                                       \
+               *(group) = CMM_ANNOTATE_MB;                             \
+       } while (0)
+
+# define cmm_annotate_group_mb_release(group)                          \
+       do {                                                            \
+               switch (cmm_annotate_dereference(group)) {              \
+               case CMM_ANNOTATE_VOID:                                 \
+                       break;                                          \
+               case CMM_ANNOTATE_LOAD:                                 \
+                       cmm_annotate_die("load before release group");  \
+                       break;                                          \
+               case CMM_ANNOTATE_STORE:                                \
+                       cmm_annotate_die(                               \
+                               "store before release group"            \
+                                       );                              \
+                       break;                                          \
+               case CMM_ANNOTATE_MB:                                   \
+                       cmm_annotate_die(                               \
+                               "redundant mb of release group"         \
+                                       );                              \
+                       break;                                          \
+               }                                                       \
+               *(group) = CMM_ANNOTATE_MB;                             \
+       } while (0)
+
+# define cmm_annotate_group_mem_acquire(group, mem)                    \
+       do {                                                            \
+               __tsan_acquire((void*)(mem));                           \
+               switch (cmm_annotate_dereference(group)) {              \
+               case CMM_ANNOTATE_VOID:                                 \
+                       *(group) = CMM_ANNOTATE_LOAD;                   \
+                       break;                                          \
+               case CMM_ANNOTATE_MB:                                   \
+                       cmm_annotate_die(                               \
+                               "load after mb for acquire group"       \
+                                       );                              \
+                       break;                                          \
+               default:                                                \
+                       break;                                          \
+               }                                                       \
+       } while (0)
+
+# define cmm_annotate_group_mem_release(group, mem)            \
+       do {                                                    \
+               __tsan_release((void*)(mem));                   \
+               switch (cmm_annotate_dereference(group)) {      \
+               case CMM_ANNOTATE_MB:                           \
+                       break;                                  \
+               default:                                        \
+                       cmm_annotate_die(                       \
+                               "missing mb for release group"  \
+                                       );                      \
+               }                                               \
+       } while (0)
+
+# define cmm_annotate_mem_acquire(mem)         \
+       __tsan_acquire((void*)(mem))
+
+# define cmm_annotate_mem_release(mem)         \
+       __tsan_release((void*)(mem))
+#else
+
+# define cmm_annotate_group_mb_acquire(group)  \
+       (void) (group)
+
+# define cmm_annotate_group_mb_release(group)  \
+       (void) (group)
+
+# define cmm_annotate_group_mem_acquire(group, mem)    \
+       (void) (group)
+
+# define cmm_annotate_group_mem_release(group, mem)    \
+       (void) (group)
+
+# define cmm_annotate_mem_acquire(mem)         \
+       do { } while (0)
+
+# define cmm_annotate_mem_release(mem)         \
+       do { } while (0)
+
+#endif  /* CMM_SANITIZE_THREAD */
+
+#endif /* _URCU_ANNOTATE_H */
index d3914da27d41e9caf5158b2351ccc78b4b4b8ee8..5147d304f4623d689ac9e280f0e779fae7fb6ad7 100644 (file)
@@ -1,22 +1,6 @@
-/*
- * urcu/arch.h
- *
- * Copyright (c) 2020 Michael Jeanson <michael.jeanson@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+// SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 #ifndef _URCU_ARCH_H
 #define _URCU_ARCH_H
@@ -49,6 +33,7 @@
  * URCU_ARCH_HPPA : All HP PA-RISC variants
  * URCU_ARCH_M68K : All Motorola 68000 variants
  * URCU_ARCH_RISCV : All RISC-V variants
+ * URCU_ARCH_LOONGARCH : All LoongArch variants
  */
 
 #if (defined(__INTEL_OFFLOAD) || defined(__TARGET_ARCH_MIC) || defined(__MIC__))
 #define URCU_ARCH_RISCV 1
 #include <urcu/arch/riscv.h>
 
+#elif defined(__loongarch__)
+
+#define URCU_ARCH_LOONGARCH 1
+#include <urcu/arch/loongarch.h>
+
 #else
 #error "Cannot build: unrecognized architecture, see <urcu/arch.h>."
 #endif
 
+#ifdef CONFIG_RCU_EMIT_LEGACY_MB
+# define cmm_emit_legacy_smp_mb() cmm_smp_mb()
+#else
+# define cmm_emit_legacy_smp_mb() do { } while (0)
+#endif
+
 
 #endif /* _URCU_ARCH_H */
index 9e2f1ffdb6d09ee93c12692a77db3866a69de9e3..f573306a05450d80c7b4548852f7bfa50f03daf3 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_AARCH64_H
 #define _URCU_ARCH_AARCH64_H
 
 /*
  * arch/aarch64.h: definitions for aarch64 architecture
- *
- * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
@@ -44,13 +32,23 @@ extern "C" {
 
 /*
  * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
+ *
+ * Backported in RHEL7 gcc 4.8.5-11
  */
+#if defined(URCU_GCC_VERSION) && defined(__GNUC_RH_RELEASE__)
+# if (URCU_GCC_VERSION == 40805) && (__GNUC_RH_RELEASE__ >= 11)
+#  define URCU_GCC_PATCHED_63293
+# endif
+#endif
+
 #ifdef URCU_GCC_VERSION
-# if URCU_GCC_VERSION < 50100
+# if URCU_GCC_VERSION < 50100 && !defined(URCU_GCC_PATCHED_63293)
 #  error Your gcc version performs unsafe access to deallocated stack
 # endif
 #endif
 
+#define caa_cpu_relax()        __asm__ __volatile__ ("yield" : : : "memory")
+
 #ifdef __cplusplus
 }
 #endif
index dc33e28d3c1966863bff4775a4bc308f4e179cb4..db7ab3eb55e3228b29d0a32287c85922cfe3c886 100644 (file)
@@ -1,24 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_ALPHA_H
 #define _URCU_ARCH_ALPHA_H
 
 /*
  * arch_alpha.h: trivial definitions for the Alpha architecture.
- *
- * Copyright (c) 2010 Paolo Bonzini <pbonzini@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index 54ca4fabc79de65bad94009c177e73a88b37b481..407f422a92ee7e0315785ff8b05fb6560864f7b9 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_ARM_H
 #define _URCU_ARCH_ARM_H
 
 /*
  * arch_arm.h: trivial definitions for the ARM architecture.
- *
- * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index e5700e451df7757eb1232a3fc8d4f4e9e283eadf..1987450df7c9228d5dc4b562bb1776005e252cc7 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_GCC_H
 #define _URCU_ARCH_GCC_H
 
 /*
  * arch_gcc.h: trivial definitions for architectures using gcc __sync_
- *
- * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index be6e41e24d88a40f16d07ae08d7d391aeb650821..ac15a3bf7a378dab57cec797bb19a223fd10a634 100644 (file)
@@ -1,24 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_GENERIC_H
 #define _URCU_ARCH_GENERIC_H
 
 /*
  * arch_generic.h: common definitions for multiple architectures.
- *
- * Copyright (c) 2010 Paolo Bonzini <pbonzini@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
@@ -43,6 +31,57 @@ extern "C" {
  * GCC builtins) as well as cmm_rmb and cmm_wmb (defaulting to cmm_mb).
  */
 
+#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
+
+# ifdef CMM_SANITIZE_THREAD
+/*
+ * This makes TSAN quiet about unsupported thread fence.
+ */
+static inline void _cmm_thread_fence_wrapper(void)
+{
+#   if defined(__clang__)
+#    pragma clang diagnostic push
+#    pragma clang diagnostic ignored "-Wpragmas"
+#    pragma clang diagnostic ignored "-Wunknown-warning-option"
+#    pragma clang diagnostic ignored "-Wtsan"
+#   elif defined(__GNUC__)
+#    pragma GCC diagnostic push
+#    pragma GCC diagnostic ignored "-Wpragmas"
+#    pragma GCC diagnostic ignored "-Wtsan"
+#   endif
+       __atomic_thread_fence(__ATOMIC_SEQ_CST);
+#   if defined(__clang__)
+#    pragma clang diagnostic pop
+#   elif defined(__GNUC__)
+#    pragma GCC diagnostic pop
+#   endif
+}
+# endif         /* CMM_SANITIZE_THREAD */
+
+# ifndef cmm_smp_mb
+#  ifdef CMM_SANITIZE_THREAD
+#   define cmm_smp_mb() _cmm_thread_fence_wrapper()
+#  else
+#   define cmm_smp_mb() __atomic_thread_fence(__ATOMIC_SEQ_CST)
+#  endif /* CMM_SANITIZE_THREAD */
+# endif /* !cmm_smp_mb */
+
+#endif /* CONFIG_RCU_USE_ATOMIC_BUILTINS */
+
+
+/*
+ * cmm_mb() expands to __sync_synchronize() instead of __atomic_thread_fence
+ * with SEQ_CST because the former "issues a full memory barrier" while the
+ * latter "acts as a synchronization fence between threads" which is too weak
+ * for what we want, for example with I/O devices.
+ *
+ * Even though sync_synchronize seems to be an alias for a sequential consistent
+ * atomic thread fence on every architecture on GCC and Clang, this assumption
+ * might be untrue in future.  Therefore, the definitions above are used to
+ * ensure correct behavior in the future.
+ *
+ * The above defintions are quoted from the GCC manual.
+ */
 #ifndef cmm_mb
 #define cmm_mb()    __sync_synchronize()
 #endif
index c8d4d057708e1d5fe603697b12200ca54d0d5682..2a2236e56c9e5f28b076f5c6a12decac889e04c0 100644 (file)
@@ -1,24 +1,12 @@
+// SPDX-FileCopyrightText: 2014 Helge Deller <deller@gmx.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_HPPA_H
 #define _URCU_ARCH_HPPA_H
 
 /*
  * arch/hppa.h: definitions for hppa architecture
- *
- * Copyright (c) 2014 Helge Deller <deller@gmx.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index bca007cf0301f0fc0d01ef5adb7635be433fa7aa..9ed009639df2fceb3aec95df9a3729f7eb8ae871 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_IA64_H
 #define _URCU_ARCH_IA64_H
 
 /*
  * arch/ia64.h: definitions for ia64 architecture
- *
- * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
diff --git a/include/urcu/arch/loongarch.h b/include/urcu/arch/loongarch.h
new file mode 100644 (file)
index 0000000..7e82d9a
--- /dev/null
@@ -0,0 +1,37 @@
+// SPDX-FileCopyrightText: 2021 Wang Jing <wangjing@loongson.cn>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef _URCU_ARCH_LOONGARCH_H
+#define _URCU_ARCH_LOONGARCH_H
+
+/*
+ * arch/loongarch.h: trivial definitions for the LoongArch architecture.
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/config.h>
+#include <urcu/syscall-compat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+#include <sys/time.h>
+
+/*
+ * On Linux, define the membarrier system call number if not yet available in
+ * the system headers.
+ */
+#if (defined(__linux__) && !defined(__NR_membarrier))
+#define __NR_membarrier                283
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <urcu/arch/generic.h>
+
+#endif /* _URCU_ARCH_LOONGARCH_H */
index f7698c37755628cfff9f9522541b28f4f3f45304..29dbfc58274389ab49cba2b368ac41b61373aa49 100644 (file)
@@ -1,24 +1,12 @@
+// SPDX-FileCopyrightText: 2017 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_M68K_H
 #define _URCU_ARCH_M68K_H
 
 /*
  * arch/m68k.h: definitions for m68k architecture
- *
- * Copyright (c) 2017 Michael Jeanson <mjeanson@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index ea5b7e9539d8449b4297135a2fd41cf53ea93c03..c22dee281489eb79a7e166542e425eca247d2f42 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+// SPDX-FileCopyrightText: 2012 Ralf Baechle <ralf@linux-mips.org>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_MIPS_H
 #define _URCU_ARCH_MIPS_H
 
 /*
  * arch_mips.h: trivial definitions for the MIPS architecture.
- *
- * Copyright (c) 2010 Paolo Bonzini <pbonzini@redhat.com>
- * Copyright (c) 2012 Ralf Baechle <ralf@linux-mips.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index b4f3e504fae1baabebd52da7da8ba4be6dda8767..4887443ad75f00f32fe54200d4f65cc5d6045440 100644 (file)
@@ -1,24 +1,12 @@
+// SPDX-FileCopyrightText: 2016 Marek Vasut <marex@denx.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_NIOS2_H
 #define _URCU_ARCH_NIOS2_H
 
 /*
  * arch_nios2.h: trivial definitions for the NIOS2 architecture.
- *
- * Copyright (c) 2016 Marek Vasut <marex@denx.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index 791529ebb1a08ff3db124103474522b77bf0ad15..1285b6d2211f3239b850a73f8a3fb277a3516990 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_PPC_H
 #define _URCU_ARCH_PPC_H
 
 /*
  * arch_ppc.h: trivial definitions for the powerpc architecture.
- *
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
 extern "C" {
 #endif
 
-/* Include size of POWER5+ L3 cache lines: 256 bytes */
+/*
+ * Most powerpc machines have 128 bytes cache lines, but to make sure
+ * there is no false sharing on all known Power hardware, use the
+ * largest known cache line size, which is the physical size of POWER5
+ * L3 cache lines (256 bytes).
+ *
+ * "Each slice [of the L3] is 12-way set-associative, with 4,096
+ * congruence classes of 256-byte lines managed as two 128-byte sectors
+ * to match the L2 line size."
+ *
+ * From: "POWER5 system microarchitecture",
+ *       IBM Journal of Research & Development,
+ *       vol. 49, no. 4/5, July/September 2005
+ *       https://www.eecg.utoronto.ca/~moshovos/ACA08/readings/power5.pdf
+ *
+ * This value is a compile-time constant, which prevents us from
+ * querying the processor for the cache line size at runtime. We
+ * therefore need to be pessimistic and assume the largest known cache
+ * line size.
+ *
+ * This value is exposed through public headers, so tuning it for
+ * specific environments is a concern for ABI compatibility between
+ * applications and liburcu.
+ */
 #define CAA_CACHE_LINE_SIZE    256
 
 #ifdef __NO_LWSYNC__
@@ -63,7 +74,7 @@ extern "C" {
        __extension__                                   \
        ({                                              \
                unsigned long rval;                     \
-               __asm__ __volatile__ ("mftbl %0" : "=r" (rval));        \
+               __asm__ __volatile__ ("mftb %0" : "=r" (rval)); \
                rval;                                   \
        })
 
index 1fd7d62bc201d234798ff46a4210906c78c46bb0..cb8173fb5773d8ef9441ae8a1f14f9ce0297d294 100644 (file)
@@ -1,24 +1,12 @@
+// SPDX-FileCopyrightText: 2018 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_RISCV_H
 #define _URCU_ARCH_RISCV_H
 
 /*
  * arch/riscv.h: definitions for the RISC-V architecture
- *
- * Copyright (c) 2018 Michael Jeanson <mjeanson@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index 67461b4d6ed1c3f6ac258b0e636a6939fd942871..906d3e97f6786485bb305b2170d5ad63c2db0c14 100644 (file)
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2009 Novell, Inc.
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_ARCH_S390_H
 #define _URCU_ARCH_S390_H
 
@@ -6,26 +10,7 @@
  * Principles of Operation "CPU Serialization" (5-91), "BRANCH ON CONDITION"
  * (7-25) and "STORE CLOCK" (7-169).
  *
- * Copyright (c) 2009 Novell, Inc.
  * Author: Jan Blunck <jblunck@suse.de>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
  */
 
 #include <urcu/compiler.h>
index 1ff40f5c4698d4d7fd693098a16aabedcf1ba45a..1fdc6a4f88f6a064001ebae0ea735af64ee4bd33 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_SPARC64_H
 #define _URCU_ARCH_SPARC64_H
 
 /*
  * arch_sparc64.h: trivial definitions for the Sparc64 architecture.
- *
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index eae1161f2203340cc96e764d2298de5983af6450..0c5af191d790eb330db77e9865f6f987b6fa4935 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_TILE_H
 #define _URCU_ARCH_TILE_H
 
 /*
  * arch/tile.h: definitions for tile architecture
- *
- * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index 744f9f97ae094b016f74ff3a9cb840c9230f97dd..dcff3a8d16c19b56a1ee62657dfddfd579dd3c7f 100644 (file)
@@ -1,25 +1,13 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_X86_H
 #define _URCU_ARCH_X86_H
 
 /*
  * arch_x86.h: trivial definitions for the x86 architecture.
- *
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index c22419fdd658b68bf277a2ed1123cf196ceee2bd..3b8cdc6c44e793867f998cbac6941f28c87645c0 100644 (file)
@@ -1,22 +1,12 @@
+// SPDX-FileCopyrightText: 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_ASSERT_H
 #define _URCU_ASSERT_H
 
 /*
- * urcu/assert.h
- *
  * Userspace RCU assertion facilities.
- *
- * Copyright (c) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
  */
 
 #include <urcu/config.h>
index fc63ecd52b8b4b7f2bccd58c0e7ecbcc2c458f98..6b6de5c526b031f41fde284ebc2436e5803bfc80 100644 (file)
@@ -1,30 +1,16 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_CALL_RCU_H
 #define _URCU_CALL_RCU_H
 
 /*
- * urcu/call-rcu.h
- *
  * Userspace RCU header - batch memory reclamation with kernel API
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * This header is meant to be included indirectly through a liburcu
  * flavor header.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdlib.h>
index 78534bbe1dc200af2c6a0b4530d6e850a338a241..9eae429af81ed4584f11ed6b287cbbf325eae291 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_CDS_H
 #define _URCU_CDS_H
 
 /*
- * urcu/cds.h
- *
  * Userspace RCU library - Concurrent Data Structures
- *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/hlist.h>
index 2f32b38d6fb1850291ebd500f0a2fdca53f5c428..197656c617d786f8af88f5648a60483ac224f3c4 100644 (file)
@@ -1,22 +1,12 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_COMPILER_H
 #define _URCU_COMPILER_H
 
 /*
- * compiler.h
- *
  * Compiler definitions.
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
  */
 
 #include <stddef.h>    /* for offsetof */
 # include <type_traits>        /* for std::remove_cv */
 #endif
 
+#include <urcu/config.h>
+
 #define caa_likely(x)  __builtin_expect(!!(x), 1)
 #define caa_unlikely(x)        __builtin_expect(!!(x), 0)
 
-#define        cmm_barrier()   __asm__ __volatile__ ("" : : : "memory")
+#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
+#  define cmm_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
+#else
+#  define cmm_barrier() __asm__ __volatile__ ("" : : : "memory")
+#endif
 
 /*
  * Instruct the compiler to perform only a single access to a variable
                (type *)((char *)__ptr - offsetof(type, member));       \
        })
 
+/*
+ * caa_container_of_check_null - Get the address of an object containing a field.
+ *
+ * @ptr: pointer to the field.
+ * @type: type of the object.
+ * @member: name of the field within the object.
+ *
+ * Return the address of the object containing the field. Return NULL if
+ * @ptr is NULL.
+ */
+#define caa_container_of_check_null(ptr, type, member)                 \
+       __extension__                                                   \
+       ({                                                              \
+               const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \
+               (__ptr) ? (type *)((char *)__ptr - offsetof(type, member)) : NULL; \
+       })
+
 #define CAA_BUILD_BUG_ON_ZERO(cond) (sizeof(struct { int:-!!(cond); }))
 #define CAA_BUILD_BUG_ON(cond) ((void)CAA_BUILD_BUG_ON_ZERO(cond))
 
                                + __GNUC_PATCHLEVEL__)
 #endif
 
+#ifdef __cplusplus
+#define caa_unqual_scalar_typeof(x)                                    \
+       std::remove_cv<std::remove_reference<decltype(x)>::type>::type
+#else
+#define caa_scalar_type_to_expr(type)                                  \
+       unsigned type: (unsigned type)0,                                \
+       signed type: (signed type)0
+
+/*
+ * Use C11 _Generic to express unqualified type from expression. This removes
+ * volatile qualifier from expression type.
+ */
+#define caa_unqual_scalar_typeof(x)                                    \
+       __typeof__(                                                     \
+               _Generic((x),                                           \
+                       char: (char)0,                                  \
+                       caa_scalar_type_to_expr(char),                  \
+                       caa_scalar_type_to_expr(short),         \
+                       caa_scalar_type_to_expr(int),                   \
+                       caa_scalar_type_to_expr(long),                  \
+                       caa_scalar_type_to_expr(long long),             \
+                       default: (x)                                    \
+               )                                                       \
+       )
+#endif
+
+/*
+ * Allow user to manually define CMM_SANITIZE_THREAD if their toolchain is not
+ * supported by this check.
+ */
+#ifndef CMM_SANITIZE_THREAD
+# if defined(__GNUC__) && defined(__SANITIZE_THREAD__)
+#  define CMM_SANITIZE_THREAD
+# elif defined(__clang__) && defined(__has_feature)
+#  if __has_feature(thread_sanitizer)
+#   define CMM_SANITIZE_THREAD
+#  endif
+# endif
+#endif /* !CMM_SANITIZE_THREAD */
+
+/*
+ * Helper to add the volatile qualifier to a pointer.
+ */
+#if defined __cplusplus
+template <typename T>
+volatile T cmm_cast_volatile(T t)
+{
+    return static_cast<volatile T>(t);
+}
+#else
+#  define cmm_cast_volatile(ptr)                       \
+       __extension__                                   \
+       ({                                              \
+               (volatile __typeof__(ptr))(ptr);        \
+       })
+#endif
+
+/*
+ * Compile time assertion.
+ * - predicate: boolean expression to evaluate,
+ * - msg: string to print to the user on failure when `static_assert()` is
+ *   supported,
+ * - c_identifier_msg: message to be included in the typedef to emulate a
+ *   static assertion. This parameter must be a valid C identifier as it will
+ *   be used as a typedef name.
+ */
+#ifdef __cplusplus
+#define urcu_static_assert(predicate, msg, c_identifier_msg)  \
+       static_assert(predicate, msg)
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+#define urcu_static_assert(predicate, msg, c_identifier_msg)  \
+       _Static_assert(predicate, msg)
+#else
+/*
+ * Evaluates the predicate and emit a compilation error on failure.
+ *
+ * If the predicate evaluates to true, this macro emits a function
+ * prototype with an argument type which is an array of size 0.
+ *
+ * If the predicate evaluates to false, this macro emits a function
+ * prototype with an argument type which is an array of negative size
+ * which is invalid in C and forces a compiler error. The
+ * c_identifier_msg parameter is used as the argument identifier so it
+ * is printed to the user when the error is reported.
+ */
+#define urcu_static_assert(predicate, msg, c_identifier_msg)  \
+       void urcu_static_assert_proto(char c_identifier_msg[2*!!(predicate)-1])
+#endif
+
 #endif /* _URCU_COMPILER_H */
index 99d763a6e8ba64e7741680de3bd44bfaf53531e6..473d7a2ec49a076225f5096e7ae65315cfc04aba 100644 (file)
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /* urcu/config.h.in. Manually generated for control over the contained defs. */
 
 /* Enable SMP support. With SMP support enabled, uniprocessors are also
    Introduces a performance penalty. */
 #undef CONFIG_RCU_DEBUG
 
+/* Uatomic API uses atomic builtins. */
+#undef CONFIG_RCU_USE_ATOMIC_BUILTINS
+
+/* Emit legacy memory barriers? */
+#undef CONFIG_RCU_EMIT_LEGACY_MB
+
 /* Expose multi-flavor support */
 #define CONFIG_RCU_HAVE_MULTIFLAVOR 1
 
index 41727f378e4368be2cd11c20f682bb3d4588618b..ff89de273150cdec2ab90be0e3c99d2d8c068b2f 100644 (file)
@@ -1,22 +1,12 @@
+// SPDX-FileCopyrightText: 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_DEBUG_H
 #define _URCU_DEBUG_H
 
 /*
- * urcu/debug.h
- *
  * Userspace RCU debugging facilities.
- *
- * Copyright (c) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
  */
 
 #include <urcu/assert.h>
index 67b5f805fe9c2ecda49842acf23002ab2295abaf..db3640494a94016e2e6e7cbd540a1e897eb6af46 100644 (file)
@@ -1,30 +1,16 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_DEFER_H
 #define _URCU_DEFER_H
 
 /*
- * urcu/defer.h
- *
  * Userspace RCU header - deferred execution
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * This header is meant to be included indirectly through a liburcu
  * flavor header.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdlib.h>
index 1a920896fc9474c0ef7babe1eafa7eec5babca90..ce2a013a9aa14d1bff0874850f1d8d1699452ef9 100644 (file)
@@ -1,28 +1,16 @@
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_FLAVOR_H
 #define _URCU_FLAVOR_H
 
 /*
- * urcu-flavor.h
- *
  * Userspace RCU header - rcu flavor declarations
- *
- * Copyright (c) 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <urcu/urcu-poll.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -58,6 +46,9 @@ struct rcu_flavor_struct {
 
        void (*register_rculfhash_atfork)(struct urcu_atfork *atfork);
        void (*unregister_rculfhash_atfork)(struct urcu_atfork *atfork);
+
+       struct urcu_gp_poll_state (*update_start_poll_synchronize_rcu)(void);
+       bool (*update_poll_state_synchronize_rcu)(struct urcu_gp_poll_state state);
 };
 
 #define DEFINE_RCU_FLAVOR(x)                           \
@@ -76,6 +67,8 @@ const struct rcu_flavor_struct x = {                  \
        .barrier                = rcu_barrier,          \
        .register_rculfhash_atfork = urcu_register_rculfhash_atfork,    \
        .unregister_rculfhash_atfork = urcu_unregister_rculfhash_atfork,\
+       .update_start_poll_synchronize_rcu = start_poll_synchronize_rcu,\
+       .update_poll_state_synchronize_rcu = poll_state_synchronize_rcu,\
 }
 
 extern const struct rcu_flavor_struct rcu_flavor;
index e96b6e5fc5b2422e3ace466492ce1a73391f3870..9d0a997473c025563bd9c557225e2029ecd6f831 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_FUTEX_H
 #define _URCU_FUTEX_H
 
 /*
- * urcu-futex.h
- *
  * Userspace RCU - sys_futex/compat_futex header.
- *
- * Copyright 2011-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/config.h>
index c5ebbbecfaa2cb04ef43b22dbaa66a54847067f8..9a1eb21e33990ea0bad4bb4e9388c6fbc1278208 100644 (file)
@@ -1,3 +1,8 @@
+// SPDX-FileCopyrightText: 2009 Novell Inc.
+// SPDX-FileCopyrightText: 2010-2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-only
+
 #ifndef _KCOMPAT_HLIST_H
 #define _KCOMPAT_HLIST_H
 
@@ -5,15 +10,7 @@
  * Kernel sourcecode compatible lightweight single pointer list head useful
  * for implementing hash tables
  *
- * Copyright (C) 2009 Novell Inc.
- *
  * Author: Jan Blunck <jblunck@suse.de>
- *
- * Copyright (C) 2010-2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as
- * published by the Free  Software Foundation.
  */
 
 #include <stddef.h>
index 0f4ee99d8c92a88d88d51fe47d36eb47275056fb..77af43bf18069df89619f85be6ac46178980de5c 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_LFSTACK_H
 #define _URCU_LFSTACK_H
 
 /*
- * lfstack.h
- *
  * Userspace RCU library - Lock-Free Stack
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifdef __cplusplus
index 8cfbd8462d97abe11b9ca5af9f80e0b15b221ab9..4bc88b3f22c505e0f83355d3919eff80fb3ac868 100644 (file)
@@ -1,25 +1,12 @@
+// SPDX-FileCopyrightText: 2002 Free Software Foundation, Inc.
+// SPDX-FileCopyrightText: 2009 Pierre-Marc Fournier
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * Copyright (C) 2002 Free Software Foundation, Inc.
  * (originally part of the GNU C Library)
  * Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
- *
- * Copyright (C) 2009 Pierre-Marc Fournier
- * Conversion to RCU list.
- * Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _CDS_LIST_H
index 8aff77871113610ff527407a7db2ed3c63bcf0e5..9ab1219d027deb33048c0096f1ca3b405930585b 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * map/urcu-clear.h
- *
  * Userspace RCU header -- name mapping to allow multiple flavors to be
  * used in the same executable.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #undef _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -76,3 +62,6 @@
 
 #undef urcu_register_rculfhash_atfork
 #undef urcu_unregister_rculfhash_atfork
+
+#undef start_poll_synchronize_rcu
+#undef poll_state_synchronize_rcu
index 6f0a15a1df0a0541199d346c847e2d00cfbcf246..da7a5ebd9adef018c70d148b7f7503e5faba64b9 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu/map/urcu-bp.h
- *
  * Userspace RCU header -- name mapping to allow multiple flavors to be
  * used in the same executable.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -83,6 +69,9 @@
 #define urcu_unregister_rculfhash_atfork       \
                urcu_bp_unregister_rculfhash_atfork
 
+#define start_poll_synchronize_rcu     urcu_bp_start_poll_synchronize_rcu
+#define poll_state_synchronize_rcu     urcu_bp_poll_state_synchronize_rcu
+
 
 /* Compat identifiers for prior undocumented multiflavor usage */
 #ifndef URCU_NO_COMPAT_IDENTIFIERS
index d3e9513b233976968c4d8f8551b1b75947f457f9..1f1147fe5f8c6032ab58914e6d70fd9db7018430 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu/map/urcu-mb.h
- *
  * Userspace RCU header -- name mapping to allow multiple flavors to be
  * used in the same executable.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -78,6 +64,9 @@
 #define urcu_unregister_rculfhash_atfork       \
                urcu_mb_unregister_rculfhash_atfork
 
+#define start_poll_synchronize_rcu     urcu_mb_start_poll_synchronize_rcu
+#define poll_state_synchronize_rcu     urcu_mb_poll_state_synchronize_rcu
+
 
 /* Compat identifiers for prior undocumented multiflavor usage */
 #ifndef URCU_NO_COMPAT_IDENTIFIERS
index 1e9740fd3e3d14b37083b28a854f93e7b7cd9028..9ae4279692842a34aeb31bfeb83d7c0ae7a3af35 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu/map/urcu-memb.h
- *
  * Userspace RCU header -- name mapping to allow multiple flavors to be
  * used in the same executable.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -78,6 +64,9 @@
 #define urcu_unregister_rculfhash_atfork       \
                urcu_memb_unregister_rculfhash_atfork
 
+#define start_poll_synchronize_rcu     urcu_memb_start_poll_synchronize_rcu
+#define poll_state_synchronize_rcu     urcu_memb_poll_state_synchronize_rcu
+
 
 /* Compat identifiers for prior undocumented multiflavor usage */
 #ifndef URCU_NO_COMPAT_IDENTIFIERS
index ce4d50b8cf25c0f78584ceb43825623a7879cea2..d177fc53eebd78488020f22378015981a2560f93 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu/map/urcu-qsbr.h
- *
  * Userspace RCU header -- name mapping to allow multiple flavors to be
  * used in the same executable.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #define urcu_unregister_rculfhash_atfork       \
                urcu_qsbr_unregister_rculfhash_atfork
 
+#define start_poll_synchronize_rcu     urcu_qsbr_start_poll_synchronize_rcu
+#define poll_state_synchronize_rcu     urcu_qsbr_poll_state_synchronize_rcu
+
+
 /* Compat identifiers for prior undocumented multiflavor usage */
 #ifndef URCU_NO_COMPAT_IDENTIFIERS
 
diff --git a/include/urcu/map/urcu-signal.h b/include/urcu/map/urcu-signal.h
deleted file mode 100644 (file)
index 29ccaad..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * urcu/map/urcu-signal.h
- *
- * Userspace RCU header -- name mapping to allow multiple flavors to be
- * used in the same executable.
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * LGPL-compatible code should include this header with :
- *
- * #define _LGPL_SOURCE
- * #include <urcu.h>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * IBM's contributions to this file may be relicensed under LGPLv2 or later.
- */
-
-#define rcu_read_lock                  urcu_signal_read_lock
-#define _rcu_read_lock                 _urcu_signal_read_lock
-#define rcu_read_unlock                        urcu_signal_read_unlock
-#define _rcu_read_unlock               _urcu_signal_read_unlock
-#define rcu_read_ongoing               urcu_signal_read_ongoing
-#define _rcu_read_ongoing              _urcu_signal_read_ongoing
-#define rcu_quiescent_state            urcu_signal_quiescent_state
-#define _rcu_quiescent_state           _urcu_signal_quiescent_state
-#define rcu_thread_offline             urcu_signal_thread_offline
-#define rcu_thread_online              urcu_signal_thread_online
-#define rcu_register_thread            urcu_signal_register_thread
-#define rcu_unregister_thread          urcu_signal_unregister_thread
-#define rcu_init                       urcu_signal_init
-#define rcu_exit                       urcu_signal_exit
-#define synchronize_rcu                        urcu_signal_synchronize_rcu
-#define rcu_reader                     urcu_signal_reader
-#define rcu_gp                         urcu_signal_gp
-
-#define get_cpu_call_rcu_data          urcu_signal_get_cpu_call_rcu_data
-#define get_call_rcu_thread            urcu_signal_get_call_rcu_thread
-#define create_call_rcu_data           urcu_signal_create_call_rcu_data
-#define set_cpu_call_rcu_data          urcu_signal_set_cpu_call_rcu_data
-#define get_default_call_rcu_data      urcu_signal_get_default_call_rcu_data
-#define get_call_rcu_data              urcu_signal_get_call_rcu_data
-#define get_thread_call_rcu_data       urcu_signal_get_thread_call_rcu_data
-#define set_thread_call_rcu_data       urcu_signal_set_thread_call_rcu_data
-#define create_all_cpu_call_rcu_data   urcu_signal_create_all_cpu_call_rcu_data
-#define free_all_cpu_call_rcu_data     urcu_signal_free_all_cpu_call_rcu_data
-#define call_rcu                       urcu_signal_call_rcu
-#define call_rcu_data_free             urcu_signal_call_rcu_data_free
-#define call_rcu_before_fork           urcu_signal_call_rcu_before_fork
-#define call_rcu_after_fork_parent     urcu_signal_call_rcu_after_fork_parent
-#define call_rcu_after_fork_child      urcu_signal_call_rcu_after_fork_child
-#define rcu_barrier                    urcu_signal_barrier
-
-#define defer_rcu                      urcu_signal_defer_rcu
-#define rcu_defer_register_thread      urcu_signal_defer_register_thread
-#define rcu_defer_unregister_thread    urcu_signal_defer_unregister_thread
-#define rcu_defer_barrier              urcu_signal_defer_barrier
-#define rcu_defer_barrier_thread       urcu_signal_defer_barrier_thread
-#define rcu_defer_exit                 urcu_signal_defer_exit
-
-#define rcu_flavor                     urcu_signal_flavor
-
-#define urcu_register_rculfhash_atfork         \
-               urcu_signal_register_rculfhash_atfork
-#define urcu_unregister_rculfhash_atfork       \
-               urcu_signal_unregister_rculfhash_atfork
-
-
-/* Compat identifiers for prior undocumented multiflavor usage */
-#ifndef URCU_NO_COMPAT_IDENTIFIERS
-
-#define rcu_dereference_sig            urcu_signal_dereference
-#define rcu_cmpxchg_pointer_sig                urcu_signal_cmpxchg_pointer
-#define rcu_xchg_pointer_sig           urcu_signal_xchg_pointer
-#define rcu_set_pointer_sig            urcu_signal_set_pointer
-
-#define rcu_sig_before_fork            urcu_signal_before_fork
-#define rcu_sig_after_fork_parent      urcu_signal_after_fork_parent
-#define rcu_sig_after_fork_child       urcu_signal_after_fork_child
-
-#define rcu_read_lock_sig              urcu_signal_read_lock
-#define _rcu_read_lock_sig             _urcu_signal_read_lock
-#define rcu_read_unlock_sig            urcu_signal_read_unlock
-#define _rcu_read_unlock_sig           _urcu_signal_read_unlock
-#define rcu_read_ongoing_sig           urcu_signal_read_ongoing
-#define _rcu_read_ongoing_sig          _urcu_signal_read_ongoing
-#define rcu_register_thread_sig                urcu_signal_register_thread
-#define rcu_unregister_thread_sig      urcu_signal_unregister_thread
-#define rcu_init_sig                   urcu_signal_init
-#define rcu_exit_sig                   urcu_signal_exit
-#define synchronize_rcu_sig            urcu_signal_synchronize_rcu
-#define rcu_reader_sig                 urcu_signal_reader
-#define rcu_gp_sig                     urcu_signal_gp
-
-#define get_cpu_call_rcu_data_sig      urcu_signal_get_cpu_call_rcu_data
-#define get_call_rcu_thread_sig                urcu_signal_get_call_rcu_thread
-#define create_call_rcu_data_sig       urcu_signal_create_call_rcu_data
-#define set_cpu_call_rcu_data_sig      urcu_signal_set_cpu_call_rcu_data
-#define get_default_call_rcu_data_sig  urcu_signal_get_default_call_rcu_data
-#define get_call_rcu_data_sig          urcu_signal_get_call_rcu_data
-#define get_thread_call_rcu_data_sig   urcu_signal_get_thread_call_rcu_data
-#define set_thread_call_rcu_data_sig   urcu_signal_set_thread_call_rcu_data
-#define create_all_cpu_call_rcu_data_sig       \
-               urcu_signal_create_all_cpu_call_rcu_data
-#define free_all_cpu_call_rcu_data_sig urcu_signal_free_all_cpu_call_rcu_data
-#define call_rcu_sig                   urcu_signal_call_rcu
-#define call_rcu_data_free_sig         urcu_signal_call_rcu_data_free
-#define call_rcu_before_fork_sig               \
-               urcu_signal_call_rcu_before_fork
-#define call_rcu_after_fork_parent_sig urcu_signal_call_rcu_after_fork_parent
-#define call_rcu_after_fork_child_sig  urcu_signal_call_rcu_after_fork_child
-#define rcu_barrier_sig                        urcu_signal_barrier
-
-#define defer_rcu_sig                  urcu_signal_defer_rcu
-#define rcu_defer_register_thread_sig  urcu_signal_defer_register_thread
-#define rcu_defer_unregister_thread_sig        urcu_signal_defer_unregister_thread
-#define rcu_defer_barrier_sig          urcu_signal_defer_barrier
-#define rcu_defer_barrier_thread_sig   urcu_signal_defer_barrier_thread
-#define rcu_defer_exit_sig             urcu_signal_defer_exit
-
-#define rcu_flavor_sig                 urcu_signal_flavor
-
-#define urcu_register_rculfhash_atfork_sig     \
-               urcu_signal_register_rculfhash_atfork
-#define urcu_unregister_rculfhash_atfork_sig   \
-               urcu_signal_unregister_rculfhash_atfork
-
-#endif /* URCU_NO_COMPAT_IDENTIFIERS */
index a2fb7c8a21c41e9c37ad6f9b78be3c4e783ccae3..96c53472f5e60d3c9051b943493dd2590e90c2ad 100644 (file)
@@ -1,38 +1,22 @@
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu-map.h
- *
  * Userspace RCU header -- name mapping to allow multiple flavors to be
  * used in the same executable.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #ifdef RCU_MEMBARRIER
 #include <urcu/map/urcu-memb.h>
-#elif defined(RCU_SIGNAL)
-#include <urcu/map/urcu-signal.h>
 #elif defined(RCU_MB)
 #include <urcu/map/urcu-mb.h>
 #else
index a6702723d611f4c2a96a57f9c8155b07fbc51752..cc9aeae38bfedd2f5d7de27e0f08d42453f12155 100644 (file)
@@ -1,28 +1,14 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_POINTER_H
 #define _URCU_POINTER_H
 
 /*
- * urcu/pointer.h
- *
  * Userspace RCU header. Operations on pointers.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
index 20c723864807ecd555115f59015b8accbb20bf0d..6dab12a8d062c11caef89d60cd901cdd247c604f 100644 (file)
@@ -1,25 +1,12 @@
+// SPDX-FileCopyrightText: 2002 Free Software Foundation, Inc.
+// SPDX-FileCopyrightText: 2009 Pierre-Marc Fournier
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * Copyright (C) 2002 Free Software Foundation, Inc.
  * (originally part of the GNU C Library)
  * Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
- *
- * Copyright (C) 2009 Pierre-Marc Fournier
- * Conversion to RCU list.
- * Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _URCU_RCUHLIST_H
index 8586e1da371f86e2c19518f60a8cef69e6db691e..e0f4b351fc9b027a32ecee2c1e8a958b3ce21b2f 100644 (file)
@@ -1,28 +1,14 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFHASH_H
 #define _URCU_RCULFHASH_H
 
 /*
- * urcu/rculfhash.h
- *
  * Userspace RCU library - Lock-Free RCU Hash Table
  *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * For use with URCU_API_MAP (API mapping of liburcu), include this file
  * _after_ including your URCU flavor.
  */
@@ -82,6 +68,18 @@ struct cds_lfht_iter {
 #endif
 };
 
+/*
+ * cds_lfht_alloc: Callbacks if we want to use custom memory allocator.
+ */
+struct cds_lfht_alloc {
+       void *(*malloc)(void *state, size_t size);
+       void *(*calloc)(void *state, size_t nmemb, size_t size);
+       void *(*realloc)(void *state, void *ptr, size_t size);
+       void *(*aligned_alloc)(void *state, size_t alignment, size_t size);
+       void  (*free)(void *state, void *ptr);
+       void  *state;
+};
+
 static inline
 struct cds_lfht_node *cds_lfht_iter_get_node(struct cds_lfht_iter *iter)
 {
@@ -129,7 +127,7 @@ enum {
 
 struct cds_lfht_mm_type {
        struct cds_lfht *(*alloc_cds_lfht)(unsigned long min_nr_alloc_buckets,
-                       unsigned long max_nr_buckets);
+                       unsigned long max_nr_buckets, const struct cds_lfht_alloc *alloc);
        void (*alloc_bucket_table)(struct cds_lfht *ht, unsigned long order);
        void (*free_bucket_table)(struct cds_lfht *ht, unsigned long order);
        struct cds_lfht_node *(*bucket_at)(struct cds_lfht *ht,
@@ -152,6 +150,19 @@ struct cds_lfht *_cds_lfht_new(unsigned long init_size,
                        const struct rcu_flavor_struct *flavor,
                        pthread_attr_t *attr);
 
+/*
+ * _cds_lfht_new_with_alloc - API used by cds_lfht_new_with_flavor_alloc.
+ */
+extern
+struct cds_lfht *_cds_lfht_new_with_alloc(unsigned long init_size,
+                       unsigned long min_nr_alloc_buckets,
+                       unsigned long max_nr_buckets,
+                       int flags,
+                       const struct cds_lfht_mm_type *mm,
+                       const struct rcu_flavor_struct *flavor,
+                       const struct cds_lfht_alloc *alloc,
+                       pthread_attr_t *attr);
+
 /*
  * cds_lfht_new_flavor - allocate a hash table tied to a RCU flavor.
  * @init_size: number of buckets to allocate initially. Must be power of two.
@@ -194,6 +205,52 @@ struct cds_lfht *cds_lfht_new_flavor(unsigned long init_size,
                        flags, NULL, flavor, attr);
 }
 
+/*
+ * cds_lfht_new_with_flavor_alloc - allocate a hash table tied to a RCU flavor.
+ * @init_size: number of buckets to allocate initially. Must be power of two.
+ * @min_nr_alloc_buckets: the minimum number of allocated buckets.
+ *                        (must be power of two)
+ * @max_nr_buckets: the maximum number of hash table buckets allowed.
+ *                  (must be power of two, 0 is accepted, means
+ *                  "infinite")
+ * @flavor: flavor of liburcu to use to synchronize the hash table
+ * @alloc: Custom memory allocator for hash table memory management.
+ *         NULL for default. If a custom allocator is used, then
+ *         the whole interface of struct cds_lfht_alloc must be implemented.
+ * @flags: hash table creation flags (can be combined with bitwise or: '|').
+ *           0: no flags.
+ *           CDS_LFHT_AUTO_RESIZE: automatically resize hash table.
+ *           CDS_LFHT_ACCOUNTING: count the number of node addition
+ *                                and removal in the table
+ * @attr: optional resize worker thread attributes. NULL for default.
+ *
+ * Return NULL on error.
+ * Note: the RCU flavor must be already included before the hash table header.
+ *
+ * The programmer is responsible for ensuring that resize operation has a
+ * priority equal to hash table updater threads. It should be performed by
+ * specifying the appropriate priority in the pthread "attr" argument, and,
+ * for CDS_LFHT_AUTO_RESIZE, by ensuring that call_rcu worker threads also have
+ * this priority level. Having lower priority for call_rcu and resize threads
+ * does not pose any correctness issue, but the resize operations could be
+ * starved by updates, thus leading to long hash table bucket chains.
+ * Threads calling cds_lfht_new are NOT required to be registered RCU
+ * read-side threads. It can be called very early. (e.g. before RCU is
+ * initialized)
+ */
+static inline
+struct cds_lfht *cds_lfht_new_with_flavor_alloc(unsigned long init_size,
+                       unsigned long min_nr_alloc_buckets,
+                       unsigned long max_nr_buckets,
+                       int flags,
+                       const struct rcu_flavor_struct *flavor,
+                       const struct cds_lfht_alloc *alloc,
+                       pthread_attr_t *attr)
+{
+       return _cds_lfht_new_with_alloc(init_size, min_nr_alloc_buckets, max_nr_buckets,
+                       flags, NULL, flavor, alloc, attr);
+}
+
 
 #ifdef URCU_API_MAP
 /*
@@ -247,16 +304,16 @@ struct cds_lfht *cds_lfht_new(unsigned long init_size,
  *
  * Return 0 on success, negative error value on error.
 
+ * Threads calling this API need to be registered RCU read-side threads.
+ *
  * Prior to liburcu 0.10:
- * - Threads calling this API need to be registered RCU read-side
- *   threads.
  * - cds_lfht_destroy should *not* be called from a RCU read-side
  *   critical section. It should *not* be called from a call_rcu thread
  *   context neither.
  *
  * Starting from liburcu 0.10, rculfhash implements its own worker
- * thread to handle resize operations, which removes RCU requirements on
- * cds_lfht_destroy.
+ * thread to handle resize operations, which removes the above RCU
+ * read-side critical section requirement on cds_lfht_destroy.
  */
 extern
 int cds_lfht_destroy(struct cds_lfht *ht, pthread_attr_t **attr);
@@ -544,24 +601,27 @@ void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size);
                cds_lfht_next_duplicate(ht, match, key, iter),          \
                        node = cds_lfht_iter_get_node(iter))
 
+#define cds_lfht_entry(ptr, type, member)                              \
+       caa_container_of_check_null(ptr, type, member)
+
 #define cds_lfht_for_each_entry(ht, iter, pos, member)                 \
        for (cds_lfht_first(ht, iter),                                  \
-                       pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       __typeof__(*(pos)), member);    \
-               cds_lfht_iter_get_node(iter) != NULL;                   \
+                       pos = cds_lfht_entry(cds_lfht_iter_get_node(iter), \
+                               __typeof__(*(pos)), member);            \
+               pos != NULL;                                            \
                cds_lfht_next(ht, iter),                                \
-                       pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       __typeof__(*(pos)), member))
+                       pos = cds_lfht_entry(cds_lfht_iter_get_node(iter), \
+                               __typeof__(*(pos)), member))
 
 #define cds_lfht_for_each_entry_duplicate(ht, hash, match, key,                \
                                iter, pos, member)                      \
        for (cds_lfht_lookup(ht, hash, match, key, iter),               \
-                       pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       __typeof__(*(pos)), member);    \
-               cds_lfht_iter_get_node(iter) != NULL;                   \
+                       pos = cds_lfht_entry(cds_lfht_iter_get_node(iter), \
+                               __typeof__(*(pos)), member);            \
+               pos != NULL;                                            \
                cds_lfht_next_duplicate(ht, match, key, iter),          \
-                       pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       __typeof__(*(pos)), member))
+                       pos = cds_lfht_entry(cds_lfht_iter_get_node(iter), \
+                               __typeof__(*(pos)), member))
 
 #ifdef __cplusplus
 }
index 2c06247b5b958246fec2680911af088a37a20de2..0e3c9109a9288c42bd0f85290b9d18f3b34db377 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFQUEUE_H
 #define _URCU_RCULFQUEUE_H
 
 /*
- * rculfqueue.h
- *
  * Userspace RCU library - Lock-Free RCU Queue
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 
index c7e5599d07fa12f13573c6dd877432be08a120e9..b0f4221bf2d2970da3e6a4d4297cfc624d9e50d6 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFSTACK_H
 #define _URCU_RCULFSTACK_H
 
 /*
- * rculfstack.h
- *
  * Userspace RCU library - Lock-Free RCU Stack
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/compiler.h>
index 753135e2cd98ab4981a7f0d73b2bc9ac72811a18..9cd0a37de59275a487f509064713eb1ba7676d85 100644 (file)
@@ -1,25 +1,12 @@
+// SPDX-FileCopyrightText: Free Software Foundation, Inc.
+// SPDX-FileCopyrightText: 2009 Pierre-Marc Fournier
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * Copyright (C) 2002 Free Software Foundation, Inc.
  * (originally part of the GNU C Library)
  * Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
- *
- * Copyright (C) 2009 Pierre-Marc Fournier
- * Conversion to RCU list.
- * Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _URCU_RCULIST_H
index e7ab5310aa5d4a2a4deff4f988cdc4bf5063d56c..408cfe2cfd409bada17a79364631fd72535b315f 100644 (file)
@@ -1,17 +1,15 @@
+// SPDX-FileCopyrightText: 2009 Novell Inc.
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-only
+
 #ifndef _URCU_REF_H
 #define _URCU_REF_H
 
 /*
  * Userspace RCU - Reference counting
  *
- * Copyright (C) 2009 Novell Inc.
- * Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * Author: Jan Blunck <jblunck@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as
- * published by the Free  Software Foundation.
  */
 
 #include <stdbool.h>
index a05acb4904d56308caadf3b7cc030ee81ea3ce94..d7e70d4966d6bab1f5f040c634a025c84f7baa99 100644 (file)
@@ -1,29 +1,15 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_STATIC_LFSTACK_H
 #define _URCU_STATIC_LFSTACK_H
 
 /*
- * urcu/static/lfstack.h
- *
  * Userspace RCU library - Lock-Free Stack
  *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu/lfstack.h for
  * linking dynamically with the userspace rcu library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdbool.h>
@@ -114,7 +100,7 @@ bool ___cds_lfs_empty_head(struct cds_lfs_head *head)
 static inline
 bool _cds_lfs_empty(cds_lfs_stack_ptr_t s)
 {
-       return ___cds_lfs_empty_head(CMM_LOAD_SHARED(s._s->head));
+       return ___cds_lfs_empty_head(uatomic_load(&s._s->head, CMM_RELAXED));
 }
 
 /*
@@ -122,6 +108,8 @@ bool _cds_lfs_empty(cds_lfs_stack_ptr_t s)
  *
  * Does not require any synchronization with other push nor pop.
  *
+ * Operations before push are consistent when observed after associated pop.
+ *
  * Lock-free stack push is not subject to ABA problem, so no need to
  * take the RCU read-side lock. Even if "head" changes between two
  * uatomic_cmpxchg() invocations here (being popped, and then pushed
@@ -167,7 +155,9 @@ bool _cds_lfs_push(cds_lfs_stack_ptr_t u_s,
                 * uatomic_cmpxchg() implicit memory barrier orders earlier
                 * stores to node before publication.
                 */
-               head = uatomic_cmpxchg(&s->head, old_head, new_head);
+               cmm_emit_legacy_smp_mb();
+               head = uatomic_cmpxchg_mo(&s->head, old_head, new_head,
+                                       CMM_SEQ_CST, CMM_SEQ_CST);
                if (old_head == head)
                        break;
        }
@@ -179,6 +169,8 @@ bool _cds_lfs_push(cds_lfs_stack_ptr_t u_s,
  *
  * Returns NULL if stack is empty.
  *
+ * Operations after pop are consistent when observed before associated push.
+ *
  * __cds_lfs_pop needs to be synchronized using one of the following
  * techniques:
  *
@@ -203,7 +195,7 @@ struct cds_lfs_node *___cds_lfs_pop(cds_lfs_stack_ptr_t u_s)
                struct cds_lfs_head *head, *next_head;
                struct cds_lfs_node *next;
 
-               head = _CMM_LOAD_SHARED(s->head);
+               head = uatomic_load(&s->head, CMM_CONSUME);
                if (___cds_lfs_empty_head(head))
                        return NULL;    /* Empty stack */
 
@@ -212,12 +204,14 @@ struct cds_lfs_node *___cds_lfs_pop(cds_lfs_stack_ptr_t u_s)
                 * memory barrier before uatomic_cmpxchg() in
                 * cds_lfs_push.
                 */
-               cmm_smp_read_barrier_depends();
-               next = _CMM_LOAD_SHARED(head->node.next);
+               next = uatomic_load(&head->node.next, CMM_RELAXED);
                next_head = caa_container_of(next,
                                struct cds_lfs_head, node);
-               if (uatomic_cmpxchg(&s->head, head, next_head) == head)
+               if (uatomic_cmpxchg_mo(&s->head, head, next_head,
+                                       CMM_SEQ_CST, CMM_SEQ_CST) == head){
+                       cmm_emit_legacy_smp_mb();
                        return &head->node;
+               }
                /* busy-loop if head changed under us */
        }
 }
@@ -245,6 +239,7 @@ static inline
 struct cds_lfs_head *___cds_lfs_pop_all(cds_lfs_stack_ptr_t u_s)
 {
        struct __cds_lfs_stack *s = u_s._s;
+       struct cds_lfs_head *head;
 
        /*
         * Implicit memory barrier after uatomic_xchg() matches implicit
@@ -256,7 +251,9 @@ struct cds_lfs_head *___cds_lfs_pop_all(cds_lfs_stack_ptr_t u_s)
         * taking care to order writes to each node prior to the full
         * memory barrier after this uatomic_xchg().
         */
-       return uatomic_xchg(&s->head, NULL);
+       head = uatomic_xchg_mo(&s->head, NULL, CMM_SEQ_CST);
+       cmm_emit_legacy_smp_mb();
+       return head;
 }
 
 /*
index 9e46a5769c92fc99142adf55989aa0d37581647c..9dc0d3eaa5f4c6177fc503449153cd08f78267ec 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_POINTER_STATIC_H
 #define _URCU_POINTER_STATIC_H
 
 /*
- * urcu/static/pointer.h
- *
  * Userspace RCU header. Operations on pointers.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -96,23 +82,8 @@ extern "C" {
  * -Wincompatible-pointer-types errors.  Using the statement expression
  * makes it an rvalue and gets rid of the const-ness.
  */
-#ifdef __URCU_DEREFERENCE_USE_ATOMIC_CONSUME
-# define _rcu_dereference(p) __extension__ ({                                          \
-                               __typeof__(__extension__ ({                             \
-                                       __typeof__(p) __attribute__((unused)) _________p0 = { 0 }; \
-                                       _________p0;                                    \
-                               })) _________p1;                                        \
-                               __atomic_load(&(p), &_________p1, __ATOMIC_CONSUME);    \
-                               (_________p1);                                          \
-                       })
-#else
-# define _rcu_dereference(p) __extension__ ({                                          \
-                               __typeof__(p) _________p1 = CMM_LOAD_SHARED(p);         \
-                               cmm_smp_read_barrier_depends();                         \
-                               (_________p1);                                          \
-                       })
-#endif
-
+# define _rcu_dereference(p)                   \
+       uatomic_load(&(p), CMM_CONSUME)
 /**
  * _rcu_cmpxchg_pointer - same as rcu_assign_pointer, but tests if the pointer
  * is as expected by "old". If succeeds, returns the previous pointer to the
@@ -120,7 +91,7 @@ extern "C" {
  * using synchronize_rcu(). If fails (unexpected value), returns old (which
  * should not be freed !).
  *
- * uatomic_cmpxchg() acts as both release and acquire barriers.
+ * uatomic_cmpxchg() acts as both release and acquire barriers on success.
  *
  * This macro is less than 10 lines long.  The intent is that this macro
  * meets the 10-line criterion in LGPL, allowing this function to be
@@ -131,8 +102,9 @@ extern "C" {
        ({                                                              \
                __typeof__(*p) _________pold = (old);                   \
                __typeof__(*p) _________pnew = (_new);                  \
-               uatomic_cmpxchg(p, _________pold, _________pnew);       \
-       })
+               uatomic_cmpxchg_mo(p, _________pold, _________pnew,     \
+                                  CMM_SEQ_CST, CMM_RELAXED);           \
+       });
 
 /**
  * _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous
@@ -149,17 +121,17 @@ extern "C" {
        __extension__                                   \
        ({                                              \
                __typeof__(*p) _________pv = (v);       \
-               uatomic_xchg(p, _________pv);           \
+               uatomic_xchg_mo(p, _________pv,         \
+                               CMM_SEQ_CST);           \
        })
 
 
-#define _rcu_set_pointer(p, v)                         \
-       do {                                            \
-               __typeof__(*p) _________pv = (v);       \
-               if (!__builtin_constant_p(v) ||         \
-                   ((v) != NULL))                      \
-                       cmm_wmb();                              \
-               uatomic_set(p, _________pv);            \
+#define _rcu_set_pointer(p, v)                                         \
+       do {                                                            \
+               __typeof__(*p) _________pv = (v);                       \
+               uatomic_store(p, _________pv,                           \
+                       __builtin_constant_p(v) && (v) == NULL ?        \
+                       CMM_RELAXED : CMM_RELEASE);                     \
        } while (0)
 
 /**
index ad73454ed57e5e9f3a4a4c10fb26a69af3bc978f..03c4ecdef76c6ee55102e5b36caaea5dee954841 100644 (file)
@@ -1,29 +1,15 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFQUEUE_STATIC_H
 #define _URCU_RCULFQUEUE_STATIC_H
 
 /*
- * rculfqueue-static.h
- *
  * Userspace RCU library - Lock-Free RCU Queue
  *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See rculfqueue.h for linking
  * dynamically with the userspace rcu library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu-call-rcu.h>
@@ -148,26 +134,29 @@ void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
         * uatomic_cmpxchg() implicit memory barrier orders earlier stores to
         * node before publication.
         */
-
        for (;;) {
                struct cds_lfq_node_rcu *tail, *next;
 
                tail = rcu_dereference(q->tail);
-               next = uatomic_cmpxchg(&tail->next, NULL, node);
+               cmm_emit_legacy_smp_mb();
+               next = uatomic_cmpxchg_mo(&tail->next, NULL, node,
+                                       CMM_SEQ_CST, CMM_SEQ_CST);
                if (next == NULL) {
                        /*
                         * Tail was at the end of queue, we successfully
                         * appended to it. Now move tail (another
                         * enqueue might beat us to it, that's fine).
                         */
-                       (void) uatomic_cmpxchg(&q->tail, tail, node);
+                       (void) uatomic_cmpxchg_mo(&q->tail, tail, node,
+                                               CMM_SEQ_CST, CMM_SEQ_CST);
                        return;
                } else {
                        /*
                         * Failure to append to current tail.
                         * Help moving tail further and retry.
                         */
-                       (void) uatomic_cmpxchg(&q->tail, tail, next);
+                       (void) uatomic_cmpxchg_mo(&q->tail, tail, next,
+                                               CMM_SEQ_CST, CMM_SEQ_CST);
                        continue;
                }
        }
@@ -211,7 +200,8 @@ struct cds_lfq_node_rcu *_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q)
                        enqueue_dummy(q);
                        next = rcu_dereference(head->next);
                }
-               if (uatomic_cmpxchg(&q->head, head, next) != head)
+               if (uatomic_cmpxchg_mo(&q->head, head, next,
+                                       CMM_SEQ_CST, CMM_SEQ_CST) != head)
                        continue;       /* Concurrently pushed. */
                if (head->dummy) {
                        /* Free dummy after grace period. */
index 54ff377b8aa801bbeaddb07097e05428d6bc8e88..b44b9e29fdbad9b73024d653fb992218f221644b 100644 (file)
@@ -1,29 +1,15 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFSTACK_STATIC_H
 #define _URCU_RCULFSTACK_STATIC_H
 
 /*
- * rculfstack-static.h
- *
  * Userspace RCU library - Lock-Free RCU Stack
  *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See rculfstack.h for linking
  * dynamically with the userspace rcu library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/uatomic.h>
@@ -83,7 +69,9 @@ int _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
                 * uatomic_cmpxchg() implicit memory barrier orders earlier
                 * stores to node before publication.
                 */
-               head = uatomic_cmpxchg(&s->head, old_head, node);
+               cmm_emit_legacy_smp_mb();
+               head = uatomic_cmpxchg_mo(&s->head, old_head, node,
+                                       CMM_SEQ_CST, CMM_SEQ_CST);
                if (old_head == head)
                        break;
        }
@@ -108,7 +96,9 @@ _cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
                if (head) {
                        struct cds_lfs_node_rcu *next = rcu_dereference(head->next);
 
-                       if (uatomic_cmpxchg(&s->head, head, next) == head) {
+                       if (uatomic_cmpxchg_mo(&s->head, head, next,
+                                               CMM_SEQ_CST, CMM_SEQ_CST) == head) {
+                               cmm_emit_legacy_smp_mb();
                                return head;
                        } else {
                                /* Concurrent modification. Retry. */
index 8ba3830b243d7e05bfddb84081a2db46f3a00beb..e660154094e7a3f568798f329ba121302788e8ce 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_BP_STATIC_H
 #define _URCU_BP_STATIC_H
 
 /*
- * urcu-bp-static.h
- *
  * Userspace RCU header.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -33,6 +19,7 @@
 #include <pthread.h>
 #include <unistd.h>
 
+#include <urcu/annotate.h>
 #include <urcu/debug.h>
 #include <urcu/config.h>
 #include <urcu/compiler.h>
@@ -117,7 +104,8 @@ static inline void urcu_bp_smp_mb_slave(void)
                cmm_smp_mb();
 }
 
-static inline enum urcu_bp_state urcu_bp_reader_state(unsigned long *ctr)
+static inline enum urcu_bp_state urcu_bp_reader_state(unsigned long *ctr,
+                                               cmm_annotate_t *group)
 {
        unsigned long v;
 
@@ -127,7 +115,9 @@ static inline enum urcu_bp_state urcu_bp_reader_state(unsigned long *ctr)
         * Make sure both tests below are done on the same version of *value
         * to insure consistency.
         */
-       v = CMM_LOAD_SHARED(*ctr);
+       v = uatomic_load(ctr, CMM_RELAXED);
+       cmm_annotate_group_mem_acquire(group, ctr);
+
        if (!(v & URCU_BP_GP_CTR_NEST_MASK))
                return URCU_BP_READER_INACTIVE;
        if (!((v ^ urcu_bp_gp.ctr) & URCU_BP_GP_CTR_PHASE))
@@ -137,9 +127,9 @@ static inline enum urcu_bp_state urcu_bp_reader_state(unsigned long *ctr)
 
 /*
  * Helper for _urcu_bp_read_lock().  The format of urcu_bp_gp.ctr (as well as
- * the per-thread rcu_reader.ctr) has the upper bits containing a count of
- * _urcu_bp_read_lock() nesting, and a lower-order bit that contains either zero
- * or URCU_BP_GP_CTR_PHASE.  The smp_mb_slave() ensures that the accesses in
+ * the per-thread rcu_reader.ctr) has the lower-order bits containing a count of
+ * _urcu_bp_read_lock() nesting, and a single high-order URCU_BP_GP_CTR_PHASE bit
+ * that contains either zero or one.  The smp_mb_slave() ensures that the accesses in
  * _urcu_bp_read_lock() happen before the subsequent read-side critical section.
  */
 static inline void _urcu_bp_read_lock_update(unsigned long tmp)
@@ -181,12 +171,14 @@ static inline void _urcu_bp_read_lock(void)
 static inline void _urcu_bp_read_unlock(void)
 {
        unsigned long tmp;
+       unsigned long *ctr = &URCU_TLS(urcu_bp_reader)->ctr;
 
        tmp = URCU_TLS(urcu_bp_reader)->ctr;
        urcu_assert_debug(tmp & URCU_BP_GP_CTR_NEST_MASK);
        /* Finish using rcu before decrementing the pointer. */
        urcu_bp_smp_mb_slave();
-       _CMM_STORE_SHARED(URCU_TLS(urcu_bp_reader)->ctr, tmp - URCU_BP_GP_COUNT);
+       cmm_annotate_mem_release(ctr);
+       uatomic_store(ctr, tmp - URCU_BP_GP_COUNT, CMM_RELAXED);
        cmm_barrier();  /* Ensure the compiler does not reorder us with mutex */
 }
 
index 60ea8b858b0feed7c3015c0a8fc12878e795e93f..d0fd06a3e221705ca14bbf820805658c65e1dda5 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_COMMON_STATIC_H
 #define _URCU_COMMON_STATIC_H
 
 /*
- * urcu-common-static.h
- *
  * Userspace RCU header.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -34,6 +20,7 @@
 #include <unistd.h>
 #include <stdint.h>
 
+#include <urcu/annotate.h>
 #include <urcu/config.h>
 #include <urcu/compiler.h>
 #include <urcu/arch.h>
@@ -105,7 +92,8 @@ static inline void urcu_common_wake_up_gp(struct urcu_gp *gp)
 }
 
 static inline enum urcu_state urcu_common_reader_state(struct urcu_gp *gp,
-               unsigned long *ctr)
+                                               unsigned long *ctr,
+                                               cmm_annotate_t *group)
 {
        unsigned long v;
 
@@ -113,7 +101,9 @@ static inline enum urcu_state urcu_common_reader_state(struct urcu_gp *gp,
         * Make sure both tests below are done on the same version of *value
         * to insure consistency.
         */
-       v = CMM_LOAD_SHARED(*ctr);
+       v = uatomic_load(ctr, CMM_RELAXED);
+       cmm_annotate_group_mem_acquire(group, ctr);
+
        if (!(v & URCU_GP_CTR_NEST_MASK))
                return URCU_READER_INACTIVE;
        if (!((v ^ gp->ctr) & URCU_GP_CTR_PHASE))
index b97e42a6b5afc623a99149047a1f81e2301fa364..8ddbd0026cbcc129dd374fdf48a974a2bb4db665 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_MB_STATIC_H
 #define _URCU_MB_STATIC_H
 
 /*
- * urcu-mb-static.h
- *
  * Userspace RCU header.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -63,9 +49,9 @@ extern DECLARE_URCU_TLS(struct urcu_reader, urcu_mb_reader);
 
 /*
  * Helper for _urcu_mb_read_lock().  The format of urcu_mb_gp.ctr (as well as
- * the per-thread rcu_reader.ctr) has the upper bits containing a count of
- * _urcu_mb_read_lock() nesting, and a lower-order bit that contains either zero
- * or URCU_GP_CTR_PHASE.  The cmm_smp_mb() ensures that the accesses in
+ * the per-thread rcu_reader.ctr) has the lower-order bits containing a count of
+ * _urcu_mb_read_lock() nesting, and a single high-order URCU_BP_GP_CTR_PHASE bit
+ * that contains either zero or one.  The cmm_smp_mb() ensures that the accesses in
  * _urcu_mb_read_lock() happen before the subsequent read-side critical section.
  */
 static inline void _urcu_mb_read_lock_update(unsigned long tmp)
@@ -108,13 +94,14 @@ static inline void _urcu_mb_read_lock(void)
  */
 static inline void _urcu_mb_read_unlock_update_and_wakeup(unsigned long tmp)
 {
+       unsigned long *ctr = &URCU_TLS(urcu_mb_reader).ctr;
+
        if (caa_likely((tmp & URCU_GP_CTR_NEST_MASK) == URCU_GP_COUNT)) {
-               cmm_smp_mb();
-               _CMM_STORE_SHARED(URCU_TLS(urcu_mb_reader).ctr, tmp - URCU_GP_COUNT);
-               cmm_smp_mb();
+               uatomic_store(ctr, tmp - URCU_GP_COUNT, CMM_SEQ_CST);
                urcu_common_wake_up_gp(&urcu_mb_gp);
-       } else
-               _CMM_STORE_SHARED(URCU_TLS(urcu_mb_reader).ctr, tmp - URCU_GP_COUNT);
+       } else {
+               uatomic_store(ctr, tmp - URCU_GP_COUNT, CMM_RELAXED);
+       }
 }
 
 /*
index c8d102f1c2653e5390890d1decc124c86d53230b..b9178c879e1ac282a00cf9958a91d3f489d22bbe 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_MEMB_STATIC_H
 #define _URCU_MEMB_STATIC_H
 
 /*
- * urcu-memb-static.h
- *
  * Userspace RCU header.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -34,6 +20,7 @@
 #include <unistd.h>
 #include <stdint.h>
 
+#include <urcu/annotate.h>
 #include <urcu/debug.h>
 #include <urcu/config.h>
 #include <urcu/compiler.h>
@@ -86,18 +73,27 @@ extern DECLARE_URCU_TLS(struct urcu_reader, urcu_memb_reader);
 
 /*
  * Helper for _rcu_read_lock().  The format of urcu_memb_gp.ctr (as well as
- * the per-thread rcu_reader.ctr) has the upper bits containing a count of
- * _rcu_read_lock() nesting, and a lower-order bit that contains either zero
- * or URCU_GP_CTR_PHASE.  The smp_mb_slave() ensures that the accesses in
+ * the per-thread rcu_reader.ctr) has the lower-order bits containing a count of
+ * _rcu_read_lock() nesting, and a single high-order URCU_BP_GP_CTR_PHASE bit
+ * that contains either zero or one.  The smp_mb_slave() ensures that the accesses in
  * _rcu_read_lock() happen before the subsequent read-side critical section.
  */
 static inline void _urcu_memb_read_lock_update(unsigned long tmp)
 {
+       unsigned long *ctr = &URCU_TLS(urcu_memb_reader).ctr;
+
        if (caa_likely(!(tmp & URCU_GP_CTR_NEST_MASK))) {
-               _CMM_STORE_SHARED(URCU_TLS(urcu_memb_reader).ctr, _CMM_LOAD_SHARED(urcu_memb_gp.ctr));
+               unsigned long *pgctr = &urcu_memb_gp.ctr;
+               unsigned long gctr = uatomic_load(pgctr, CMM_RELAXED);
+
+               /* Paired with following mb slave. */
+               cmm_annotate_mem_acquire(pgctr);
+               uatomic_store(ctr, gctr, CMM_RELAXED);
+
                urcu_memb_smp_mb_slave();
-       } else
-               _CMM_STORE_SHARED(URCU_TLS(urcu_memb_reader).ctr, tmp + URCU_GP_COUNT);
+       } else {
+               uatomic_store(ctr, tmp + URCU_GP_COUNT, CMM_RELAXED);
+       }
 }
 
 /*
@@ -131,13 +127,17 @@ static inline void _urcu_memb_read_lock(void)
  */
 static inline void _urcu_memb_read_unlock_update_and_wakeup(unsigned long tmp)
 {
+       unsigned long *ctr = &URCU_TLS(urcu_memb_reader).ctr;
+
        if (caa_likely((tmp & URCU_GP_CTR_NEST_MASK) == URCU_GP_COUNT)) {
                urcu_memb_smp_mb_slave();
-               _CMM_STORE_SHARED(URCU_TLS(urcu_memb_reader).ctr, tmp - URCU_GP_COUNT);
+               cmm_annotate_mem_release(ctr);
+               uatomic_store(ctr, tmp - URCU_GP_COUNT, CMM_RELAXED);
                urcu_memb_smp_mb_slave();
                urcu_common_wake_up_gp(&urcu_memb_gp);
-       } else
-               _CMM_STORE_SHARED(URCU_TLS(urcu_memb_reader).ctr, tmp - URCU_GP_COUNT);
+       } else {
+               uatomic_store(ctr, tmp - URCU_GP_COUNT, CMM_RELAXED);
+       }
 }
 
 /*
index b8788771c33103f44981cac1ad381fe525dcf3ce..de798831bb5c1ac7aaa950351171b17c750053bb 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_QSBR_STATIC_H
 #define _URCU_QSBR_STATIC_H
 
 /*
- * urcu-qsbr-static.h
- *
  * Userspace RCU QSBR header.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -35,6 +21,7 @@
 #include <unistd.h>
 #include <stdint.h>
 
+#include <urcu/annotate.h>
 #include <urcu/debug.h>
 #include <urcu/compiler.h>
 #include <urcu/arch.h>
@@ -96,11 +83,14 @@ static inline void urcu_qsbr_wake_up_gp(void)
        }
 }
 
-static inline enum urcu_state urcu_qsbr_reader_state(unsigned long *ctr)
+static inline enum urcu_state urcu_qsbr_reader_state(unsigned long *ctr,
+                                               cmm_annotate_t *group)
 {
        unsigned long v;
 
-       v = CMM_LOAD_SHARED(*ctr);
+       v = uatomic_load(ctr, CMM_RELAXED);
+       cmm_annotate_group_mem_acquire(group, ctr);
+
        if (!v)
                return URCU_READER_INACTIVE;
        if (v == urcu_qsbr_gp.ctr)
@@ -155,9 +145,9 @@ static inline int _urcu_qsbr_read_ongoing(void)
  */
 static inline void _urcu_qsbr_quiescent_state_update_and_wakeup(unsigned long gp_ctr)
 {
-       cmm_smp_mb();
-       _CMM_STORE_SHARED(URCU_TLS(urcu_qsbr_reader).ctr, gp_ctr);
-       cmm_smp_mb();   /* write URCU_TLS(urcu_qsbr_reader).ctr before read futex */
+       uatomic_store(&URCU_TLS(urcu_qsbr_reader).ctr, gp_ctr, CMM_SEQ_CST);
+
+       /* write URCU_TLS(urcu_qsbr_reader).ctr before read futex */
        urcu_qsbr_wake_up_gp();
        cmm_smp_mb();
 }
@@ -179,7 +169,8 @@ static inline void _urcu_qsbr_quiescent_state(void)
        unsigned long gp_ctr;
 
        urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).registered);
-       if ((gp_ctr = CMM_LOAD_SHARED(urcu_qsbr_gp.ctr)) == URCU_TLS(urcu_qsbr_reader).ctr)
+       gp_ctr = uatomic_load(&urcu_qsbr_gp.ctr, CMM_RELAXED);
+       if (gp_ctr == URCU_TLS(urcu_qsbr_reader).ctr)
                return;
        _urcu_qsbr_quiescent_state_update_and_wakeup(gp_ctr);
 }
@@ -195,9 +186,8 @@ static inline void _urcu_qsbr_quiescent_state(void)
 static inline void _urcu_qsbr_thread_offline(void)
 {
        urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).registered);
-       cmm_smp_mb();
-       CMM_STORE_SHARED(URCU_TLS(urcu_qsbr_reader).ctr, 0);
-       cmm_smp_mb();   /* write URCU_TLS(urcu_qsbr_reader).ctr before read futex */
+       uatomic_store(&URCU_TLS(urcu_qsbr_reader).ctr, 0, CMM_SEQ_CST);
+       /* write URCU_TLS(urcu_qsbr_reader).ctr before read futex */
        urcu_qsbr_wake_up_gp();
        cmm_barrier();  /* Ensure the compiler does not reorder us with mutex */
 }
@@ -212,9 +202,14 @@ static inline void _urcu_qsbr_thread_offline(void)
  */
 static inline void _urcu_qsbr_thread_online(void)
 {
+       unsigned long *pctr = &URCU_TLS(urcu_qsbr_reader).ctr;
+       unsigned long ctr;
+
        urcu_assert_debug(URCU_TLS(urcu_qsbr_reader).registered);
        cmm_barrier();  /* Ensure the compiler does not reorder us with mutex */
-       _CMM_STORE_SHARED(URCU_TLS(urcu_qsbr_reader).ctr, CMM_LOAD_SHARED(urcu_qsbr_gp.ctr));
+       ctr = uatomic_load(&urcu_qsbr_gp.ctr, CMM_RELAXED);
+       cmm_annotate_mem_acquire(&urcu_qsbr_gp.ctr);
+       uatomic_store(pctr, ctr, CMM_RELAXED);
        cmm_smp_mb();
 }
 
diff --git a/include/urcu/static/urcu-signal-nr.h b/include/urcu/static/urcu-signal-nr.h
deleted file mode 100644 (file)
index a488f3a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _STATIC_URCU_SIGNAL_NR_H
-#define _STATIC_URCU_SIGNAL_NR_H
-
-/*
- * static/urcu-signal-nr.h
- *
- * Userspace RCU header.
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * IBM's contributions to this file may be relicensed under LGPLv2 or later.
- */
-
-/*
- * The signal number used by the RCU library can be overridden with
- * -DSIGRCU= when compiling the library.
- * Provide backward compatibility for liburcu 0.3.x SIGURCU.
- */
-#ifdef SIGURCU
-#define SIGRCU SIGURCU
-#endif
-
-#ifndef SIGRCU
-#define SIGRCU SIGUSR1
-#endif
-
-#endif /* _STATIC_URCU_SIGNAL_NR_H */
diff --git a/include/urcu/static/urcu-signal.h b/include/urcu/static/urcu-signal.h
deleted file mode 100644 (file)
index c7577d3..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef _URCU_SIGNAL_STATIC_H
-#define _URCU_SIGNAL_STATIC_H
-
-/*
- * urcu-signal-static.h
- *
- * Userspace RCU header.
- *
- * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
- * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * IBM's contributions to this file may be relicensed under LGPLv2 or later.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <stdint.h>
-
-#include <urcu/debug.h>
-#include <urcu/config.h>
-#include <urcu/compiler.h>
-#include <urcu/arch.h>
-#include <urcu/system.h>
-#include <urcu/uatomic.h>
-#include <urcu/list.h>
-#include <urcu/futex.h>
-#include <urcu/tls-compat.h>
-#include <urcu/static/urcu-common.h>
-#include <urcu/static/urcu-signal-nr.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This code section can only be included in LGPL 2.1 compatible source code.
- * See below for the function call wrappers which can be used in code meant to
- * be only linked with the Userspace RCU library. This comes with a small
- * performance degradation on the read-side due to the added function calls.
- * This is required to permit relinking with newer versions of the library.
- */
-
-extern struct urcu_gp urcu_signal_gp;
-
-extern DECLARE_URCU_TLS(struct urcu_reader, urcu_signal_reader);
-
-/*
- * Helper for _rcu_read_lock().  The format of urcu_signal_gp.ctr (as well as
- * the per-thread rcu_reader.ctr) has the upper bits containing a count of
- * _rcu_read_lock() nesting, and a lower-order bit that contains either zero
- * or URCU_GP_CTR_PHASE.  The cmm_barrier() ensures that the accesses in
- * _rcu_read_lock() happen before the subsequent read-side critical section.
- */
-static inline void _urcu_signal_read_lock_update(unsigned long tmp)
-{
-       if (caa_likely(!(tmp & URCU_GP_CTR_NEST_MASK))) {
-               _CMM_STORE_SHARED(URCU_TLS(urcu_signal_reader).ctr, _CMM_LOAD_SHARED(urcu_signal_gp.ctr));
-               cmm_barrier();
-       } else
-               _CMM_STORE_SHARED(URCU_TLS(urcu_signal_reader).ctr, tmp + URCU_GP_COUNT);
-}
-
-/*
- * Enter an RCU read-side critical section.
- *
- * The first cmm_barrier() call ensures that the compiler does not reorder
- * the body of _rcu_read_lock() with a mutex.
- *
- * This function and its helper are both less than 10 lines long.  The
- * intent is that this function meets the 10-line criterion in LGPL,
- * allowing this function to be invoked directly from non-LGPL code.
- */
-static inline void _urcu_signal_read_lock(void)
-{
-       unsigned long tmp;
-
-       urcu_assert_debug(URCU_TLS(urcu_signal_reader).registered);
-       cmm_barrier();
-       tmp = URCU_TLS(urcu_signal_reader).ctr;
-       urcu_assert_debug((tmp & URCU_GP_CTR_NEST_MASK) != URCU_GP_CTR_NEST_MASK);
-       _urcu_signal_read_lock_update(tmp);
-}
-
-/*
- * This is a helper function for _rcu_read_unlock().
- *
- * The first cmm_barrier() call ensures that the critical section is
- * seen to precede the store to rcu_reader.ctr.
- * The second cmm_barrier() call ensures that we write to rcu_reader.ctr
- * before reading the update-side futex.
- */
-static inline void _urcu_signal_read_unlock_update_and_wakeup(unsigned long tmp)
-{
-       if (caa_likely((tmp & URCU_GP_CTR_NEST_MASK) == URCU_GP_COUNT)) {
-               cmm_barrier();
-               _CMM_STORE_SHARED(URCU_TLS(urcu_signal_reader).ctr, tmp - URCU_GP_COUNT);
-               cmm_barrier();
-               urcu_common_wake_up_gp(&urcu_signal_gp);
-       } else
-               _CMM_STORE_SHARED(URCU_TLS(urcu_signal_reader).ctr, tmp - URCU_GP_COUNT);
-}
-
-/*
- * Exit an RCU read-side critical section.  Both this function and its
- * helper are smaller than 10 lines of code, and are intended to be
- * usable by non-LGPL code, as called out in LGPL.
- */
-static inline void _urcu_signal_read_unlock(void)
-{
-       unsigned long tmp;
-
-       urcu_assert_debug(URCU_TLS(urcu_signal_reader).registered);
-       tmp = URCU_TLS(urcu_signal_reader).ctr;
-       urcu_assert_debug(tmp & URCU_GP_CTR_NEST_MASK);
-       _urcu_signal_read_unlock_update_and_wakeup(tmp);
-       cmm_barrier();  /* Ensure the compiler does not reorder us with mutex */
-}
-
-/*
- * Returns whether within a RCU read-side critical section.
- *
- * This function is less than 10 lines long.  The intent is that this
- * function meets the 10-line criterion for LGPL, allowing this function
- * to be invoked directly from non-LGPL code.
- */
-static inline int _urcu_signal_read_ongoing(void)
-{
-       return URCU_TLS(urcu_signal_reader).ctr & URCU_GP_CTR_NEST_MASK;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _URCU_SIGNAL_STATIC_H */
index b83e72ba6760fa1714a9f5b94da5157667bba502..c164ae31bca00947e2259594a46d48f48ae1d341 100644 (file)
@@ -1,36 +1,22 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_STATIC_H
 #define _URCU_STATIC_H
 
 /*
- * urcu-static.h
- *
  * Userspace RCU header.
  *
  * TO BE INCLUDED ONLY IN CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
  * RELEASE. See urcu.h for linking dynamically with the userspace rcu library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 /* Default is RCU_MEMBARRIER */
-#if !defined(RCU_MEMBARRIER) && !defined(RCU_MB) && !defined(RCU_SIGNAL)
+#if !defined(RCU_MEMBARRIER) && !defined(RCU_MB)
 #define RCU_MEMBARRIER
 #endif
 
@@ -42,8 +28,4 @@
 #include <urcu/static/urcu-mb.h>
 #endif
 
-#ifdef RCU_SIGNAL
-#include <urcu/static/urcu-signal.h>
-#endif
-
 #endif /* _URCU_STATIC_H */
index 478e8598a6b2898694d9d1d4856691390ffbce66..26741ae81d241ed04f1917b68e7755847c90490b 100644 (file)
@@ -1,30 +1,16 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011-2012 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WFCQUEUE_STATIC_H
 #define _URCU_WFCQUEUE_STATIC_H
 
 /*
- * urcu/static/wfcqueue.h
- *
  * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
  *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu/wfcqueue.h for
  * linking dynamically with the userspace rcu library.
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <pthread.h>
@@ -91,6 +77,11 @@ static inline void _cds_wfcq_node_init(struct cds_wfcq_node *node)
        node->next = NULL;
 }
 
+static inline void _cds_wfcq_node_init_atomic(struct cds_wfcq_node *node)
+{
+       uatomic_store(&node->next, NULL, CMM_RELAXED);
+}
+
 /*
  * cds_wfcq_init: initialize wait-free queue (with lock). Pair with
  * cds_wfcq_destroy().
@@ -153,8 +144,8 @@ static inline bool _cds_wfcq_empty(cds_wfcq_head_ptr_t u_head,
         * common case to ensure that dequeuers do not frequently access
         * enqueuer's tail->p cache line.
         */
-       return CMM_LOAD_SHARED(head->node.next) == NULL
-               && CMM_LOAD_SHARED(tail->p) == &head->node;
+       return uatomic_load(&head->node.next, CMM_CONSUME) == NULL
+               && uatomic_load(&tail->p, CMM_CONSUME) == &head->node;
 }
 
 static inline void _cds_wfcq_dequeue_lock(struct cds_wfcq_head *head,
@@ -188,7 +179,7 @@ static inline bool ___cds_wfcq_append(cds_wfcq_head_ptr_t u_head,
         * stores to data structure containing node and setting
         * node->next to NULL before publication.
         */
-       old_tail = uatomic_xchg(&tail->p, new_tail);
+       old_tail = uatomic_xchg_mo(&tail->p, new_tail, CMM_SEQ_CST);
 
        /*
         * Implicit memory barrier after uatomic_xchg() orders store to
@@ -199,7 +190,8 @@ static inline bool ___cds_wfcq_append(cds_wfcq_head_ptr_t u_head,
         * store will append "node" to the queue from a dequeuer
         * perspective.
         */
-       CMM_STORE_SHARED(old_tail->next, new_head);
+       uatomic_store(&old_tail->next, new_head, CMM_RELEASE);
+
        /*
         * Return false if queue was empty prior to adding the node,
         * else return true.
@@ -210,8 +202,8 @@ static inline bool ___cds_wfcq_append(cds_wfcq_head_ptr_t u_head,
 /*
  * cds_wfcq_enqueue: enqueue a node into a wait-free queue.
  *
- * Issues a full memory barrier before enqueue. No mutual exclusion is
- * required.
+ * Operations prior to enqueue are consistant with respect to dequeuing or
+ * splicing and iterating.
  *
  * Returns false if the queue was empty prior to adding the node.
  * Returns true otherwise.
@@ -220,6 +212,8 @@ static inline bool _cds_wfcq_enqueue(cds_wfcq_head_ptr_t head,
                struct cds_wfcq_tail *tail,
                struct cds_wfcq_node *new_tail)
 {
+       cmm_emit_legacy_smp_mb();
+
        return ___cds_wfcq_append(head, tail, new_tail, new_tail);
 }
 
@@ -270,8 +264,10 @@ ___cds_wfcq_node_sync_next(struct cds_wfcq_node *node, int blocking)
 
        /*
         * Adaptative busy-looping waiting for enqueuer to complete enqueue.
+        *
+        * Load node.next before loading node's content
         */
-       while ((next = CMM_LOAD_SHARED(node->next)) == NULL) {
+       while ((next = uatomic_load(&node->next, CMM_CONSUME)) == NULL) {
                if (___cds_wfcq_busy_wait(&attempt, blocking))
                        return CDS_WFCQ_WOULDBLOCK;
        }
@@ -290,8 +286,7 @@ ___cds_wfcq_first(cds_wfcq_head_ptr_t u_head,
        if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail))
                return NULL;
        node = ___cds_wfcq_node_sync_next(&head->node, blocking);
-       /* Load head->node.next before loading node's content */
-       cmm_smp_read_barrier_depends();
+
        return node;
 }
 
@@ -343,16 +338,15 @@ ___cds_wfcq_next(cds_wfcq_head_ptr_t head __attribute__((unused)),
         * out if we reached the end of the queue, we first check
         * node->next as a common case to ensure that iteration on nodes
         * do not frequently access enqueuer's tail->p cache line.
+        *
+        * Load node->next before loading next's content
         */
-       if ((next = CMM_LOAD_SHARED(node->next)) == NULL) {
-               /* Load node->next before tail->p */
-               cmm_smp_rmb();
-               if (CMM_LOAD_SHARED(tail->p) == node)
+       if ((next = uatomic_load(&node->next, CMM_CONSUME)) == NULL) {
+               if (uatomic_load(&tail->p, CMM_RELAXED) == node)
                        return NULL;
                next = ___cds_wfcq_node_sync_next(node, blocking);
        }
-       /* Load node->next before loading next's content */
-       cmm_smp_read_barrier_depends();
+
        return next;
 }
 
@@ -414,7 +408,7 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
                return CDS_WFCQ_WOULDBLOCK;
        }
 
-       if ((next = CMM_LOAD_SHARED(node->next)) == NULL) {
+       if ((next = uatomic_load(&node->next, CMM_CONSUME)) == NULL) {
                /*
                 * @node is probably the only node in the queue.
                 * Try to move the tail to &q->head.
@@ -422,17 +416,13 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
                 * NULL if the cmpxchg succeeds. Should the
                 * cmpxchg fail due to a concurrent enqueue, the
                 * q->head.next will be set to the next node.
-                * The implicit memory barrier before
-                * uatomic_cmpxchg() orders load node->next
-                * before loading q->tail.
-                * The implicit memory barrier before uatomic_cmpxchg
-                * orders load q->head.next before loading node's
-                * content.
                 */
-               _cds_wfcq_node_init(&head->node);
-               if (uatomic_cmpxchg(&tail->p, node, &head->node) == node) {
+               _cds_wfcq_node_init_atomic(&head->node);
+               if (uatomic_cmpxchg_mo(&tail->p, node, &head->node,
+                                       CMM_SEQ_CST, CMM_SEQ_CST) == node) {
                        if (state)
                                *state |= CDS_WFCQ_STATE_LAST;
+                       cmm_emit_legacy_smp_mb();
                        return node;
                }
                next = ___cds_wfcq_node_sync_next(node, blocking);
@@ -442,7 +432,7 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
                 * (currently NULL) back to its original value.
                 */
                if (!blocking && next == CDS_WFCQ_WOULDBLOCK) {
-                       head->node.next = node;
+                       uatomic_store(&head->node.next, node, CMM_RELAXED);
                        return CDS_WFCQ_WOULDBLOCK;
                }
        }
@@ -450,10 +440,9 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
        /*
         * Move queue head forward.
         */
-       head->node.next = next;
+       uatomic_store(&head->node.next, next, CMM_RELAXED);
+       cmm_emit_legacy_smp_mb();
 
-       /* Load q->head.next before loading node's content */
-       cmm_smp_read_barrier_depends();
        return node;
 }
 
@@ -515,6 +504,8 @@ ___cds_wfcq_dequeue_nonblocking(cds_wfcq_head_ptr_t head,
 /*
  * __cds_wfcq_splice: enqueue all src_q nodes at the end of dest_q.
  *
+ * Operations after splice are consistant with respect to enqueue.
+ *
  * Dequeue all nodes from src_q.
  * dest_q must be already initialized.
  * Mutual exclusion for src_q should be ensured by the caller as
@@ -548,10 +539,10 @@ ___cds_wfcq_splice(
                 * uatomic_xchg, as well as tail pointer vs head node
                 * address.
                 */
-               head = uatomic_xchg(&src_q_head->node.next, NULL);
+               head = uatomic_xchg_mo(&src_q_head->node.next, NULL, CMM_SEQ_CST);
                if (head)
                        break;  /* non-empty */
-               if (CMM_LOAD_SHARED(src_q_tail->p) == &src_q_head->node)
+               if (uatomic_load(&src_q_tail->p, CMM_CONSUME) == &src_q_head->node)
                        return CDS_WFCQ_RET_SRC_EMPTY;
                if (___cds_wfcq_busy_wait(&attempt, blocking))
                        return CDS_WFCQ_RET_WOULDBLOCK;
@@ -563,7 +554,8 @@ ___cds_wfcq_splice(
         * concurrent enqueue on src_q, which exchanges the tail before
         * updating the previous tail's next pointer.
         */
-       tail = uatomic_xchg(&src_q_tail->p, &src_q_head->node);
+       cmm_emit_legacy_smp_mb();
+       tail = uatomic_xchg_mo(&src_q_tail->p, &src_q_head->node, CMM_SEQ_CST);
 
        /*
         * Append the spliced content of src_q into dest_q. Does not
index d04f66f35c895d4184e5056d7172ce8d865f69e3..0cb7b1b98cd965557121af56910687c94c2ecdd8 100644 (file)
@@ -1,29 +1,15 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WFQUEUE_STATIC_H
 #define _URCU_WFQUEUE_STATIC_H
 
 /*
- * wfqueue-static.h
- *
  * Userspace RCU library - Queue with Wait-Free Enqueue/Blocking Dequeue
  *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See wfqueue.h for linking
  * dynamically with the userspace rcu library.
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <pthread.h>
@@ -81,13 +67,14 @@ static inline void _cds_wfq_enqueue(struct cds_wfq_queue *q,
         * structure containing node and setting node->next to NULL before
         * publication.
         */
-       old_tail = uatomic_xchg(&q->tail, &node->next);
+       cmm_emit_legacy_smp_mb();
+       old_tail = uatomic_xchg_mo(&q->tail, &node->next, CMM_SEQ_CST);
        /*
         * At this point, dequeuers see a NULL old_tail->next, which indicates
         * that the queue is being appended to. The following store will append
         * "node" to the queue from a dequeuer perspective.
         */
-       CMM_STORE_SHARED(*old_tail, node);
+       uatomic_store(old_tail, node, CMM_RELEASE);
 }
 
 /*
@@ -102,7 +89,7 @@ ___cds_wfq_node_sync_next(struct cds_wfq_node *node)
        /*
         * Adaptative busy-looping waiting for enqueuer to complete enqueue.
         */
-       while ((next = CMM_LOAD_SHARED(node->next)) == NULL) {
+       while ((next = uatomic_load(&node->next, CMM_CONSUME)) == NULL) {
                if (++attempt >= WFQ_ADAPT_ATTEMPTS) {
                        (void) poll(NULL, 0, WFQ_WAIT); /* Wait for 10ms */
                        attempt = 0;
@@ -129,7 +116,7 @@ ___cds_wfq_dequeue_blocking(struct cds_wfq_queue *q)
        /*
         * Queue is empty if it only contains the dummy node.
         */
-       if (q->head == &q->dummy && CMM_LOAD_SHARED(q->tail) == &q->dummy.next)
+       if (q->head == &q->dummy && uatomic_load(&q->tail, CMM_CONSUME) == &q->dummy.next)
                return NULL;
        node = q->head;
 
index 088e6e3acbbe4631a6c7c16136a687c3d21811db..c46e97d9f25197e0e701a55ef24b0975bd1b2aac 100644 (file)
@@ -1,29 +1,15 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_STATIC_WFSTACK_H
 #define _URCU_STATIC_WFSTACK_H
 
 /*
- * urcu/static/wfstack.h
- *
  * Userspace RCU library - Stack with with wait-free push, blocking traversal.
  *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu/wfstack.h for
  * linking dynamically with the userspace rcu library.
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <pthread.h>
@@ -124,7 +110,7 @@ static inline bool _cds_wfs_empty(cds_wfs_stack_ptr_t u_stack)
 {
        struct __cds_wfs_stack *s = u_stack._s;
 
-       return ___cds_wfs_end(CMM_LOAD_SHARED(s->head));
+       return ___cds_wfs_end(uatomic_load(&s->head, CMM_RELAXED));
 }
 
 /*
@@ -133,6 +119,8 @@ static inline bool _cds_wfs_empty(cds_wfs_stack_ptr_t u_stack)
  * Issues a full memory barrier before push. No mutual exclusion is
  * required.
  *
+ * Operations before push are consistent when observed after associated pop.
+ *
  * Returns 0 if the stack was empty prior to adding the node.
  * Returns non-zero otherwise.
  */
@@ -148,12 +136,13 @@ int _cds_wfs_push(cds_wfs_stack_ptr_t u_stack, struct cds_wfs_node *node)
         * uatomic_xchg() implicit memory barrier orders earlier stores
         * to node (setting it to NULL) before publication.
         */
-       old_head = uatomic_xchg(&s->head, new_head);
+       cmm_emit_legacy_smp_mb();
+       old_head = uatomic_xchg_mo(&s->head, new_head, CMM_SEQ_CST);
        /*
         * At this point, dequeuers see a NULL node->next, they should
         * busy-wait until node->next is set to old_head.
         */
-       CMM_STORE_SHARED(node->next, &old_head->node);
+       uatomic_store(&node->next, &old_head->node, CMM_RELEASE);
        return !___cds_wfs_end(old_head);
 }
 
@@ -169,7 +158,7 @@ ___cds_wfs_node_sync_next(struct cds_wfs_node *node, int blocking)
        /*
         * Adaptative busy-looping waiting for push to complete.
         */
-       while ((next = CMM_LOAD_SHARED(node->next)) == NULL) {
+       while ((next = uatomic_load(&node->next, CMM_CONSUME)) == NULL) {
                if (!blocking)
                        return CDS_WFS_WOULDBLOCK;
                if (++attempt >= CDS_WFS_ADAPT_ATTEMPTS) {
@@ -194,7 +183,7 @@ ___cds_wfs_pop(cds_wfs_stack_ptr_t u_stack, int *state, int blocking)
        if (state)
                *state = 0;
        for (;;) {
-               head = CMM_LOAD_SHARED(s->head);
+               head = uatomic_load(&s->head, CMM_CONSUME);
                if (___cds_wfs_end(head)) {
                        return NULL;
                }
@@ -203,9 +192,11 @@ ___cds_wfs_pop(cds_wfs_stack_ptr_t u_stack, int *state, int blocking)
                        return CDS_WFS_WOULDBLOCK;
                }
                new_head = caa_container_of(next, struct cds_wfs_head, node);
-               if (uatomic_cmpxchg(&s->head, head, new_head) == head) {
+               if (uatomic_cmpxchg_mo(&s->head, head, new_head,
+                                       CMM_SEQ_CST, CMM_SEQ_CST) == head) {
                        if (state && ___cds_wfs_end(new_head))
                                *state |= CDS_WFS_STATE_LAST;
+                       cmm_emit_legacy_smp_mb();
                        return &head->node;
                }
                if (!blocking) {
@@ -220,6 +211,8 @@ ___cds_wfs_pop(cds_wfs_stack_ptr_t u_stack, int *state, int blocking)
  *
  * Returns NULL if stack is empty.
  *
+ * Operations after pop push are consistent when observed before associated push.
+ *
  * __cds_wfs_pop_blocking needs to be synchronized using one of the
  * following techniques:
  *
@@ -278,6 +271,8 @@ ___cds_wfs_pop_nonblocking(cds_wfs_stack_ptr_t u_stack)
 /*
  * __cds_wfs_pop_all: pop all nodes from a stack.
  *
+ * Operations after pop push are consistent when observed before associated push.
+ *
  * __cds_wfs_pop_all does not require any synchronization with other
  * push, nor with other __cds_wfs_pop_all, but requires synchronization
  * matching the technique used to synchronize __cds_wfs_pop_blocking:
@@ -309,7 +304,8 @@ ___cds_wfs_pop_all(cds_wfs_stack_ptr_t u_stack)
         * taking care to order writes to each node prior to the full
         * memory barrier after this uatomic_xchg().
         */
-       head = uatomic_xchg(&s->head, CDS_WFS_END);
+       head = uatomic_xchg_mo(&s->head, CDS_WFS_END, CMM_SEQ_CST);
+       cmm_emit_legacy_smp_mb();
        if (___cds_wfs_end(head))
                return NULL;
        return head;
index 23b266ef561875a59e4bba9e2dfc83c7a44a3928..d49b9886b8d004e01db531f7ec860ab28093ab67 100644 (file)
@@ -1,30 +1,12 @@
+// SPDX-FileCopyrightText: 2013 Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_SYSCALL_COMPAT_H
 #define _URCU_SYSCALL_COMPAT_H
 
 /*
- * urcu/syscall-compat.h
- *
  * Userspace RCU library - Syscall Compatibility Header
- *
- * Copyright 2013 - Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
- *
- * Note: this file is only used to simplify the code required to
- * include the 'syscall.h' system header across multiple platforms,
- * which might not always be located at the same place (or needed at all).
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #if defined(__ANDROID__) || defined(__sun__) || defined(__GNU__)
@@ -33,7 +15,8 @@
 #include <syscall.h>
 
 #elif defined(__CYGWIN__) || defined(__APPLE__) || \
-       defined(__FreeBSD__) || defined(__DragonFly__)
+       defined(__FreeBSD__) || defined(__DragonFly__) || \
+       defined(__OpenBSD__)
 /* Don't include anything on these platforms. */
 
 #else
index faae39055484875b237dd62dd0928e9903725da1..139c37f6d474a646141bb0650b6f8c936061a9a2 100644 (file)
@@ -1,27 +1,37 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_SYSTEM_H
 #define _URCU_SYSTEM_H
 
 /*
- * system.h
- *
  * System definitions.
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
  */
 
+#include <urcu/config.h>
 #include <urcu/compiler.h>
 #include <urcu/arch.h>
 
+#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
+
+#define CMM_LOAD_SHARED(x)                                             \
+       __atomic_load_n(cmm_cast_volatile(&(x)), __ATOMIC_RELAXED)
+
+#define _CMM_LOAD_SHARED(x) CMM_LOAD_SHARED(x)
+
+#define CMM_STORE_SHARED(x, v)                                 \
+       __extension__                                           \
+       ({                                                      \
+               __typeof__(v) _v = (v);                         \
+               __atomic_store_n(cmm_cast_volatile(&(x)), _v,   \
+                                __ATOMIC_RELAXED);             \
+               _v;                                             \
+       })
+
+#define _CMM_STORE_SHARED(x, v) CMM_STORE_SHARED(x, v)
+
+#else
 /*
  * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come
  * before the load.
@@ -56,4 +66,6 @@
                _v = _v;        /* Work around clang "unused result" */ \
        })
 
+#endif /* CONFIG_RCU_USE_ATOMIC_BUILTINS */
+
 #endif /* _URCU_SYSTEM_H */
index 431319d608518af222045f9467dfb8081dfaaa8c..1f3ef0fbbdb5bfe8f03d58e642ccdc1373e2f54c 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_TLS_COMPAT_H
 #define _URCU_TLS_COMPAT_H
 
 /*
- * urcu/tls-compat.h
- *
  * Userspace RCU library - Thread-Local Storage Compatibility Header
- *
- * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdlib.h>
index 2fb5fd40eefcc127547bdd84f04dd1d161c7e6b0..561c8294f3faf1d8afeedb12ea97bbbde9eacdad 100644 (file)
@@ -1,29 +1,71 @@
-/*
- * urcu/uatomic.h
- *
- * Copyright (c) 2020 Michael Jeanson <michael.jeanson@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+// SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 #ifndef _URCU_UATOMIC_H
 #define _URCU_UATOMIC_H
 
 #include <urcu/arch.h>
+#include <urcu/compiler.h>
+#include <urcu/config.h>
+
+enum cmm_memorder {
+       CMM_RELAXED = 0,
+       CMM_CONSUME = 1,
+       CMM_ACQUIRE = 2,
+       CMM_RELEASE = 3,
+       CMM_ACQ_REL = 4,
+       CMM_SEQ_CST = 5,
+       CMM_SEQ_CST_FENCE = 6,
+};
+
+#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
+
+/*
+ * Make sure that CMM_SEQ_CST_FENCE is not equivalent to other memory orders.
+ */
+urcu_static_assert(CMM_RELAXED == __ATOMIC_RELAXED, "CMM_RELAXED vs __ATOMIC_RELAXED values mismatch", cmm_relaxed_values_mismatch);
+urcu_static_assert(CMM_CONSUME == __ATOMIC_CONSUME, "CMM_CONSUME vs __ATOMIC_CONSUME values mismatch", cmm_consume_values_mismatch);
+urcu_static_assert(CMM_ACQUIRE == __ATOMIC_ACQUIRE, "CMM_ACQUIRE vs __ATOMIC_ACQUIRE values mismatch", cmm_acquire_values_mismatch);
+urcu_static_assert(CMM_RELEASE == __ATOMIC_RELEASE, "CMM_RELEASE vs __ATOMIC_RELEASE values mismatch", cmm_release_values_mismatch);
+urcu_static_assert(CMM_ACQ_REL == __ATOMIC_ACQ_REL, "CMM_ACQ_REL vs __ATOMIC_ACQ_REL values mismatch", cmm_acq_rel_values_mismatch);
+urcu_static_assert(CMM_SEQ_CST == __ATOMIC_SEQ_CST, "CMM_SEQ_CST vs __ATOMIC_SEQ_CST values mismatch", cmm_seq_cst_values_mismatch);
+
+/*
+ * This is not part of the public API. It it used internally to implement the
+ * CMM_SEQ_CST_FENCE memory order.
+ *
+ * NOTE: Using switch here instead of if statement to avoid -Wduplicated-cond
+ * warning when memory order is conditionally determined.
+ */
+static inline void cmm_seq_cst_fence_after_atomic(enum cmm_memorder mo)
+{
+       switch (mo) {
+       case CMM_SEQ_CST_FENCE:
+               cmm_smp_mb();
+               break;
+       default:
+               break;
+       }
+}
+
+#endif
+
+/*
+ * This is not part of the public API. It is used internally to convert from the
+ * CMM memory model to the C11 memory model.
+ */
+static inline int cmm_to_c11(int mo)
+{
+       if (mo == CMM_SEQ_CST_FENCE) {
+               return CMM_SEQ_CST;
+       }
+       return mo;
+}
 
-#if defined(URCU_ARCH_X86)
+#if defined(CONFIG_RCU_USE_ATOMIC_BUILTINS)
+#include <urcu/uatomic/builtins.h>
+#elif defined(URCU_ARCH_X86)
 #include <urcu/uatomic/x86.h>
 #elif defined(URCU_ARCH_PPC)
 #include <urcu/uatomic/ppc.h>
@@ -51,6 +93,8 @@
 #include <urcu/uatomic/m68k.h>
 #elif defined(URCU_ARCH_RISCV)
 #include <urcu/uatomic/riscv.h>
+#elif defined(URCU_ARCH_LOONGARCH)
+#include <urcu/uatomic/loongarch.h>
 #else
 #error "Cannot build: unrecognized architecture, see <urcu/arch.h>."
 #endif
index 58698ce5d405f3a23b83ea013b3fe0ec23e1baf1..31d428d339ececff3910a5e499317b809e0c133f 100644 (file)
@@ -1,23 +1,15 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_AARCH64_H
 #define _URCU_ARCH_UATOMIC_AARCH64_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009-2015 Mathieu Desnoyers
- * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
- *                        (Adapted from uatomic_arch_ppc.h)
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
index 5dceb9007733409781c67af74ea64d0cc4814bf8..afa7dff0268f12ed2b013f033dd3da63ab5466a3 100644 (file)
@@ -1,28 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_UATOMIC_ARCH_ALPHA_H
 #define _URCU_UATOMIC_ARCH_ALPHA_H
 
 /*
  * Atomic exchange operations for the Alpha architecture. Let GCC do it.
- *
- * Copyright (c) 2010 Paolo Bonzini <pbonzini@redhat.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
  */
 
 #include <urcu/compiler.h>
index 95f32f3d47b497c79373c7fcbf71bb65c8aa5dda..5124a71aa9d4dfda80c41e04500c6706a60c0638 100644 (file)
@@ -1,25 +1,17 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_ARM_H
 #define _URCU_ARCH_UATOMIC_ARM_H
 
 /*
  * Atomics for ARM.  This approach is usable on kernels back to 2.6.15.
  *
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009      Mathieu Desnoyers
- * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
- *                        (Adapted from uatomic_arch_ppc.h)
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
diff --git a/include/urcu/uatomic/builtins-generic.h b/include/urcu/uatomic/builtins-generic.h
new file mode 100644 (file)
index 0000000..15c7f07
--- /dev/null
@@ -0,0 +1,162 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+/*
+ * urcu/uatomic/builtins-generic.h
+ */
+
+#ifndef _URCU_UATOMIC_BUILTINS_GENERIC_H
+#define _URCU_UATOMIC_BUILTINS_GENERIC_H
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+
+#define uatomic_store(addr, v, mo)                             \
+       do {                                                    \
+               __atomic_store_n(cmm_cast_volatile(addr), v,    \
+                               cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);             \
+       } while (0)
+
+#define uatomic_set(addr, v)                           \
+       do {                                            \
+               uatomic_store(addr, v, CMM_RELAXED);    \
+       } while (0)
+
+#define uatomic_load(addr, mo)                                         \
+       __extension__                                                   \
+       ({                                                              \
+               __typeof__(*(addr)) _value =                            \
+                       __atomic_load_n(cmm_cast_volatile(addr),        \
+                                       cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);                     \
+                                                                       \
+               _value;                                                 \
+       })
+
+#define uatomic_read(addr)                     \
+       uatomic_load(addr, CMM_RELAXED)
+
+#define uatomic_cmpxchg_mo(addr, old, new, mos, mof)                   \
+       __extension__                                                   \
+       ({                                                              \
+               __typeof__(*(addr)) _old = (__typeof__(*(addr)))old;    \
+                                                                       \
+               if (__atomic_compare_exchange_n(cmm_cast_volatile(addr), \
+                                                       &_old, new, 0,  \
+                                                       cmm_to_c11(mos), \
+                                                       cmm_to_c11(mof))) { \
+                       cmm_seq_cst_fence_after_atomic(mos);            \
+               } else {                                                \
+                       cmm_seq_cst_fence_after_atomic(mof);            \
+               }                                                       \
+               _old;                                                   \
+       })
+
+#define uatomic_cmpxchg(addr, old, new)                                        \
+       uatomic_cmpxchg_mo(addr, old, new, CMM_SEQ_CST_FENCE, CMM_RELAXED)
+
+#define uatomic_xchg_mo(addr, v, mo)                                   \
+       __extension__                                                   \
+       ({                                                              \
+               __typeof__((*addr)) _old =                              \
+                       __atomic_exchange_n(cmm_cast_volatile(addr), v, \
+                                       cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);                     \
+               _old;                                                   \
+       })
+
+#define uatomic_xchg(addr, v)                          \
+       uatomic_xchg_mo(addr, v, CMM_SEQ_CST_FENCE)
+
+#define uatomic_add_return_mo(addr, v, mo)                             \
+       __extension__                                                   \
+       ({                                                              \
+               __typeof__(*(addr)) _old =                              \
+                       __atomic_add_fetch(cmm_cast_volatile(addr), v,  \
+                                       cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);                     \
+               _old;                                                   \
+       })
+
+#define uatomic_add_return(addr, v)                            \
+       uatomic_add_return_mo(addr, v, CMM_SEQ_CST_FENCE)
+
+#define uatomic_sub_return_mo(addr, v, mo)                             \
+       __extension__                                                   \
+       ({                                                              \
+               __typeof__(*(addr)) _old =                              \
+                       __atomic_sub_fetch(cmm_cast_volatile(addr), v,  \
+                                       cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);                     \
+               _old;                                                   \
+       })
+
+#define uatomic_sub_return(addr, v)                            \
+       uatomic_sub_return_mo(addr, v, CMM_SEQ_CST_FENCE)
+
+#define uatomic_and_mo(addr, mask, mo)                                 \
+       do {                                                            \
+               (void) __atomic_and_fetch(cmm_cast_volatile(addr), mask, \
+                                       cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);                     \
+       } while (0)
+
+#define uatomic_and(addr, mask)                        \
+       uatomic_and_mo(addr, mask, CMM_SEQ_CST)
+
+#define uatomic_or_mo(addr, mask, mo)                                  \
+       do {                                                            \
+               (void) __atomic_or_fetch(cmm_cast_volatile(addr), mask, \
+                                       cmm_to_c11(mo));                \
+               cmm_seq_cst_fence_after_atomic(mo);                     \
+       } while (0)
+
+
+#define uatomic_or(addr, mask)                 \
+       uatomic_or_mo(addr, mask, CMM_RELAXED)
+
+#define uatomic_add_mo(addr, v, mo)                    \
+       (void) uatomic_add_return_mo(addr, v, mo)
+
+#define uatomic_add(addr, v)                   \
+       uatomic_add_mo(addr, v, CMM_RELAXED)
+
+#define uatomic_sub_mo(addr, v, mo)                    \
+       (void) uatomic_sub_return_mo(addr, v, mo)
+
+#define uatomic_sub(addr, v)                   \
+       uatomic_sub_mo(addr, v, CMM_RELAXED)
+
+#define uatomic_inc_mo(addr, mo)               \
+       uatomic_add_mo(addr, 1, mo)
+
+#define uatomic_inc(addr)                      \
+       uatomic_inc_mo(addr, CMM_RELAXED)
+
+#define uatomic_dec_mo(addr, mo)               \
+       uatomic_sub_mo(addr, 1, mo)
+
+#define uatomic_dec(addr)                      \
+       uatomic_dec_mo(addr, CMM_RELAXED)
+
+#define cmm_smp_mb__before_uatomic_and() cmm_smp_mb()
+#define cmm_smp_mb__after_uatomic_and()  cmm_smp_mb()
+
+#define cmm_smp_mb__before_uatomic_or() cmm_smp_mb()
+#define cmm_smp_mb__after_uatomic_or()  cmm_smp_mb()
+
+#define cmm_smp_mb__before_uatomic_add() cmm_smp_mb()
+#define cmm_smp_mb__after_uatomic_add()  cmm_smp_mb()
+
+#define cmm_smp_mb__before_uatomic_sub() cmm_smp_mb()
+#define cmm_smp_mb__after_uatomic_sub()  cmm_smp_mb()
+
+#define cmm_smp_mb__before_uatomic_inc() cmm_smp_mb()
+#define cmm_smp_mb__after_uatomic_inc() cmm_smp_mb()
+
+#define cmm_smp_mb__before_uatomic_dec() cmm_smp_mb()
+#define cmm_smp_mb__after_uatomic_dec() cmm_smp_mb()
+
+#endif /* _URCU_UATOMIC_BUILTINS_X86_H */
diff --git a/include/urcu/uatomic/builtins.h b/include/urcu/uatomic/builtins.h
new file mode 100644 (file)
index 0000000..5b92700
--- /dev/null
@@ -0,0 +1,67 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+/*
+ * urcu/uatomic/builtins.h
+ */
+
+#ifndef _URCU_UATOMIC_BUILTINS_H
+#define _URCU_UATOMIC_BUILTINS_H
+
+#include <urcu/arch.h>
+
+#if defined(__has_builtin)
+# if !__has_builtin(__atomic_store_n)
+#  error "Toolchain does not support __atomic_store_n."
+# endif
+# if !__has_builtin(__atomic_load_n)
+#  error "Toolchain does not support __atomic_load_n."
+# endif
+# if !__has_builtin(__atomic_exchange_n)
+#  error "Toolchain does not support __atomic_exchange_n."
+# endif
+# if !__has_builtin(__atomic_compare_exchange_n)
+#  error "Toolchain does not support __atomic_compare_exchange_n."
+# endif
+# if !__has_builtin(__atomic_add_fetch)
+#  error "Toolchain does not support __atomic_add_fetch."
+# endif
+# if !__has_builtin(__atomic_sub_fetch)
+#  error "Toolchain does not support __atomic_sub_fetch."
+# endif
+# if !__has_builtin(__atomic_or_fetch)
+#  error "Toolchain does not support __atomic_or_fetch."
+# endif
+# if !__has_builtin(__atomic_thread_fence)
+#  error "Toolchain does not support __atomic_thread_fence."
+# endif
+# if !__has_builtin(__atomic_signal_fence)
+#  error "Toolchain does not support __atomic_signal_fence."
+# endif
+#elif defined(__GNUC__)
+# define GCC_VERSION (__GNUC__       * 10000 + \
+                      __GNUC_MINOR__ * 100   + \
+                      __GNUC_PATCHLEVEL__)
+# if  GCC_VERSION < 40700
+#  error "GCC version is too old. Version must be 4.7 or greater"
+# endif
+# undef  GCC_VERSION
+#else
+# error "Toolchain is not supported."
+#endif
+
+#if defined(__GNUC__)
+# define UATOMIC_HAS_ATOMIC_BYTE  __GCC_ATOMIC_CHAR_LOCK_FREE
+# define UATOMIC_HAS_ATOMIC_SHORT __GCC_ATOMIC_SHORT_LOCK_FREE
+#elif defined(__clang__)
+# define UATOMIC_HAS_ATOMIC_BYTE  __CLANG_ATOMIC_CHAR_LOCK_FREE
+# define UATOMIC_HAS_ATOMIC_SHORT __CLANG_ATOMIC_SHORT_LOCK_FREE
+#else
+/* #  define UATOMIC_HAS_ATOMIC_BYTE  */
+/* #  define UATOMIC_HAS_ATOMIC_SHORT */
+#endif
+
+#include <urcu/uatomic/builtins-generic.h>
+
+#endif /* _URCU_UATOMIC_BUILTINS_H */
index 438e039309db0513edda9f8de6bda462e67a9e9f..e0763afeffd9d055d08499900836194aa910cf0e 100644 (file)
@@ -1,23 +1,15 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_GCC_H
 #define _URCU_ARCH_UATOMIC_GCC_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009      Mathieu Desnoyers
- * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
- *                        (Adapted from uatomic_arch_ppc.h)
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
index 89d1cfa98c1ab198cc8f628a0e28fdaadfbd5f90..ed655bb8def13a5120990d049eb12199ee47376a 100644 (file)
@@ -1,22 +1,15 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_UATOMIC_GENERIC_H
 #define _URCU_UATOMIC_GENERIC_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009      Mathieu Desnoyers
- * Copyright (c) 2010      Paolo Bonzini
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
@@ -33,24 +26,125 @@ extern "C" {
 #define uatomic_set(addr, v)   ((void) CMM_STORE_SHARED(*(addr), (v)))
 #endif
 
+/*
+ * Can be defined for the architecture.
+ *
+ * What needs to be emitted _before_ the `operation' with memory ordering `mo'.
+ */
+#ifndef _cmm_compat_c11_smp_mb__before_mo
+# define _cmm_compat_c11_smp_mb__before_mo(operation, mo) cmm_smp_mb()
+#endif
+
+/*
+ * Can be defined for the architecture.
+ *
+ * What needs to be emitted _after_ the `operation' with memory ordering `mo'.
+ */
+#ifndef _cmm_compat_c11_smp_mb__after_mo
+# define _cmm_compat_c11_smp_mb__after_mo(operation, mo) cmm_smp_mb()
+#endif
+
+#define uatomic_load_store_return_op(op, addr, v, mo)          \
+       __extension__                                           \
+       ({                                                      \
+               _cmm_compat_c11_smp_mb__before_mo(op, mo);      \
+               __typeof__((*addr)) _value = op(addr, v);       \
+               _cmm_compat_c11_smp_mb__after_mo(op, mo);       \
+                                                               \
+               _value;                                         \
+       })
+
+#define uatomic_load_store_op(op, addr, v, mo)                 \
+       do {                                                    \
+               _cmm_compat_c11_smp_mb__before_mo(op, mo);      \
+               op(addr, v);                                    \
+               _cmm_compat_c11_smp_mb__after_mo(op, mo);       \
+       } while (0)
+
+#define uatomic_store(addr, v, mo)                                     \
+       do {                                                            \
+               _cmm_compat_c11_smp_mb__before_mo(uatomic_set, mo);     \
+               uatomic_set(addr, v);                                   \
+               _cmm_compat_c11_smp_mb__after_mo(uatomic_set, mo);      \
+       } while (0)
+
+#define uatomic_and_mo(addr, v, mo)                    \
+       uatomic_load_store_op(uatomic_and, addr, v, mo)
+
+#define uatomic_or_mo(addr, v, mo)                     \
+       uatomic_load_store_op(uatomic_or, addr, v, mo)
+
+#define uatomic_add_mo(addr, v, mo)                    \
+       uatomic_load_store_op(uatomic_add, addr, v, mo)
+
+#define uatomic_sub_mo(addr, v, mo)                    \
+       uatomic_load_store_op(uatomic_sub, addr, v, mo)
+
+#define uatomic_inc_mo(addr, mo)                       \
+       uatomic_load_store_op(uatomic_add, addr, 1, mo)
+
+#define uatomic_dec_mo(addr, mo)                               \
+       uatomic_load_store_op(uatomic_add, addr, -1, mo)
+/*
+ * NOTE: We can not just do switch (_value == (old) ? mos : mof) otherwise the
+ * compiler emit a -Wduplicated-cond warning.
+ */
+#define uatomic_cmpxchg_mo(addr, old, new, mos, mof)                   \
+       __extension__                                                   \
+       ({                                                              \
+               _cmm_compat_c11_smp_mb__before_mo(uatomic_cmpxchg, mos); \
+               __typeof__(*(addr)) _value = uatomic_cmpxchg(addr, old, \
+                                                       new);           \
+                                                                       \
+               if (_value == (old)) {                                  \
+                       _cmm_compat_c11_smp_mb__after_mo(uatomic_cmpxchg, mos); \
+               } else {                                                \
+                       _cmm_compat_c11_smp_mb__after_mo(uatomic_cmpxchg, mof); \
+               }                                                       \
+               _value;                                                 \
+       })
+
+#define uatomic_xchg_mo(addr, v, mo)                           \
+       uatomic_load_store_return_op(uatomic_xchg, addr, v, mo)
+
+#define uatomic_add_return_mo(addr, v, mo)                             \
+       uatomic_load_store_return_op(uatomic_add_return, addr, v)
+
+#define uatomic_sub_return_mo(addr, v, mo)                             \
+       uatomic_load_store_return_op(uatomic_sub_return, addr, v)
+
 #ifndef uatomic_read
 #define uatomic_read(addr)     CMM_LOAD_SHARED(*(addr))
 #endif
 
+#define uatomic_load(addr, mo)                                         \
+       __extension__                                                   \
+       ({                                                              \
+               _cmm_compat_c11_smp_mb__before_mo(uatomic_read, mo);    \
+               __typeof__(*(addr)) _rcu_value = uatomic_read(addr);    \
+               _cmm_compat_c11_smp_mb__after_mo(uatomic_read, mo);     \
+                                                                       \
+               _rcu_value;                                             \
+       })
+
 #if !defined __OPTIMIZE__  || defined UATOMIC_NO_LINK_ERROR
-static inline __attribute__((always_inline, noreturn))
+#ifdef ILLEGAL_INSTR
+static inline __attribute__((always_inline))
 void _uatomic_link_error(void)
 {
-#ifdef ILLEGAL_INSTR
        /*
         * generate an illegal instruction. Cannot catch this with
         * linker tricks when optimizations are disabled.
         */
        __asm__ __volatile__(ILLEGAL_INSTR);
+}
 #else
+static inline __attribute__((always_inline, __noreturn__))
+void _uatomic_link_error(void)
+{
        __builtin_trap();
-#endif
 }
+#endif
 
 #else /* #if !defined __OPTIMIZE__  || defined UATOMIC_NO_LINK_ERROR */
 extern void _uatomic_link_error(void);
index 21021537c9076b8aec2bcae0fc8689463d88491a..82864615e4a3492fdd0608bded10893f0608f2ea 100644 (file)
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2014 Helge Deller <deller@gmx.de>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_ARCH_UATOMIC_HPPA_H
 #define _URCU_ARCH_UATOMIC_HPPA_H
 
index b5db8cc2e1d8cad1ce2f2fa1444b95db58399804..381594c0c40d40cbbde497bdeaa2e2f7dd4a48e9 100644 (file)
@@ -1,23 +1,15 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_IA64_H
 #define _URCU_ARCH_UATOMIC_IA64_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009-2015 Mathieu Desnoyers
- * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
- *                        (Adapted from uatomic_arch_ppc.h)
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
diff --git a/include/urcu/uatomic/loongarch.h b/include/urcu/uatomic/loongarch.h
new file mode 100644 (file)
index 0000000..3454d41
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-FileCopyrightText: 2021 Wang Jing <wangjing@loongson.cn>
+//
+// SPDX-License-Identifier: MIT
+
+#ifndef _URCU_UATOMIC_ARCH_LOONGARCH_H
+#define _URCU_UATOMIC_ARCH_LOONGARCH_H
+
+/*
+ * Atomic exchange operations for the LoongArch architecture. Let GCC do it.
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * LoongArch implements byte and short atomics with LL/SC instructions,
+ * which retry if the cache line is modified concurrently between LL and
+ * SC.
+ */
+#define UATOMIC_HAS_ATOMIC_BYTE
+#define UATOMIC_HAS_ATOMIC_SHORT
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <urcu/uatomic/generic.h>
+
+#endif /* _URCU_UATOMIC_ARCH_LOONGARCH_H */
index 60b01c776a28fb910ddc548ca750a8ec7e060283..9a28e7c223e9a2760f3d7ac4acafc2a870575d81 100644 (file)
@@ -1,25 +1,9 @@
+// SPDX-FileCopyrightText: 2017 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
  * Atomic exchange operations for the m68k architecture. Let GCC do it.
- *
- * Copyright (c) 2017 Michael Jeanson <mjeanson@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
  */
 
 #ifndef _URCU_ARCH_UATOMIC_M68K_H
index bd7ca7f776118761aaeb9b10bdbe782865fafd84..265401db95891c936eed0a207bd1b4267d4f9854 100644 (file)
@@ -1,28 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_UATOMIC_ARCH_MIPS_H
 #define _URCU_UATOMIC_ARCH_MIPS_H
 
 /*
  * Atomic exchange operations for the MIPS architecture. Let GCC do it.
- *
- * Copyright (c) 2010 Paolo Bonzini <pbonzini@redhat.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
  */
 
 #include <urcu/compiler.h>
index 5b3c3033ab43607161d86385ed4add65f419e70d..0eca72729f516f35503ac62626d84f6091ac31d7 100644 (file)
@@ -1,28 +1,12 @@
+// SPDX-FileCopyrightText: 2016 Marek Vasut <marex@denx.de>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_UATOMIC_ARCH_NIOS2_H
 #define _URCU_UATOMIC_ARCH_NIOS2_H
 
 /*
  * Atomic exchange operations for the NIOS2 architecture. Let GCC do it.
- *
- * Copyright (c) 2016 Marek Vasut <marex@denx.de>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
  */
 
 #include <urcu/compiler.h>
index 0e672f57260529679b7c15d31304f57767328bb9..dc59518c8e0a7472560d5fe5fc4e55b8389bf1ee 100644 (file)
@@ -1,21 +1,14 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_PPC_H
 #define _URCU_ARCH_UATOMIC_PPC_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009      Mathieu Desnoyers
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
@@ -34,7 +27,7 @@ extern "C" {
  * instructions for cmpxchg and add_return family of atomic primitives.
  *
  * This is achieved with:
- *   lwsync (prior loads can be reordered after following load)
+ *   lwsync (prior stores can be reordered after following loads)
  *   lwarx
  *   stwcx.
  *   test if success (retry)
index a6700e17e2429567fbe1e4e95117bf0c69c7c0f0..c1ba29e2dd1f711236c8ace982f3c75a49961c6d 100644 (file)
@@ -1,25 +1,11 @@
+// SPDX-FileCopyrightText: 2018 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 /*
- * Atomic exchange operations for the RISC-V architecture. Let GCC do it.
- *
- * Copyright (c) 2018 Michael Jeanson <mjeanson@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * Atomic exchange operations for the RISC-V architecture.
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
+ * Let the compiler do it.
  */
 
 #ifndef _URCU_ARCH_UATOMIC_RISCV_H
 #include <urcu/compiler.h>
 #include <urcu/system.h>
 
+/*
+ * See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104831> for details.
+ *
+ * Until the following patches are backported, Userspace RCU is broken for the
+ * RISC-V architecture when compiled with GCC.
+ *
+ *  - <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4990cf84c460f064d6281d0813f20b0ef20c7448>
+ *  - <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4990cf84c460f064d6281d0813f20b0ef20c7448>
+ *  - <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d199d2e56da2379004e7e0457150409c0c99d3e6>
+ */
+#ifdef URCU_GCC_VERSION
+# error "Implementations of some atomic operations of GCC for RISC-V are insufficient for sequential consistency. For this reason Userspace RCU is currently marked as 'broken' for RISC-V with GCC. However, it is still possible to use other toolchains."
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index 42f23e757807453586831af7e8210c04e1453d44..25626961dc320a01c25a2b56f4f5e0928cc3a4e2 100644 (file)
@@ -1,3 +1,8 @@
+// SPDX-FileCopyrightText: 2009 Novell, Inc.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
 #ifndef _URCU_UATOMIC_ARCH_S390_H
 #define _URCU_UATOMIC_ARCH_S390_H
 
@@ -6,27 +11,7 @@
  * taken from the Principles of Operation Appendix A "Conditional Swapping
  * Instructions (CS, CDS)".
  *
- * Copyright (c) 2009 Novell, Inc.
  * Author: Jan Blunck <jblunck@suse.de>
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
  */
 
 #include <urcu/compiler.h>
index a9f27954657cdf6b0b8ad1a9c1a720b695a8b248..97ecb466d083b21dad6f56420d6b3bf48732a085 100644 (file)
@@ -1,21 +1,14 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2003 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_SPARC64_H
 #define _URCU_ARCH_UATOMIC_SPARC64_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
- * Copyright (c) 2009      Mathieu Desnoyers
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
index 830f26054e70cf19ac74e0a88456725c062ac2fb..412c9ed8992a8a4957e5cf0808f12d7d80003a9b 100644 (file)
@@ -1,23 +1,15 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_TILE_H
 #define _URCU_ARCH_UATOMIC_TILE_H
 
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009-2015 Mathieu Desnoyers
- * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
- *                        (Adapted from uatomic_arch_ppc.h)
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
index d416963c31aeca0cdd5003b67858c1209779627c..616eee9be3ca60b4be62c8a10cadb0aff2d1ea8d 100644 (file)
@@ -1,21 +1,16 @@
+// SPDX-FileCopyrightText: 1991-1994 by Xerox Corporation.  All rights reserved.
+// SPDX-FileCopyrightText: 1996-1999 by Silicon Graphics.  All rights reserved.
+// SPDX-FileCopyrightText: 1999-2004 Hewlett-Packard Development Company, L.P.
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _URCU_ARCH_UATOMIC_X86_H
 #define _URCU_ARCH_UATOMIC_X86_H
 
+#include <stdlib.h>            /* For abort(3). */
+
 /*
- * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
- * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
- * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
- * Copyright (c) 2009      Mathieu Desnoyers
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
  * Code inspired from libuatomic_ops-1.2, inherited in part from the
  * Boehm-Demers-Weiser conservative garbage collector.
  */
@@ -637,6 +632,474 @@ extern unsigned long _compat_uatomic_add_return(void *addr,
 #define cmm_smp_mb__before_uatomic_dec()       cmm_barrier()
 #define cmm_smp_mb__after_uatomic_dec()                cmm_barrier()
 
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_read_mo(enum cmm_memorder mo)
+{
+       /*
+        * A SMP barrier is not necessary for CMM_SEQ_CST because, only a
+        * previous store can be reordered with the load.  However, emitting the
+        * memory barrier after the store is sufficient to prevent reordering
+        * between the two.  This follows toolchains decision of emitting the
+        * memory fence on the stores instead of the loads.
+        *
+        * A compiler barrier is necessary because the underlying operation does
+        * not clobber the registers.
+        */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               cmm_barrier();
+               break;
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       default:
+               abort();
+               break;
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_read_mo(enum cmm_memorder mo)
+{
+       /*
+        * A SMP barrier is not necessary for CMM_SEQ_CST because following
+        * loads and stores cannot be reordered with the load.
+        *
+        * A SMP barrier is however necessary for CMM_SEQ_CST_FENCE to respect
+        * the memory model, since the underlying operation does not have a lock
+        * prefix.
+        *
+        * A compiler barrier is necessary because the underlying operation does
+        * not clobber the registers.
+        */
+       switch (mo) {
+       case CMM_SEQ_CST_FENCE:
+               cmm_smp_mb();
+               break;
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_SEQ_CST:
+               cmm_barrier();
+               break;
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       default:
+               abort();
+               break;
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_set_mo(enum cmm_memorder mo)
+{
+       /*
+        * A SMP barrier is not necessary for CMM_SEQ_CST because the store can
+        * only be reodered with later loads
+        *
+        * A compiler barrier is necessary because the underlying operation does
+        * not clobber the registers.
+        */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               cmm_barrier();
+               break;
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       default:
+               abort();
+               break;
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_set_mo(enum cmm_memorder mo)
+{
+       /*
+        * A SMP barrier is necessary for CMM_SEQ_CST because the store can be
+        * reorded with later loads.  Since no memory barrier is being emitted
+        * before loads, one has to be emitted after the store.  This follows
+        * toolchains decision of emitting the memory fence on the stores instead
+        * of the loads.
+        *
+        * A SMP barrier is necessary for CMM_SEQ_CST_FENCE to respect the
+        * memory model, since the underlying store does not have a lock prefix.
+        *
+        * A compiler barrier is necessary because the underlying operation does
+        * not clobber the registers.
+        */
+       switch (mo) {
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               cmm_smp_mb();
+               break;
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_RELEASE:
+               cmm_barrier();
+               break;
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       default:
+               abort();
+               break;
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_xchg_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_xchg has implicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_xchg_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_xchg has implicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_cmpxchg_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_cmpxchg has implicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_cmpxchg_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_cmpxchg has implicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_and_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_and has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_and_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_and has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_or_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_or has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_or_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_or has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_add_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_add has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_add_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_add has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_sub_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_sub has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_sub_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_sub has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_inc_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_inc has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_inc_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_inc has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_dec_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_dec has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_dec_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_dec has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_add_return_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_add_return has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_add_return_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_add_return has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__before_uatomic_sub_return_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_sub_return has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+static inline void _cmm_compat_c11_smp_mb__after_uatomic_sub_return_mo(enum cmm_memorder mo)
+{
+       /* NOP. uatomic_sub_return has explicit lock prefix. */
+       switch (mo) {
+       case CMM_RELAXED:       /* Fall-through */
+       case CMM_ACQUIRE:       /* Fall-through */
+       case CMM_CONSUME:       /* Fall-through */
+       case CMM_RELEASE:       /* Fall-through */
+       case CMM_ACQ_REL:       /* Fall-through */
+       case CMM_SEQ_CST:       /* Fall-through */
+       case CMM_SEQ_CST_FENCE:
+               break;
+       default:
+               abort();
+       }
+}
+
+#define _cmm_compat_c11_smp_mb__before_mo(operation, mo)                       \
+       do {                                                    \
+               _cmm_compat_c11_smp_mb__before_ ## operation ## _mo (mo);       \
+       } while (0)
+
+#define _cmm_compat_c11_smp_mb__after_mo(operation, mo)                        \
+       do {                                                    \
+               _cmm_compat_c11_smp_mb__after_ ## operation ## _mo (mo);        \
+       } while (0)
+
+
 #ifdef __cplusplus
 }
 #endif
index baaa7a7f67c58125adaf0decca0a50bf990842a9..5c3510fe8219861ff0fba097b14797a13aa1400f 100644 (file)
@@ -1,2 +1,6 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #warning "urcu/uatomic_arch.h is deprecated. Please include urcu/uatomic.h instead."
 #include <urcu/uatomic.h>
index e28c2bff8e7db3e0fda163b1655369e6799ceac4..152c53665ddf64bafdba1c507cdd5d093d3a2f2a 100644 (file)
@@ -1,41 +1,28 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_BP_H
 #define _URCU_BP_H
 
 /*
- * urcu-bp.h
- *
  * Userspace RCU header, "bulletproof" version.
  *
  * Slower RCU read-side adapted for tracing library. Does not require thread
  * registration nor unregistration. Also signal-safe.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #include <stdlib.h>
 #include <pthread.h>
+#include <stdbool.h>
 
 #include <urcu/map/urcu-bp.h>
 
@@ -52,6 +39,7 @@
  * publication headers.
  */
 #include <urcu/pointer.h>
+#include <urcu/urcu-poll.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -140,6 +128,12 @@ extern void *urcu_bp_set_pointer_sym(void **p, void *v);
 
 extern void urcu_bp_synchronize_rcu(void);
 
+/*
+ * RCU grace period polling API.
+ */
+extern struct urcu_gp_poll_state urcu_bp_start_poll_synchronize_rcu(void);
+extern bool urcu_bp_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
+
 /*
  * urcu_bp_before_fork, urcu_bp_after_fork_parent and urcu_bp_after_fork_child
  * should be called around fork() system calls when the child process is not
index a1abffb85a1fa8ee8575b5474aa6547e54e0c923..65c2a6b8efc54c32edac581783f8f604df42a7b9 100644 (file)
@@ -1,2 +1,6 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #warning "urcu/urcu-futex.h is deprecated. Please include urcu/futex.h instead."
 #include <urcu/futex.h>
index ab485f112f6177c37fa9d1bebe3bc5ef15f4c470..acd02d09750413919d9350135c5432d7c1d8be33 100644 (file)
@@ -1,44 +1,32 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_MB_H
 #define _URCU_MB_H
 
 /*
- * urcu-mb.h
- *
  * Userspace RCU header
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #include <stdlib.h>
 #include <pthread.h>
+#include <stdbool.h>
 
 /*
  * See urcu/pointer.h and urcu/static/pointer.h for pointer
  * publication headers.
  */
 #include <urcu/pointer.h>
+#include <urcu/urcu-poll.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -90,6 +78,12 @@ extern int urcu_mb_read_ongoing(void);
 
 extern void urcu_mb_synchronize_rcu(void);
 
+/*
+ * RCU grace period polling API.
+ */
+extern struct urcu_gp_poll_state urcu_mb_start_poll_synchronize_rcu(void);
+extern bool urcu_mb_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
+
 /*
  * Reader thread registration.
  */
index c11c93e850fcb065e4dc07ce982701364a8c97b7..c89b4c0d6f3fb001a8996e414b4f9c4f8f0c8526 100644 (file)
@@ -1,44 +1,32 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_MEMB_H
 #define _URCU_MEMB_H
 
 /*
- * urcu-memb.h
- *
  * Userspace RCU header
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #include <stdlib.h>
 #include <pthread.h>
+#include <stdbool.h>
 
 /*
  * See urcu/pointer.h and urcu/static/pointer.h for pointer
  * publication headers.
  */
 #include <urcu/pointer.h>
+#include <urcu/urcu-poll.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -90,6 +78,12 @@ extern int urcu_memb_read_ongoing(void);
 
 extern void urcu_memb_synchronize_rcu(void);
 
+/*
+ * RCU grace period polling API.
+ */
+extern struct urcu_gp_poll_state urcu_memb_start_poll_synchronize_rcu(void);
+extern bool urcu_memb_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
+
 /*
  * Reader thread registration.
  */
diff --git a/include/urcu/urcu-poll.h b/include/urcu/urcu-poll.h
new file mode 100644 (file)
index 0000000..c52d695
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-FileCopyrightText: 2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef _URCU_POLL_H
+#define _URCU_POLL_H
+
+/*
+ * Userspace RCU polling header
+ */
+
+struct urcu_gp_poll_state {
+       unsigned long grace_period_id;
+};
+
+#endif /* _URCU_POLL_H */
index fd6cbda31bef58441344dd23d45a5f28b377dc28..c2a3e1929a64dd07db011674824e981ea700bd8f 100644 (file)
@@ -1,9 +1,12 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_QSBR_H
 #define _URCU_QSBR_H
 
 /*
- * urcu-qsbr.h
- *
  * Userspace RCU QSBR header.
  *
  * LGPL-compatible code should include this header with :
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #include <stdlib.h>
 #include <pthread.h>
+#include <stdbool.h>
 
 #include <urcu/config.h>
 
@@ -38,6 +28,7 @@
  * publication headers.
  */
 #include <urcu/pointer.h>
+#include <urcu/urcu-poll.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -125,6 +116,12 @@ extern void urcu_qsbr_thread_online(void);
 
 extern void urcu_qsbr_synchronize_rcu(void);
 
+/*
+ * RCU grace period polling API.
+ */
+extern struct urcu_gp_poll_state urcu_qsbr_start_poll_synchronize_rcu(void);
+extern bool urcu_qsbr_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
+
 /*
  * Reader thread registration.
  */
diff --git a/include/urcu/urcu-signal.h b/include/urcu/urcu-signal.h
deleted file mode 100644 (file)
index 59c5d01..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-#ifndef _URCU_SIGNAL_H
-#define _URCU_SIGNAL_H
-
-/*
- * urcu-signal.h
- *
- * Userspace RCU header
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * LGPL-compatible code should include this header with :
- *
- * #define _LGPL_SOURCE
- * #include <urcu.h>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * IBM's contributions to this file may be relicensed under LGPLv2 or later.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-
-/*
- * See urcu/pointer.h and urcu/static/pointer.h for pointer
- * publication headers.
- */
-#include <urcu/pointer.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <urcu/map/urcu-signal.h>
-
-/*
- * Important !
- *
- * Each thread containing read-side critical sections must be registered
- * with rcu_register_thread_mb() before calling rcu_read_lock_mb().
- * rcu_unregister_thread_mb() should be called before the thread exits.
- */
-
-#ifdef _LGPL_SOURCE
-
-#include <urcu/static/urcu-signal.h>
-
-/*
- * Mappings for static use of the userspace RCU library.
- * Should only be used in LGPL-compatible code.
- */
-
-/*
- * rcu_read_lock()
- * rcu_read_unlock()
- *
- * Mark the beginning and end of a read-side critical section.
- * DON'T FORGET TO USE RCU_REGISTER/UNREGISTER_THREAD() FOR EACH THREAD WITH
- * READ-SIDE CRITICAL SECTION.
- */
-#define urcu_signal_read_lock          _urcu_signal_read_lock
-#define urcu_signal_read_unlock                _urcu_signal_read_unlock
-#define urcu_signal_read_ongoing       _urcu_signal_read_ongoing
-
-#else /* !_LGPL_SOURCE */
-
-/*
- * library wrappers to be used by non-LGPL compatible source code.
- * See LGPL-only urcu/static/pointer.h for documentation.
- */
-
-extern void urcu_signal_read_lock(void);
-extern void urcu_signal_read_unlock(void);
-extern int urcu_signal_read_ongoing(void);
-
-#endif /* !_LGPL_SOURCE */
-
-extern void urcu_signal_synchronize_rcu(void);
-
-/*
- * Reader thread registration.
- */
-extern void urcu_signal_register_thread(void);
-extern void urcu_signal_unregister_thread(void);
-
-/*
- * Explicit rcu initialization, for "early" use within library constructors.
- */
-extern void urcu_signal_init(void);
-
-/*
- * Q.S. reporting are no-ops for these URCU flavors.
- */
-static inline void urcu_signal_quiescent_state(void)
-{
-}
-
-static inline void urcu_signal_thread_offline(void)
-{
-}
-
-static inline void urcu_signal_thread_online(void)
-{
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#include <urcu/call-rcu.h>
-#include <urcu/defer.h>
-#include <urcu/flavor.h>
-
-#ifndef URCU_API_MAP
-#include <urcu/map/clear.h>
-#endif
-
-#endif /* _URCU_SIGNAL_H */
index 79cf590f61da2022dfc8b56468b0bf45eec6c3bc..4df48e4ba3cd13f443e1d7d19bcd0b7db55b6ab6 100644 (file)
@@ -1,44 +1,28 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_H
 #define _URCU_H
 
 /*
- * urcu.h
- *
  * Userspace RCU header
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
  * LGPL-compatible code should include this header with :
  *
  * #define _LGPL_SOURCE
  * #include <urcu.h>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
-#if !defined(RCU_MEMBARRIER) && !defined(RCU_SIGNAL) && !defined(RCU_MB)
+#if !defined(RCU_MEMBARRIER) && !defined(RCU_MB)
 #define RCU_MEMBARRIER
 #endif
 
 #ifdef RCU_MEMBARRIER
 #include <urcu/urcu-memb.h>
-#elif defined(RCU_SIGNAL)
-#include <urcu/urcu-signal.h>
 #elif defined(RCU_MB)
 #include <urcu/urcu-mb.h>
 #else
index 5579ca6c93caed06b69c6f35d31138d2e32fe650..916a9df317dc76e649ccecd6781d6d8d8528b3ac 100644 (file)
@@ -1,2 +1,6 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #warning "urcu/urcu_ref.h is deprecated. Please include urcu/ref.h instead."
 #include <urcu/ref.h>
index bd920ca488b6b0feedb243383fe641b0741842a2..bba5c558d96cef1015c2a3197c5fe43797356e9d 100644 (file)
@@ -1,27 +1,13 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011-2012 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WFCQUEUE_H
 #define _URCU_WFCQUEUE_H
 
 /*
- * urcu/wfcqueue.h
- *
  * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <pthread.h>
index 214d3bf2f6d06b1774485bf3fe589d952c32eec8..45506ea21cf49065295795e3bcc7df7df615cdad 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WFQUEUE_H
 #define _URCU_WFQUEUE_H
 
 /*
- * wfqueue.h
- *
  * Userspace RCU library - Queue with Wait-Free Enqueue/Blocking Dequeue
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <pthread.h>
index 0890f5c1a54b7d8e590196cf6553ce12f5b7e001..38e5b6b2dcb3099dec87f8a6b3fb4f5750e93fb1 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WFSTACK_H
 #define _URCU_WFSTACK_H
 
 /*
- * urcu/wfstack.h
- *
  * Userspace RCU library - Stack with wait-free push, blocking traversal.
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <pthread.h>
diff --git a/lgpl-2.1.txt b/lgpl-2.1.txt
deleted file mode 100644 (file)
index 602bfc9..0000000
+++ /dev/null
@@ -1,504 +0,0 @@
-                 GNU LESSER GENERAL PUBLIC LICENSE
-                      Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
-                 GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-\f
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                           NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-\f
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/lgpl-relicensing.md b/lgpl-relicensing.md
new file mode 100644 (file)
index 0000000..10e7832
--- /dev/null
@@ -0,0 +1,37 @@
+<!--
+SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
+# Userspace-RCU LGPL 2.1+ re-licensing
+
+Mathieu Desnoyers
+May 13th, 2009
+
+IBM Corporation allowed LGPLv2.1+ licensing of their contribution to the
+userspace RCU library in a patch submitted on May 8, 2009 from Paul E.
+McKenney and reviewed by Steven L. Bennett:
+
+    https://lists.lttng.org/pipermail/lttng-dev/2009-May/012835.html
+
+I (Mathieu Desnoyers) re-implemented ACCESS_ONCE(), likely(), unlikely() and
+barrier() from scratch without reference to the original code.
+
+    commit id : 2dc5fa0f7cfbfb0a64a7a67b39626650e863f16a
+
+Bert Wesarg <bert.wesarg@googlemail.com> approved LGPL re-licensing of his
+patch in an email dated May 13, 2009 :
+
+    http://lkml.org/lkml/2009/5/13/16
+
+xchg() primitives has been rewritten from a MIT-licensed cmpxchg for Intel
+and powerpc. They are MIT-licensed and therefore usable in LGPL code.
+This cmpxchg code was obtained from the atomic_ops project:
+
+    http://www.hpl.hp.com/research/linux/atomic_ops/
+
+I (Mathieu Desnoyers) wrote the remainder of the code.
+
+The license for the library files in this project was therefore changed to
+LGPLv2.1 on May 13, 2009, as detailed in LICENSE.
diff --git a/lgpl-relicensing.txt b/lgpl-relicensing.txt
deleted file mode 100644 (file)
index 3e47d3f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Mathieu Desnoyers
-May 13th, 2009
-
-IBM Corporation allowed LGPLv2.1+ licensing of their contribution to the
-userspace RCU library in a patch submitted on May 8, 2009 from Paul E.
-McKenney and reviewed by Steven L. Bennett:
-
-   https://lists.lttng.org/pipermail/lttng-dev/2009-May/012835.html
-
-I (Mathieu Desnoyers) re-implemented ACCESS_ONCE(), likely(), unlikely() and
-barrier() from scratch without reference to the original code.
-
-   commit id : 2dc5fa0f7cfbfb0a64a7a67b39626650e863f16a
-
-Bert Wesarg <bert.wesarg@googlemail.com> approved LGPL relicensing of his
-patch in an email dated May 13, 2009 :
-
-   http://lkml.org/lkml/2009/5/13/16
-
-xchg() primitives has been rewritten from a MIT-licensed cmpxchg for Intel
-and powerpc. They are MIT-licensed and therefore usable in LGPL code.
-This cmpxchg code was obtained from the atomic_ops project:
-
-       http://www.hpl.hp.com/research/linux/atomic_ops/
-
-I (Mathieu Desnoyers) wrote the remainder of the code.
-
-The license for the library files in this project was therefore changed to
-LGPLv2.1 on May 13, 2009, as detailed in LICENSE.
diff --git a/m4/ae_cc_atomic_builtins.m4 b/m4/ae_cc_atomic_builtins.m4
new file mode 100644 (file)
index 0000000..0bdb8d0
--- /dev/null
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
+# SPDX-FileCopyrightText: 2023 Michael Jeanson <mjeanson@efficios.com>
+#
+# SYNOPSIS
+#
+#   AE_CC_ATOMIC_BUILTINS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+
+#serial 1
+
+AC_DEFUN([AE_CC_ATOMIC_BUILTINS], [
+AC_REQUIRE([AC_PROG_CC])
+AC_LANG_PUSH([C])
+
+AC_CACHE_CHECK(
+  [whether $CC supports atomic builtins],
+  [ae_cv_cc_atomic_builtins],
+  [
+    AC_LINK_IFELSE([
+      AC_LANG_PROGRAM([
+        int x, y;
+      ],[
+        __atomic_store_n(&x, 0, __ATOMIC_RELAXED);
+        __atomic_load_n(&x, __ATOMIC_RELAXED);
+        y = __atomic_exchange_n(&x, 1, __ATOMIC_RELAXED);
+        __atomic_compare_exchange_n(&x, &y, 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+        __atomic_add_fetch(&x, 1, __ATOMIC_RELAXED);
+        __atomic_sub_fetch(&x, 1, __ATOMIC_RELAXED);
+        __atomic_and_fetch(&x, 0x01, __ATOMIC_RELAXED);
+        __atomic_or_fetch(&x, 0x01, __ATOMIC_RELAXED);
+        __atomic_thread_fence(__ATOMIC_RELAXED);
+        __atomic_signal_fence(__ATOMIC_RELAXED);
+      ])
+    ],[
+      ae_cv_cc_atomic_builtins=yes
+    ],[
+      ae_cv_cc_atomic_builtins=no
+    ])
+  ]
+)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test "x$ae_cv_cc_atomic_builtins" = "xyes"; then
+  $1
+  :
+else
+  $2
+  :
+fi
+
+AC_LANG_POP
+])dnl AE_CC_ATOMIC_BUILTINS
index 1d7cd5831ab57ed2c64124141359eaf4698618a0..d34f5b50d9555f9be7b9a2e6fc43f55278bf224b 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
+# SPDX-FileCopyrightText: 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
 #
 # SYNOPSIS
 #
 #   NOTE: AE_FEATURE_ENABLE/DISABLE() must be placed first of the relative
 #   AE_FEATURE() macro if you want the the proper ACTION-IF-ENABLED and
 #   ACTION-IF-NOT-ENABLED to run.
-#
-# LICENSE
-#
-#   Copyright (c) 2020 Michael Jeanson <mjeanson@efficios.com>
-#   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
-#
-#   This program is 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 2 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 <https://www.gnu.org/licenses/>.
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Archive. When you make and distribute a
-#   modified version of the Autoconf Macro, you may extend this special
-#   exception to the GPL to apply to your modified version as well.
 
-#serial 2
+#serial 3
 
 
 # AE_FEATURE_DEFAULT_ENABLE: The next feature defined with AE_FEATURE will
diff --git a/m4/ae_pprint.m4 b/m4/ae_pprint.m4
new file mode 100644 (file)
index 0000000..029ff99
--- /dev/null
@@ -0,0 +1,210 @@
+# SPDX-FileCopyrightText: 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later WITH Autoconf-exception-2.0
+
+#serial 2
+
+# AE_PPRINT_INIT(): initializes the pretty printing system.
+#
+# Use this macro before using any other AE_PPRINT_* macro.
+AC_DEFUN([AE_PPRINT_INIT], [
+  m4_define([AE_PPRINT_CONFIG_TS], [50])
+  m4_define([AE_PPRINT_CONFIG_INDENT], [2])
+  AE_PPRINT_YES_MSG=yes
+  AE_PPRINT_NO_MSG=no
+
+  # find tput, which tells us if colors are supported and gives us color codes
+  AC_PATH_PROG([ae_pprint_tput], [tput])
+
+  AS_IF([test -n "$ae_pprint_tput"], [
+    AS_IF([test -n "$PS1" && test `"$ae_pprint_tput" colors` -eq 256 && test -t 1], [
+      # interactive shell and colors supported and standard output
+      # file descriptor is opened on a terminal
+      AE_PPRINT_COLOR_TXTBLK="`"$ae_pprint_tput" setaf 0`"
+      AE_PPRINT_COLOR_TXTBLU="`"$ae_pprint_tput" setaf 4`"
+      AE_PPRINT_COLOR_TXTGRN="`"$ae_pprint_tput" setaf 2`"
+      AE_PPRINT_COLOR_TXTCYN="`"$ae_pprint_tput" setaf 6`"
+      AE_PPRINT_COLOR_TXTRED="`"$ae_pprint_tput" setaf 1`"
+      AE_PPRINT_COLOR_TXTPUR="`"$ae_pprint_tput" setaf 5`"
+      AE_PPRINT_COLOR_TXTYLW="`"$ae_pprint_tput" setaf 3`"
+      AE_PPRINT_COLOR_TXTWHT="`"$ae_pprint_tput" setaf 7`"
+      AE_PPRINT_COLOR_BLD=`"$ae_pprint_tput" bold`
+      AE_PPRINT_COLOR_BLDBLK="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTBLK"
+      AE_PPRINT_COLOR_BLDBLU="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTBLU"
+      AE_PPRINT_COLOR_BLDGRN="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTGRN"
+      AE_PPRINT_COLOR_BLDCYN="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTCYN"
+      AE_PPRINT_COLOR_BLDRED="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTRED"
+      AE_PPRINT_COLOR_BLDPUR="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTPUR"
+      AE_PPRINT_COLOR_BLDYLW="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTYLW"
+      AE_PPRINT_COLOR_BLDWHT="$AE_PPRINT_COLOR_BLD$AE_PPRINT_COLOR_TXTWHT"
+      AE_PPRINT_COLOR_RST="`"$ae_pprint_tput" sgr0`"
+
+      # colored yes and no
+      AE_PPRINT_YES_MSG="$AE_PPRINT_COLOR_BLDGRN$AE_PPRINT_YES_MSG$AE_PPRINT_COLOR_RST"
+      AE_PPRINT_NO_MSG="$AE_PPRINT_COLOR_BLDRED$AE_PPRINT_NO_MSG$AE_PPRINT_COLOR_RST"
+
+      # subtitle color
+      AE_PPRINT_COLOR_SUBTITLE="$AE_PPRINT_COLOR_BLDCYN"
+    ])
+  ])
+])
+
+# AE_PPRINT_SET_INDENT(indent): sets the current indentation.
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_SET_INDENT], [
+  m4_define([AE_PPRINT_CONFIG_INDENT], [$1])
+])
+
+# AE_PPRINT_SET_TS(ts): sets the current tab stop.
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_SET_TS], [
+  m4_define([AE_PPRINT_CONFIG_TS], [$1])
+])
+
+# AE_PPRINT_SUBTITLE(subtitle): pretty prints a subtitle.
+#
+# The subtitle is put as is in a double-quoted shell string so the user
+# needs to escape ".
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_SUBTITLE], [
+  AS_ECHO(["${AE_PPRINT_COLOR_SUBTITLE}$1$AE_PPRINT_COLOR_RST"])
+])
+
+AC_DEFUN([_AE_PPRINT_INDENT], [
+  m4_if(AE_PPRINT_CONFIG_INDENT, 0, [
+  ], [
+    m4_for([ae_pprint_i], [0], m4_eval(AE_PPRINT_CONFIG_INDENT * 2 - 1), [1], [
+      AS_ECHO_N([" "])
+    ])
+  ])
+])
+
+# AE_PPRINT_PROP_STRING(title, value, title_color?): pretty prints a
+# string property.
+#
+# The title is put as is in a double-quoted shell string so the user
+# needs to escape ".
+#
+# The $AE_PPRINT_CONFIG_INDENT variable must be set to the desired indentation
+# level.
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_PROP_STRING], [
+  m4_pushdef([ae_pprint_title], [$1])
+  m4_pushdef([ae_pprint_value], [$2])
+  m4_pushdef([ae_pprint_title_color], m4_default([$3], []))
+  m4_pushdef([ae_pprint_title_len], m4_len(ae_pprint_title))
+  m4_pushdef([ae_pprint_spaces_cnt], m4_eval(AE_PPRINT_CONFIG_TS - ae_pprint_title_len - (AE_PPRINT_CONFIG_INDENT * 2) - 1))
+
+  m4_if(m4_eval(ae_pprint_spaces_cnt <= 0), [1], [
+    m4_define([ae_pprint_spaces_cnt], [1])
+  ])
+
+  m4_pushdef([ae_pprint_spaces], [])
+
+  m4_for([ae_pprint_i], 0, m4_eval(ae_pprint_spaces_cnt - 1), [1], [
+    m4_append([ae_pprint_spaces], [ ])
+  ])
+
+  _AE_PPRINT_INDENT
+
+  AS_ECHO_N(["ae_pprint_title_color""ae_pprint_title$AE_PPRINT_COLOR_RST:ae_pprint_spaces"])
+  AS_ECHO(["${AE_PPRINT_COLOR_BLD}ae_pprint_value$AE_PPRINT_COLOR_RST"])
+
+  m4_popdef([ae_pprint_spaces])
+  m4_popdef([ae_pprint_spaces_cnt])
+  m4_popdef([ae_pprint_title_len])
+  m4_popdef([ae_pprint_title_color])
+  m4_popdef([ae_pprint_value])
+  m4_popdef([ae_pprint_title])
+])
+
+# AE_PPRINT_PROP_BOOL(title, value, title_color?): pretty prints a boolean
+# property.
+#
+# The title is put as is in a double-quoted shell string so the user
+# needs to escape ".
+#
+# The value is evaluated at shell runtime. Its evaluation must be
+# 0 (false) or 1 (true).
+#
+# Uses the AE_PPRINT_PROP_STRING() with the "yes" or "no" string.
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_PROP_BOOL], [
+  m4_pushdef([ae_pprint_title], [$1])
+  m4_pushdef([ae_pprint_value], [$2])
+
+  test ae_pprint_value -eq 0 && ae_pprint_msg="$AE_PPRINT_NO_MSG" || ae_pprint_msg="$AE_PPRINT_YES_MSG"
+
+  m4_if([$#], [3], [
+    AE_PPRINT_PROP_STRING(ae_pprint_title, [$ae_pprint_msg], $3)
+  ], [
+    AE_PPRINT_PROP_STRING(ae_pprint_title, [$ae_pprint_msg])
+  ])
+
+  m4_popdef([ae_pprint_value])
+  m4_popdef([ae_pprint_title])
+])
+
+# AE_PPRINT_PROP_BOOL_CUSTOM(title, value, no_msg, title_color?): pretty prints a boolean
+# property.
+#
+# The title is put as is in a double-quoted shell string so the user
+# needs to escape ".
+#
+# The value is evaluated at shell runtime. Its evaluation must be
+# 0 (false) or 1 (true).
+#
+# Uses the AE_PPRINT_PROP_STRING() with the "yes" or "no" string.
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_PROP_BOOL_CUSTOM], [
+  m4_pushdef([ae_pprint_title], [$1])
+  m4_pushdef([ae_pprint_value], [$2])
+  m4_pushdef([ae_pprint_value_no_msg], [$3])
+
+  test ae_pprint_value -eq 0 && ae_pprint_msg="$AE_PPRINT_NO_MSG (ae_pprint_value_no_msg)" || ae_pprint_msg="$AE_PPRINT_YES_MSG"
+
+  m4_if([$#], [4], [
+    AE_PPRINT_PROP_STRING(ae_pprint_title, [$ae_pprint_msg], $4)
+  ], [
+    AE_PPRINT_PROP_STRING(ae_pprint_title, [$ae_pprint_msg])
+  ])
+
+  m4_popdef([ae_pprint_value_no_msg])
+  m4_popdef([ae_pprint_value])
+  m4_popdef([ae_pprint_title])
+])
+
+# AE_PPRINT_WARN(msg): pretty prints a warning message.
+#
+# The message is put as is in a double-quoted shell string so the user
+# needs to escape ".
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_WARN], [
+  m4_pushdef([ae_pprint_msg], [$1])
+
+  _AE_PPRINT_INDENT
+  AS_ECHO(["${AE_PPRINT_COLOR_TXTYLW}WARNING:$AE_PPRINT_COLOR_RST ${AE_PPRINT_COLOR_BLDYLW}ae_pprint_msg$AE_PPRINT_COLOR_RST"])
+
+  m4_popdef([ae_pprint_msg])
+])
+
+# AE_PPRINT_ERROR(msg): pretty prints an error message and exits.
+#
+# The message is put as is in a double-quoted shell string so the user
+# needs to escape ".
+#
+# Use AE_PPRINT_INIT() before using this macro.
+AC_DEFUN([AE_PPRINT_ERROR], [
+  m4_pushdef([ae_pprint_msg], [$1])
+
+  AC_MSG_ERROR([${AE_PPRINT_COLOR_BLDRED}ae_pprint_msg$AE_PPRINT_COLOR_RST])
+
+  m4_popdef([ae_pprint_msg])
+])
index 9c856356c0cda65b4df891e05314cbc74e719bcf..29d86e0fe876dc12d18b09d9fd8945fb6c74ab93 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: FSFAP
 # ============================================================================
 #  https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
 # ============================================================================
index dd6d8b61406c32a1822760b8835062a7d6b1a156..e1ea0fc46b6da517e04bb3c3fa40b891aebd88f0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: FSFAP
 # ===========================================================================
 #      https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
 # ===========================================================================
index 6a1ede15e6315876712dc0007100ea298028b593..98999e11f63d90d671631316db9e47bde4bb7738 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
 # ===========================================================================
 #    https://www.gnu.org/software/autoconf-archive/ax_c___attribute__.html
 # ===========================================================================
index bd753b34d7dc57063b0b65f1441dde0889e1cd26..8f62565e9a60f9511bf8ead4671b6f3b1bd97996 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: FSFAP
 # ===========================================================================
 #  https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
 # ===========================================================================
index 9413da624d2545123501b7788b7ac6d96fd322e8..c081ffacc03ace7b740b4a33a8b68dab4cd8dae7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: FSFAP
 # ===========================================================================
 #  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
 # ===========================================================================
@@ -10,8 +11,8 @@
 #
 #   Check for baseline language coverage in the compiler for the specified
 #   version of the C++ standard.  If necessary, add switches to CXX and
-#   CXXCPP to enable support.  VERSION may be '11' (for the C++11 standard)
-#   or '14' (for the C++14 standard).
+#   CXXCPP to enable support.  VERSION may be '11', '14', '17', or '20' for
+#   the respective C++ standard version.
 #
 #   The second argument, if specified, indicates whether you insist on an
 #   extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
 #   Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
 #   Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
 #   Copyright (c) 2020 Jason Merrill <jason@redhat.com>
+#   Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved.  This file is offered as-is, without any
 #   warranty.
 
-#serial 12
+#serial 18
 
 dnl  This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
 dnl  (serial version number 13).
@@ -51,6 +53,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
   m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
         [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
         [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
+        [$1], [20], [ax_cxx_compile_alternatives="20"],
         [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
   m4_if([$2], [], [],
         [$2], [ext], [],
@@ -102,9 +105,18 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
     dnl HP's aCC needs +std=c++11 according to:
     dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
     dnl Cray's crayCC needs "-h std=c++11"
+    dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
     for alternative in ${ax_cxx_compile_alternatives}; do
-      for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
-        cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+      for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do
+        if test x"$switch" = xMSVC; then
+          dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide
+          dnl with -std=c++17.  We suffix the cache variable name with _MSVC to
+          dnl avoid this.
+          switch=-std:c++${alternative}
+          cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC])
+        else
+          cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+        fi
         AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
                        $cachevar,
           [ac_save_CXX="$CXX"
@@ -151,7 +163,6 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
   _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
 )
 
-
 dnl  Test body for checking C++14 support
 
 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
@@ -159,12 +170,24 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
   _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
 )
 
+dnl  Test body for checking C++17 support
+
 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
   _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
   _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
   _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
 )
 
+dnl  Test body for checking C++20 support
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20],
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
+  _AX_CXX_COMPILE_STDCXX_testbody_new_in_20
+)
+
+
 dnl  Tests for new features in C++11
 
 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
@@ -176,7 +199,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201103L
+// MSVC always sets __cplusplus to 199711L in older versions; newer versions
+// only set it correctly if /Zc:__cplusplus is specified as well as a
+// /std:c++NN switch:
+// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
+#elif __cplusplus < 201103L && !defined _MSC_VER
 
 #error "This is not a C++11 compiler"
 
@@ -467,7 +494,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201402L
+#elif __cplusplus < 201402L && !defined _MSC_VER
 
 #error "This is not a C++14 compiler"
 
@@ -591,7 +618,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
 
 #error "This is not a C++ compiler"
 
-#elif __cplusplus < 201703L
+#elif __cplusplus < 201703L && !defined _MSC_VER
 
 #error "This is not a C++17 compiler"
 
@@ -957,6 +984,36 @@ namespace cxx17
 
 }  // namespace cxx17
 
-#endif  // __cplusplus < 201703L
+#endif  // __cplusplus < 201703L && !defined _MSC_VER
+
+]])
+
+
+dnl  Tests for new features in C++20
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 202002L && !defined _MSC_VER
+
+#error "This is not a C++20 compiler"
+
+#else
+
+#include <version>
+
+namespace cxx20
+{
+
+// As C++20 supports feature test macros in the standard, there is no
+// immediate need to actually test for feature availability on the
+// Autoconf side.
+
+}  // namespace cxx20
+
+#endif  // __cplusplus < 202002L && !defined _MSC_VER
 
 ]])
index 507f182a8745f2d1327a74f80376136ec8aab7bd..db15ab983a1c3f32dd94a5d393ef001f8761d031 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
 # ===========================================================================
 #        https://www.gnu.org/software/autoconf-archive/ax_pthread.html
 # ===========================================================================
 #   flags that are needed. (The user can also force certain compiler
 #   flags/libs to be tested by setting these environment variables.)
 #
-#   Also sets PTHREAD_CC to any special C compiler that is needed for
-#   multi-threaded programs (defaults to the value of CC otherwise). (This
-#   is necessary on AIX to use the special cc_r compiler alias.)
+#   Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
+#   needed for multi-threaded programs (defaults to the value of CC
+#   respectively CXX otherwise). (This is necessary on e.g. AIX to use the
+#   special cc_r/CC_r compiler alias.)
 #
 #   NOTE: You are assumed to not only compile your program with these flags,
 #   but also to link with them as well. For example, you might link with
 #   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#   $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
 #
 #   If you are only building threaded programs, you may wish to use these
 #   variables in your default LIBS, CFLAGS, and CC:
 #
 #     LIBS="$PTHREAD_LIBS $LIBS"
 #     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+#     CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
 #     CC="$PTHREAD_CC"
+#     CXX="$PTHREAD_CXX"
 #
 #   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
 #   has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
@@ -83,7 +88,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 27
+#serial 31
 
 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
 AC_DEFUN([AX_PTHREAD], [
@@ -105,6 +110,7 @@ if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
         ax_pthread_save_CFLAGS="$CFLAGS"
         ax_pthread_save_LIBS="$LIBS"
         AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
+        AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
         LIBS="$PTHREAD_LIBS $LIBS"
         AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
@@ -482,18 +488,28 @@ if test "x$ax_pthread_ok" = "xyes"; then
                     [#handle absolute path differently from PATH based program lookup
                      AS_CASE(["x$CC"],
                          [x/*],
-                         [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
-                         [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
+                         [
+                          AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
+                          AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
+                        ],
+                         [
+                          AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
+                          AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
+                        ]
+                     )
+                    ])
                 ;;
             esac
         fi
 fi
 
 test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
 
 AC_SUBST([PTHREAD_LIBS])
 AC_SUBST([PTHREAD_CFLAGS])
 AC_SUBST([PTHREAD_CC])
+AC_SUBST([PTHREAD_CXX])
 
 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 if test "x$ax_pthread_ok" = "xyes"; then
index 17c3eab7dafde6c1358c7c189bbe44a6e14995a7..6de1b2a5a2f068825b69b1f4940aff49a6947989 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: FSFAP
 # ===========================================================================
 #    https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
 # ===========================================================================
diff --git a/m4/pprint.m4 b/m4/pprint.m4
deleted file mode 100644 (file)
index a7cfd94..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-# Pretty printing macros.
-#
-# Author: Philippe Proulx <pproulx@efficios.com>
-
-#serial 1
-
-# PPRINT_INIT(): initializes the pretty printing system.
-#
-# Use this macro before using any other PPRINT_* macro.
-AC_DEFUN([PPRINT_INIT], [
-  m4_define([PPRINT_CONFIG_TS], [50])
-  m4_define([PPRINT_CONFIG_INDENT], [2])
-  PPRINT_YES_MSG=yes
-  PPRINT_NO_MSG=no
-
-  # find tput, which tells us if colors are supported and gives us color codes
-  AC_PATH_PROG([pprint_tput], [tput])
-
-  AS_IF([test -n "$pprint_tput"], [
-    AS_IF([test -n "$PS1" && test `"$pprint_tput" colors` -eq 256 && test -t 1], [
-      # interactive shell and colors supported and standard output
-      # file descriptor is opened on a terminal
-      PPRINT_COLOR_TXTBLK="`"$pprint_tput" setaf 0`"
-      PPRINT_COLOR_TXTBLU="`"$pprint_tput" setaf 4`"
-      PPRINT_COLOR_TXTGRN="`"$pprint_tput" setaf 2`"
-      PPRINT_COLOR_TXTCYN="`"$pprint_tput" setaf 6`"
-      PPRINT_COLOR_TXTRED="`"$pprint_tput" setaf 1`"
-      PPRINT_COLOR_TXTPUR="`"$pprint_tput" setaf 5`"
-      PPRINT_COLOR_TXTYLW="`"$pprint_tput" setaf 3`"
-      PPRINT_COLOR_TXTWHT="`"$pprint_tput" setaf 7`"
-      PPRINT_COLOR_BLD=`"$pprint_tput" bold`
-      PPRINT_COLOR_BLDBLK="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTBLK"
-      PPRINT_COLOR_BLDBLU="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTBLU"
-      PPRINT_COLOR_BLDGRN="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTGRN"
-      PPRINT_COLOR_BLDCYN="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTCYN"
-      PPRINT_COLOR_BLDRED="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTRED"
-      PPRINT_COLOR_BLDPUR="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTPUR"
-      PPRINT_COLOR_BLDYLW="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTYLW"
-      PPRINT_COLOR_BLDWHT="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTWHT"
-      PPRINT_COLOR_RST="`"$pprint_tput" sgr0`"
-
-      # colored yes and no
-      PPRINT_YES_MSG="$PPRINT_COLOR_BLDGRN$PPRINT_YES_MSG$PPRINT_COLOR_RST"
-      PPRINT_NO_MSG="$PPRINT_COLOR_BLDRED$PPRINT_NO_MSG$PPRINT_COLOR_RST"
-
-      # subtitle color
-      PPRINT_COLOR_SUBTITLE="$PPRINT_COLOR_BLDCYN"
-    ])
-  ])
-])
-
-# PPRINT_SET_INDENT(indent): sets the current indentation.
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_SET_INDENT], [
-  m4_define([PPRINT_CONFIG_INDENT], [$1])
-])
-
-# PPRINT_SET_TS(ts): sets the current tab stop.
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_SET_TS], [
-  m4_define([PPRINT_CONFIG_TS], [$1])
-])
-
-# PPRINT_SUBTITLE(subtitle): pretty prints a subtitle.
-#
-# The subtitle is put as is in a double-quoted shell string so the user
-# needs to escape ".
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_SUBTITLE], [
-  AS_ECHO(["${PPRINT_COLOR_SUBTITLE}$1$PPRINT_COLOR_RST"])
-])
-
-AC_DEFUN([_PPRINT_INDENT], [
-  m4_if(PPRINT_CONFIG_INDENT, 0, [
-  ], [
-    m4_for([pprint_i], [0], m4_eval(PPRINT_CONFIG_INDENT * 2 - 1), [1], [
-      AS_ECHO_N([" "])
-    ])
-  ])
-])
-
-# PPRINT_PROP_STRING(title, value, title_color?): pretty prints a
-# string property.
-#
-# The title is put as is in a double-quoted shell string so the user
-# needs to escape ".
-#
-# The $PPRINT_CONFIG_INDENT variable must be set to the desired indentation
-# level.
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_PROP_STRING], [
-  m4_pushdef([pprint_title], [$1])
-  m4_pushdef([pprint_value], [$2])
-  m4_pushdef([pprint_title_color], m4_default([$3], []))
-  m4_pushdef([pprint_title_len], m4_len(pprint_title))
-  m4_pushdef([pprint_spaces_cnt], m4_eval(PPRINT_CONFIG_TS - pprint_title_len - (PPRINT_CONFIG_INDENT * 2) - 1))
-
-  m4_if(m4_eval(pprint_spaces_cnt <= 0), [1], [
-    m4_define([pprint_spaces_cnt], [1])
-  ])
-
-  m4_pushdef([pprint_spaces], [])
-
-  m4_for([pprint_i], 0, m4_eval(pprint_spaces_cnt - 1), [1], [
-    m4_append([pprint_spaces], [ ])
-  ])
-
-  _PPRINT_INDENT
-
-  AS_ECHO_N(["pprint_title_color""pprint_title$PPRINT_COLOR_RST:pprint_spaces"])
-  AS_ECHO(["${PPRINT_COLOR_BLD}pprint_value$PPRINT_COLOR_RST"])
-
-  m4_popdef([pprint_spaces])
-  m4_popdef([pprint_spaces_cnt])
-  m4_popdef([pprint_title_len])
-  m4_popdef([pprint_title_color])
-  m4_popdef([pprint_value])
-  m4_popdef([pprint_title])
-])
-
-# PPRINT_PROP_BOOL(title, value, title_color?): pretty prints a boolean
-# property.
-#
-# The title is put as is in a double-quoted shell string so the user
-# needs to escape ".
-#
-# The value is evaluated at shell runtime. Its evaluation must be
-# 0 (false) or 1 (true).
-#
-# Uses the PPRINT_PROP_STRING() with the "yes" or "no" string.
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_PROP_BOOL], [
-  m4_pushdef([pprint_title], [$1])
-  m4_pushdef([pprint_value], [$2])
-
-  test pprint_value -eq 0 && pprint_msg="$PPRINT_NO_MSG" || pprint_msg="$PPRINT_YES_MSG"
-
-  m4_if([$#], [3], [
-    PPRINT_PROP_STRING(pprint_title, [$pprint_msg], $3)
-  ], [
-    PPRINT_PROP_STRING(pprint_title, [$pprint_msg])
-  ])
-
-  m4_popdef([pprint_value])
-  m4_popdef([pprint_title])
-])
-
-# PPRINT_PROP_BOOL_CUSTOM(title, value, no_msg, title_color?): pretty prints a boolean
-# property.
-#
-# The title is put as is in a double-quoted shell string so the user
-# needs to escape ".
-#
-# The value is evaluated at shell runtime. Its evaluation must be
-# 0 (false) or 1 (true).
-#
-# Uses the PPRINT_PROP_STRING() with the "yes" or "no" string.
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_PROP_BOOL_CUSTOM], [
-  m4_pushdef([pprint_title], [$1])
-  m4_pushdef([pprint_value], [$2])
-  m4_pushdef([pprint_value_no_msg], [$3])
-
-  test pprint_value -eq 0 && pprint_msg="$PPRINT_NO_MSG (pprint_value_no_msg)" || pprint_msg="$PPRINT_YES_MSG"
-
-  m4_if([$#], [4], [
-    PPRINT_PROP_STRING(pprint_title, [$pprint_msg], $4)
-  ], [
-    PPRINT_PROP_STRING(pprint_title, [$pprint_msg])
-  ])
-
-  m4_popdef([pprint_value_no_msg])
-  m4_popdef([pprint_value])
-  m4_popdef([pprint_title])
-])
-
-# PPRINT_WARN(msg): pretty prints a warning message.
-#
-# The message is put as is in a double-quoted shell string so the user
-# needs to escape ".
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_WARN], [
-  m4_pushdef([pprint_msg], [$1])
-
-  _PPRINT_INDENT
-  AS_ECHO(["${PPRINT_COLOR_TXTYLW}WARNING:$PPRINT_COLOR_RST ${PPRINT_COLOR_BLDYLW}pprint_msg$PPRINT_COLOR_RST"])
-
-  m4_popdef([pprint_msg])
-])
-
-# PPRINT_ERROR(msg): pretty prints an error message and exits.
-#
-# The message is put as is in a double-quoted shell string so the user
-# needs to escape ".
-#
-# Use PPRINT_INIT() before using this macro.
-AC_DEFUN([PPRINT_ERROR], [
-  m4_pushdef([pprint_msg], [$1])
-
-  AC_MSG_ERROR([${PPRINT_COLOR_BLDRED}pprint_msg$PPRINT_COLOR_RST])
-
-  m4_popdef([pprint_msg])
-])
index 3d150486ffcbf4ba9622b3166067411d279ff968..3f065b4c71b9d1589f40b443429e53b9a5cd1ceb 100755 (executable)
@@ -1,25 +1,13 @@
 #!/bin/sh
+
+# SPDX-FileCopyrightText: 2013 IBM Corporation
 #
+# SPDX-License-Identifier: GPL-2.0-or-later
+
 # Run in userspace-rcu git archive.  Prints out a list of API members
 # and the version in which they were introduced.  You need to list all
 # the API members immediately below. Depends on "cscope".
-#
-# This program is 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 2 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright (C) IBM Corporation, 2013
-#
+
 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
 
 api="caa_container_of \
index cf6c32c6cad3628937cee581193032725ddd600a..b555c8181f61b1bbe53e6573ff5fcd9fa38a919d 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 AM_CPPFLAGS += -I$(top_srcdir)/src
 
 #Add the -version-info directly here since we are only building
@@ -5,7 +9,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/src
 AM_LDFLAGS=-version-info $(URCU_LIBRARY_VERSION) $(LT_NO_UNDEFINED)
 
 dist_noinst_HEADERS = urcu-die.h urcu-wait.h compat-getcpu.h \
-       compat-rand.h urcu-utils.h compat-smp.h
+       urcu-utils.h compat-smp.h
 
 COMPAT = compat_arch.c compat_futex.c
 
@@ -14,7 +18,7 @@ RCULFHASH = rculfhash.c rculfhash-mm-order.c rculfhash-mm-chunk.c \
 
 lib_LTLIBRARIES = liburcu-common.la \
                liburcu.la liburcu-qsbr.la \
-               liburcu-mb.la liburcu-signal.la liburcu-bp.la \
+               liburcu-mb.la liburcu-bp.la \
                liburcu-memb.la liburcu-cds.la
 
 #
@@ -39,10 +43,6 @@ liburcu_mb_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT)
 liburcu_mb_la_CFLAGS = -DRCU_MB $(AM_CFLAGS)
 liburcu_mb_la_LIBADD = liburcu-common.la
 
-liburcu_signal_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT)
-liburcu_signal_la_CFLAGS = -DRCU_SIGNAL $(AM_CFLAGS)
-liburcu_signal_la_LIBADD = liburcu-common.la
-
 liburcu_bp_la_SOURCES = urcu-bp.c urcu-pointer.c $(COMPAT)
 liburcu_bp_la_LIBADD = liburcu-common.la
 
@@ -52,9 +52,10 @@ liburcu_cds_la_LIBADD = liburcu-common.la
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = liburcu-cds.pc liburcu.pc liburcu-bp.pc liburcu-qsbr.pc \
-       liburcu-signal.pc liburcu-mb.pc liburcu-memb.pc
+       liburcu-mb.pc liburcu-memb.pc
 
 EXTRA_DIST = \
        urcu-call-rcu-impl.h \
        urcu-defer-impl.h \
+       urcu-poll-impl.h \
        rculfhash-internal.h
index 3c1899b28d38f4876467e3e685136d2fa0fa217f..ad5ec117a324eb7d977b26e19e43a4848f47551e 100644 (file)
@@ -1,26 +1,10 @@
+// SPDX-FileCopyrightText: 2015 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _COMPAT_GETCPU_H
 #define _COMPAT_GETCPU_H
 
-/*
- * compat-getcpu.h
- *
- * Copyright (c) 2015 Michael Jeanson <mjeanson@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
 #if defined(HAVE_SCHED_GETCPU)
 #include <sched.h>
 
diff --git a/src/compat-rand.h b/src/compat-rand.h
deleted file mode 100644 (file)
index 835d99b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _COMPAT_RAND_H
-#define _COMPAT_RAND_H
-
-/*
- * compat-rand.h
- *
- * Userspace RCU library - rand/rand_r Compatibility Header
- *
- * Copyright 1996 - Ulrich Drepper <drepper@cygnus.com >
- * Copyright 2013 - Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
- *
- * Note: this file is only used to simplify the code required to
- * use the 'rand_r(...)' system function across multiple platforms,
- * which might not always be referenced the same way.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef HAVE_RAND_R
-/*
- * Reentrant random function from POSIX.1c.
- * Copyright (C) 1996, 1999 Free Software Foundation, Inc.
- * This file is part of the GNU C Library.
- * Contributed by Ulrich Drepper <drepper@cygnus.com <mailto:drepper@cygnus.com>>, 1996.
- */
-static inline int rand_r(unsigned int *seed)
-{
-       unsigned int next = *seed;
-       int result;
-
-       next *= 1103515245;
-       next += 12345;
-       result = (unsigned int) (next / 65536) % 2048;
-
-       next *= 1103515245;
-       next += 12345;
-       result <<= 10;
-       result ^= (unsigned int) (next / 65536) % 1024;
-
-       next *= 1103515245;
-       next += 12345;
-       result <<= 10;
-       result ^= (unsigned int) (next / 65536) % 1024;
-
-       *seed = next;
-
-       return result;
-}
-#endif /* HAVE_RAND_R */
-
-#endif /* _COMPAT_RAND_H */
index 50bdffbe4935ad4d595b40f3a774ea1c087fc21d..474a832811a4e2935f58d447cc2c3ea519ec89d5 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * compat_arch.c
- *
  * Userspace RCU library - architecture compatibility checks
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/arch.h>
index 9281138723da6a1ddefd67f91e37211ea10a53fd..151a40cbae2b9cfa8cc1528d5c7630c6a1c4bcd0 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * compat_futex.c
- *
  * Userspace RCU library - sys_futex compatibility code
- *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdio.h>
index c974a4768171c7cfa7dfde15566804d18419fc7c..5a2c80f71f347a7994e40310098f13430715dc5c 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * lfstack.c
- *
  * Userspace RCU library - Lock-Free Stack
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
index 7cba58a54e2c7081e3db1a326897e29b82016091..4f89fc2ea6f5487d724678cf66d97eaee595291c 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
index 1cb19b60c3b3de87838957dfe14723c15f598bbb..945666c5e1cb40564bd7bbaa9aa4979c1966f25c 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
index 16847012dad86ed0716936eb0bcbf9e6bb1e7c03..fcd32e056f0a25574a247194a856be1c2d3cdea0 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
index 5fb8476684f7b6f7849cea7da11f3a440e96e8c0..b72008d4a540bcbf0287c63723242dc22f1c5940 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
index d123a1086f91237913907ab3348672ac09854b10..2dc69985e103eadd88c426f4ebddf9009aaa9152 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
diff --git a/src/liburcu-signal.pc.in b/src/liburcu-signal.pc.in
deleted file mode 100644 (file)
index 844c449..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Userspace RCU signal
-Description: A userspace RCU (read-copy-update) library, signal version
-Version: @PACKAGE_VERSION@
-Requires:
-Libs: -L${libdir} -lurcu-common -lurcu-signal
-Cflags: -I${includedir} 
index b9f812b333f440434642380a776dba17e2e5a915..8f738aee78121e571c8097576d92c9d7f1eca433 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
index e17210b8624cf7fd370ef88f591174e100085548..7225ec99e90f27824d71b8647fc4495a2e3f24d3 100644 (file)
@@ -1,27 +1,13 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFHASH_INTERNAL_H
 #define _URCU_RCULFHASH_INTERNAL_H
 
 /*
- * urcu/rculfhash-internal.h
- *
  * Internal header for Lock-Free RCU Hash Table
- *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/assert.h>
@@ -29,6 +15,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "workqueue.h"
+
 #ifdef DEBUG
 #define dbg_printf(fmt, args...)     printf("[debug rculfhash] " fmt, ## args)
 #else
@@ -71,6 +59,7 @@ struct cds_lfht {
        /* Initial configuration items */
        unsigned long max_nr_buckets;
        const struct cds_lfht_mm_type *mm;      /* memory management plugin */
+       const struct cds_lfht_alloc *alloc;     /* memory allocator for mm */
        const struct rcu_flavor_struct *flavor; /* RCU flavor */
 
        long count;                     /* global approximate item count */
@@ -82,11 +71,13 @@ struct cds_lfht {
         * therefore cause grace-period deadlock if we hold off RCU G.P.
         * completion.
         */
-       pthread_mutex_t resize_mutex;   /* resize mutex: add/del mutex */
-       pthread_attr_t *resize_attr;    /* Resize threads attributes */
+       pthread_mutex_t resize_mutex;           /* resize mutex: add/del mutex */
+       pthread_attr_t *caller_resize_attr;     /* resize threads attributes from lfht_new caller */
+       pthread_attr_t resize_attr;
        unsigned int in_progress_destroy;
        unsigned long resize_target;
        int resize_initiated;
+       struct urcu_work destroy_work;
 
        /*
         * Variables needed for add and remove fast-paths.
@@ -149,30 +140,32 @@ extern unsigned int cds_lfht_fls_ulong(unsigned long x);
 extern int cds_lfht_get_count_order_ulong(unsigned long x);
 
 #ifdef POISON_FREE
-#define poison_free(ptr)                                       \
+#define poison_free(alloc, ptr)                                        \
        do {                                                    \
                if (ptr) {                                      \
                        memset(ptr, 0x42, sizeof(*(ptr)));      \
-                       free(ptr);                              \
+                       alloc->free(alloc->state, ptr);                         \
                }                                               \
        } while (0)
 #else
-#define poison_free(ptr)       free(ptr)
+#define poison_free(alloc, ptr)        alloc->free(alloc->state, ptr)
 #endif
 
 static inline
 struct cds_lfht *__default_alloc_cds_lfht(
                const struct cds_lfht_mm_type *mm,
+               const struct cds_lfht_alloc *alloc,
                unsigned long cds_lfht_size,
                unsigned long min_nr_alloc_buckets,
                unsigned long max_nr_buckets)
 {
        struct cds_lfht *ht;
 
-       ht = calloc(1, cds_lfht_size);
+       ht = alloc->calloc(alloc->state, 1, cds_lfht_size);
        urcu_posix_assert(ht);
 
        ht->mm = mm;
+       ht->alloc = alloc;
        ht->bucket_at = mm->bucket_at;
        ht->min_nr_alloc_buckets = min_nr_alloc_buckets;
        ht->min_alloc_buckets_order =
index 9273ac9755c295cf29d5006698827da821ad2ef3..93931ee7a7e773dbd6fcf92917c6cfac1cfe2306 100644 (file)
@@ -1,42 +1,28 @@
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * rculfhash-mm-chunk.c
- *
  * Chunk based memory management for Lock-Free RCU Hash Table
- *
- * Copyright 2011 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stddef.h>
 #include <urcu/assert.h>
-#include <rculfhash-internal.h>
+#include "rculfhash-internal.h"
 
 static
 void cds_lfht_alloc_bucket_table(struct cds_lfht *ht, unsigned long order)
 {
        if (order == 0) {
-               ht->tbl_chunk[0] = calloc(ht->min_nr_alloc_buckets,
-                       sizeof(struct cds_lfht_node));
+               ht->tbl_chunk[0] = ht->alloc->calloc(ht->alloc->state,
+                       ht->min_nr_alloc_buckets, sizeof(struct cds_lfht_node));
                urcu_posix_assert(ht->tbl_chunk[0]);
        } else if (order > ht->min_alloc_buckets_order) {
                unsigned long i, len = 1UL << (order - 1 - ht->min_alloc_buckets_order);
 
                for (i = len; i < 2 * len; i++) {
-                       ht->tbl_chunk[i] = calloc(ht->min_nr_alloc_buckets,
-                               sizeof(struct cds_lfht_node));
+                       ht->tbl_chunk[i] = ht->alloc->calloc(ht->alloc->state,
+                               ht->min_nr_alloc_buckets, sizeof(struct cds_lfht_node));
                        urcu_posix_assert(ht->tbl_chunk[i]);
                }
        }
@@ -52,12 +38,12 @@ static
 void cds_lfht_free_bucket_table(struct cds_lfht *ht, unsigned long order)
 {
        if (order == 0)
-               poison_free(ht->tbl_chunk[0]);
+               poison_free(ht->alloc, ht->tbl_chunk[0]);
        else if (order > ht->min_alloc_buckets_order) {
                unsigned long i, len = 1UL << (order - 1 - ht->min_alloc_buckets_order);
 
                for (i = len; i < 2 * len; i++)
-                       poison_free(ht->tbl_chunk[i]);
+                       poison_free(ht->alloc, ht->tbl_chunk[i]);
        }
        /* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */
 }
@@ -74,7 +60,7 @@ struct cds_lfht_node *bucket_at(struct cds_lfht *ht, unsigned long index)
 
 static
 struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets,
-               unsigned long max_nr_buckets)
+               unsigned long max_nr_buckets, const struct cds_lfht_alloc *alloc)
 {
        unsigned long nr_chunks, cds_lfht_size;
 
@@ -86,7 +72,7 @@ struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets,
        cds_lfht_size = max(cds_lfht_size, sizeof(struct cds_lfht));
 
        return __default_alloc_cds_lfht(
-                       &cds_lfht_mm_chunk, cds_lfht_size,
+                       &cds_lfht_mm_chunk, alloc, cds_lfht_size,
                        min_nr_alloc_buckets, max_nr_buckets);
 }
 
index 4bce972094881bf3d8dc031be87241cd933b18c4..2b4bc421bae0d48050c1b93e942b8c303069b2ee 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * rculfhash-mm-mmap.c
- *
  * mmap/reservation based memory management for Lock-Free RCU Hash Table
- *
- * Copyright 2011 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <unistd.h>
@@ -132,8 +118,8 @@ void cds_lfht_alloc_bucket_table(struct cds_lfht *ht, unsigned long order)
        if (order == 0) {
                if (ht->min_nr_alloc_buckets == ht->max_nr_buckets) {
                        /* small table */
-                       ht->tbl_mmap = calloc(ht->max_nr_buckets,
-                                       sizeof(*ht->tbl_mmap));
+                       ht->tbl_mmap = ht->alloc->calloc(ht->alloc->state,
+                                       ht->max_nr_buckets, sizeof(*ht->tbl_mmap));
                        urcu_posix_assert(ht->tbl_mmap);
                        return;
                }
@@ -164,7 +150,7 @@ void cds_lfht_free_bucket_table(struct cds_lfht *ht, unsigned long order)
        if (order == 0) {
                if (ht->min_nr_alloc_buckets == ht->max_nr_buckets) {
                        /* small table */
-                       poison_free(ht->tbl_mmap);
+                       poison_free(ht->alloc, ht->tbl_mmap);
                        return;
                }
                /* large table */
@@ -188,7 +174,7 @@ struct cds_lfht_node *bucket_at(struct cds_lfht *ht, unsigned long index)
 
 static
 struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets,
-               unsigned long max_nr_buckets)
+               unsigned long max_nr_buckets, const struct cds_lfht_alloc *alloc)
 {
        unsigned long page_bucket_size;
 
@@ -203,7 +189,7 @@ struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets,
        }
 
        return __default_alloc_cds_lfht(
-                       &cds_lfht_mm_mmap, sizeof(struct cds_lfht),
+                       &cds_lfht_mm_mmap, alloc, sizeof(struct cds_lfht),
                        min_nr_alloc_buckets, max_nr_buckets);
 }
 
index a182a838867b9388a193845c856539bdf892955a..2b0f707ef05ca77703e9de6c19cb55f5068cb948 100644 (file)
@@ -1,39 +1,25 @@
+// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * rculfhash-mm-order.c
- *
  * Order based memory management for Lock-Free RCU Hash Table
- *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/assert.h>
-#include <rculfhash-internal.h>
+#include "rculfhash-internal.h"
 
 static
 void cds_lfht_alloc_bucket_table(struct cds_lfht *ht, unsigned long order)
 {
        if (order == 0) {
-               ht->tbl_order[0] = calloc(ht->min_nr_alloc_buckets,
-                       sizeof(struct cds_lfht_node));
+               ht->tbl_order[0] = ht->alloc->calloc(ht->alloc->state,
+                       ht->min_nr_alloc_buckets, sizeof(struct cds_lfht_node));
                urcu_posix_assert(ht->tbl_order[0]);
        } else if (order > ht->min_alloc_buckets_order) {
-               ht->tbl_order[order] = calloc(1UL << (order -1),
-                       sizeof(struct cds_lfht_node));
+               ht->tbl_order[order] = ht->alloc->calloc(ht->alloc->state,
+                       1UL << (order -1), sizeof(struct cds_lfht_node));
                urcu_posix_assert(ht->tbl_order[order]);
        }
        /* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */
@@ -48,9 +34,9 @@ static
 void cds_lfht_free_bucket_table(struct cds_lfht *ht, unsigned long order)
 {
        if (order == 0)
-               poison_free(ht->tbl_order[0]);
+               poison_free(ht->alloc, ht->tbl_order[0]);
        else if (order > ht->min_alloc_buckets_order)
-               poison_free(ht->tbl_order[order]);
+               poison_free(ht->alloc, ht->tbl_order[order]);
        /* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */
 }
 
@@ -76,10 +62,10 @@ struct cds_lfht_node *bucket_at(struct cds_lfht *ht, unsigned long index)
 
 static
 struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets,
-               unsigned long max_nr_buckets)
+               unsigned long max_nr_buckets, const struct cds_lfht_alloc *alloc)
 {
        return __default_alloc_cds_lfht(
-                       &cds_lfht_mm_order, sizeof(struct cds_lfht),
+                       &cds_lfht_mm_order, alloc, sizeof(struct cds_lfht),
                        min_nr_alloc_buckets, max_nr_buckets);
 }
 
index a41cac83a2f4fdc202b1b1821b98312f58d83018..10f5b8ed58a89c687421b72e513e218492299a0c 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * rculfhash.c
- *
  * Userspace RCU library - Lock-Free Resizable RCU Hash Table
- *
- * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /*
 #include <string.h>
 #include <sched.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 #include "compat-getcpu.h"
 #include <urcu/assert.h>
 #include <urcu/uatomic.h>
 #include <urcu/compiler.h>
 #include <urcu/rculfhash.h>
-#include <urcu/static/urcu-signal-nr.h>
-#include <rculfhash-internal.h>
 #include <stdio.h>
 #include <pthread.h>
 #include <signal.h>
+#include "rculfhash-internal.h"
 #include "workqueue.h"
 #include "urcu-die.h"
 #include "urcu-utils.h"
@@ -362,8 +348,12 @@ struct partition_resize_work {
                    unsigned long start, unsigned long len);
 };
 
+enum nr_cpus_mask_state {
+       NR_CPUS_MASK_INIT_FAILED = -2,
+       NR_CPUS_MASK_UNINITIALIZED = -1,
+};
+
 static struct urcu_workqueue *cds_lfht_workqueue;
-static unsigned long cds_lfht_workqueue_user_count;
 
 /*
  * Mutex ensuring mutual exclusion between workqueue initialization and
@@ -380,8 +370,8 @@ static struct urcu_atfork cds_lfht_atfork;
  */
 static int cds_lfht_workqueue_atfork_nesting;
 
+static void __attribute__((destructor)) cds_lfht_exit(void);
 static void cds_lfht_init_worker(const struct rcu_flavor_struct *flavor);
-static void cds_lfht_fini_worker(const struct rcu_flavor_struct *flavor);
 
 #ifdef CONFIG_CDS_LFHT_ITER_DEBUG
 
@@ -579,6 +569,50 @@ unsigned int cds_lfht_fls_ulong(unsigned long x)
 #endif
 }
 
+static void *cds_lfht_malloc(void *state __attribute__((unused)),
+               size_t size)
+{
+       return malloc(size);
+}
+
+static void *cds_lfht_calloc(void *state __attribute__((unused)),
+               size_t nmemb, size_t size)
+{
+       return calloc(nmemb, size);
+}
+
+static void *cds_lfht_realloc(void *state __attribute__((unused)),
+               void *ptr, size_t size)
+{
+       return realloc(ptr, size);
+}
+
+static void *cds_lfht_aligned_alloc(void *state __attribute__((unused)),
+               size_t alignment, size_t size)
+{
+       void *ptr;
+
+       if (posix_memalign(&ptr, alignment, size))
+               return NULL;
+       return ptr;
+}
+
+static void cds_lfht_free(void *state __attribute__((unused)), void *ptr)
+{
+       free(ptr);
+}
+
+
+/* Default memory allocator */
+static struct cds_lfht_alloc cds_lfht_default_alloc = {
+       .malloc = cds_lfht_malloc,
+       .calloc = cds_lfht_calloc,
+       .realloc = cds_lfht_realloc,
+       .aligned_alloc = cds_lfht_aligned_alloc,
+       .free = cds_lfht_free,
+       .state = NULL,
+};
+
 /*
  * Return the minimum order for which x <= (1UL << order).
  * Return -1 if x is 0.
@@ -624,9 +658,7 @@ static void mutex_lock(pthread_mutex_t *mutex)
                if (ret != EBUSY && ret != EINTR)
                        urcu_die(ret);
                if (CMM_LOAD_SHARED(URCU_TLS(rcu_reader).need_mb)) {
-                       cmm_smp_mb();
-                       _CMM_STORE_SHARED(URCU_TLS(rcu_reader).need_mb, 0);
-                       cmm_smp_mb();
+                       uatomic_store(&URCU_TLS(rcu_reader).need_mb, 0, CMM_SEQ_CST);
                }
                (void) poll(NULL, 0, 10);
        }
@@ -642,7 +674,7 @@ static void mutex_unlock(pthread_mutex_t *mutex)
                urcu_die(ret);
 }
 
-static long nr_cpus_mask = -1;
+static long nr_cpus_mask = NR_CPUS_MASK_UNINITIALIZED;
 static long split_count_mask = -1;
 static int split_count_order = -1;
 
@@ -652,7 +684,7 @@ static void ht_init_nr_cpus_mask(void)
 
        maxcpus = get_possible_cpus_array_len();
        if (maxcpus <= 0) {
-               nr_cpus_mask = -2;
+               nr_cpus_mask = NR_CPUS_MASK_INIT_FAILED;
                return;
        }
        /*
@@ -666,7 +698,7 @@ static void ht_init_nr_cpus_mask(void)
 static
 void alloc_split_items_count(struct cds_lfht *ht)
 {
-       if (nr_cpus_mask == -1) {
+       if (nr_cpus_mask == NR_CPUS_MASK_UNINITIALIZED) {
                ht_init_nr_cpus_mask();
                if (nr_cpus_mask < 0)
                        split_count_mask = DEFAULT_SPLIT_COUNT_MASK;
@@ -679,7 +711,7 @@ void alloc_split_items_count(struct cds_lfht *ht)
        urcu_posix_assert(split_count_mask >= 0);
 
        if (ht->flags & CDS_LFHT_ACCOUNTING) {
-               ht->split_count = calloc(split_count_mask + 1,
+               ht->split_count = ht->alloc->calloc(ht->alloc->state, split_count_mask + 1,
                                        sizeof(struct ht_items_count));
                urcu_posix_assert(ht->split_count);
        } else {
@@ -690,7 +722,7 @@ void alloc_split_items_count(struct cds_lfht *ht)
 static
 void free_split_items_count(struct cds_lfht *ht)
 {
-       poison_free(ht->split_count);
+       poison_free(ht->alloc, ht->split_count);
 }
 
 static
@@ -884,8 +916,10 @@ unsigned long _uatomic_xchg_monotonic_increase(unsigned long *ptr,
        old1 = uatomic_read(ptr);
        do {
                old2 = old1;
-               if (old2 >= v)
+               if (old2 >= v) {
+                       cmm_smp_mb();
                        return old2;
+               }
        } while ((old1 = uatomic_cmpxchg(ptr, old2, v)) != old2);
        return old2;
 }
@@ -1169,6 +1203,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
                struct cds_lfht_node *node)
 {
        struct cds_lfht_node *bucket, *next;
+       uintptr_t *node_next;
 
        if (!node)      /* Return -ENOENT if asked to delete NULL node */
                return -ENOENT;
@@ -1191,15 +1226,18 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
        /*
         * The del operation semantic guarantees a full memory barrier
         * before the uatomic_or atomic commit of the deletion flag.
-        */
-       cmm_smp_mb__before_uatomic_or();
-       /*
+        *
         * We set the REMOVED_FLAG unconditionally. Note that there may
         * be more than one concurrent thread setting this flag.
         * Knowing which wins the race will be known after the garbage
         * collection phase, stay tuned!
+        *
+        * NOTE: The node_next variable is present to avoid breaking
+        * strict-aliasing rules.
         */
-       uatomic_or(&node->next, REMOVED_FLAG);
+       node_next = (uintptr_t*)&node->next;
+       uatomic_or_mo(node_next, REMOVED_FLAG, CMM_RELEASE);
+
        /* We performed the (logical) deletion. */
 
        /*
@@ -1224,7 +1262,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
         * was already set).
         */
        if (!is_removal_owner(uatomic_xchg(&node->next,
-                       flag_removal_owner(node->next))))
+                       flag_removal_owner(uatomic_load(&node->next, CMM_RELAXED)))))
                return 0;
        else
                return -ENOENT;
@@ -1253,7 +1291,7 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
        unsigned long thread, nr_threads;
        sigset_t newmask, oldmask;
 
-       urcu_posix_assert(nr_cpus_mask != -1);
+       urcu_posix_assert(nr_cpus_mask != NR_CPUS_MASK_UNINITIALIZED);
        if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
                goto fallback;
 
@@ -1269,7 +1307,7 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
                nr_threads = 1;
        }
        partition_len = len >> cds_lfht_get_count_order_ulong(nr_threads);
-       work = calloc(nr_threads, sizeof(*work));
+       work = ht->alloc->calloc(ht->alloc->state, nr_threads, sizeof(*work));
        if (!work) {
                dbg_printf("error allocating for resize, single-threading\n");
                goto fallback;
@@ -1286,7 +1324,8 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
                work[thread].len = partition_len;
                work[thread].start = thread * partition_len;
                work[thread].fct = fct;
-               ret = pthread_create(&(work[thread].thread_id), ht->resize_attr,
+               ret = pthread_create(&(work[thread].thread_id),
+                       ht->caller_resize_attr ? &ht->resize_attr : NULL,
                        partition_resize_thread, &work[thread]);
                if (ret == EAGAIN) {
                        /*
@@ -1309,7 +1348,7 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
                ret = pthread_join(work[thread].thread_id, NULL);
                urcu_posix_assert(!ret);
        }
-       free(work);
+       ht->alloc->free(ht->alloc->state, work);
 
        /*
         * A pthread_create failure above will either lead in us having
@@ -1389,9 +1428,10 @@ void init_table(struct cds_lfht *ht,
 
                /*
                 * Update table size.
+                *
+                * Populate data before RCU size.
                 */
-               cmm_smp_wmb();  /* populate data before RCU size */
-               CMM_STORE_SHARED(ht->size, 1UL << i);
+               uatomic_store(&ht->size, 1UL << i, CMM_RELEASE);
 
                dbg_printf("init new size: %lu\n", 1UL << i);
                if (CMM_LOAD_SHARED(ht->in_progress_destroy))
@@ -1436,12 +1476,18 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
        for (j = size + start; j < size + start + len; j++) {
                struct cds_lfht_node *fini_bucket = bucket_at(ht, j);
                struct cds_lfht_node *parent_bucket = bucket_at(ht, j - size);
+               uintptr_t *fini_bucket_next;
 
                urcu_posix_assert(j >= size && j < (size << 1));
                dbg_printf("remove entry: order %lu index %lu hash %lu\n",
                           i, j, j);
-               /* Set the REMOVED_FLAG to freeze the ->next for gc */
-               uatomic_or(&fini_bucket->next, REMOVED_FLAG);
+               /* Set the REMOVED_FLAG to freeze the ->next for gc.
+                *
+                * NOTE: The fini_bucket_next variable is present to
+                * avoid breaking strict-aliasing rules.
+                */
+               fini_bucket_next = (uintptr_t*)&fini_bucket->next;
+               uatomic_or(fini_bucket_next, REMOVED_FLAG);
                _cds_lfht_gc_bucket(parent_bucket, fini_bucket);
        }
        ht->flavor->read_unlock();
@@ -1595,12 +1641,13 @@ void cds_lfht_node_init_deleted(struct cds_lfht_node *node)
        node->next = flag_removed(NULL);
 }
 
-struct cds_lfht *_cds_lfht_new(unsigned long init_size,
+struct cds_lfht *_cds_lfht_new_with_alloc(unsigned long init_size,
                        unsigned long min_nr_alloc_buckets,
                        unsigned long max_nr_buckets,
                        int flags,
                        const struct cds_lfht_mm_type *mm,
                        const struct rcu_flavor_struct *flavor,
+                       const struct cds_lfht_alloc *alloc,
                        pthread_attr_t *attr)
 {
        struct cds_lfht *ht;
@@ -1636,14 +1683,17 @@ struct cds_lfht *_cds_lfht_new(unsigned long init_size,
        max_nr_buckets = max(max_nr_buckets, min_nr_alloc_buckets);
        init_size = min(init_size, max_nr_buckets);
 
-       ht = mm->alloc_cds_lfht(min_nr_alloc_buckets, max_nr_buckets);
+       ht = mm->alloc_cds_lfht(min_nr_alloc_buckets, max_nr_buckets, alloc ? : &cds_lfht_default_alloc);
+
        urcu_posix_assert(ht);
        urcu_posix_assert(ht->mm == mm);
        urcu_posix_assert(ht->bucket_at == mm->bucket_at);
 
        ht->flags = flags;
        ht->flavor = flavor;
-       ht->resize_attr = attr;
+       ht->caller_resize_attr = attr;
+       if (attr)
+               ht->resize_attr = *attr;
        alloc_split_items_count(ht);
        /* this mutex should not nest in read-side C.S. */
        pthread_mutex_init(&ht->resize_mutex, NULL);
@@ -1654,6 +1704,19 @@ struct cds_lfht *_cds_lfht_new(unsigned long init_size,
        return ht;
 }
 
+struct cds_lfht *_cds_lfht_new(unsigned long init_size,
+                       unsigned long min_nr_alloc_buckets,
+                       unsigned long max_nr_buckets,
+                       int flags,
+                       const struct cds_lfht_mm_type *mm,
+                       const struct rcu_flavor_struct *flavor,
+                       pthread_attr_t *attr)
+{
+       return _cds_lfht_new_with_alloc(init_size,
+                       min_nr_alloc_buckets, max_nr_buckets,
+                       flags, mm, flavor, NULL, attr);
+}
+
 void cds_lfht_lookup(struct cds_lfht *ht, unsigned long hash,
                cds_lfht_match_fct match, const void *key,
                struct cds_lfht_iter *iter)
@@ -1665,7 +1728,14 @@ void cds_lfht_lookup(struct cds_lfht *ht, unsigned long hash,
 
        reverse_hash = bit_reverse_ulong(hash);
 
-       size = rcu_dereference(ht->size);
+       /*
+        * Use load acquire instead of rcu_dereference because there is no
+        * dependency between the table size and the dereference of the bucket
+        * content.
+        *
+        * This acquire is paired with the store release in init_table().
+        */
+       size = uatomic_load(&ht->size, CMM_ACQUIRE);
        bucket = lookup_bucket(ht, size, hash);
        /* We can always skip the bucket node initially */
        node = rcu_dereference(bucket->next);
@@ -1724,7 +1794,7 @@ void cds_lfht_next_duplicate(struct cds_lfht *ht __attribute__((unused)),
                }
                node = clear_flag(next);
        }
-       urcu_posix_assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
+       urcu_posix_assert(!node || !is_bucket(uatomic_load(&node->next, CMM_RELAXED)));
        iter->node = node;
        iter->next = next;
 }
@@ -1748,7 +1818,7 @@ void cds_lfht_next(struct cds_lfht *ht __attribute__((unused)),
                }
                node = clear_flag(next);
        }
-       urcu_posix_assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
+       urcu_posix_assert(!node || !is_bucket(uatomic_load(&node->next, CMM_RELAXED)));
        iter->node = node;
        iter->next = next;
 }
@@ -1760,7 +1830,7 @@ void cds_lfht_first(struct cds_lfht *ht, struct cds_lfht_iter *iter)
         * Get next after first bucket node. The first bucket node is the
         * first node of the linked list.
         */
-       iter->next = bucket_at(ht, 0)->next;
+       iter->next = uatomic_load(&bucket_at(ht, 0)->next, CMM_CONSUME);
        cds_lfht_next(ht, iter);
 }
 
@@ -1770,7 +1840,7 @@ void cds_lfht_add(struct cds_lfht *ht, unsigned long hash,
        unsigned long size;
 
        node->reverse_hash = bit_reverse_ulong(hash);
-       size = rcu_dereference(ht->size);
+       size = uatomic_load(&ht->size, CMM_ACQUIRE);
        _cds_lfht_add(ht, hash, NULL, NULL, size, node, NULL, 0);
        ht_count_add(ht, size, hash);
 }
@@ -1785,7 +1855,7 @@ struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht,
        struct cds_lfht_iter iter;
 
        node->reverse_hash = bit_reverse_ulong(hash);
-       size = rcu_dereference(ht->size);
+       size = uatomic_load(&ht->size, CMM_ACQUIRE);
        _cds_lfht_add(ht, hash, match, key, size, node, &iter, 0);
        if (iter.node == node)
                ht_count_add(ht, size, hash);
@@ -1802,7 +1872,7 @@ struct cds_lfht_node *cds_lfht_add_replace(struct cds_lfht *ht,
        struct cds_lfht_iter iter;
 
        node->reverse_hash = bit_reverse_ulong(hash);
-       size = rcu_dereference(ht->size);
+       size = uatomic_load(&ht->size, CMM_ACQUIRE);
        for (;;) {
                _cds_lfht_add(ht, hash, match, key, size, node, &iter, 0);
                if (iter.node == node) {
@@ -1831,7 +1901,7 @@ int cds_lfht_replace(struct cds_lfht *ht,
                return -EINVAL;
        if (caa_unlikely(!match(old_iter->node, key)))
                return -EINVAL;
-       size = rcu_dereference(ht->size);
+       size = uatomic_load(&ht->size, CMM_ACQUIRE);
        return _cds_lfht_replace(ht, size, old_iter->node, old_iter->next,
                        new_node);
 }
@@ -1841,7 +1911,7 @@ int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node)
        unsigned long size;
        int ret;
 
-       size = rcu_dereference(ht->size);
+       size = uatomic_load(&ht->size, CMM_ACQUIRE);
        ret = _cds_lfht_del(ht, size, node);
        if (!ret) {
                unsigned long hash;
@@ -1857,6 +1927,35 @@ int cds_lfht_is_node_deleted(const struct cds_lfht_node *node)
        return is_removed(CMM_LOAD_SHARED(node->next));
 }
 
+static
+bool cds_lfht_is_empty(struct cds_lfht *ht)
+{
+       struct cds_lfht_node *node, *next;
+       bool empty = true;
+       bool was_online;
+
+       was_online = ht->flavor->read_ongoing();
+       if (!was_online) {
+               ht->flavor->thread_online();
+               ht->flavor->read_lock();
+       }
+       /* Check that the table is empty */
+       node = bucket_at(ht, 0);
+       do {
+               next = rcu_dereference(node->next);
+               if (!is_bucket(next)) {
+                       empty = false;
+                       break;
+               }
+               node = clear_flag(next);
+       } while (!is_end(node));
+       if (!was_online) {
+               ht->flavor->read_unlock();
+               ht->flavor->thread_offline();
+       }
+       return empty;
+}
+
 static
 int cds_lfht_delete_bucket(struct cds_lfht *ht)
 {
@@ -1891,6 +1990,24 @@ int cds_lfht_delete_bucket(struct cds_lfht *ht)
        return 0;
 }
 
+static
+void do_auto_resize_destroy_cb(struct urcu_work *work)
+{
+       struct cds_lfht *ht = caa_container_of(work, struct cds_lfht, destroy_work);
+       int ret;
+
+       ht->flavor->register_thread();
+       ret = cds_lfht_delete_bucket(ht);
+       if (ret)
+               urcu_die(-ret);
+       free_split_items_count(ht);
+       ret = pthread_mutex_destroy(&ht->resize_mutex);
+       if (ret)
+               urcu_die(ret);
+       ht->flavor->unregister_thread();
+       poison_free(ht->alloc, ht);
+}
+
 /*
  * Should only be called when no more concurrent readers nor writers can
  * possibly access the table.
@@ -1900,23 +2017,39 @@ int cds_lfht_destroy(struct cds_lfht *ht, pthread_attr_t **attr)
        int ret;
 
        if (ht->flags & CDS_LFHT_AUTO_RESIZE) {
+               /*
+                * Perform error-checking for emptiness before queuing
+                * work, so we can return error to the caller. This runs
+                * concurrently with ongoing resize.
+                */
+               if (!cds_lfht_is_empty(ht))
+                       return -EPERM;
                /* Cancel ongoing resize operations. */
-               _CMM_STORE_SHARED(ht->in_progress_destroy, 1);
-               /* Wait for in-flight resize operations to complete */
-               urcu_workqueue_flush_queued_work(cds_lfht_workqueue);
+               uatomic_store(&ht->in_progress_destroy, 1, CMM_RELAXED);
+               if (attr) {
+                       *attr = ht->caller_resize_attr;
+                       ht->caller_resize_attr = NULL;
+               }
+               /*
+                * Queue destroy work after prior queued resize
+                * operations. Given there are no concurrent writers
+                * accessing the hash table at this point, no resize
+                * operations can be queued after this destroy work.
+                */
+               urcu_workqueue_queue_work(cds_lfht_workqueue,
+                       &ht->destroy_work, do_auto_resize_destroy_cb);
+               return 0;
        }
        ret = cds_lfht_delete_bucket(ht);
        if (ret)
                return ret;
        free_split_items_count(ht);
        if (attr)
-               *attr = ht->resize_attr;
+               *attr = ht->caller_resize_attr;
        ret = pthread_mutex_destroy(&ht->resize_mutex);
        if (ret)
                ret = -EBUSY;
-       if (ht->flags & CDS_LFHT_AUTO_RESIZE)
-               cds_lfht_fini_worker(ht->flavor);
-       poison_free(ht);
+       poison_free(ht->alloc, ht);
        return ret;
 }
 
@@ -2012,19 +2145,22 @@ void _do_cds_lfht_resize(struct cds_lfht *ht)
         * Resize table, re-do if the target size has changed under us.
         */
        do {
-               if (CMM_LOAD_SHARED(ht->in_progress_destroy))
+               if (uatomic_load(&ht->in_progress_destroy, CMM_RELAXED))
                        break;
-               ht->resize_initiated = 1;
+
+               uatomic_store(&ht->resize_initiated, 1, CMM_RELAXED);
+
                old_size = ht->size;
-               new_size = CMM_LOAD_SHARED(ht->resize_target);
+               new_size = uatomic_load(&ht->resize_target, CMM_RELAXED);
                if (old_size < new_size)
                        _do_cds_lfht_grow(ht, old_size, new_size);
                else if (old_size > new_size)
                        _do_cds_lfht_shrink(ht, old_size, new_size);
-               ht->resize_initiated = 0;
+
+               uatomic_store(&ht->resize_initiated, 0, CMM_RELAXED);
                /* write resize_initiated before read resize_target */
                cmm_smp_mb();
-       } while (ht->size != CMM_LOAD_SHARED(ht->resize_target));
+       } while (ht->size != uatomic_load(&ht->resize_target, CMM_RELAXED));
 }
 
 static
@@ -2045,7 +2181,12 @@ void resize_target_update_count(struct cds_lfht *ht,
 void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size)
 {
        resize_target_update_count(ht, new_size);
-       CMM_STORE_SHARED(ht->resize_initiated, 1);
+
+       /*
+        * Set flags has early as possible even in contention case.
+        */
+       uatomic_store(&ht->resize_initiated, 1, CMM_RELAXED);
+
        mutex_lock(&ht->resize_mutex);
        _do_cds_lfht_resize(ht);
        mutex_unlock(&ht->resize_mutex);
@@ -2063,7 +2204,7 @@ void do_resize_cb(struct urcu_work *work)
        _do_cds_lfht_resize(ht);
        mutex_unlock(&ht->resize_mutex);
        ht->flavor->unregister_thread();
-       poison_free(work);
+       poison_free(ht->alloc, work);
 }
 
 static
@@ -2071,13 +2212,15 @@ void __cds_lfht_resize_lazy_launch(struct cds_lfht *ht)
 {
        struct resize_work *work;
 
-       /* Store resize_target before read resize_initiated */
-       cmm_smp_mb();
-       if (!CMM_LOAD_SHARED(ht->resize_initiated)) {
-               if (CMM_LOAD_SHARED(ht->in_progress_destroy)) {
+       /*
+        * Store to resize_target is before read resize_initiated as guaranteed
+        * by either cmpxchg or _uatomic_xchg_monotonic_increase.
+        */
+       if (!uatomic_load(&ht->resize_initiated, CMM_RELAXED)) {
+               if (uatomic_load(&ht->in_progress_destroy, CMM_RELAXED)) {
                        return;
                }
-               work = malloc(sizeof(*work));
+               work = ht->alloc->malloc(ht->alloc->state, sizeof(*work));
                if (work == NULL) {
                        dbg_printf("error allocating resize work, bailing out\n");
                        return;
@@ -2085,7 +2228,7 @@ void __cds_lfht_resize_lazy_launch(struct cds_lfht *ht)
                work->ht = ht;
                urcu_workqueue_queue_work(cds_lfht_workqueue,
                        &work->work, do_resize_cb);
-               CMM_STORE_SHARED(ht->resize_initiated, 1);
+               uatomic_store(&ht->resize_initiated, 1, CMM_RELAXED);
        }
 }
 
@@ -2179,23 +2322,19 @@ static void cds_lfht_init_worker(const struct rcu_flavor_struct *flavor)
        flavor->register_rculfhash_atfork(&cds_lfht_atfork);
 
        mutex_lock(&cds_lfht_fork_mutex);
-       if (cds_lfht_workqueue_user_count++)
-               goto end;
-       cds_lfht_workqueue = urcu_workqueue_create(0, -1, NULL,
-               NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-end:
+       if (!cds_lfht_workqueue)
+               cds_lfht_workqueue = urcu_workqueue_create(0, -1, NULL,
+                       NULL, NULL, NULL, NULL, NULL, NULL, NULL);
        mutex_unlock(&cds_lfht_fork_mutex);
 }
 
-static void cds_lfht_fini_worker(const struct rcu_flavor_struct *flavor)
+static void cds_lfht_exit(void)
 {
        mutex_lock(&cds_lfht_fork_mutex);
-       if (--cds_lfht_workqueue_user_count)
-               goto end;
-       urcu_workqueue_destroy(cds_lfht_workqueue);
-       cds_lfht_workqueue = NULL;
-end:
+       if (cds_lfht_workqueue) {
+               urcu_workqueue_flush_queued_work(cds_lfht_workqueue);
+               urcu_workqueue_destroy(cds_lfht_workqueue);
+               cds_lfht_workqueue = NULL;
+       }
        mutex_unlock(&cds_lfht_fork_mutex);
-
-       flavor->unregister_rculfhash_atfork(&cds_lfht_atfork);
 }
index 38eddcf3a4283c2b86d2d66ee5604bf3a57b2213..8b6e0a65baa3dfd65fb212a6e871d70e27bd2adc 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * rculfqueue.c
- *
  * Userspace RCU library - Lock-Free RCU Queue
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
index df5c54703820461766b6cc18bf7f961812cad8b7..d7b00ffcd8876695366cd103c51461bf6c038a16 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * rculfstack.c
- *
  * Userspace RCU library - Lock-Free RCU Stack
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* Remove deprecation warnings from LGPL wrapper build. */
index a097d7f00312a1372123f5c61a732f0e8270354d..38f867e7b46347dd8da6b74a2fd18f2ea8505129 100644 (file)
@@ -1,25 +1,11 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu-bp.c
- *
  * Userspace RCU library, "bulletproof" version.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -36,6 +22,7 @@
 #include <stdbool.h>
 #include <sys/mman.h>
 
+#include <urcu/annotate.h>
 #include <urcu/assert.h>
 #include <urcu/config.h>
 #include <urcu/arch.h>
@@ -88,10 +75,7 @@ void *mremap_wrapper(void *old_address __attribute__((unused)),
 
 /* Sleep delay in ms */
 #define RCU_SLEEP_DELAY_MS     10
-#define INIT_NR_THREADS                8
-#define ARENA_INIT_ALLOC               \
-       sizeof(struct registry_chunk)   \
-       + INIT_NR_THREADS * sizeof(struct urcu_bp_reader)
+#define INIT_READER_COUNT      8
 
 /*
  * Active attempts to check for reader Q.S. before calling sleep().
@@ -120,7 +104,10 @@ enum membarrier_cmd {
 static
 void __attribute__((constructor)) _urcu_bp_init(void);
 static
-void __attribute__((destructor)) urcu_bp_exit(void);
+void urcu_bp_exit(void);
+static
+void __attribute__((destructor)) urcu_bp_exit_destructor(void);
+static void urcu_call_rcu_exit(void);
 
 #ifndef CONFIG_RCU_FORCE_SYS_MEMBARRIER
 int urcu_bp_has_sys_membarrier;
@@ -158,10 +145,10 @@ DEFINE_URCU_TLS(struct urcu_bp_reader *, urcu_bp_reader);
 static CDS_LIST_HEAD(registry);
 
 struct registry_chunk {
-       size_t data_len;                /* data length */
-       size_t used;                    /* amount of data used */
+       size_t capacity;                /* capacity of this chunk (in elements) */
+       size_t used;                    /* count of elements used */
        struct cds_list_head node;      /* chunk_list node */
-       char data[];
+       struct urcu_bp_reader readers[];
 };
 
 struct registry_arena {
@@ -211,13 +198,21 @@ static void smp_mb_master(void)
        }
 }
 
+/* Get the size of a chunk's allocation from its capacity (an element count). */
+static size_t chunk_allocation_size(size_t capacity)
+{
+       return (capacity * sizeof(struct urcu_bp_reader)) +
+               sizeof(struct registry_chunk);
+}
+
 /*
  * Always called with rcu_registry lock held. Releases this lock between
  * iterations and grabs it again. Holds the lock when it returns.
  */
 static void wait_for_readers(struct cds_list_head *input_readers,
                        struct cds_list_head *cur_snap_readers,
-                       struct cds_list_head *qsreaders)
+                       struct cds_list_head *qsreaders,
+                       cmm_annotate_t *group)
 {
        unsigned int wait_loops = 0;
        struct urcu_bp_reader *index, *tmp;
@@ -232,7 +227,7 @@ static void wait_for_readers(struct cds_list_head *input_readers,
                        wait_loops++;
 
                cds_list_for_each_entry_safe(index, tmp, input_readers, node) {
-                       switch (urcu_bp_reader_state(&index->ctr)) {
+                       switch (urcu_bp_reader_state(&index->ctr, group)) {
                        case URCU_BP_READER_ACTIVE_CURRENT:
                                if (cur_snap_readers) {
                                        cds_list_move(&index->node,
@@ -271,6 +266,8 @@ static void wait_for_readers(struct cds_list_head *input_readers,
 
 void urcu_bp_synchronize_rcu(void)
 {
+       cmm_annotate_define(acquire_group);
+       cmm_annotate_define(release_group);
        CDS_LIST_HEAD(cur_snap_readers);
        CDS_LIST_HEAD(qsreaders);
        sigset_t newmask, oldmask;
@@ -292,13 +289,14 @@ void urcu_bp_synchronize_rcu(void)
         * where new ptr points to. */
        /* Write new ptr before changing the qparity */
        smp_mb_master();
+       cmm_annotate_group_mb_release(&release_group);
 
        /*
         * Wait for readers to observe original parity or be quiescent.
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&registry, &cur_snap_readers, &qsreaders);
+       wait_for_readers(&registry, &cur_snap_readers, &qsreaders, &acquire_group);
 
        /*
         * Adding a cmm_smp_mb() which is _not_ formally required, but makes the
@@ -308,7 +306,8 @@ void urcu_bp_synchronize_rcu(void)
        cmm_smp_mb();
 
        /* Switch parity: 0 -> 1, 1 -> 0 */
-       CMM_STORE_SHARED(rcu_gp.ctr, rcu_gp.ctr ^ URCU_BP_GP_CTR_PHASE);
+       cmm_annotate_group_mem_release(&release_group, &rcu_gp.ctr);
+       uatomic_store(&rcu_gp.ctr, rcu_gp.ctr ^ URCU_BP_GP_CTR_PHASE, CMM_RELAXED);
 
        /*
         * Must commit qparity update to memory before waiting for other parity
@@ -329,7 +328,7 @@ void urcu_bp_synchronize_rcu(void)
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&cur_snap_readers, NULL, &qsreaders);
+       wait_for_readers(&cur_snap_readers, NULL, &qsreaders, &acquire_group);
 
        /*
         * Put quiescent reader list back into registry.
@@ -341,6 +340,7 @@ void urcu_bp_synchronize_rcu(void)
         * freed.
         */
        smp_mb_master();
+       cmm_annotate_group_mb_acquire(&acquire_group);
 out:
        mutex_unlock(&rcu_registry_lock);
        mutex_unlock(&rcu_gp_lock);
@@ -379,24 +379,20 @@ static
 void expand_arena(struct registry_arena *arena)
 {
        struct registry_chunk *new_chunk, *last_chunk;
-       size_t old_chunk_len, new_chunk_len;
+       size_t old_chunk_size_bytes, new_chunk_size_bytes, new_capacity;
 
        /* No chunk. */
        if (cds_list_empty(&arena->chunk_list)) {
-               urcu_posix_assert(ARENA_INIT_ALLOC >=
-                       sizeof(struct registry_chunk)
-                       + sizeof(struct rcu_reader));
-               new_chunk_len = ARENA_INIT_ALLOC;
+               new_chunk_size_bytes = chunk_allocation_size(INIT_READER_COUNT);
                new_chunk = (struct registry_chunk *) mmap(NULL,
-                       new_chunk_len,
+                       new_chunk_size_bytes,
                        PROT_READ | PROT_WRITE,
                        MAP_ANONYMOUS | MAP_PRIVATE,
                        -1, 0);
                if (new_chunk == MAP_FAILED)
                        abort();
-               memset(new_chunk, 0, new_chunk_len);
-               new_chunk->data_len =
-                       new_chunk_len - sizeof(struct registry_chunk);
+               memset(new_chunk, 0, new_chunk_size_bytes);
+               new_chunk->capacity = INIT_READER_COUNT;
                cds_list_add_tail(&new_chunk->node, &arena->chunk_list);
                return;         /* We're done. */
        }
@@ -404,34 +400,32 @@ void expand_arena(struct registry_arena *arena)
        /* Try expanding last chunk. */
        last_chunk = cds_list_entry(arena->chunk_list.prev,
                struct registry_chunk, node);
-       old_chunk_len =
-               last_chunk->data_len + sizeof(struct registry_chunk);
-       new_chunk_len = old_chunk_len << 1;
+       old_chunk_size_bytes = chunk_allocation_size(last_chunk->capacity);
+       new_capacity = last_chunk->capacity << 1;
+       new_chunk_size_bytes = chunk_allocation_size(new_capacity);
 
        /* Don't allow memory mapping to move, just expand. */
-       new_chunk = mremap_wrapper(last_chunk, old_chunk_len,
-               new_chunk_len, 0);
+       new_chunk = mremap_wrapper(last_chunk, old_chunk_size_bytes,
+               new_chunk_size_bytes, 0);
        if (new_chunk != MAP_FAILED) {
                /* Should not have moved. */
-               urcu_posix_assert(new_chunk == last_chunk);
-               memset((char *) last_chunk + old_chunk_len, 0,
-                       new_chunk_len - old_chunk_len);
-               last_chunk->data_len =
-                       new_chunk_len - sizeof(struct registry_chunk);
+               assert(new_chunk == last_chunk);
+               memset((char *) last_chunk + old_chunk_size_bytes, 0,
+                       new_chunk_size_bytes - old_chunk_size_bytes);
+               last_chunk->capacity = new_capacity;
                return;         /* We're done. */
        }
 
        /* Remap did not succeed, we need to add a new chunk. */
        new_chunk = (struct registry_chunk *) mmap(NULL,
-               new_chunk_len,
+               new_chunk_size_bytes,
                PROT_READ | PROT_WRITE,
                MAP_ANONYMOUS | MAP_PRIVATE,
                -1, 0);
        if (new_chunk == MAP_FAILED)
                abort();
-       memset(new_chunk, 0, new_chunk_len);
-       new_chunk->data_len =
-               new_chunk_len - sizeof(struct registry_chunk);
+       memset(new_chunk, 0, new_chunk_size_bytes);
+       new_chunk->capacity = new_capacity;
        cds_list_add_tail(&new_chunk->node, &arena->chunk_list);
 }
 
@@ -439,22 +433,23 @@ static
 struct rcu_reader *arena_alloc(struct registry_arena *arena)
 {
        struct registry_chunk *chunk;
-       struct rcu_reader *rcu_reader_reg;
        int expand_done = 0;    /* Only allow to expand once per alloc */
-       size_t len = sizeof(struct rcu_reader);
 
 retry:
        cds_list_for_each_entry(chunk, &arena->chunk_list, node) {
-               if (chunk->data_len - chunk->used < len)
+               size_t spot_idx;
+
+               /* Skip fully used chunks. */
+               if (chunk->used == chunk->capacity) {
                        continue;
-               /* Find spot */
-               for (rcu_reader_reg = (struct rcu_reader *) &chunk->data[0];
-                               rcu_reader_reg < (struct rcu_reader *) &chunk->data[chunk->data_len];
-                               rcu_reader_reg++) {
-                       if (!rcu_reader_reg->alloc) {
-                               rcu_reader_reg->alloc = 1;
-                               chunk->used += len;
-                               return rcu_reader_reg;
+               }
+
+               /* Find a spot. */
+               for (spot_idx = 0; spot_idx < chunk->capacity; spot_idx++) {
+                       if (!chunk->readers[spot_idx].alloc) {
+                               chunk->readers[spot_idx].alloc = 1;
+                               chunk->used++;
+                               return &chunk->readers[spot_idx];
                        }
                }
        }
@@ -502,7 +497,7 @@ void cleanup_thread(struct registry_chunk *chunk,
        cds_list_del(&rcu_reader_reg->node);
        rcu_reader_reg->tid = 0;
        rcu_reader_reg->alloc = 0;
-       chunk->used -= sizeof(struct rcu_reader);
+       chunk->used--;
 }
 
 static
@@ -511,9 +506,9 @@ struct registry_chunk *find_chunk(struct rcu_reader *rcu_reader_reg)
        struct registry_chunk *chunk;
 
        cds_list_for_each_entry(chunk, &registry_arena.chunk_list, node) {
-               if (rcu_reader_reg < (struct rcu_reader *) &chunk->data[0])
+               if (rcu_reader_reg < (struct urcu_bp_reader *) &chunk->readers[0])
                        continue;
-               if (rcu_reader_reg >= (struct rcu_reader *) &chunk->data[chunk->data_len])
+               if (rcu_reader_reg >= (struct urcu_bp_reader *) &chunk->readers[chunk->capacity])
                        continue;
                return chunk;
        }
@@ -662,8 +657,7 @@ void urcu_bp_exit(void)
 
                cds_list_for_each_entry_safe(chunk, tmp,
                                &registry_arena.chunk_list, node) {
-                       munmap((void *) chunk, chunk->data_len
-                                       + sizeof(struct registry_chunk));
+                       munmap((void *) chunk, chunk_allocation_size(chunk->capacity));
                }
                CDS_INIT_LIST_HEAD(&registry_arena.chunk_list);
                ret = pthread_key_delete(urcu_bp_key);
@@ -673,6 +667,13 @@ void urcu_bp_exit(void)
        mutex_unlock(&init_lock);
 }
 
+static
+void urcu_bp_exit_destructor(void)
+{
+       urcu_call_rcu_exit();
+       urcu_bp_exit();
+}
+
 /*
  * Holding the rcu_gp_lock and rcu_registry_lock across fork will make
  * sure we fork() don't race with a concurrent thread executing with
@@ -713,17 +714,18 @@ static
 void urcu_bp_prune_registry(void)
 {
        struct registry_chunk *chunk;
-       struct urcu_bp_reader *rcu_reader_reg;
 
        cds_list_for_each_entry(chunk, &registry_arena.chunk_list, node) {
-               for (rcu_reader_reg = (struct urcu_bp_reader *) &chunk->data[0];
-                               rcu_reader_reg < (struct urcu_bp_reader *) &chunk->data[chunk->data_len];
-                               rcu_reader_reg++) {
-                       if (!rcu_reader_reg->alloc)
+               size_t spot_idx;
+
+               for (spot_idx = 0; spot_idx < chunk->capacity; spot_idx++) {
+                       struct urcu_bp_reader *reader = &chunk->readers[spot_idx];
+
+                       if (!reader->alloc)
                                continue;
-                       if (rcu_reader_reg->tid == pthread_self())
+                       if (reader->tid == pthread_self())
                                continue;
-                       cleanup_thread(chunk, rcu_reader_reg);
+                       cleanup_thread(chunk, reader);
                }
        }
 }
@@ -769,3 +771,4 @@ DEFINE_RCU_FLAVOR(rcu_flavor);
 
 #include "urcu-call-rcu-impl.h"
 #include "urcu-defer-impl.h"
+#include "urcu-poll-impl.h"
index 9f85d55b403c5fa1f882947af021c6cae460d712..2ea1efcd19c978f4a144aa4f7300ecdae8e67101 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu-call-rcu.c
- *
  * Userspace RCU library - batch memory reclamation with kernel API
- *
- * Copyright (c) 2010 Paul E. McKenney <paulmck@linux.vnet.ibm.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #define _LGPL_SOURCE
@@ -81,6 +67,10 @@ struct call_rcu_completion_work {
        struct call_rcu_completion *completion;
 };
 
+enum crdf_flags {
+       CRDF_FLAG_JOIN_THREAD = (1 << 0),
+};
+
 /*
  * List of all call_rcu_data structures to keep valgrind happy.
  * Protected by call_rcu_mutex.
@@ -102,7 +92,6 @@ static pthread_mutex_t call_rcu_mutex = PTHREAD_MUTEX_INITIALIZER;
 static struct call_rcu_data *default_call_rcu_data;
 
 static struct urcu_atfork *registered_rculfhash_atfork;
-static unsigned long registered_rculfhash_atfork_refcount;
 
 /*
  * If the sched_getcpu() and sysconf(_SC_NPROCESSORS_CONF) calls are
@@ -447,8 +436,7 @@ static void call_rcu_data_init(struct call_rcu_data **crdpp,
        cds_list_add(&crdp->list, &call_rcu_data_list);
        crdp->cpu_affinity = cpu_affinity;
        crdp->gp_count = 0;
-       cmm_smp_mb();  /* Structure initialized before pointer is planted. */
-       *crdpp = crdp;
+       rcu_set_pointer(crdpp, crdp);
 
        ret = sigfillset(&newmask);
        urcu_posix_assert(!ret);
@@ -572,22 +560,27 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
 
 /*
  * Return a pointer to the default call_rcu_data structure, creating
- * one if need be.  Because we never free call_rcu_data structures,
- * we don't need to be in an RCU read-side critical section.
+ * one if need be.
+ *
+ * The call to this function with intent to use the returned
+ * call_rcu_data should be protected by RCU read-side lock.
  */
 
 struct call_rcu_data *get_default_call_rcu_data(void)
 {
-       if (default_call_rcu_data != NULL)
-               return rcu_dereference(default_call_rcu_data);
+       struct call_rcu_data *crdp;
+
+       crdp = rcu_dereference(default_call_rcu_data);
+       if (crdp != NULL)
+               return crdp;
+
        call_rcu_lock(&call_rcu_mutex);
-       if (default_call_rcu_data != NULL) {
-               call_rcu_unlock(&call_rcu_mutex);
-               return default_call_rcu_data;
-       }
-       call_rcu_data_init(&default_call_rcu_data, 0, -1);
+       if (default_call_rcu_data == NULL)
+               call_rcu_data_init(&default_call_rcu_data, 0, -1);
+       crdp = default_call_rcu_data;
        call_rcu_unlock(&call_rcu_mutex);
-       return default_call_rcu_data;
+
+       return crdp;
 }
 
 /*
@@ -766,7 +759,8 @@ void call_rcu(struct rcu_head *head,
  * a list corruption bug in the 0.7.x series. The equivalent fix
  * appeared in 0.6.8 for the stable-0.6 branch.
  */
-void call_rcu_data_free(struct call_rcu_data *crdp)
+static
+void _call_rcu_data_free(struct call_rcu_data *crdp, unsigned int flags)
 {
        if (crdp == NULL || crdp == default_call_rcu_data) {
                return;
@@ -795,9 +789,21 @@ void call_rcu_data_free(struct call_rcu_data *crdp)
        cds_list_del(&crdp->list);
        call_rcu_unlock(&call_rcu_mutex);
 
+       if (flags & CRDF_FLAG_JOIN_THREAD) {
+               int ret;
+
+               ret = pthread_join(get_call_rcu_thread(crdp), NULL);
+               if (ret)
+                       urcu_die(ret);
+       }
        free(crdp);
 }
 
+void call_rcu_data_free(struct call_rcu_data *crdp)
+{
+       _call_rcu_data_free(crdp, CRDF_FLAG_JOIN_THREAD);
+}
+
 /*
  * Clean up all the per-CPU call_rcu threads.
  */
@@ -889,7 +895,7 @@ void rcu_barrier(void)
                goto online;
        }
 
-       completion = calloc(sizeof(*completion), 1);
+       completion = calloc(1, sizeof(*completion));
        if (!completion)
                urcu_die(errno);
 
@@ -904,7 +910,7 @@ void rcu_barrier(void)
        cds_list_for_each_entry(crdp, &call_rcu_data_list, list) {
                struct call_rcu_completion_work *work;
 
-               work = calloc(sizeof(*work), 1);
+               work = calloc(1, sizeof(*work));
                if (!work)
                        urcu_die(errno);
                work->completion = completion;
@@ -1022,26 +1028,85 @@ void call_rcu_after_fork_child(void)
                if (crdp == default_call_rcu_data)
                        continue;
                uatomic_set(&crdp->flags, URCU_CALL_RCU_STOPPED);
-               call_rcu_data_free(crdp);
+               /*
+                * Do not join the thread because it does not exist in
+                * the child.
+                */
+               _call_rcu_data_free(crdp, 0);
        }
 }
 
 void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork)
 {
+       if (CMM_LOAD_SHARED(registered_rculfhash_atfork))
+               return;
        call_rcu_lock(&call_rcu_mutex);
-       if (registered_rculfhash_atfork_refcount++)
-               goto end;
-       registered_rculfhash_atfork = atfork;
-end:
+       if (!registered_rculfhash_atfork)
+               registered_rculfhash_atfork = atfork;
        call_rcu_unlock(&call_rcu_mutex);
 }
 
+/*
+ * This unregistration function is deprecated, meant only for internal
+ * use by rculfhash.
+ */
+__attribute__((__noreturn__))
 void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork __attribute__((unused)))
 {
+       urcu_die(EPERM);
+}
+
+/*
+ * Teardown the default call_rcu worker thread if there are no queued
+ * callbacks on process exit. This prevents leaking memory.
+ *
+ * Here is how an application can ensure graceful teardown of this
+ * worker thread:
+ *
+ * - An application queuing call_rcu callbacks should invoke
+ *   rcu_barrier() before it exits.
+ * - When chaining call_rcu callbacks, the number of calls to
+ *   rcu_barrier() on application exit must match at least the maximum
+ *   number of chained callbacks.
+ * - If an application chains callbacks endlessly, it would have to be
+ *   modified to stop chaining callbacks when it detects an application
+ *   exit (e.g. with a flag), and wait for quiescence with rcu_barrier()
+ *   after setting that flag.
+ * - The statements above apply to a library which queues call_rcu
+ *   callbacks, only it needs to invoke rcu_barrier in its library
+ *   destructor.
+ *
+ * Note that this function does not presume it is being called when the
+ * application is single-threaded even though this is invoked from a
+ * destructor: this function synchronizes against concurrent calls to
+ * get_default_call_rcu_data().
+ */
+static void urcu_call_rcu_exit(void)
+{
+       struct call_rcu_data *crdp;
+       bool teardown = true;
+
+       if (default_call_rcu_data == NULL)
+               return;
        call_rcu_lock(&call_rcu_mutex);
-       if (--registered_rculfhash_atfork_refcount)
-               goto end;
-       registered_rculfhash_atfork = NULL;
-end:
+       /*
+        * If the application leaves callbacks in the default call_rcu
+        * worker queue, keep the default worker in place.
+        */
+       crdp = default_call_rcu_data;
+       if (!crdp) {
+               teardown = false;
+               goto unlock;
+       }
+       if (!cds_wfcq_empty(&crdp->cbs_head, &crdp->cbs_tail)) {
+               teardown = false;
+               goto unlock;
+       }
+       rcu_set_pointer(&default_call_rcu_data, NULL);
+unlock:
        call_rcu_unlock(&call_rcu_mutex);
+       if (teardown) {
+               synchronize_rcu();
+               call_rcu_data_free(crdp);
+       }
 }
index cbb0ca8565bfe2b52806e343f7f61d09117d6f8c..a180c4875bf173ea70f70d93aa6d17f998919229 100644 (file)
@@ -1,31 +1,17 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_DEFER_IMPL_H
 #define _URCU_DEFER_IMPL_H
 
 /*
- * urcu-defer-impl.h
- *
  * Userspace RCU header - memory reclamation.
  *
  * TO BE INCLUDED ONLY FROM URCU LIBRARY CODE. See urcu-defer.h for linking
  * dynamically with the userspace rcu reclamation library.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
index 227c8dcfa5468e0045d8ef7b7fbc015207d33047..d6b0b16a821f03b8462835d43efdf6c40e99d3cf 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_DIE_H
 #define _URCU_DIE_H
 
 /*
- * urcu-die.h
- *
  * Userspace RCU library unrecoverable error handling
- *
- * Copyright (c) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdlib.h>
index d0854ac8fb3ac1051b573b7afad890cf6f04cc2d..a42fe87be47c0feea1549ccc91ba9db685342538 100644 (file)
@@ -1,26 +1,11 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
 
 /*
- * urcu-pointer.c
- *
  * library wrappers to be used by non-LGPL compatible source code.
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -39,19 +24,16 @@ void *rcu_dereference_sym(void *p)
 
 void *rcu_set_pointer_sym(void **p, void *v)
 {
-       cmm_wmb();
-       uatomic_set(p, v);
+       uatomic_store(p, v, CMM_RELEASE);
        return v;
 }
 
 void *rcu_xchg_pointer_sym(void **p, void *v)
 {
-       cmm_wmb();
-       return uatomic_xchg(p, v);
+       return uatomic_xchg_mo(p, v, CMM_SEQ_CST);
 }
 
 void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new)
 {
-       cmm_wmb();
-       return uatomic_cmpxchg(p, old, _new);
+       return uatomic_cmpxchg_mo(p, old, _new, CMM_SEQ_CST, CMM_RELAXED);
 }
diff --git a/src/urcu-poll-impl.h b/src/urcu-poll-impl.h
new file mode 100644 (file)
index 0000000..9aaf5eb
--- /dev/null
@@ -0,0 +1,86 @@
+// SPDX-FileCopyrightText: 2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+/*
+ * Userspace RCU library - Grace period polling API
+ */
+
+#include <pthread.h>
+#include <stdbool.h>
+
+#include <urcu/urcu-poll.h>
+#include <urcu/call-rcu.h>
+
+struct urcu_poll_worker_state {
+       struct urcu_gp_poll_state current_state;
+       struct urcu_gp_poll_state latest_target;        /* Most recent snapshot taken */
+       struct rcu_head rcu_head;
+       pthread_mutex_t lock;
+       bool active;
+};
+
+static struct urcu_poll_worker_state poll_worker_gp_state = {
+       .lock = PTHREAD_MUTEX_INITIALIZER,
+};
+
+static
+void urcu_poll_worker_cb(struct rcu_head *head __attribute__((unused)))
+{
+       mutex_lock(&poll_worker_gp_state.lock);
+       /* A new grace period has been reached. */
+       poll_worker_gp_state.current_state.grace_period_id++;
+       if ((long)(poll_worker_gp_state.latest_target.grace_period_id - poll_worker_gp_state.current_state.grace_period_id) >= 0) {
+               /* Need to re-queue. */
+               call_rcu(&poll_worker_gp_state.rcu_head, urcu_poll_worker_cb);
+       } else {
+               /* No user waiting for a target grace period. */
+               poll_worker_gp_state.active = false;
+       }
+       mutex_unlock(&poll_worker_gp_state.lock);
+}
+
+/*
+ * Start polling on grace period. If no worker is currently active,
+ * snapshot the current value and start a worker callback. If the worker
+ * is currently active, snapshot the current value + 1, and set this
+ * value as the latest snapshot, which will cause the worker to re-queue
+ * itself with call_rcu to issue one more grace period.
+ *
+ * Because it uses call_rcu, it needs to be called from a registered RCU
+ * thread.
+ */
+struct urcu_gp_poll_state start_poll_synchronize_rcu(void)
+{
+       struct urcu_gp_poll_state new_target_gp_state;
+       bool was_active = false;
+
+       mutex_lock(&poll_worker_gp_state.lock);
+       new_target_gp_state.grace_period_id = poll_worker_gp_state.current_state.grace_period_id;
+       was_active = poll_worker_gp_state.active;
+       if (!was_active)
+               poll_worker_gp_state.active = true;
+       else
+               new_target_gp_state.grace_period_id++;
+       poll_worker_gp_state.latest_target.grace_period_id = new_target_gp_state.grace_period_id;
+       if (!was_active)
+               call_rcu(&poll_worker_gp_state.rcu_head, urcu_poll_worker_cb);
+       mutex_unlock(&poll_worker_gp_state.lock);
+       return new_target_gp_state;
+}
+
+/*
+ * Poll the grace period state. Return true if quiescence was reached
+ * since the snapshot was taken, return false if quiescence was not
+ * reached since snapshot.
+ */
+bool poll_state_synchronize_rcu(struct urcu_gp_poll_state target_gp_state)
+{
+       bool target_gp_reached = false;
+
+       mutex_lock(&poll_worker_gp_state.lock);
+       if ((long)(target_gp_state.grace_period_id - poll_worker_gp_state.current_state.grace_period_id) < 0)
+               target_gp_reached = true;
+       mutex_unlock(&poll_worker_gp_state.lock);
+       return target_gp_reached;
+}
index a3382857a7f358ab2f6bd548df6504c35e8bbadf..e7ee180a9f81119a091de2d3156203028debb2bb 100644 (file)
@@ -1,25 +1,11 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu-qsbr.c
- *
  * Userspace RCU QSBR library
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -34,6 +20,7 @@
 #include <errno.h>
 #include <poll.h>
 
+#include <urcu/annotate.h>
 #include <urcu/assert.h>
 #include <urcu/wfcqueue.h>
 #include <urcu/map/urcu-qsbr.h>
@@ -53,6 +40,7 @@
 #define _LGPL_SOURCE
 
 void __attribute__((destructor)) urcu_qsbr_exit(void);
+static void urcu_call_rcu_exit(void);
 
 /*
  * rcu_gp_lock ensures mutual exclusion between threads calling
@@ -155,7 +143,8 @@ static void wait_gp(void)
  */
 static void wait_for_readers(struct cds_list_head *input_readers,
                        struct cds_list_head *cur_snap_readers,
-                       struct cds_list_head *qsreaders)
+                       struct cds_list_head *qsreaders,
+                       cmm_annotate_t *group)
 {
        unsigned int wait_loops = 0;
        struct urcu_qsbr_reader *index, *tmp;
@@ -182,7 +171,7 @@ static void wait_for_readers(struct cds_list_head *input_readers,
                        cmm_smp_mb();
                }
                cds_list_for_each_entry_safe(index, tmp, input_readers, node) {
-                       switch (urcu_qsbr_reader_state(&index->ctr)) {
+                       switch (urcu_qsbr_reader_state(&index->ctr, group)) {
                        case URCU_READER_ACTIVE_CURRENT:
                                if (cur_snap_readers) {
                                        cds_list_move(&index->node,
@@ -207,8 +196,7 @@ static void wait_for_readers(struct cds_list_head *input_readers,
                if (cds_list_empty(input_readers)) {
                        if (wait_loops >= RCU_QS_ACTIVE_ATTEMPTS) {
                                /* Read reader_gp before write futex */
-                               cmm_smp_mb();
-                               uatomic_set(&urcu_qsbr_gp.futex, 0);
+                               uatomic_store(&urcu_qsbr_gp.futex, 0, CMM_RELEASE);
                        }
                        break;
                } else {
@@ -237,6 +225,8 @@ static void wait_for_readers(struct cds_list_head *input_readers,
 #if (CAA_BITS_PER_LONG < 64)
 void urcu_qsbr_synchronize_rcu(void)
 {
+       cmm_annotate_define(acquire_group);
+       cmm_annotate_define(release_group);
        CDS_LIST_HEAD(cur_snap_readers);
        CDS_LIST_HEAD(qsreaders);
        unsigned long was_online;
@@ -257,6 +247,7 @@ void urcu_qsbr_synchronize_rcu(void)
                urcu_qsbr_thread_offline();
        else
                cmm_smp_mb();
+       cmm_annotate_group_mb_release(&release_group);
 
        /*
         * Add ourself to gp_waiters queue of threads awaiting to wait
@@ -288,7 +279,7 @@ void urcu_qsbr_synchronize_rcu(void)
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&registry, &cur_snap_readers, &qsreaders);
+       wait_for_readers(&registry, &cur_snap_readers, &qsreaders, &acquire_group);
 
        /*
         * Must finish waiting for quiescent state for original parity
@@ -308,7 +299,8 @@ void urcu_qsbr_synchronize_rcu(void)
        cmm_smp_mb();
 
        /* Switch parity: 0 -> 1, 1 -> 0 */
-       CMM_STORE_SHARED(urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr ^ URCU_QSBR_GP_CTR);
+       cmm_annotate_group_mem_release(&release_group, &urcu_qsbr_gp.ctr);
+       uatomic_store(&urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr ^ URCU_QSBR_GP_CTR, CMM_RELAXED);
 
        /*
         * Must commit urcu_qsbr_gp.ctr update to memory before waiting for
@@ -331,7 +323,7 @@ void urcu_qsbr_synchronize_rcu(void)
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&cur_snap_readers, NULL, &qsreaders);
+       wait_for_readers(&cur_snap_readers, NULL, &qsreaders, &acquire_group);
 
        /*
         * Put quiescent reader list back into registry.
@@ -346,6 +338,8 @@ gp_end:
         * Finish waiting for reader threads before letting the old ptr being
         * freed.
         */
+       cmm_annotate_group_mb_acquire(&acquire_group);
+
        if (was_online)
                urcu_qsbr_thread_online();
        else
@@ -354,6 +348,8 @@ gp_end:
 #else /* !(CAA_BITS_PER_LONG < 64) */
 void urcu_qsbr_synchronize_rcu(void)
 {
+       cmm_annotate_define(acquire_group);
+       cmm_annotate_define(release_group);
        CDS_LIST_HEAD(qsreaders);
        unsigned long was_online;
        DEFINE_URCU_WAIT_NODE(wait, URCU_WAIT_WAITING);
@@ -370,6 +366,7 @@ void urcu_qsbr_synchronize_rcu(void)
                urcu_qsbr_thread_offline();
        else
                cmm_smp_mb();
+       cmm_annotate_group_mb_release(&release_group);
 
        /*
         * Add ourself to gp_waiters queue of threads awaiting to wait
@@ -397,7 +394,8 @@ void urcu_qsbr_synchronize_rcu(void)
                goto out;
 
        /* Increment current G.P. */
-       CMM_STORE_SHARED(urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr + URCU_QSBR_GP_CTR);
+       cmm_annotate_group_mem_release(&release_group, &urcu_qsbr_gp.ctr);
+       uatomic_store(&urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr + URCU_QSBR_GP_CTR, CMM_RELAXED);
 
        /*
         * Must commit urcu_qsbr_gp.ctr update to memory before waiting for
@@ -420,7 +418,7 @@ void urcu_qsbr_synchronize_rcu(void)
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&registry, NULL, &qsreaders);
+       wait_for_readers(&registry, NULL, &qsreaders, &acquire_group);
 
        /*
         * Put quiescent reader list back into registry.
@@ -435,6 +433,8 @@ gp_end:
                urcu_qsbr_thread_online();
        else
                cmm_smp_mb();
+
+       cmm_annotate_group_mb_acquire(&acquire_group);
 }
 #endif  /* !(CAA_BITS_PER_LONG < 64) */
 
@@ -509,9 +509,11 @@ void urcu_qsbr_exit(void)
         * readers, and left running at exit.
         * urcu_posix_assert(cds_list_empty(&registry));
         */
+       urcu_call_rcu_exit();
 }
 
 DEFINE_RCU_FLAVOR(rcu_flavor);
 
 #include "urcu-call-rcu-impl.h"
 #include "urcu-defer-impl.h"
+#include "urcu-poll-impl.h"
index af0367516a2bace8624c7f31f8796e69559702df..face6552215540f332ae8920a0a64cee5dc17984 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2018 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_UTILS_H
 #define _URCU_UTILS_H
 
 /*
- * urcu-utils.h
- *
  * Userspace RCU library internal utils
- *
- * Copyright (c) 2018 Michael Jeanson <mjeanson@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/config.h>
index ef5f7ede318c2b3f0aaddcde7aec189aa1bccf60..d77282bd55defc12e9dc78a797ab80c54777829b 100644 (file)
@@ -1,31 +1,18 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WAIT_H
 #define _URCU_WAIT_H
 
 /*
- * urcu-wait.h
- *
  * Userspace RCU library wait/wakeup management
- *
- * Copyright (c) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <urcu/assert.h>
 #include <urcu/uatomic.h>
 #include <urcu/wfstack.h>
+#include <urcu/futex.h>
 #include "urcu-die.h"
 
 /*
@@ -49,7 +36,7 @@ struct urcu_wait_node {
 };
 
 #define URCU_WAIT_NODE_INIT(name, _state)              \
-       { .state = _state }
+       { .node = { .next = NULL }, .state = _state }
 
 #define DEFINE_URCU_WAIT_NODE(name, state)             \
        struct urcu_wait_node name = URCU_WAIT_NODE_INIT(name, state)
@@ -126,16 +113,15 @@ void urcu_wait_node_init(struct urcu_wait_node *node,
 static inline
 void urcu_adaptative_wake_up(struct urcu_wait_node *wait)
 {
-       cmm_smp_mb();
        urcu_posix_assert(uatomic_read(&wait->state) == URCU_WAIT_WAITING);
-       uatomic_set(&wait->state, URCU_WAIT_WAKEUP);
+       uatomic_store(&wait->state, URCU_WAIT_WAKEUP, CMM_RELEASE);
        if (!(uatomic_read(&wait->state) & URCU_WAIT_RUNNING)) {
                if (futex_noasync(&wait->state, FUTEX_WAKE, 1,
                                NULL, NULL, 0) < 0)
                        urcu_die(errno);
        }
        /* Allow teardown of struct urcu_wait memory. */
-       uatomic_or(&wait->state, URCU_WAIT_TEARDOWN);
+       uatomic_or_mo(&wait->state, URCU_WAIT_TEARDOWN, CMM_RELEASE);
 }
 
 /*
@@ -150,11 +136,11 @@ void urcu_adaptative_busy_wait(struct urcu_wait_node *wait)
        /* Load and test condition before read state */
        cmm_smp_rmb();
        for (i = 0; i < URCU_WAIT_ATTEMPTS; i++) {
-               if (uatomic_read(&wait->state) != URCU_WAIT_WAITING)
+               if (uatomic_load(&wait->state, CMM_ACQUIRE) != URCU_WAIT_WAITING)
                        goto skip_futex_wait;
                caa_cpu_relax();
        }
-       while (uatomic_read(&wait->state) == URCU_WAIT_WAITING) {
+       while (uatomic_load(&wait->state, CMM_ACQUIRE) == URCU_WAIT_WAITING) {
                if (!futex_noasync(&wait->state, FUTEX_WAIT, URCU_WAIT_WAITING, NULL, NULL, 0)) {
                        /*
                         * Prior queued wakeups queued by unrelated code
@@ -189,11 +175,11 @@ skip_futex_wait:
         * memory allocated for struct urcu_wait.
         */
        for (i = 0; i < URCU_WAIT_ATTEMPTS; i++) {
-               if (uatomic_read(&wait->state) & URCU_WAIT_TEARDOWN)
+               if (uatomic_load(&wait->state, CMM_RELAXED) & URCU_WAIT_TEARDOWN)
                        break;
                caa_cpu_relax();
        }
-       while (!(uatomic_read(&wait->state) & URCU_WAIT_TEARDOWN))
+       while (!(uatomic_load(&wait->state, CMM_ACQUIRE) & URCU_WAIT_TEARDOWN))
                poll(NULL, 0, 10);
        urcu_posix_assert(uatomic_read(&wait->state) & URCU_WAIT_TEARDOWN);
 }
@@ -209,7 +195,7 @@ void urcu_wake_all_waiters(struct urcu_waiters *waiters)
                        caa_container_of(iter, struct urcu_wait_node, node);
 
                /* Don't wake already running threads */
-               if (wait_node->state & URCU_WAIT_RUNNING)
+               if (uatomic_load(&wait_node->state, CMM_RELAXED) & URCU_WAIT_RUNNING)
                        continue;
                urcu_adaptative_wake_up(wait_node);
        }
index cf4d6d03f711750c05e91991f2a64687640b4438..5f4a7d71c2fad83e414e5c32f09ff884aac13488 100644 (file)
@@ -1,25 +1,11 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * urcu.c
- *
  * Userspace RCU library
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
@@ -38,6 +24,7 @@
 #include <poll.h>
 
 #include <urcu/config.h>
+#include <urcu/annotate.h>
 #include <urcu/assert.h>
 #include <urcu/arch.h>
 #include <urcu/wfcqueue.h>
@@ -99,20 +86,14 @@ int urcu_memb_has_sys_membarrier = 0;
 void __attribute__((constructor)) rcu_init(void);
 #endif
 
-#ifdef RCU_MB
+#if defined(RCU_MB)
 void rcu_init(void)
 {
 }
 #endif
 
-#ifdef RCU_SIGNAL
-static int init_done;
-
-void __attribute__((constructor)) rcu_init(void);
 void __attribute__((destructor)) rcu_exit(void);
-
-static DEFINE_URCU_TLS(int, rcu_signal_was_blocked);
-#endif
+static void urcu_call_rcu_exit(void);
 
 /*
  * rcu_gp_lock ensures mutual exclusion between threads calling
@@ -190,62 +171,13 @@ static void smp_mb_master(void)
 }
 #endif
 
-#ifdef RCU_MB
+#if defined(RCU_MB)
 static void smp_mb_master(void)
 {
        cmm_smp_mb();
 }
 #endif
 
-#ifdef RCU_SIGNAL
-static void force_mb_all_readers(void)
-{
-       struct urcu_reader *index;
-
-       /*
-        * Ask for each threads to execute a cmm_smp_mb() so we can consider the
-        * compiler barriers around rcu read lock as real memory barriers.
-        */
-       if (cds_list_empty(&registry))
-               return;
-       /*
-        * pthread_kill has a cmm_smp_mb(). But beware, we assume it performs
-        * a cache flush on architectures with non-coherent cache. Let's play
-        * safe and don't assume anything : we use cmm_smp_mc() to make sure the
-        * cache flush is enforced.
-        */
-       cds_list_for_each_entry(index, &registry, node) {
-               CMM_STORE_SHARED(index->need_mb, 1);
-               pthread_kill(index->tid, SIGRCU);
-       }
-       /*
-        * Wait for sighandler (and thus mb()) to execute on every thread.
-        *
-        * Note that the pthread_kill() will never be executed on systems
-        * that correctly deliver signals in a timely manner.  However, it
-        * is not uncommon for kernels to have bugs that can result in
-        * lost or unduly delayed signals.
-        *
-        * If you are seeing the below pthread_kill() executing much at
-        * all, we suggest testing the underlying kernel and filing the
-        * relevant bug report.  For Linux kernels, we recommend getting
-        * the Linux Test Project (LTP).
-        */
-       cds_list_for_each_entry(index, &registry, node) {
-               while (CMM_LOAD_SHARED(index->need_mb)) {
-                       pthread_kill(index->tid, SIGRCU);
-                       (void) poll(NULL, 0, 1);
-               }
-       }
-       cmm_smp_mb();   /* read ->need_mb before ending the barrier */
-}
-
-static void smp_mb_master(void)
-{
-       force_mb_all_readers();
-}
-#endif /* #ifdef RCU_SIGNAL */
-
 /*
  * synchronize_rcu() waiting. Single thread.
  * Always called with rcu_registry lock held. Releases this lock and
@@ -254,9 +186,7 @@ static void smp_mb_master(void)
 static void wait_gp(void)
 {
        /*
-        * Read reader_gp before read futex. smp_mb_master() needs to
-        * be called with the rcu registry lock held in RCU_SIGNAL
-        * flavor.
+        * Read reader_gp before read futex.
         */
        smp_mb_master();
        /* Temporarily unlock the registry lock. */
@@ -298,7 +228,8 @@ end:
  */
 static void wait_for_readers(struct cds_list_head *input_readers,
                        struct cds_list_head *cur_snap_readers,
-                       struct cds_list_head *qsreaders)
+                       struct cds_list_head *qsreaders,
+                       cmm_annotate_t *group)
 {
        unsigned int wait_loops = 0;
        struct urcu_reader *index, *tmp;
@@ -321,7 +252,7 @@ static void wait_for_readers(struct cds_list_head *input_readers,
                }
 
                cds_list_for_each_entry_safe(index, tmp, input_readers, node) {
-                       switch (urcu_common_reader_state(&rcu_gp, &index->ctr)) {
+                       switch (urcu_common_reader_state(&rcu_gp, &index->ctr, group)) {
                        case URCU_READER_ACTIVE_CURRENT:
                                if (cur_snap_readers) {
                                        cds_list_move(&index->node,
@@ -405,6 +336,8 @@ static void wait_for_readers(struct cds_list_head *input_readers,
 
 void synchronize_rcu(void)
 {
+       cmm_annotate_define(acquire_group);
+       cmm_annotate_define(release_group);
        CDS_LIST_HEAD(cur_snap_readers);
        CDS_LIST_HEAD(qsreaders);
        DEFINE_URCU_WAIT_NODE(wait, URCU_WAIT_WAITING);
@@ -419,10 +352,11 @@ void synchronize_rcu(void)
         * queue before their insertion into the wait queue.
         */
        if (urcu_wait_add(&gp_waiters, &wait) != 0) {
-               /* Not first in queue: will be awakened by another thread. */
+               /*
+                * Not first in queue: will be awakened by another thread.
+                * Implies a memory barrier after grace period.
+                */
                urcu_adaptative_busy_wait(&wait);
-               /* Order following memory accesses after grace period. */
-               cmm_smp_mb();
                return;
        }
        /* We won't need to wake ourself up */
@@ -447,13 +381,14 @@ void synchronize_rcu(void)
         */
        /* Write new ptr before changing the qparity */
        smp_mb_master();
+       cmm_annotate_group_mb_release(&release_group);
 
        /*
         * Wait for readers to observe original parity or be quiescent.
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&registry, &cur_snap_readers, &qsreaders);
+       wait_for_readers(&registry, &cur_snap_readers, &qsreaders, &acquire_group);
 
        /*
         * Must finish waiting for quiescent state for original parity before
@@ -472,7 +407,8 @@ void synchronize_rcu(void)
        cmm_smp_mb();
 
        /* Switch parity: 0 -> 1, 1 -> 0 */
-       CMM_STORE_SHARED(rcu_gp.ctr, rcu_gp.ctr ^ URCU_GP_CTR_PHASE);
+       cmm_annotate_group_mem_release(&release_group, &rcu_gp.ctr);
+       uatomic_store(&rcu_gp.ctr, rcu_gp.ctr ^ URCU_GP_CTR_PHASE, CMM_RELAXED);
 
        /*
         * Must commit rcu_gp.ctr update to memory before waiting for quiescent
@@ -495,7 +431,7 @@ void synchronize_rcu(void)
         * wait_for_readers() can release and grab again rcu_registry_lock
         * internally.
         */
-       wait_for_readers(&cur_snap_readers, NULL, &qsreaders);
+       wait_for_readers(&cur_snap_readers, NULL, &qsreaders, &acquire_group);
 
        /*
         * Put quiescent reader list back into registry.
@@ -508,6 +444,7 @@ void synchronize_rcu(void)
         * iterates on reader threads.
         */
        smp_mb_master();
+       cmm_annotate_group_mb_acquire(&acquire_group);
 out:
        mutex_unlock(&rcu_registry_lock);
        mutex_unlock(&rcu_gp_lock);
@@ -539,52 +476,8 @@ int rcu_read_ongoing(void)
        return _rcu_read_ongoing();
 }
 
-#ifdef RCU_SIGNAL
-/*
- * Make sure the signal used by the urcu-signal flavor is unblocked
- * while the thread is registered.
- */
-static
-void urcu_signal_unblock(void)
-{
-       sigset_t mask, oldmask;
-       int ret;
-
-       ret = sigemptyset(&mask);
-       urcu_posix_assert(!ret);
-       ret = sigaddset(&mask, SIGRCU);
-       urcu_posix_assert(!ret);
-       ret = pthread_sigmask(SIG_UNBLOCK, &mask, &oldmask);
-       urcu_posix_assert(!ret);
-       URCU_TLS(rcu_signal_was_blocked) = sigismember(&oldmask, SIGRCU);
-}
-
-static
-void urcu_signal_restore(void)
-{
-       sigset_t mask;
-       int ret;
-
-       if (!URCU_TLS(rcu_signal_was_blocked))
-               return;
-       ret = sigemptyset(&mask);
-       urcu_posix_assert(!ret);
-       ret = sigaddset(&mask, SIGRCU);
-       urcu_posix_assert(!ret);
-       ret = pthread_sigmask(SIG_BLOCK, &mask, NULL);
-       urcu_posix_assert(!ret);
-}
-#else
-static
-void urcu_signal_unblock(void) { }
-static
-void urcu_signal_restore(void) { }
-#endif
-
 void rcu_register_thread(void)
 {
-       urcu_signal_unblock();
-
        URCU_TLS(rcu_reader).tid = pthread_self();
        urcu_posix_assert(URCU_TLS(rcu_reader).need_mb == 0);
        urcu_posix_assert(!(URCU_TLS(rcu_reader).ctr & URCU_GP_CTR_NEST_MASK));
@@ -604,8 +497,6 @@ void rcu_unregister_thread(void)
        URCU_TLS(rcu_reader).registered = 0;
        cds_list_del(&URCU_TLS(rcu_reader).node);
        mutex_unlock(&rcu_registry_lock);
-
-       urcu_signal_restore();
 }
 
 #ifdef RCU_MEMBARRIER
@@ -656,61 +547,13 @@ void rcu_init(void)
 }
 #endif
 
-#ifdef RCU_SIGNAL
-static void sigrcu_handler(int signo __attribute__((unused)),
-               siginfo_t *siginfo __attribute__((unused)),
-               void *context __attribute__((unused)))
-{
-       /*
-        * Executing this cmm_smp_mb() is the only purpose of this signal handler.
-        * It punctually promotes cmm_barrier() into cmm_smp_mb() on every thread it is
-        * executed on.
-        */
-       cmm_smp_mb();
-       _CMM_STORE_SHARED(URCU_TLS(rcu_reader).need_mb, 0);
-       cmm_smp_mb();
-}
-
-/*
- * rcu_init constructor. Called when the library is linked, but also when
- * reader threads are calling rcu_register_thread().
- * Should only be called by a single thread at a given time. This is ensured by
- * holing the rcu_registry_lock from rcu_register_thread() or by running
- * at library load time, which should not be executed by multiple
- * threads nor concurrently with rcu_register_thread() anyway.
- */
-void rcu_init(void)
-{
-       struct sigaction act;
-       int ret;
-
-       if (init_done)
-               return;
-       init_done = 1;
-
-       act.sa_sigaction = sigrcu_handler;
-       act.sa_flags = SA_SIGINFO | SA_RESTART;
-       sigemptyset(&act.sa_mask);
-       ret = sigaction(SIGRCU, &act, NULL);
-       if (ret)
-               urcu_die(errno);
-}
-
 void rcu_exit(void)
 {
-       /*
-        * Don't unregister the SIGRCU signal handler anymore, because
-        * call_rcu threads could still be using it shortly before the
-        * application exits.
-        * Assertion disabled because call_rcu threads are now rcu
-        * readers, and left running at exit.
-        * urcu_posix_assert(cds_list_empty(&registry));
-        */
+       urcu_call_rcu_exit();
 }
 
-#endif /* #ifdef RCU_SIGNAL */
-
 DEFINE_RCU_FLAVOR(rcu_flavor);
 
 #include "urcu-call-rcu-impl.h"
 #include "urcu-defer-impl.h"
+#include "urcu-poll-impl.h"
index 85de8ecf9b29531b6cd1245dda4ca06cc8fde310..ff05510bd29d0f87aba4632bfcf92b8c34c43cc9 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2011-2012 Lai Jiangshan <laijs@cn.fujitsu.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * wfcqueue.c
- *
  * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
index 509f4f9c6275b1511916f7046c40ffbd978c99d7..062f8017ea9dd179bded32483416b9f128fa1459 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * wfqueue.c
- *
  * Userspace RCU library - Queue with Wait-Free Enqueue/Blocking Dequeue
- *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* Remove deprecation warnings from LGPL wrapper build. */
index 46300f92ce061176a4b2fe9339a85891c5d8f0e7..8fddaecf32a9c1d2e1f3326947f0f7e5c71ed2ef 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * wfstack.c
- *
  * Userspace RCU library - Stack with wait-free push, blocking traversal.
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
index 1039d7297b9ce13446c4b81aee86fa217a005eab..10b9fdee5df22155875edda1ccf4fff77adf3f0f 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010 Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+// SPDX-FileCopyrightText: 2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * workqueue.c
- *
  * Userspace RCU library - Userspace workqeues
- *
- * Copyright (c) 2010 Paul E. McKenney <paulmck@linux.vnet.ibm.com>
- * Copyright (c) 2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #define _LGPL_SOURCE
@@ -398,7 +384,7 @@ struct urcu_workqueue_completion *urcu_workqueue_create_completion(void)
 {
        struct urcu_workqueue_completion *completion;
 
-       completion = calloc(sizeof(*completion), 1);
+       completion = calloc(1, sizeof(*completion));
        if (!completion)
                urcu_die(errno);
        urcu_ref_set(&completion->ref, 1);
@@ -429,7 +415,7 @@ void urcu_workqueue_queue_completion(struct urcu_workqueue *workqueue,
 {
        struct urcu_workqueue_completion_work *work;
 
-       work = calloc(sizeof(*work), 1);
+       work = calloc(1, sizeof(*work));
        if (!work)
                urcu_die(errno);
        work->completion = completion;
index 52b69731003ad322f7272a7d52c41d2325070373..ed391da7743d062f6d7c5d4009614d4db1fb8f71 100644 (file)
@@ -1,27 +1,13 @@
+// SPDX-FileCopyrightText: 2009,2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_WORKQUEUE_H
 #define _URCU_WORKQUEUE_H
 
 /*
- * workqueue.h
- *
  * Userspace RCU header - Userspace workqueues
- *
- * Copyright (c) 2009,2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <stdlib.h>
index 8e0e6d14d397a434555ad175842768c6b4fedfb7..c4f4afa11a73c8c8011dfe8cd9cc554584c273d2 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 SUBDIRS = utils common unit benchmark regression
 
 .PHONY: short_bench long_bench regtest check-loop
index c53e02587d80bad0f71eb1afb929627b1ea44aa7..e5ce2e9860bb6c8560d1665ab33b4dff9026b04b 100644 (file)
@@ -1,4 +1,9 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/tests/common
+AM_CPPFLAGS += -include $(top_srcdir)/tests/benchmark/common-states.h
 
 TEST_EXTENSIONS = .tap
 TAP_LOG_DRIVER_FLAGS = --merge --comments
@@ -7,6 +12,8 @@ TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' \
        URCU_TESTS_BUILDDIR='$(abs_top_builddir)/tests' \
        $(SHELL) $(top_srcdir)/tests/utils/tap-driver.sh
 
+noinst_HEADERS = common-states.h
+
 SCRIPT_LIST = \
        runpaul-phase1.sh \
        runpaul-phase2.sh \
@@ -33,13 +40,12 @@ dist_noinst_DATA = \
        urcu_30_seconds.tap
 
 noinst_PROGRAMS = test_urcu test_urcu_dynamic_link test_urcu_timing \
-       test_urcu_signal test_urcu_signal_dynamic_link test_urcu_signal_timing \
         test_rwlock_timing test_rwlock test_perthreadlock_timing \
-        test_perthreadlock test_urcu_yield test_urcu_signal_yield test_urcu_mb \
+        test_perthreadlock test_urcu_yield test_urcu_mb \
         test_urcu_qsbr_timing test_urcu_qsbr \
-       test_mutex test_looplen test_urcu_gc test_urcu_signal_gc \
+       test_mutex test_looplen test_urcu_gc \
        test_urcu_lgc \
-        test_urcu_mb_gc test_urcu_qsbr_gc test_urcu_qsbr_lgc test_urcu_signal_lgc \
+        test_urcu_mb_gc test_urcu_qsbr_gc test_urcu_qsbr_lgc \
         test_urcu_mb_lgc test_urcu_qsbr_dynamic_link test_urcu_defer \
         test_urcu_assign test_urcu_assign_dynamic_link \
         test_urcu_bp test_urcu_bp_dynamic_link test_cycles_per_loop \
@@ -55,169 +61,143 @@ URCU_COMMON_LIB=$(top_builddir)/src/liburcu-common.la
 URCU_LIB=$(top_builddir)/src/liburcu.la
 URCU_QSBR_LIB=$(top_builddir)/src/liburcu-qsbr.la
 URCU_MB_LIB=$(top_builddir)/src/liburcu-mb.la
-URCU_SIGNAL_LIB=$(top_builddir)/src/liburcu-signal.la
 URCU_BP_LIB=$(top_builddir)/src/liburcu-bp.la
 URCU_CDS_LIB=$(top_builddir)/src/liburcu-cds.la
 
 DEBUG_YIELD_LIB=$(builddir)/../common/libdebug-yield.la
 
-test_urcu_SOURCES = test_urcu.c
+test_urcu_SOURCES = test_urcu.c common-states.c
 test_urcu_LDADD = $(URCU_LIB)
 
-test_urcu_dynamic_link_SOURCES = test_urcu.c
+test_urcu_dynamic_link_SOURCES = test_urcu.c common-states.c
 test_urcu_dynamic_link_LDADD = $(URCU_LIB)
 test_urcu_dynamic_link_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 
-test_urcu_timing_SOURCES = test_urcu_timing.c
+test_urcu_timing_SOURCES = test_urcu_timing.c common-states.c
 test_urcu_timing_LDADD = $(URCU_LIB)
 
-test_urcu_yield_SOURCES = test_urcu.c
+test_urcu_yield_SOURCES = test_urcu.c common-states.c
 test_urcu_yield_LDADD = $(URCU_LIB) $(DEBUG_YIELD_LIB)
 test_urcu_yield_CFLAGS = -DDEBUG_YIELD $(AM_CFLAGS)
 
 
-test_urcu_qsbr_SOURCES = test_urcu_qsbr.c
+test_urcu_qsbr_SOURCES = test_urcu_qsbr.c common-states.c
 test_urcu_qsbr_LDADD = $(URCU_QSBR_LIB)
 
-test_urcu_qsbr_timing_SOURCES = test_urcu_qsbr_timing.c
+test_urcu_qsbr_timing_SOURCES = test_urcu_qsbr_timing.c common-states.c
 test_urcu_qsbr_timing_LDADD = $(URCU_QSBR_LIB)
 
 
-test_urcu_mb_SOURCES = test_urcu.c
+test_urcu_mb_SOURCES = test_urcu.c common-states.c
 test_urcu_mb_LDADD = $(URCU_MB_LIB)
 test_urcu_mb_CFLAGS = -DRCU_MB $(AM_CFLAGS)
 
 
-test_urcu_signal_SOURCES = test_urcu.c
-test_urcu_signal_LDADD = $(URCU_SIGNAL_LIB)
-test_urcu_signal_CFLAGS = -DRCU_SIGNAL $(AM_CFLAGS)
-
-test_urcu_signal_dynamic_link_SOURCES = test_urcu.c
-test_urcu_signal_dynamic_link_LDADD = $(URCU_SIGNAL_LIB)
-test_urcu_signal_dynamic_link_CFLAGS = -DRCU_SIGNAL -DDYNAMIC_LINK_TEST \
-                                       $(AM_CFLAGS)
-
-test_urcu_signal_timing_SOURCES = test_urcu_timing.c
-test_urcu_signal_timing_LDADD = $(URCU_SIGNAL_LIB)
-test_urcu_signal_timing_CFLAGS= -DRCU_SIGNAL $(AM_CFLAGS)
+test_rwlock_timing_SOURCES = test_rwlock_timing.c common-states.c
+test_rwlock_timing_LDADD = $(URCU_LIB)
 
-test_urcu_signal_yield_SOURCES = test_urcu.c
-test_urcu_signal_yield_LDADD = $(URCU_SIGNAL_LIB) $(DEBUG_YIELD_LIB)
-test_urcu_signal_yield_CFLAGS = -DRCU_SIGNAL -DDEBUG_YIELD $(AM_CFLAGS)
+test_rwlock_SOURCES = test_rwlock.c common-states.c
+test_rwlock_LDADD = $(URCU_LIB)
 
-test_rwlock_timing_SOURCES = test_rwlock_timing.c
-test_rwlock_timing_LDADD = $(URCU_SIGNAL_LIB)
+test_perthreadlock_timing_SOURCES = test_perthreadlock_timing.c common-states.c
+test_perthreadlock_timing_LDADD = $(URCU_LIB)
 
-test_rwlock_SOURCES = test_rwlock.c
-test_rwlock_LDADD = $(URCU_SIGNAL_LIB)
+test_perthreadlock_SOURCES = test_perthreadlock.c common-states.c
+test_perthreadlock_LDADD = $(URCU_LIB)
 
-test_perthreadlock_timing_SOURCES = test_perthreadlock_timing.c
-test_perthreadlock_timing_LDADD = $(URCU_SIGNAL_LIB)
+test_mutex_SOURCES = test_mutex.c common-states.c
 
-test_perthreadlock_SOURCES = test_perthreadlock.c
-test_perthreadlock_LDADD = $(URCU_SIGNAL_LIB)
+test_looplen_SOURCES = test_looplen.c common-states.c
 
-test_mutex_SOURCES = test_mutex.c
-
-test_looplen_SOURCES = test_looplen.c
-
-test_urcu_gc_SOURCES = test_urcu_gc.c
+test_urcu_gc_SOURCES = test_urcu_gc.c common-states.c
 test_urcu_gc_LDADD = $(URCU_LIB)
 
-test_urcu_signal_gc_SOURCES = test_urcu_gc.c
-test_urcu_signal_gc_LDADD = $(URCU_SIGNAL_LIB)
-test_urcu_signal_gc_CFLAGS = -DRCU_SIGNAL $(AM_CFLAGS)
-
-test_urcu_mb_gc_SOURCES = test_urcu_gc.c
+test_urcu_mb_gc_SOURCES = test_urcu_gc.c common-states.c
 test_urcu_mb_gc_LDADD = $(URCU_MB_LIB)
 test_urcu_mb_gc_CFLAGS = -DRCU_MB $(AM_CFLAGS)
 
-test_urcu_qsbr_gc_SOURCES = test_urcu_qsbr_gc.c
+test_urcu_qsbr_gc_SOURCES = test_urcu_qsbr_gc.c common-states.c
 test_urcu_qsbr_gc_LDADD = $(URCU_QSBR_LIB)
 
-test_urcu_qsbr_lgc_SOURCES = test_urcu_qsbr_gc.c
+test_urcu_qsbr_lgc_SOURCES = test_urcu_qsbr_gc.c common-states.c
 test_urcu_qsbr_lgc_LDADD = $(URCU_QSBR_LIB)
 test_urcu_qsbr_lgc_CFLAGS = -DTEST_LOCAL_GC $(AM_CFLAGS)
 
-test_urcu_lgc_SOURCES = test_urcu_gc.c
+test_urcu_lgc_SOURCES = test_urcu_gc.c common-states.c
 test_urcu_lgc_LDADD = $(URCU_LIB)
 test_urcu_lgc_CFLAGS = -DTEST_LOCAL_GC $(AM_CFLAGS)
 
-test_urcu_signal_lgc_SOURCES = test_urcu_gc.c
-test_urcu_signal_lgc_LDADD = $(URCU_SIGNAL_LIB)
-test_urcu_signal_lgc_CFLAGS = -DRCU_SIGNAL -DTEST_LOCAL_GC $(AM_CFLAGS)
-
-test_urcu_mb_lgc_SOURCES = test_urcu_gc.c
+test_urcu_mb_lgc_SOURCES = test_urcu_gc.c common-states.c
 test_urcu_mb_lgc_LDADD = $(URCU_MB_LIB)
 test_urcu_mb_lgc_CFLAGS = -DTEST_LOCAL_GC -DRCU_MB $(AM_CFLAGS)
 
-test_urcu_qsbr_dynamic_link_SOURCES = test_urcu_qsbr.c
+test_urcu_qsbr_dynamic_link_SOURCES = test_urcu_qsbr.c common-states.c
 test_urcu_qsbr_dynamic_link_LDADD = $(URCU_QSBR_LIB)
 test_urcu_qsbr_dynamic_link_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 
-test_urcu_defer_SOURCES = test_urcu_defer.c
+test_urcu_defer_SOURCES = test_urcu_defer.c common-states.c
 test_urcu_defer_LDADD = $(URCU_LIB)
 
 test_cycles_per_loop_SOURCES = test_cycles_per_loop.c
 
-test_urcu_assign_SOURCES = test_urcu_assign.c
+test_urcu_assign_SOURCES = test_urcu_assign.c common-states.c
 test_urcu_assign_LDADD = $(URCU_LIB)
 
-test_urcu_assign_dynamic_link_SOURCES = test_urcu_assign.c
+test_urcu_assign_dynamic_link_SOURCES = test_urcu_assign.c common-states.c
 test_urcu_assign_dynamic_link_LDADD = $(URCU_LIB)
 test_urcu_assign_dynamic_link_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 
-test_urcu_bp_SOURCES = test_urcu_bp.c
+test_urcu_bp_SOURCES = test_urcu_bp.c common-states.c
 test_urcu_bp_LDADD = $(URCU_BP_LIB)
 
-test_urcu_bp_dynamic_link_SOURCES = test_urcu_bp.c
+test_urcu_bp_dynamic_link_SOURCES = test_urcu_bp.c common-states.c
 test_urcu_bp_dynamic_link_LDADD = $(URCU_BP_LIB)
 test_urcu_bp_dynamic_link_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 
-test_urcu_lfq_SOURCES = test_urcu_lfq.c
+test_urcu_lfq_SOURCES = test_urcu_lfq.c common-states.c
 test_urcu_lfq_LDADD = $(URCU_LIB) $(URCU_CDS_LIB)
 
-test_urcu_lfq_dynlink_SOURCES = test_urcu_lfq.c
+test_urcu_lfq_dynlink_SOURCES = test_urcu_lfq.c common-states.c
 test_urcu_lfq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_lfq_dynlink_LDADD = $(URCU_LIB) $(URCU_CDS_LIB)
 
-test_urcu_wfq_SOURCES = test_urcu_wfq.c
+test_urcu_wfq_SOURCES = test_urcu_wfq.c common-states.c
 test_urcu_wfq_LDADD = $(URCU_COMMON_LIB)
 
-test_urcu_wfq_dynlink_SOURCES = test_urcu_wfq.c
+test_urcu_wfq_dynlink_SOURCES = test_urcu_wfq.c common-states.c
 test_urcu_wfq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_wfq_dynlink_LDADD = $(URCU_COMMON_LIB)
 
-test_urcu_wfcq_SOURCES = test_urcu_wfcq.c
+test_urcu_wfcq_SOURCES = test_urcu_wfcq.c common-states.c
 test_urcu_wfcq_LDADD = $(URCU_COMMON_LIB)
 
-test_urcu_wfcq_dynlink_SOURCES = test_urcu_wfcq.c
+test_urcu_wfcq_dynlink_SOURCES = test_urcu_wfcq.c common-states.c
 test_urcu_wfcq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_wfcq_dynlink_LDADD = $(URCU_COMMON_LIB)
 
-test_urcu_lfs_SOURCES = test_urcu_lfs.c
+test_urcu_lfs_SOURCES = test_urcu_lfs.c common-states.c
 test_urcu_lfs_LDADD = $(URCU_LIB) $(URCU_CDS_LIB)
 
-test_urcu_lfs_rcu_SOURCES = test_urcu_lfs_rcu.c
+test_urcu_lfs_rcu_SOURCES = test_urcu_lfs_rcu.c common-states.c
 test_urcu_lfs_rcu_LDADD = $(URCU_LIB) $(URCU_CDS_LIB)
 
-test_urcu_lfs_dynlink_SOURCES = test_urcu_lfs.c
+test_urcu_lfs_dynlink_SOURCES = test_urcu_lfs.c common-states.c
 test_urcu_lfs_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_lfs_dynlink_LDADD = $(URCU_LIB) $(URCU_CDS_LIB)
 
-test_urcu_lfs_rcu_dynlink_SOURCES = test_urcu_lfs_rcu.c
+test_urcu_lfs_rcu_dynlink_SOURCES = test_urcu_lfs_rcu.c common-states.c
 test_urcu_lfs_rcu_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_lfs_rcu_dynlink_LDADD = $(URCU_LIB) $(URCU_CDS_LIB)
 
-test_urcu_wfs_SOURCES = test_urcu_wfs.c
+test_urcu_wfs_SOURCES = test_urcu_wfs.c common-states.c
 test_urcu_wfs_LDADD = $(URCU_COMMON_LIB)
 
-test_urcu_wfs_dynlink_SOURCES = test_urcu_wfs.c
+test_urcu_wfs_dynlink_SOURCES = test_urcu_wfs.c common-states.c
 test_urcu_wfs_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_wfs_dynlink_LDADD = $(URCU_COMMON_LIB)
 
 test_urcu_hash_SOURCES = test_urcu_hash.c test_urcu_hash.h \
-               test_urcu_hash_rw.c test_urcu_hash_unique.c
+               test_urcu_hash_rw.c test_urcu_hash_unique.c common-states.c
 test_urcu_hash_CFLAGS = -DRCU_QSBR $(AM_CFLAGS)
 test_urcu_hash_LDADD = $(URCU_QSBR_LIB) $(URCU_COMMON_LIB) $(URCU_CDS_LIB)
 
diff --git a/tests/benchmark/common-states.c b/tests/benchmark/common-states.c
new file mode 100644 (file)
index 0000000..4a7f719
--- /dev/null
@@ -0,0 +1,5 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+volatile int _test_go = 0, _test_stop = 0;
diff --git a/tests/benchmark/common-states.h b/tests/benchmark/common-states.h
new file mode 100644 (file)
index 0000000..d46fd38
--- /dev/null
@@ -0,0 +1,55 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/* Common states for benchmarks. */
+
+#include <unistd.h>
+
+#include <urcu/uatomic.h>
+
+extern volatile int _test_go, _test_stop;
+
+static inline void complete_sleep(unsigned int seconds)
+{
+       while (seconds != 0) {
+               seconds = sleep(seconds);
+       }
+}
+
+static inline void begin_test(void)
+{
+       uatomic_store(&_test_go, 1, CMM_RELEASE);
+}
+
+static inline void end_test(void)
+{
+       uatomic_store(&_test_stop, 1, CMM_RELAXED);
+}
+
+static inline void test_for(unsigned int duration)
+{
+       begin_test();
+       complete_sleep(duration);
+       end_test();
+}
+
+static inline void wait_until_go(void)
+{
+       while (!uatomic_load(&_test_go, CMM_ACQUIRE))
+       {
+       }
+}
+
+/*
+ * returns 0 if test should end.
+ */
+static inline int test_duration_write(void)
+{
+       return !uatomic_load(&_test_stop, CMM_RELAXED);
+}
+
+static inline int test_duration_read(void)
+{
+       return !uatomic_load(&_test_stop, CMM_RELAXED);
+}
index e6d363c70258502f9e3837844034f8b1f6fcc9cc..d71cc3f43877a57cc826551aebb494bff50efb76 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ab809beaaff04f74da3e50a5d18ece9265e7850e..49ad0e6a8755f592adc24f456187eacf1b0e3faf 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 73b536e16159c5116d19fb7b9c727b3434621633..c63618b3705d88ca3b8b64ac9f78ced405241aba 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index cb8205459c8043f88f3624381e7911fc6ecfad0d..13347ee1ce159843326564a3dcc6e04083a756de 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
@@ -39,10 +39,10 @@ if [[ ${NUM_CPUS} -lt 4 ]]; then
 fi
 
 # batch: 19 * 1 = 19
-# fraction: 15 * 29 =
-# scalabilit NUM_CPUS * 15
-# reader 15 * 23 =
-NUM_TESTS=$(( 19 + 435 + ( NUM_CPUS * 15 ) + 345 ))
+# fraction: 12 * 29 =
+# scalabilit NUM_CPUS * 12
+# reader 12 * 23 =
+NUM_TESTS=$(( 19 + 348 + ( NUM_CPUS * 12 ) + 276 ))
 
 plan_tests     ${NUM_TESTS}
 
@@ -90,9 +90,9 @@ for BATCH_SIZE in ${BATCH_ARRAY}; do
        done
 done
 
-TEST_ARRAY="test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_urcu_qsbr_gc
-            test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc
-            test_urcu test_urcu_signal test_urcu_mb test_urcu_qsbr
+TEST_ARRAY="test_urcu_gc test_urcu_mb_gc test_urcu_qsbr_gc
+            test_urcu_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc
+            test_urcu test_urcu_mb test_urcu_qsbr
             test_rwlock test_perthreadlock test_mutex"
 
 #setting gc each 32768. ** UPDATE FOR YOUR ARCHITECTURE BASED ON TEST ABOVE **
index 8bbac0024188ecf8ea4ae04e23f24161c3181252..c3f42ebe327bb231e9a7bf503afe4ac6117ecec9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index d2c8649132a056977e62f0bf6b1fb59836e80069..4ebea56ec52542ff65fcb918fe1b7a29c2ea9a08 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 #run all tests
 
 #set to number of active CPUS
index bba9e3e06e66c9e926db673617342905fb1d54e7..74fbd5b3f524592f3e31325837b57abc427f30a9 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 #run all tests
 
 #set to number of active CPUS
index 7c5f055c15349cce93340ccd547601a182bd8c81..4618c3c53642fcd5d0f8c650f21b68fe837d17c8 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 #run all tests
 
 #set to number of active CPUS
index ede402c7d981b797181cefca885717cf035068e9..4edddc469152b39a26e4723bfe1d527221f162f9 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 #run all tests
 
 #set to number of active CPUS
index bb4bfe7b35922b47652e987d6a6be008549c2d93..5d462ec543068e57ff42f676001f9579c1fd203a 100755 (executable)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 # test run after write-size update
 
 sh runpaul-phase1.sh
index 5f650725eb685389b02808c8f42c7b3ed1eca84c..647749b3db8a66cd8eee406bccb8adbe29eb5cf2 100755 (executable)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 sh runpaul-phase1.sh
 mkdir runpaul-phase1
 mv *.log runpaul-phase1/
index 4c301dac9f96fccdda0087abb4dc630430a497e6..83afd50bc9b25c55eecab728b77d43988254c2f9 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 #run all tests
 
 #set to number of active CPUS
index 55650234f4268b229b50350e1cadd1f8a1bbd8d1..93af6d4596d055422ceed26f6b96aefa7e093c5e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index cfc0bacb59e43f26c2acae165a3a48213ea2f7cb..761a5476b5c0f2f6db614624b94e9f585c04a7df 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
@@ -25,13 +25,13 @@ TMPFILE=$(mktemp)
 trap 'rm -f "$TMPFILE"; _exit' EXIT
 
 
-NUM_TESTS=15
+NUM_TESTS=12
 
 plan_tests     ${NUM_TESTS}
 
-for a in test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_urcu_qsbr_gc \
-       test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc \
-       test_urcu test_urcu_signal test_urcu_mb test_urcu_qsbr \
+for a in test_urcu_gc test_urcu_mb_gc test_urcu_qsbr_gc \
+       test_urcu_lgc test_urcu_mb_lgc test_urcu_qsbr_lgc \
+       test_urcu test_urcu_mb test_urcu_qsbr \
        test_rwlock test_perthreadlock test_mutex; do
        okx ${URCU_TESTS_TIME_BIN} "$URCU_TESTS_BUILDDIR/benchmark/${a}" "$@" 2>"${TMPFILE}"
        diag "time: $(cat "${TMPFILE}")"
index d0d7587d66a04a28fc2b4956b161ecfc10270b77..95f39e1542f5a5312bb83ef1f582e63c7e713464 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+# SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
 #run all tests
 
 #set to number of active CPUS
index ca66ffaf7b44f7c4ef5cf6a3efdb7a4331596fcb..7fec92cb8af50279addde6897944337cf997912b 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_cycles_per_loop.c
- *
  * Userspace RCU library - test cycles per loop
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <urcu/arch.h>
index d969ffcc00b2d58c0add83a53df2c31148d3aefd..b743828979f138dfee737639021c6a464f5b5401 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_looplen.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
index 55f7c38f21bf66f2d8ad7dbb91cb778256b6ccb4..6254e15c4cf0dee0bbf50f826eb8d0e1b91d295f 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -49,8 +35,6 @@ struct test_array {
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static volatile struct test_array test_array = { 8 };
@@ -111,19 +95,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -147,9 +118,7 @@ void *thr_reader(void *data)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
+       wait_until_go();
 
        for (;;) {
                int v;
@@ -182,10 +151,7 @@ void *thr_writer(void *data)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                pthread_mutex_lock(&lock);
@@ -325,13 +291,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 47a512cba06b12d8672247710db5feabdd2e3c45..2cc50d1d13b296400bfea0b0afa2572e75c399dc 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -53,8 +39,6 @@ struct per_thread_lock {
 
 static struct per_thread_lock *per_thread_lock;
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static volatile struct test_array test_array = { 8 };
@@ -117,19 +101,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -175,9 +146,7 @@ void *thr_reader(void *data)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
+       wait_until_go();
 
        for (;;) {
                int v;
@@ -211,10 +180,7 @@ void *thr_writer(void *data)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                for (tidx = 0; tidx < (long)nr_readers; tidx++) {
@@ -359,13 +325,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 34aae5fdba7918c1623b963deb5367ca195e571b..78222750302dd6e46a4d5fd1a60dbe36fd05f2c6 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_perthreadloc_timing.c
- *
  * Per thread locks - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
index 6908ea4ca5b4a7f315d76a5212640adface5073a..b275f78a51deb4f67afe134b63d1c0cff9b2545e 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -53,8 +39,6 @@ struct test_array {
  */
 pthread_rwlock_t lock;
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static volatile struct test_array test_array = { 8 };
@@ -116,19 +100,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -147,9 +118,7 @@ void *thr_reader(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
+       wait_until_go();
 
        for (;;) {
                int a, ret;
@@ -194,10 +163,7 @@ void *thr_writer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                int ret;
@@ -355,13 +321,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 99c957c148c3b92629505a998bcb270aeef6aaa3..2bae56ca275b676bfff217a7ec226f093ca42bee 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
index ea849fa7c481ce37cdf5dd9a384b12043d5b13b4..053993ae940349c7f0ae8a559bdf1f7180fd167a 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -44,8 +30,6 @@
 #endif
 #include <urcu.h>
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static int *test_rcu_pointer;
@@ -107,19 +91,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -142,10 +113,7 @@ void *thr_reader(void *_count)
        rcu_register_thread();
        urcu_posix_assert(!rcu_read_ongoing());
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -186,10 +154,7 @@ void *thr_writer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                new = malloc(sizeof(int));
@@ -337,13 +302,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 88889a89d0421097b90177f1853f7ac3fa5cb0db..d0272a7b2bf07939af4dce3643b31d736446b95c 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_assign.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -48,8 +34,6 @@ struct test_array {
        int a;
 };
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static struct test_array *test_rcu_pointer;
@@ -111,19 +95,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -201,10 +172,7 @@ void *thr_reader(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -240,10 +208,7 @@ void *thr_writer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_copy_mutex_lock();
@@ -394,13 +359,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 6f8c59d67500d548a8ffec10f0272ff5a1ed8f51..5da71320db3692c7159bcde0dd9937868c15ece9 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -44,8 +30,6 @@
 #endif
 #include <urcu-bp.h>
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static int *test_rcu_pointer;
@@ -107,19 +91,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -142,10 +113,7 @@ void *thr_reader(void *_count)
        rcu_register_thread();
        urcu_posix_assert(!rcu_read_ongoing());
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -182,10 +150,7 @@ void *thr_writer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                new = malloc(sizeof(int));
@@ -332,13 +297,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index e948ebff8e942d7dc0c21fe29e61b1f38dd5f1bd..56ac28d419d2b38345c030e4b8535e981f347b69 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_defer.c
- *
  * Userspace RCU library - test program (with automatic reclamation)
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -49,8 +35,6 @@ struct test_array {
        int a;
 };
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static struct test_array *test_rcu_pointer;
@@ -112,19 +96,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -149,10 +120,7 @@ void *thr_reader(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -203,10 +171,7 @@ void *thr_writer(void *data)
                exit(-1);
        }
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                new = malloc(sizeof(*new));
@@ -359,13 +324,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index f14f7286f4dcd4e7c20551fcd497e0f3feaab58a..d52a51df87278328e4c7995ded69f669bc7ceb49 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_gc.c
- *
  * Userspace RCU library - test program (with batch reclamation)
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -33,6 +19,7 @@
 #include <urcu/arch.h>
 #include <urcu/assert.h>
 #include <urcu/tls-compat.h>
+#include <urcu/uatomic.h>
 #include "thread-id.h"
 #include "../common/debug-yield.h"
 
@@ -48,8 +35,6 @@ struct test_array {
        int a;
 };
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static struct test_array *test_rcu_pointer;
@@ -120,19 +105,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -157,10 +129,7 @@ void *thr_reader(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -231,10 +200,7 @@ void *thr_writer(void *data)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
 #ifndef TEST_LOCAL_GC
@@ -399,13 +365,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 3574b4c3468117cce094344fcb170f390e06d8d1..606851baf37ee1b5a84e63b9e8c3cbe3e2a74e48 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_hash.c
- *
  * Userspace RCU library - test program
- *
- * Copyright 2009-2012 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "test_urcu_hash.h"
@@ -96,8 +82,6 @@ DEFINE_URCU_TLS(unsigned long, lookup_ok);
 
 struct cds_lfht *test_ht;
 
-volatile int test_go, test_stop;
-
 unsigned long wdelay;
 
 unsigned long duration;
@@ -649,14 +633,14 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        remain = duration;
        do {
                remain = sleep(remain);
        } while (remain > 0);
 
-       test_stop = 1;
+       end_test();
 
 end_pthread_join:
        for (i_thr = 0; i_thr < nr_readers_created; i_thr++) {
index 47b2ae3ea5f3523c06a5a67fb835b823ebe78fcf..0ecb781a129b2804b74a5ae8253ae2d7bd030b97 100644 (file)
@@ -1,26 +1,12 @@
+// SPDX-FileCopyrightText: 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 #ifndef _TEST_URCU_HASH_H
 #define _TEST_URCU_HASH_H
 
 /*
- * test_urcu_hash.h
- *
  * Userspace RCU library - test program
- *
- * Copyright 2009-2012 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -125,8 +111,6 @@ cds_lfht_iter_get_test_node(struct cds_lfht_iter *iter)
        return to_test_node(cds_lfht_iter_get_node(iter));
 }
 
-extern volatile int test_go, test_stop;
-
 extern unsigned long wdelay;
 
 extern unsigned long duration;
@@ -174,19 +158,6 @@ extern pthread_mutex_t affinity_mutex;
 
 void set_affinity(void);
 
-/*
- * returns 0 if test should end.
- */
-static inline int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static inline int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 extern DECLARE_URCU_TLS(unsigned long long, nr_writes);
 extern DECLARE_URCU_TLS(unsigned long long, nr_reads);
 
index 862a6f0dc5e55a09528d9e58da81a7a7bfaf2a90..b76603e6742db7f702ed38d46cd6c73fac4bfff3 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_hash_rw.c
- *
  * Userspace RCU library - test program
- *
- * Copyright 2009-2012 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "test_urcu_hash.h"
@@ -73,10 +59,7 @@ void *test_hash_rw_thr_reader(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -133,10 +116,7 @@ void *test_hash_rw_thr_writer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_lfht_node *ret_node = NULL;
index de7c427e4a1c3088b84cacd6232467f75f31fdfa..487baa878e698cc01bad314cd34d5b77cb615fe0 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_hash_unique.c
- *
  * Userspace RCU library - test program
- *
- * Copyright 2009-2012 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "test_urcu_hash.h"
@@ -71,10 +57,7 @@ void *test_hash_unique_thr_reader(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct lfht_test_node *node;
@@ -136,10 +119,7 @@ void *test_hash_unique_thr_writer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                /*
index 490e8b0527154f3f55edcf9beb0c44e0a1080aa5..66cf78ca36aa0e4668e663461cd2c84a7c12f8c6 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_lfq.c
- *
  * Userspace RCU library - example RCU-based lock-free queue
- *
- * Copyright February 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -47,8 +33,6 @@
 #include <urcu.h>
 #include <urcu/cds.h>
 
-static volatile int test_go, test_stop;
-
 static unsigned long rduration;
 
 static unsigned long duration;
@@ -110,12 +94,12 @@ static void set_affinity(void)
  */
 static int test_duration_dequeue(void)
 {
-       return !test_stop;
+       return test_duration_read();
 }
 
 static int test_duration_enqueue(void)
 {
-       return !test_stop;
+       return test_duration_write();
 }
 
 static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@ -146,10 +130,7 @@ void *thr_enqueuer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct test *node = malloc(sizeof(*node));
@@ -202,10 +183,7 @@ void *thr_dequeuer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_lfq_node_rcu *qnode;
@@ -375,7 +353,7 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
@@ -385,7 +363,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop = 1;
+       end_test();
 
        for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_join(tid_enqueuer[i_thr], &tret);
index 52239e02360931be91738c30753a6f5f522892ac..933f0b37bfdb01c6ce8d8d618b4945569e983d61 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_lfs.c
- *
  * Userspace RCU library - example lock-free stack
- *
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -59,8 +45,6 @@ enum test_sync {
 
 static enum test_sync test_sync;
 
-static volatile int test_go, test_stop;
-
 static unsigned long rduration;
 
 static unsigned long duration;
@@ -124,12 +108,12 @@ static void set_affinity(void)
  */
 static int test_duration_dequeue(void)
 {
-       return !test_stop;
+       return test_duration_read();
 }
 
 static int test_duration_enqueue(void)
 {
-       return !test_stop;
+       return test_duration_write();
 }
 
 static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@ -159,10 +143,7 @@ static void *thr_enqueuer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct test *node = malloc(sizeof(*node));
@@ -261,10 +242,7 @@ static void *thr_dequeuer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        urcu_posix_assert(test_pop || test_pop_all);
 
@@ -459,7 +437,7 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
@@ -469,7 +447,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop = 1;
+       end_test();
 
        for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_join(tid_enqueuer[i_thr], &tret);
index 7975fafd14585cc43372641e1eca5728e73a3742..cb9236d87d05a0209b3392a1aa47a34345c612f9 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_lfs_rcu.c
- *
  * Userspace RCU library - example RCU-based lock-free stack
- *
- * Copyright February 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -51,8 +37,6 @@
 
 #include <urcu/cds.h>
 
-static volatile int test_go, test_stop;
-
 static unsigned long rduration;
 
 static unsigned long duration;
@@ -114,12 +98,12 @@ static void set_affinity(void)
  */
 static int test_duration_dequeue(void)
 {
-       return !test_stop;
+       return test_duration_read();
 }
 
 static int test_duration_enqueue(void)
 {
-       return !test_stop;
+       return test_duration_write();
 }
 
 static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@ -150,10 +134,7 @@ void *thr_enqueuer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct test *node = malloc(sizeof(*node));
@@ -205,10 +186,7 @@ void *thr_dequeuer(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_lfs_node_rcu *snode;
@@ -377,7 +355,7 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
@@ -387,7 +365,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop = 1;
+       end_test();
 
        for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_join(tid_enqueuer[i_thr], &tret);
index 1ea369cbea9203fa690bee1d80c96f63fff488a4..a33dbd342df734baae3fc92678619a72f7116bb1 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -44,8 +30,6 @@
 #endif
 #include "urcu-qsbr.h"
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static int *test_rcu_pointer;
@@ -106,19 +90,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -145,10 +116,7 @@ void *thr_reader(void *_count)
        urcu_posix_assert(!rcu_read_ongoing());
        rcu_thread_online();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                rcu_read_lock();
@@ -192,10 +160,7 @@ void *thr_writer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                new = malloc(sizeof(int));
@@ -343,13 +308,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 8877a8213d3cbb466c5a98f07d364204fa0dc2c5..00f6757c9d294348cb969b015f4b658831301e7d 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_gc.c
- *
  * Userspace RCU library - test program (with baatch reclamation)
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -33,6 +19,7 @@
 #include <urcu/arch.h>
 #include <urcu/assert.h>
 #include <urcu/tls-compat.h>
+#include <urcu/uatomic.h>
 #include "thread-id.h"
 #include "../common/debug-yield.h"
 
@@ -46,8 +33,6 @@ struct test_array {
        int a;
 };
 
-static volatile int test_go, test_stop;
-
 static unsigned long wdelay;
 
 static struct test_array *test_rcu_pointer;
@@ -118,19 +103,6 @@ static void set_affinity(void)
 #endif /* HAVE_SCHED_SETAFFINITY */
 }
 
-/*
- * returns 0 if test should end.
- */
-static int test_duration_write(void)
-{
-       return !test_stop;
-}
-
-static int test_duration_read(void)
-{
-       return !test_stop;
-}
-
 static DEFINE_URCU_TLS(unsigned long long, nr_writes);
 static DEFINE_URCU_TLS(unsigned long long, nr_reads);
 
@@ -154,10 +126,7 @@ void *thr_reader(void *_count)
 
        rcu_register_thread();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                _rcu_read_lock();
@@ -231,10 +200,7 @@ void *thr_writer(void *data)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
 #ifndef TEST_LOCAL_GC
@@ -399,13 +365,7 @@ int main(int argc, char **argv)
                        exit(1);
        }
 
-       cmm_smp_mb();
-
-       test_go = 1;
-
-       sleep(duration);
-
-       test_stop = 1;
+       test_for(duration);
 
        for (i_thr = 0; i_thr < nr_readers; i_thr++) {
                err = pthread_join(tid_reader[i_thr], &tret);
index 09b9ca963c9133496cb3f2cc12512ede8e70089a..00de939ffa101c6bca95bd8d71530b5a5640dec4 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_qsbr_timing.c
- *
  * Userspace QSBR - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
index 35b0e80e2b1ce66b28bf95c10ca4a54e98c84f50..6ab390d4c5b85c6cb30d5c0f2c8a07189cc4c1be 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu.c
- *
  * Userspace RCU library - test program
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
index 2c6e0fd841842b40b6f08fe81cc75db9a6283c49..71bca100cd45670e15ff452eabfab389b0023d1a 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_wfcq.c
- *
  * Userspace RCU library - example RCU-based lock-free concurrent queue
- *
- * Copyright February 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -56,7 +42,7 @@ static enum test_sync test_sync;
 
 static int test_force_sync;
 
-static volatile int test_go, test_stop_enqueue, test_stop_dequeue;
+static volatile int test_stop_enqueue, test_stop_dequeue;
 
 static unsigned long rduration;
 
@@ -122,12 +108,12 @@ static void set_affinity(void)
  */
 static int test_duration_dequeue(void)
 {
-       return !test_stop_dequeue;
+       return !uatomic_load(&test_stop_dequeue, CMM_RELAXED);
 }
 
 static int test_duration_enqueue(void)
 {
-       return !test_stop_enqueue;
+       return !uatomic_load(&test_stop_enqueue, CMM_RELAXED);
 }
 
 static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@ -155,10 +141,7 @@ static void *thr_enqueuer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_wfcq_node *node = malloc(sizeof(*node));
@@ -266,10 +249,7 @@ static void *thr_dequeuer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                if (test_dequeue && test_splice) {
@@ -482,7 +462,7 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
@@ -492,7 +472,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop_enqueue = 1;
+       uatomic_store(&test_stop_enqueue, 1, CMM_RELEASE);
 
        if (test_wait_empty) {
                while (nr_enqueuers != uatomic_read(&test_enqueue_stopped)) {
@@ -503,7 +483,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop_dequeue = 1;
+       uatomic_store(&test_stop_dequeue, 1, CMM_RELAXED);
 
        for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_join(tid_enqueuer[i_thr], &tret);
index 8381160fe8ecd95c0238984137cf861bcb46eafd..b17df5ac37787b432c3456a82ecba6b21303e03f 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_wfq.c
- *
  * Userspace RCU library - example RCU-based lock-free queue
- *
- * Copyright February 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -51,8 +37,6 @@
 #include <urcu.h>
 #include <urcu/wfqueue.h>
 
-static volatile int test_go, test_stop;
-
 static unsigned long rduration;
 
 static unsigned long duration;
@@ -114,12 +98,12 @@ static void set_affinity(void)
  */
 static int test_duration_dequeue(void)
 {
-       return !test_stop;
+       return test_duration_read();
 }
 
 static int test_duration_enqueue(void)
 {
-       return !test_stop;
+       return test_duration_write();
 }
 
 static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@ -143,10 +127,7 @@ void *thr_enqueuer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_wfq_node *node = malloc(sizeof(*node));
@@ -185,10 +166,7 @@ void *thr_dequeuer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_wfq_node *node = cds_wfq_dequeue_blocking(&q);
@@ -343,7 +321,7 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
@@ -353,7 +331,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop = 1;
+       end_test();
 
        for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_join(tid_enqueuer[i_thr], &tret);
index c285feb30577a60cca79b8ed055fbb3fbc7fc1d3..39704f4acb5cce5eee13112fa127d78bea31e6d7 100644 (file)
@@ -1,24 +1,10 @@
-/*
- * test_urcu_wfs.c
- *
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2010 Paolo Bonzini <pbonzini@redhat.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+ /*
  * Userspace RCU library - example RCU-based lock-free stack
- *
- * Copyright February 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -59,7 +45,7 @@ static enum test_sync test_sync;
 
 static int test_force_sync;
 
-static volatile int test_go, test_stop_enqueue, test_stop_dequeue;
+static volatile int test_stop_enqueue, test_stop_dequeue;
 
 static unsigned long rduration;
 
@@ -125,12 +111,12 @@ static void set_affinity(void)
  */
 static int test_duration_dequeue(void)
 {
-       return !test_stop_dequeue;
+       return !uatomic_load(&test_stop_dequeue, CMM_RELAXED);
 }
 
 static int test_duration_enqueue(void)
 {
-       return !test_stop_enqueue;
+       return !uatomic_load(&test_stop_enqueue, CMM_RELAXED);
 }
 
 static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@ -157,10 +143,7 @@ static void *thr_enqueuer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        for (;;) {
                struct cds_wfs_node *node = malloc(sizeof(*node));
@@ -250,10 +233,7 @@ static void *thr_dequeuer(void *_count)
 
        set_affinity();
 
-       while (!test_go)
-       {
-       }
-       cmm_smp_mb();
+       wait_until_go();
 
        urcu_posix_assert(test_pop || test_pop_all);
 
@@ -469,7 +449,7 @@ int main(int argc, char **argv)
 
        cmm_smp_mb();
 
-       test_go = 1;
+       begin_test();
 
        for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
@@ -479,7 +459,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop_enqueue = 1;
+       uatomic_store(&test_stop_enqueue, 1, CMM_RELEASE);
 
        if (test_wait_empty) {
                while (nr_enqueuers != uatomic_read(&test_enqueue_stopped)) {
@@ -490,7 +470,7 @@ int main(int argc, char **argv)
                }
        }
 
-       test_stop_dequeue = 1;
+       uatomic_store(&test_stop_dequeue, 1, CMM_RELAXED);
 
        for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_join(tid_enqueuer[i_thr], &tret);
index c7223f8f1a47527246b0564bb58c385092dbe96f..8d229bfbb365193e8661f8942b15b8e2e85690ed 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 63595b9b356901fc05a183c4a857972094af4f3d..da8aae1c5d3154ee90f5f96f3914843eaa4da038 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 4ceee7e8c1f7596e9bc277820da331caf917e3ba..0ec6ebb508d7e15baa58c5afa362c85b0f204996 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index bfd5d57b08a66351e71abafc99e6feaf5aa636f2..af6d89f5c9c3f66f851d69c6d73924f22196033f 100644 (file)
@@ -1,9 +1,14 @@
-AM_CPPFLAGS += -I$(top_srcdir)/src
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
 
-noinst_HEADERS = thread-id.h
+AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/tests/common
+
+noinst_HEADERS = \
+       api.h \
+       compat-rand.h \
+       thread-id.h
 
 noinst_LTLIBRARIES = libdebug-yield.la
 
 libdebug_yield_la_SOURCES = debug-yield.c debug-yield.h
-
-EXTRA_DIST = api.h
index a260463ad09ea212bb7ee4517a2fd995f21b2d74..ec3ce1ef7486251ec0321d0c65d18aa761816af4 100644 (file)
@@ -1,31 +1,20 @@
+// SPDX-FileCopyrightText: 2006 Paul E. McKenney, IBM.
+//
+// SPDX-License-Identifier: GPL-2.0-only
+
 #ifndef _INCLUDE_API_H
 #define _INCLUDE_API_H
 
 /*
  * common.h: Common Linux kernel-isms.
  *
- * This program is 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; but version 2 of the License only due
- * to code included from the Linux kernel.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright (c) 2006 Paul E. McKenney, IBM.
- *
  * Much code taken from the Linux kernel.  For such code, the option
  * to redistribute under later versions of GPL might not be available.
  */
 
 #include <urcu/compiler.h>
 #include <urcu/arch.h>
+#include <urcu/uatomic.h>
 
 /*
  * Machine parameters.
 #define ____cacheline_internodealigned_in_smp \
        __attribute__((__aligned__(CAA_CACHE_LINE_SIZE)))
 
-/*
- * api_pthreads.h: API mapping to pthreads environment.
- *
- * This program is 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 2 of the License, or
- * (at your option) any later version.  However, please note that much
- * of the code in this file derives from the Linux kernel, and that such
- * code may not be available except under GPLv2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Copyright (c) 2006 Paul E. McKenney, IBM.
- */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -135,7 +103,7 @@ static int __smp_thread_id(void)
        thread_id_t tid = pthread_self();
 
        for (i = 0; i < NR_THREADS; i++) {
-               if (__thread_id_map[i] == tid) {
+               if (uatomic_read(&__thread_id_map[i]) == tid) {
                        long v = i + 1;  /* must be non-NULL. */
 
                        if (pthread_setspecific(thread_id_key, (void *)v) != 0) {
@@ -184,12 +152,13 @@ static thread_id_t create_thread(void *(*func)(void *), void *arg)
                exit(-1);
        }
        __thread_id_map[i] = __THREAD_ID_MAP_WAITING;
-       spin_unlock(&__thread_id_map_mutex);
+
        if (pthread_create(&tid, NULL, func, arg) != 0) {
                perror("create_thread:pthread_create");
                exit(-1);
        }
-       __thread_id_map[i] = tid;
+       uatomic_set(&__thread_id_map[i], tid);
+       spin_unlock(&__thread_id_map_mutex);
        return tid;
 }
 
@@ -199,7 +168,7 @@ static void *wait_thread(thread_id_t tid)
        void *vp;
 
        for (i = 0; i < NR_THREADS; i++) {
-               if (__thread_id_map[i] == tid)
+               if (uatomic_read(&__thread_id_map[i]) == tid)
                        break;
        }
        if (i >= NR_THREADS){
@@ -211,7 +180,7 @@ static void *wait_thread(thread_id_t tid)
                perror("wait_thread:pthread_join");
                exit(-1);
        }
-       __thread_id_map[i] = __THREAD_ID_MAP_EMPTY;
+       uatomic_set(&__thread_id_map[i], __THREAD_ID_MAP_EMPTY);
        return vp;
 }
 
diff --git a/tests/common/compat-rand.h b/tests/common/compat-rand.h
new file mode 100644 (file)
index 0000000..42fbb30
--- /dev/null
@@ -0,0 +1,49 @@
+// SPDX-FileCopyrightText: 1996 Ulrich Drepper <drepper@cygnus.com>
+// SPDX-FileCopyrightText: 2013 Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#ifndef _COMPAT_RAND_H
+#define _COMPAT_RAND_H
+
+/*
+ * Userspace RCU library - rand/rand_r Compatibility Header
+ *
+ * Note: this file is only used to simplify the code required to
+ * use the 'rand_r(...)' system function across multiple platforms,
+ * which might not always be referenced the same way.
+ */
+
+#ifndef HAVE_RAND_R
+/*
+ * Reentrant random function from POSIX.1c.
+ * Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+ * This file is part of the GNU C Library.
+ * Contributed by Ulrich Drepper <drepper@cygnus.com <mailto:drepper@cygnus.com>>, 1996.
+ */
+static inline int rand_r(unsigned int *seed)
+{
+       unsigned int next = *seed;
+       int result;
+
+       next *= 1103515245;
+       next += 12345;
+       result = (unsigned int) (next / 65536) % 2048;
+
+       next *= 1103515245;
+       next += 12345;
+       result <<= 10;
+       result ^= (unsigned int) (next / 65536) % 1024;
+
+       next *= 1103515245;
+       next += 12345;
+       result <<= 10;
+       result ^= (unsigned int) (next / 65536) % 1024;
+
+       *seed = next;
+
+       return result;
+}
+#endif /* HAVE_RAND_R */
+
+#endif /* _COMPAT_RAND_H */
index 8f06a9ddea0a7fb19facc24d86e6bd504c43014d..16205a415aa85339695da61f114292403b98c927 100644 (file)
@@ -1,25 +1,11 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 /*
- * debug-yield.c
- *
  * Userspace RCU library tests - Debugging code
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
index 7f1b58acf9744453da474b6a23a519f9545f5865..7d4f62ac7e6047d88bc4b6af16195eab7867eba8 100644 (file)
@@ -1,28 +1,14 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+// SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef URCU_TESTS_DEBUG_YIELD_H
 #define URCU_TESTS_DEBUG_YIELD_H
 
 /*
- * debug-yield.h
- *
  * Userspace RCU library tests - Debugging header
  *
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  * IBM's contributions to this file may be relicensed under LGPLv2 or later.
  */
 
 #define RCU_YIELD_READ         (1 << 0)
 #define RCU_YIELD_WRITE        (1 << 1)
 
-/*
- * Updates with RCU_SIGNAL are much slower. Account this in the delay.
- */
-#ifdef RCU_SIGNAL
-/* maximum sleep delay, in us */
-#define MAX_SLEEP 30000
-#else
 #define MAX_SLEEP 50
-#endif
 
 extern unsigned int rcu_yield_active;
 extern DECLARE_URCU_TLS(unsigned int, rcu_rand_yield);
index cb0d903748b1d0ddf2fd6b7c8a219d10f917896c..575acaf9f81c6e5bda1a2de2c5b674b4e7f7e8d2 100644 (file)
@@ -1,21 +1,12 @@
+// SPDX-FileCopyrightText: 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LicenseRef-Boehm-GC
+
 #ifndef _TEST_THREAD_ID_H
 #define _TEST_THREAD_ID_H
 
 /*
- * thread-id.h
- *
  * Userspace RCU library - thread ID
- *
- * Copyright 2013 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
  */
 
 #ifdef __linux__
@@ -68,7 +59,14 @@ unsigned long urcu_get_thread_id(void)
        pthread_t thr = pthread_self();
        return pthread_getsequence_np(&thr);
 }
+#elif defined(__OpenBSD__)
+#include <unistd.h>
 
+static inline
+unsigned long urcu_get_thread_id(void)
+{
+       return (unsigned long) getthrid();
+}
 #else
 # warning "use pid as thread ID"
 static inline
index 96bda6f6cdbacaa446a813fb3eaefb0306f56d6e..93c35efbeb82fb323d9411d87ef2ebe2278c3060 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/tests/utils -I$(top_srcdir)/tests/common
 
 TEST_EXTENSIONS = .tap
@@ -12,8 +16,6 @@ noinst_PROGRAMS = \
        test_urcu_fork_cxx.tap \
        rcutorture_urcu_membarrier \
        rcutorture_urcu_membarrier_cxx \
-       rcutorture_urcu_signal \
-       rcutorture_urcu_signal_cxx \
        rcutorture_urcu_mb \
        rcutorture_urcu_mb_cxx \
        rcutorture_urcu_bp \
@@ -27,7 +29,6 @@ URCU_COMMON_LIB=$(top_builddir)/src/liburcu-common.la
 URCU_LIB=$(top_builddir)/src/liburcu.la
 URCU_QSBR_LIB=$(top_builddir)/src/liburcu-qsbr.la
 URCU_MB_LIB=$(top_builddir)/src/liburcu-mb.la
-URCU_SIGNAL_LIB=$(top_builddir)/src/liburcu-signal.la
 URCU_BP_LIB=$(top_builddir)/src/liburcu-bp.la
 URCU_CDS_LIB=$(top_builddir)/src/liburcu-cds.la
 TAP_LIB=$(top_builddir)/tests/utils/libtap.a
@@ -62,14 +63,6 @@ rcutorture_urcu_qsbr_cxx_SOURCES = urcutorture_cxx.cpp
 rcutorture_urcu_qsbr_cxx_CXXFLAGS = -DTORTURE_QSBR -DRCU_QSBR $(AM_CXXFLAGS)
 rcutorture_urcu_qsbr_cxx_LDADD = $(URCU_QSBR_LIB) $(TAP_LIB)
 
-rcutorture_urcu_signal_SOURCES = urcutorture.c
-rcutorture_urcu_signal_CFLAGS = -DRCU_SIGNAL $(AM_CFLAGS)
-rcutorture_urcu_signal_LDADD = $(URCU_SIGNAL_LIB) $(TAP_LIB)
-
-rcutorture_urcu_signal_cxx_SOURCES = urcutorture_cxx.cpp
-rcutorture_urcu_signal_cxx_CXXFLAGS = -DRCU_SIGNAL $(AM_CXXFLAGS)
-rcutorture_urcu_signal_cxx_LDADD = $(URCU_SIGNAL_LIB) $(TAP_LIB)
-
 rcutorture_urcu_bp_SOURCES = urcutorture.c
 rcutorture_urcu_bp_CFLAGS = -DRCU_BP $(AM_CFLAGS)
 rcutorture_urcu_bp_LDADD = $(URCU_BP_LIB) $(TAP_LIB)
@@ -176,31 +169,7 @@ dist_check_SCRIPTS = \
        test_rcutorture_urcu_qsbr_uperf_percpu.tap \
        test_rcutorture_urcu_qsbr_uperf_percpu_cxx.tap \
        test_rcutorture_urcu_qsbr_uperf_perthread.tap \
-       test_rcutorture_urcu_qsbr_uperf_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_perf_global.tap \
-       test_rcutorture_urcu_signal_perf_global_cxx.tap \
-       test_rcutorture_urcu_signal_perf_percpu.tap \
-       test_rcutorture_urcu_signal_perf_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_perf_perthread.tap \
-       test_rcutorture_urcu_signal_perf_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_rperf_global.tap \
-       test_rcutorture_urcu_signal_rperf_global_cxx.tap \
-       test_rcutorture_urcu_signal_rperf_percpu.tap \
-       test_rcutorture_urcu_signal_rperf_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_rperf_perthread.tap \
-       test_rcutorture_urcu_signal_rperf_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_stress_global.tap \
-       test_rcutorture_urcu_signal_stress_global_cxx.tap \
-       test_rcutorture_urcu_signal_stress_percpu.tap \
-       test_rcutorture_urcu_signal_stress_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_stress_perthread.tap \
-       test_rcutorture_urcu_signal_stress_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_uperf_global.tap \
-       test_rcutorture_urcu_signal_uperf_global_cxx.tap \
-       test_rcutorture_urcu_signal_uperf_percpu.tap \
-       test_rcutorture_urcu_signal_uperf_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_uperf_perthread.tap \
-       test_rcutorture_urcu_signal_uperf_perthread_cxx.tap
+       test_rcutorture_urcu_qsbr_uperf_perthread_cxx.tap
 
 .PHONY: regtest
 
@@ -306,31 +275,7 @@ REGTEST_TESTS = \
        test_rcutorture_urcu_qsbr_uperf_percpu.tap \
        test_rcutorture_urcu_qsbr_uperf_percpu_cxx.tap \
        test_rcutorture_urcu_qsbr_uperf_perthread.tap \
-       test_rcutorture_urcu_qsbr_uperf_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_perf_global.tap \
-       test_rcutorture_urcu_signal_perf_global_cxx.tap \
-       test_rcutorture_urcu_signal_perf_percpu.tap \
-       test_rcutorture_urcu_signal_perf_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_perf_perthread.tap \
-       test_rcutorture_urcu_signal_perf_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_rperf_global.tap \
-       test_rcutorture_urcu_signal_rperf_global_cxx.tap \
-       test_rcutorture_urcu_signal_rperf_percpu.tap \
-       test_rcutorture_urcu_signal_rperf_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_rperf_perthread.tap \
-       test_rcutorture_urcu_signal_rperf_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_stress_global.tap \
-       test_rcutorture_urcu_signal_stress_global_cxx.tap \
-       test_rcutorture_urcu_signal_stress_percpu.tap \
-       test_rcutorture_urcu_signal_stress_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_stress_perthread.tap \
-       test_rcutorture_urcu_signal_stress_perthread_cxx.tap \
-       test_rcutorture_urcu_signal_uperf_global.tap \
-       test_rcutorture_urcu_signal_uperf_global_cxx.tap \
-       test_rcutorture_urcu_signal_uperf_percpu.tap \
-       test_rcutorture_urcu_signal_uperf_percpu_cxx.tap \
-       test_rcutorture_urcu_signal_uperf_perthread.tap \
-       test_rcutorture_urcu_signal_uperf_perthread_cxx.tap
+       test_rcutorture_urcu_qsbr_uperf_perthread_cxx.tap
 
 regtest:
        $(MAKE) $(AM_MAKEFLAGS) check TESTS="$(REGTEST_TESTS)"
index 639fcfc19cb2bfe33f765629dd233af04e35267d..441ff79bf349fa301b60e7ee61935e0caa58aba2 100644 (file)
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2008 Paul E. McKenney, IBM Corporation.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
  * rcutorture.h: simple user-level performance/stress test of RCU.
  *
  * data.  A correct RCU implementation will have all but the first two
  * numbers non-zero.
  *
+ * rcu_stress_count: Histogram of "ages" of structures seen by readers.  If any
+ * entries past the first two are non-zero, RCU is broken. The age of a newly
+ * allocated structure is zero, it becomes one when removed from reader
+ * visibility, and is incremented once per grace period subsequently -- and is
+ * freed after passing through (RCU_STRESS_PIPE_LEN-2) grace periods.  Since
+ * this tests only has one true writer (there are fake writers), only buckets at
+ * indexes 0 and 1 should be none-zero.
+ *
  * This program is 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 2 of the License, or
 #include <stdlib.h>
 #include "tap.h"
 
+#include <urcu/uatomic.h>
+
+#include "urcu-wait.h"
+
 #define NR_TESTS       1
 
 DEFINE_PER_THREAD(long long, n_reads_pt);
@@ -79,6 +95,12 @@ enum callrcu_type {
        CALLRCU_PERTHREAD,
 };
 
+enum writer_state {
+       WRITER_STATE_SYNC_RCU,
+       WRITER_STATE_CALL_RCU,
+       WRITER_STATE_POLL_RCU,
+};
+
 static enum callrcu_type callrcu_type = CALLRCU_GLOBAL;
 
 long long n_reads = 0LL;
@@ -139,10 +161,10 @@ void *rcu_read_perf_test(void *arg)
        run_on(me);
        uatomic_inc(&nthreadsrunning);
        put_thread_offline();
-       while (goflag == GOFLAG_INIT)
+       while (uatomic_read(&goflag) == GOFLAG_INIT)
                (void) poll(NULL, 0, 1);
        put_thread_online();
-       while (goflag == GOFLAG_RUN) {
+       while (uatomic_read(&goflag) == GOFLAG_RUN) {
                for (i = 0; i < RCU_READ_RUN; i++) {
                        rcu_read_lock();
                        /* rcu_read_lock_nest(); */
@@ -174,9 +196,9 @@ void *rcu_update_perf_test(void *arg __attribute__((unused)))
                }
        }
        uatomic_inc(&nthreadsrunning);
-       while (goflag == GOFLAG_INIT)
+       while (uatomic_read(&goflag) == GOFLAG_INIT)
                (void) poll(NULL, 0, 1);
-       while (goflag == GOFLAG_RUN) {
+       while (uatomic_read(&goflag) == GOFLAG_RUN) {
                synchronize_rcu();
                n_updates_local++;
        }
@@ -205,15 +227,11 @@ int perftestrun(int nthreads, int nreaders, int nupdaters)
        int t;
        int duration = 1;
 
-       cmm_smp_mb();
        while (uatomic_read(&nthreadsrunning) < nthreads)
                (void) poll(NULL, 0, 1);
-       goflag = GOFLAG_RUN;
-       cmm_smp_mb();
+       uatomic_set(&goflag, GOFLAG_RUN);
        sleep(duration);
-       cmm_smp_mb();
-       goflag = GOFLAG_STOP;
-       cmm_smp_mb();
+       uatomic_set(&goflag, GOFLAG_STOP);
        wait_all_threads();
        for_each_thread(t) {
                n_reads += per_thread(n_reads_pt, t);
@@ -294,6 +312,13 @@ struct rcu_stress rcu_stress_array[RCU_STRESS_PIPE_LEN] = { { 0, 0 } };
 struct rcu_stress *rcu_stress_current;
 int rcu_stress_idx = 0;
 
+/*
+ * How many time a reader has seen something that should not be visible. It is
+ * an error if this value is different than zero at the end of the stress test.
+ *
+ * Here, the something that should not be visibile is an old pipe that has been
+ * freed (mbtest = 0).
+ */
 int n_mberror = 0;
 DEFINE_PER_THREAD(long long [RCU_STRESS_PIPE_LEN + 1], rcu_stress_count);
 
@@ -309,19 +334,25 @@ void *rcu_read_stress_test(void *arg __attribute__((unused)))
 
        rcu_register_thread();
        put_thread_offline();
-       while (goflag == GOFLAG_INIT)
+       while (uatomic_read(&goflag) == GOFLAG_INIT)
                (void) poll(NULL, 0, 1);
        put_thread_online();
-       while (goflag == GOFLAG_RUN) {
+       while (uatomic_read(&goflag) == GOFLAG_RUN) {
                rcu_read_lock();
                p = rcu_dereference(rcu_stress_current);
                if (p->mbtest == 0)
-                       n_mberror++;
+                       uatomic_inc_mo(&n_mberror, CMM_RELAXED);
                rcu_read_lock_nest();
+               /*
+                * The value of garbage is nothing important. This is
+                * essentially a busy loop. The atomic operation -- while not
+                * important here -- helps tools such as TSAN to not flag this
+                * as a race condition.
+                */
                for (i = 0; i < 100; i++)
-                       garbage++;
+                       uatomic_inc(&garbage);
                rcu_read_unlock_nest();
-               pc = p->pipe_count;
+               pc = uatomic_read(&p->pipe_count);
                rcu_read_unlock();
                if ((pc > RCU_STRESS_PIPE_LEN) || (pc < 0))
                        pc = RCU_STRESS_PIPE_LEN;
@@ -340,34 +371,30 @@ void *rcu_read_stress_test(void *arg __attribute__((unused)))
        return (NULL);
 }
 
-static pthread_mutex_t call_rcu_test_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t call_rcu_test_cond = PTHREAD_COND_INITIALIZER;
+static DEFINE_URCU_WAIT_QUEUE(call_rcu_waiters);
 
 static
 void rcu_update_stress_test_rcu(struct rcu_head *head __attribute__((unused)))
 {
-       int ret;
+       struct urcu_waiters waiters;
 
-       ret = pthread_mutex_lock(&call_rcu_test_mutex);
-       if (ret) {
-               errno = ret;
-               diag("pthread_mutex_lock: %s",
-                       strerror(errno));
-               abort();
-       }
-       ret = pthread_cond_signal(&call_rcu_test_cond);
-       if (ret) {
-               errno = ret;
-               diag("pthread_cond_signal: %s",
-                       strerror(errno));
-               abort();
-       }
-       ret = pthread_mutex_unlock(&call_rcu_test_mutex);
-       if (ret) {
-               errno = ret;
-               diag("pthread_mutex_unlock: %s",
-                       strerror(errno));
-               abort();
+       urcu_move_waiters(&waiters, &call_rcu_waiters);
+       urcu_wake_all_waiters(&waiters);
+}
+
+static
+void advance_writer_state(enum writer_state *state)
+{
+       switch (*state) {
+       case WRITER_STATE_SYNC_RCU:
+               *state = WRITER_STATE_CALL_RCU;
+               break;
+       case WRITER_STATE_CALL_RCU:
+               *state = WRITER_STATE_POLL_RCU;
+               break;
+       case WRITER_STATE_POLL_RCU:
+               *state = WRITER_STATE_SYNC_RCU;
+               break;
        }
 }
 
@@ -375,73 +402,93 @@ static
 void *rcu_update_stress_test(void *arg __attribute__((unused)))
 {
        int i;
-       struct rcu_stress *p;
+       struct rcu_stress *p, *old_p;
        struct rcu_head rh;
+       enum writer_state writer_state = WRITER_STATE_SYNC_RCU;
 
-       while (goflag == GOFLAG_INIT)
+       rcu_register_thread();
+
+       /* Offline for poll. */
+       put_thread_offline();
+       while (uatomic_read(&goflag) == GOFLAG_INIT)
                (void) poll(NULL, 0, 1);
-       while (goflag == GOFLAG_RUN) {
+       put_thread_online();
+
+       old_p = NULL;
+       while (uatomic_read(&goflag) == GOFLAG_RUN) {
                i = rcu_stress_idx + 1;
                if (i >= RCU_STRESS_PIPE_LEN)
                        i = 0;
+
+               rcu_read_lock();
+               old_p = rcu_dereference(rcu_stress_current);
+               rcu_read_unlock();
+
+               /*
+                * Allocate a new pipe.
+                */
                p = &rcu_stress_array[i];
-               p->mbtest = 0;
-               cmm_smp_mb();
                p->pipe_count = 0;
                p->mbtest = 1;
+
                rcu_assign_pointer(rcu_stress_current, p);
                rcu_stress_idx = i;
+
+               /*
+                * Increment every pipe except the freshly allocated one. A
+                * reader should only see either the old pipe or the new
+                * pipe. This is reflected in the rcu_stress_count histogram.
+                */
                for (i = 0; i < RCU_STRESS_PIPE_LEN; i++)
                        if (i != rcu_stress_idx)
-                               rcu_stress_array[i].pipe_count++;
-               if (n_updates & 0x1)
+                               uatomic_inc(&rcu_stress_array[i].pipe_count);
+
+               switch (writer_state) {
+               case WRITER_STATE_SYNC_RCU:
                        synchronize_rcu();
-               else {
-                       int ret;
-
-                       ret = pthread_mutex_lock(&call_rcu_test_mutex);
-                       if (ret) {
-                               errno = ret;
-                               diag("pthread_mutex_lock: %s",
-                                       strerror(errno));
-                               abort();
-                       }
-                       rcu_register_thread();
+                       break;
+               case WRITER_STATE_CALL_RCU:
+               {
+                       DEFINE_URCU_WAIT_NODE(wait, URCU_WAIT_WAITING);
+
+                       urcu_wait_add(&call_rcu_waiters, &wait);
+
                        call_rcu(&rh, rcu_update_stress_test_rcu);
-                       rcu_unregister_thread();
-                       /*
-                        * Our MacOS X test machine with the following
-                        * config:
-                        * 15.6.0 Darwin Kernel Version 15.6.0
-                        * root:xnu-3248.60.10~1/RELEASE_X86_64
-                        * appears to have issues with liburcu-signal
-                        * signal being delivered on top of
-                        * pthread_cond_wait. It seems to make the
-                        * thread continue, and therefore corrupt the
-                        * rcu_head. Work around this issue by
-                        * unregistering the RCU read-side thread
-                        * immediately after call_rcu (call_rcu needs
-                        * us to be registered RCU readers).
-                        */
-                       ret = pthread_cond_wait(&call_rcu_test_cond,
-                                       &call_rcu_test_mutex);
-                       if (ret) {
-                               errno = ret;
-                               diag("pthread_cond_signal: %s",
-                                       strerror(errno));
-                               abort();
-                       }
-                       ret = pthread_mutex_unlock(&call_rcu_test_mutex);
-                       if (ret) {
-                               errno = ret;
-                               diag("pthread_mutex_unlock: %s",
-                                       strerror(errno));
-                               abort();
-                       }
+
+                       /* Offline for busy-wait. */
+                       put_thread_offline();
+                       urcu_adaptative_busy_wait(&wait);
+                       put_thread_online();
+                       break;
+               }
+               case WRITER_STATE_POLL_RCU:
+               {
+                       struct urcu_gp_poll_state poll_state;
+
+                       poll_state = start_poll_synchronize_rcu();
+
+                       /* Offline for poll. */
+                       put_thread_offline();
+                       while (!poll_state_synchronize_rcu(poll_state))
+                               (void) poll(NULL, 0, 1);        /* Wait for 1ms */
+                       put_thread_online();
+                       break;
                }
+               }
+               /*
+                * No readers should see that old pipe now. Setting mbtest to 0
+                * to mark it as "freed".
+                */
+               if (old_p) {
+                       old_p->mbtest = 0;
+               }
+               old_p = p;
                n_updates++;
+               advance_writer_state(&writer_state);
        }
 
+       rcu_unregister_thread();
+
        return NULL;
 }
 
@@ -457,9 +504,9 @@ void *rcu_fake_update_stress_test(void *arg __attribute__((unused)))
                        set_thread_call_rcu_data(crdp);
                }
        }
-       while (goflag == GOFLAG_INIT)
+       while (uatomic_read(&goflag) == GOFLAG_INIT)
                (void) poll(NULL, 0, 1);
-       while (goflag == GOFLAG_RUN) {
+       while (uatomic_read(&goflag) == GOFLAG_RUN) {
                synchronize_rcu();
                (void) poll(NULL, 0, 1);
        }
@@ -480,6 +527,7 @@ int stresstest(int nreaders)
        int t;
        long long *p;
        long long sum;
+       int ret;
 
        init_per_thread(n_reads_pt, 0LL);
        for_each_thread(t) {
@@ -495,13 +543,9 @@ int stresstest(int nreaders)
        create_thread(rcu_update_stress_test, NULL);
        for (i = 0; i < 5; i++)
                create_thread(rcu_fake_update_stress_test, NULL);
-       cmm_smp_mb();
-       goflag = GOFLAG_RUN;
-       cmm_smp_mb();
+       uatomic_set(&goflag, GOFLAG_RUN);
        sleep(10);
-       cmm_smp_mb();
-       goflag = GOFLAG_STOP;
-       cmm_smp_mb();
+       uatomic_set(&goflag, GOFLAG_STOP);
        wait_all_threads();
        for_each_thread(t)
                n_reads += per_thread(n_reads_pt, t);
@@ -509,11 +553,19 @@ int stresstest(int nreaders)
               n_reads, n_updates, n_mberror);
        rdiag_start();
        rdiag("rcu_stress_count:");
+       ret = 0;
        for (i = 0; i <= RCU_STRESS_PIPE_LEN; i++) {
                sum = 0LL;
                for_each_thread(t) {
                        sum += per_thread(rcu_stress_count, t)[i];
                }
+               /*
+                * If any entries past the first two are non-zero, RCU is
+                * broken. See details above about rcu_stress_count.
+                */
+               if (i > 1 && sum != 0) {
+                       ret = -1;
+               }
                rdiag(" %lld", sum);
        }
        rdiag_end();
@@ -521,10 +573,9 @@ int stresstest(int nreaders)
                diag("Deallocating per-CPU call_rcu threads.");
                free_all_cpu_call_rcu_data();
        }
-       if (!n_mberror)
-               return 0;
-       else
-               return -1;
+       if (n_mberror)
+               ret = -1;
+       return ret;
 }
 
 /*
@@ -532,7 +583,7 @@ int stresstest(int nreaders)
  */
 
 static
-void usage(char *argv[]) __attribute__((noreturn));
+void usage(char *argv[]) __attribute__((__noreturn__));
 
 static
 void usage(char *argv[])
index c39c731838361e331c410de93c2c6999353bf300..96a640d8e7a95e5951b9d739440266c63864fae5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 274ed4725c6e3525ad1712a7a755322f18bea8c3..9c324bd71c5d33528b3a46e3cdc5e322211746ff 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index f6e7763b586cc96af664acae0115aca321905be2..f697116305e48adc090f85ffa3d53d199847e60c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index e2086b4fe18bd5e057790208daf8fb71e444ae38..e30d6f5f2765a8a3a225bab4eb806336b97f8f86 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 9baa0a9c9783fc274dc916c1eef3e44b475b6495..f18dc8c4fd87e5d1a7f0cc9bbb52d9aa086be99c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 3ac1093b80753764288b0b7bcf621b956ed23bee..54c09ec0412cd28ee5929fea661a86ffa4099e6b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index b33afc084ac1e0ebf3d1af734900fde0f4b996c6..c003127c0d8ef24054cd46185d7d98af7f41fbcd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index c93a9b2d0d521bdc773ec0fb61ee95a739a9d129..4109798aceba49126f95a9b32052d64be1f5012e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ff776bca2026b083d6e2bdfbc62feed83d918b6b..96d36745ddb459514ae3188c0415e2ea885cc2ca 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 492c30c6c0a9aa08efdf01462b677e9e49b357e1..9ce9e9f6ba0ccdcdfb5bd623fb523754553050c7 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 73dc02cb454a05d89ec3514b453579fbe642187a..9635caab22782a61ff9ff8cdcb78443fd5377fed 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 7d38a355dafc77464007435dc3b981cb3500125b..66668fe42c60e20b9e84cba1251ef0cebb4a337f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ffd0bd952a744ca6aed7f85538f81caa93dda21c..1fad3ac8296e0df37e07510e82dc755bf61071d8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index fc4ab461bbdcda88071ebf65f8b0d6f9ecd7f35f..f807630d3911adbaa65896ad73f5fa13e1c79f7c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index a53e7b4f76b75855f222f62bc6d80c374d81edb4..b4daa595302b32af60208d6d1a61f41e2aa64e75 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 6e223411c29056260402374edb8572f20aae3270..84d0a4a5183ab62a010dd19048f6e15b86447288 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 9748a1aad4631edabaacf78939aa9cf5d14677b8..440327bd5dcefa4d574b4b1118184c312430b7b3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index f56f1a1af1d41e169230630683d83762022ad866..05df988ed32f844f107c7464bcd582bfdeb7bd1b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 7aa01d57b374bd7804e9fa065eb3130fa80e7090..fa908a92c4272062872fd30ed48ef24cc116dca1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index adf532a853a5e965edfc6a5e23e1782be00c211a..550049f045e675a4cb26778235ef639bfc259a23 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 821639ff15e308d5455115baf6b7bb080e990d78..0a84e686b51d941bb2108657f69803a743e8af5d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 1b1092d4e49b966591fc5d3ad43d636f13c8edbb..2231c002b2bb78ec7384c5c280f8eb228acbd5dc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 5c3f6cd1fd1b4cb6d06acf48677bd943f13a9df6..a33820f4e8631a765b60c6ef4cf280803022466a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index eecedb7d3bdd2f9affb0df5a81fec59ef09115c3..3ef20d9828c880426803e4fb34febdcb88a4ac5b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index d353d6563c39774b2f9fe7ddc72d27cab51527fa..f0f3370d2eef98732f0749c9101e2542f0882d69 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 3ece3ae69c996595efd0f20c5a1887df14718f09..416dc310234dbac1f3e2819c0adce42e5abbc879 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 54c747274a707defe55dbfd0fa9708f5407bd5ab..6a6c0ee85224741c2f5e9e6447026f9744f39e6b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 6db6af2904d5e92f2fa2a86f8282e197195217ea..ffb2e930da4be86b990206c74c2a13bb2bfb6e8a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 88fedc2ec74c66993c477b4da4c8a6d7de435ca4..898629e80b614516fffccb5a654bb788036e5790 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 625bc453ace3ce3041bab617f3c6f52660b09fb9..718da74b1c8aef9b47a3a0a0b8568b27fc223475 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 9085fdb5666b1eadbd8e160808629f508800bbd1..61543ea659cc3e3553dd74871d4e1c7f4fdfbb9c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 628ee15d74d09af0f09c9ce9c0ec73a50d03cbd3..379ae651a0d1447e1300fae16b25b9639dc71df1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 01661ace3e309a6b4fa376d2896068b4ee03609f..5fdca8adedfe9967c9a22afb7848d99dc61ad104 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index e99b276e3b8fce8a738eaf29ad3606604fbb472a..c153c78d21828686bc680daaf5ef5062d2cc4735 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 63a12eecb287700ed04e605dbc49a9efef061cd1..254d171697fc8b3c785cb536cd73b238f51160cd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index d541d0b480e5636a12f28dc106193c3435e64146..0f1cb64ddd6708f324e0bceb116acef449a6b2d1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ca506cd417ac5c598b33d572a1fad4ec547397dc..a07fcecb16a238137babd2e2fca67cfd8aca440b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index f0d351e1031513eeaf229974f894b670c8cf7996..a896058d2e45671ee69746987bafd881b23a619d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index bdb0773b418dc551d8f9913fc86d16a1d92522d0..bf1f9d12434690110d4774ef7007ef42739aaa90 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 4e2e239c7547e07f0070ab9601b1e212dbc80b17..67135dcbe9f4ff12afc501d0ca0b5316d05c26fd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 41e7e02c3c0c46280e3ec392d2f1b3289bb9c0ea..73a6f04dd26467c57185bd6eb2dc758da8ee476c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 65721214c1ef4ae1ff7657d4cd14e1ef2688cd5a..520960d6b740fd7b0260e3ec53e7bd8596ef4e5a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 511cce6bf0e4e2b79dd52d5d8d410157a6558f64..2455a487fdf025e3b92ba2ad5632ded4d476ad70 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 16d497368d478321b92afdfff1eaf1cbac3fd0c4..dbbca53f89aa28550067457a2d40811f5b5a487b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 54d08a82427293229c26e229c3323916cc42ab53..36bc4b029a965b27e020401d49e97351a1e7a091 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 55f03efb822dd6dbea0b91af0b5e540b2d5eb5a8..7115576f1ebf9084789bc49a55b5c6c5c51a8445 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 2bfb0c1d5faea2f07e56de9a07fa4242b011cd71..d6628bff4437c0c8a5468e504ed6be38f12c4b06 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 0809135b6e94d39f8779d9e5dcc7dd6629f537bb..759a06892fa126b68649844b8aa64adb489b5cd8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 1375c09e72a6d5f23992ac13fca8180b0d27be6b..05f22ac4bb18988d00d310d40c7b8e708956bc69 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 41c5a5d523b2bd6068321a883e84d7a932fe706c..f88e08b40d5a1933575cbb95400cc7ed5c13b4cb 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 67587b9975d5f7c02c5cee42d5ca17da86deb842..7c4cc531a8988af64a25b1fcef887d155281c243 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index f882fe0091d0ccf382d1af7070184fc4616222fb..f24a04b787698d8567d18384c2f37983dc7ea723 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 24d9b15fad23cbc2788e181eb036ba629285ca82..2b5c1b8ea466cc47b6cae4f1d5d0c0e88369d0c8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 77dc3ec5904cbff9bd65a0b0044ecd70578e9b2f..c40de4c8598742ac406e0d7d22424e7035be40cc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index c2a425d984ad3368a46beca632f9f38fbbed88a7..edea741aa3a5676203b0e5badfcd1072040c86bd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index d18ae31d31db4b7c3788d98085361eb6120e19be..5b485891ddee4bf4e09078cb7bfa7537f5d8297a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 16ba03ad934f47117ae88dd70744945384b1ca3a..dd585cfab0ffac88a571d63604547d7179bfb6a1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 6e0198e537047d103b69c7cbd8ab0afe2e6c4945..864fa63b7bd1a3a3e695bd3dc449a3a9c85db416 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index f7badb31b4fe91ee2b8acc10a34bfe5db6668713..9875d1eb85175899f3c0f5e4927c0faad5b998df 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 7eec308e210ef13077c5a857a85143903ee097d7..3d60e0fc6a2f6eb87d703f76b09f889d49180f15 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 9774da25b70760077fda46e44dd0796684e4e540..4642ce43b3e3975b70f95dd8404eeb1172b14b3e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index efb54d29b338c9a69d81882c2c36a9ec794d6c6a..0cc7783ddb1c5cfe3380943ce028b467e7cb639e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 7ba53607c029220befbea8a8d0bc2556e94df1a6..3f9efbf9f38d7e9a4125b1015e432598dad525cb 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 8728328b202ac77e021d995044d0cbb5f1f09bc1..f5d1c3f2eab771c316cfb2a1744efc222ff9d796 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 5c7e47fa602a98cbd108fcdfb65ad41abcfa53c6..1b239a53b9d53bd1a33910dec9559268dadaf489 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 5f3e9dc2463a38d8aade0ea6a5f73b9fe4b38b52..a7c5daac73a81fd1c7615fd97e161d94d21fd21e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index a0c320ceb8d3da9206d81a7fb3815a2bec4e506a..f738f24420edfe4a4d0c9cf70b4b701a629cc1ea 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 2297f482e22980a479701b44ce89ccb88f17c54f..0b183507df0624b5fe8d0470368dc57d426fb577 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ef262b9d7b4eb3f6b58b56d1d504c79b751ea8fa..d1d24ea36706c8cd6afd4e726d9e5c5ff891ca7b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 322cfca90e97c383a11a672912bd890ef22c82ac..a85bd48aaca2a3c8fc83f72592d58e003911d72e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index d3089b1363b88ad9d7f00b5732458f5b53f17da7..dd19f6c5396c7efac4fa0671a9c20311d48b0892 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 26e047f74b7c83c035706b822b9da8739b1fe27a..7d79de1153dbff493f2702871b78300a1f5dcae7 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 2c15dc757ea77e3466979169528be12765e642c9..0b75a48655c54e7ece2b3d7f2f7c598cd1acee58 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 445e2b7647cf1738da1d8feff8cadb8fe53fd146..eba1e88a6a571e06c7d4367964e5e75ae8a43b8d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 8c73162a6191d6917e9896369c9ec840806d1ec2..8d7c80467d0be1251a38ebacddcf9de9f5e7ed9a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 638b8c4bffae8b4038976a4b757306916907c3ec..21e6e6380d8ab305010d2f1d26f743cd45c3ae51 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 5ba6b3e8b913b0e32224bfd73b95acfc2615041b..7058cec895dd56f8cddab47c03ea51e1454d7e3f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index c01d1f1c49090cb63c4e5e699611e9b974e8fdca..93069f69c79bc8854ec3393937ff32a46f0b4bb4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ded73eebbdfcda45abcc95303a0547b2a90ec2b3..3b0c68d345b6aff207f88c91a84b95e45cf84a17 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 90dd9d8bfd265598372cd3334d9ffd653f47cb8c..d6cf3ff4cbf6dc4372aade9cef3985caea69d543 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index e3ee861ea5192ffa7e6ff582d17878efd74cd601..df0bbc8ebe263b32f14787c652345f6a661e9df5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index ceeb88052df6cda3e692bdba4225a03b3b6efa94..d7225512ed81cba64deaa03408a8db26352cb4a0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index c902accc651b9dbd0caf4cdeb614e33797ff0f70..5fc6d3da5e8a211b77b8fb69d7c495d6b834ed5d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index e8ba929bb7ff3b749f7a6eb18bf70f48f8f98a43..35563ea2e81167ddc74224d7771b1b184710fc44 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index d0ea60e00d4c0e5fae5729c4d3dfc7ba69f4c2ee..b7140ab6a4ce96b23334bffb3f8b8318b89613da 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 0d5ad0f5b46cd48ce1f52969ed8ea45a691bc1ca..cd453373a74ff3ecb41e1770efdc356ef210f08c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 3280248876312804889df205edc2a25f22e498f5..38f383629c3c22404aaefa5a3ebf5ab35f776f1d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 64fada1eeb9a9c42fbe6a48b7cd9e5efbaabda67..ee9e9444fda827b6ad3cb5667930ae7c19afa22d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 624bfba5e90460fdf9b48883ec70efa3038bc2fa..696192d65dfd50328b08f5f2f612f73a3eabe4a9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 46cfb6ff2047bbaecb5febb953e6e9840a634cb5..4e79a37d261d053eeccace7a7782fe63964eb6e2 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 6a1abccf2b641134b421e89cdd962f09dba52a01..ef8dce8ea84cc9bc485b29fb0a26337cb186f769 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 3d9de6b93d588936f4b41c7bece847e2aef74f6d..678a9ff21ca38ef6547c4786653d5a3af91f94e0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 93ff29996e6b4345e81b67b8e41304a4f2adcef3..c360c75ba9f44fbbdcbe348275219987b9c8eb2a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 930f322889bae5799696413cd95150df2a4101e6..24addb9ff346c83bed64deaea088cc7baf8803e1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 695b1a569c79e42855f2186e56eb91b85b83794b..0fd439a0a9f360bb30cf46133b3e45fb16a8eefc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 8ae0efcd3ea989029cba44021a6027d760ef0938..e64df13cca0bdf888c6d600b0973f1a3a6da6edc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
diff --git a/tests/regression/test_rcutorture_urcu_signal_perf_global.tap b/tests/regression/test_rcutorture_urcu_signal_perf_global.tap
deleted file mode 100755 (executable)
index 83e6171..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" perf 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_perf_global_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_perf_global_cxx.tap
deleted file mode 100755 (executable)
index 2f79c1d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" perf 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_perf_percpu.tap b/tests/regression/test_rcutorture_urcu_signal_perf_percpu.tap
deleted file mode 100755 (executable)
index df425ce..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" perf 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_perf_percpu_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_perf_percpu_cxx.tap
deleted file mode 100755 (executable)
index 4cc04cd..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" perf 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_perf_perthread.tap b/tests/regression/test_rcutorture_urcu_signal_perf_perthread.tap
deleted file mode 100755 (executable)
index bea0bf4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" perf 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_perf_perthread_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_perf_perthread_cxx.tap
deleted file mode 100755 (executable)
index a16ae23..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" perf 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_rperf_global.tap b/tests/regression/test_rcutorture_urcu_signal_rperf_global.tap
deleted file mode 100755 (executable)
index facf7c3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" rperf 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_rperf_global_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_rperf_global_cxx.tap
deleted file mode 100755 (executable)
index 57135d9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" rperf 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_rperf_percpu.tap b/tests/regression/test_rcutorture_urcu_signal_rperf_percpu.tap
deleted file mode 100755 (executable)
index d5526b0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" rperf 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_rperf_percpu_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_rperf_percpu_cxx.tap
deleted file mode 100755 (executable)
index dc49a86..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" rperf 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_rperf_perthread.tap b/tests/regression/test_rcutorture_urcu_signal_rperf_perthread.tap
deleted file mode 100755 (executable)
index ca0b157..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" rperf 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_rperf_perthread_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_rperf_perthread_cxx.tap
deleted file mode 100755 (executable)
index 148df38..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" rperf 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_stress_global.tap b/tests/regression/test_rcutorture_urcu_signal_stress_global.tap
deleted file mode 100755 (executable)
index 64689dc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" stress 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_stress_global_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_stress_global_cxx.tap
deleted file mode 100755 (executable)
index ed8bd21..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" stress 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_stress_percpu.tap b/tests/regression/test_rcutorture_urcu_signal_stress_percpu.tap
deleted file mode 100755 (executable)
index e829e49..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" stress 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_stress_percpu_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_stress_percpu_cxx.tap
deleted file mode 100755 (executable)
index caea412..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" stress 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_stress_perthread.tap b/tests/regression/test_rcutorture_urcu_signal_stress_perthread.tap
deleted file mode 100755 (executable)
index 0199847..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" stress 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_stress_perthread_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_stress_perthread_cxx.tap
deleted file mode 100755 (executable)
index a9998bc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" stress 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_uperf_global.tap b/tests/regression/test_rcutorture_urcu_signal_uperf_global.tap
deleted file mode 100755 (executable)
index 5efd9ae..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" uperf 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_uperf_global_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_uperf_global_cxx.tap
deleted file mode 100755 (executable)
index d99a8b9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" uperf 1 callrcu_global
diff --git a/tests/regression/test_rcutorture_urcu_signal_uperf_percpu.tap b/tests/regression/test_rcutorture_urcu_signal_uperf_percpu.tap
deleted file mode 100755 (executable)
index 13f063d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" uperf 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_uperf_percpu_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_uperf_percpu_cxx.tap
deleted file mode 100755 (executable)
index 07ef2c4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" uperf 1 callrcu_percpu
diff --git a/tests/regression/test_rcutorture_urcu_signal_uperf_perthread.tap b/tests/regression/test_rcutorture_urcu_signal_uperf_perthread.tap
deleted file mode 100755 (executable)
index c6256e9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal" "$(urcu_nproc)" uperf 1 callrcu_perthread
diff --git a/tests/regression/test_rcutorture_urcu_signal_uperf_perthread_cxx.tap b/tests/regression/test_rcutorture_urcu_signal_uperf_perthread_cxx.tap
deleted file mode 100755 (executable)
index 5cf8ce6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# SPDX-FileCopyrightText: 2022 EfficiOS Inc.
-#
-
-if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
-       UTILSSH="$URCU_TESTS_SRCDIR/utils/utils.sh"
-else
-       UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-
-"${URCU_TESTS_BUILDDIR}/regression/rcutorture_urcu_signal_cxx" "$(urcu_nproc)" uperf 1 callrcu_perthread
index db4e81dcf67a36d8750684cc5f025a233a23ed33..52ccce756b293ab401c4abb6644b4294c51fe8e5 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_fork.c
- *
  * Userspace RCU library - test program (fork)
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
index 8c872201f3ee4390acf401e9fd0d7eeafd5affc0..2f65b4661ed08075ac3e71bd0c5a23367151e5fc 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_fork.c"
index 5e9b0596fc1570a1b909d78687cb8c36c10419ce..ed256ea0a13358e7fcae0d640f23eba65f88f217 100644 (file)
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 #include <string.h>
 #include <sys/time.h>
 #include <poll.h>
@@ -11,9 +15,6 @@
 #ifdef RCU_MEMBARRIER
 #include <urcu.h>
 #endif
-#ifdef RCU_SIGNAL
-#include <urcu.h>
-#endif
 #ifdef RCU_MB
 #include <urcu.h>
 #endif
index ab4e5820eea91d509dc0c6ca008c7ce7a9729338..cacd0bf015a7f9bef99da7c2adf5ec06d95b1e5e 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "urcutorture.c"
index 29f61112ff50ae596f1a1dc743a4647f5ed15cbe..5884ccbe0dcb9c2c62ff6e396b1bb70e6fe64628 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/tests/utils -I$(top_srcdir)/tests/common
 
 LOG_DRIVER_FLAGS = --merge --comments
@@ -70,7 +74,6 @@ URCU_COMMON_LIB=$(top_builddir)/src/liburcu-common.la
 URCU_LIB=$(top_builddir)/src/liburcu.la
 URCU_QSBR_LIB=$(top_builddir)/src/liburcu-qsbr.la
 URCU_MB_LIB=$(top_builddir)/src/liburcu-mb.la
-URCU_SIGNAL_LIB=$(top_builddir)/src/liburcu-signal.la
 URCU_BP_LIB=$(top_builddir)/src/liburcu-bp.la
 URCU_CDS_LIB=$(top_builddir)/src/liburcu-cds.la
 TAP_LIB=$(top_builddir)/tests/utils/libtap.a
@@ -107,58 +110,54 @@ test_uatomic_cxx_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
 test_urcu_multiflavor_SOURCES = test_urcu_multiflavor.c \
        test_urcu_multiflavor-memb.c \
        test_urcu_multiflavor-mb.c \
-       test_urcu_multiflavor-signal.c \
        test_urcu_multiflavor-qsbr.c \
        test_urcu_multiflavor-bp.c
 test_urcu_multiflavor_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_cxx_SOURCES = test_urcu_multiflavor_cxx.cpp \
        test_urcu_multiflavor-memb_cxx.cpp \
        test_urcu_multiflavor-mb_cxx.cpp \
-       test_urcu_multiflavor-signal_cxx.cpp \
        test_urcu_multiflavor-qsbr_cxx.cpp \
        test_urcu_multiflavor-bp_cxx.cpp
 test_urcu_multiflavor_cxx_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_dynlink_SOURCES = test_urcu_multiflavor.c \
        test_urcu_multiflavor-memb.c \
        test_urcu_multiflavor-mb.c \
-       test_urcu_multiflavor-signal.c \
        test_urcu_multiflavor-qsbr.c \
        test_urcu_multiflavor-bp.c
 test_urcu_multiflavor_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_multiflavor_dynlink_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_dynlink_cxx_SOURCES = test_urcu_multiflavor_cxx.cpp \
        test_urcu_multiflavor-memb_cxx.cpp \
        test_urcu_multiflavor-mb_cxx.cpp \
-       test_urcu_multiflavor-signal_cxx.cpp \
        test_urcu_multiflavor-qsbr_cxx.cpp \
        test_urcu_multiflavor-bp_cxx.cpp
 test_urcu_multiflavor_dynlink_cxx_CXXFLAGS = -DDYNAMIC_LINK_TEST $(AM_CXXFLAGS)
 test_urcu_multiflavor_dynlink_cxx_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_single_unit_SOURCES = test_urcu_multiflavor_single_unit.c
 test_urcu_multiflavor_single_unit_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_single_unit_cxx_SOURCES = test_urcu_multiflavor_single_unit_cxx.cpp
 test_urcu_multiflavor_single_unit_cxx_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_single_unit_dynlink_SOURCES = test_urcu_multiflavor_single_unit.c
 test_urcu_multiflavor_single_unit_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
 test_urcu_multiflavor_single_unit_dynlink_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_urcu_multiflavor_single_unit_dynlink_cxx_SOURCES = test_urcu_multiflavor_single_unit_cxx.cpp
 test_urcu_multiflavor_single_unit_dynlink_cxx_CXXFLAGS = -DDYNAMIC_LINK_TEST $(AM_CXXFLAGS)
 test_urcu_multiflavor_single_unit_dynlink_cxx_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
-       $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+       $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
 
 test_build_SOURCES = \
        test_build.c
index 1e120d4616642d440e4a6c283cc3d365884ed9af..a413f3c88554b8a7cf85262de43f1de855a2abe4 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "get_cpu_mask_from_sysfs.c"
index 951e9f70d2815b74f5f42f8d5eaebf6ca5544cb9..4e46dfbd9f314791f74176ba5c52b4943f30e3fc 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "get_max_cpuid_from_sysfs.c"
index fb447d6ce8bd4159c76867017192637ca9dcfc4c..141c564b3e1687b9a004ac18d9c0dcce70ba3da7 100644 (file)
@@ -1,24 +1,6 @@
-/*
- * test_arch.c
- *
- * Userspace RCU library - test arch headers
- *
- * Copyright February 2021 Michael Jeanson <mjeanson@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+// SPDX-FileCopyrightText: 2021 Michael Jeanson <mjeanson@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include <stdio.h>
 #include <urcu/arch.h>
index 5aa9d9844e6851882fdec81f6a93058cc1fa261e..6c6c97261df99477f4b04dd6a60b0a42393d4616 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_arch.c"
index f6b667ce2b3d9ab08dc64704337f9960d923ab68..99ddbcdd2ac4b9dfa3f84a563e5fa3eb90c0cdea 100644 (file)
@@ -1,20 +1,6 @@
-/*
- * Copyright 2021 Simon Marchi <simon.marchi@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+// SPDX-FileCopyrightText: 2021 Simon Marchi <simon.marchi@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
  * This file is meant to verify that headers are compatible with both C and
@@ -52,7 +38,6 @@
 #include <urcu/urcu-mb.h>
 #include <urcu/urcu-memb.h>
 #include <urcu/urcu-qsbr.h>
-#include <urcu/urcu-signal.h>
 #include <urcu/wfcqueue.h>
 #include <urcu/wfqueue.h>
 #include <urcu/wfstack.h>
@@ -129,10 +114,10 @@ void test_build_rcu_dereference(void)
        static struct a_clear_struct *clear = NULL;
        static struct a_clear_struct *const clear_const = NULL;
 
-       rcu_dereference(opaque);
-       rcu_dereference(opaque_const);
-       rcu_dereference(clear);
-       rcu_dereference(clear_const);
+       (void) rcu_dereference(opaque);
+       (void) rcu_dereference(opaque_const);
+       (void) rcu_dereference(clear);
+       (void) rcu_dereference(clear_const);
 }
 
 int main(void)
index 5a45b6ae8c0f20ac6d130b570a3f5ae151159567..0d557e50ef50355d7e586b88593897270261db4e 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_build.c"
index 2a6acc1bfb38dadf73aff8a89ba89b3c7d861edf..0709892086072efc36157ab1c48b1d9cffbc9ded 100755 (executable)
@@ -1,4 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
index ffddbf9c27f96507d33bc4759bab33c43381f12e..4ed4ebdf893b0e0da71016eed2a5600123555b73 100755 (executable)
@@ -1,4 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
index 5c5810893c9f2101d80832b45299bb6e44b0a1dc..bd91459ce077593b82033d0eb6a625c683eff7d9 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_get_max_cpuid_from_mask.c"
index cd646a16ecd35ec1e0fa38283b1ef37d2ea595b1..7c0abce42f1f38ce3d6cba4288096cdf653dda74 100755 (executable)
@@ -1,4 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
index db99094f7157702a3d2331b35cce8d7e4da8fb9e..2283a046aa48476fd208ff5ec3fc6d5a48d1e4f3 100755 (executable)
@@ -1,4 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
index e081cd4fd7be9702515f8479833e9c8ec73f756d..536c509ad8c115487dde90ad1b3cfef15bdf1cd6 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_get_possible_cpus_array_len.c"
diff --git a/tests/unit/test_lfstack.c b/tests/unit/test_lfstack.c
new file mode 100644 (file)
index 0000000..03d1632
--- /dev/null
@@ -0,0 +1,78 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * test_lfstack.c
+ *
+ * Userspace RCU library - test wftack race conditions
+ */
+
+#define _LGPL_SOURCE
+
+#include <stdlib.h>
+
+#include <pthread.h>
+
+#include <urcu/lfstack.h>
+
+#include "tap.h"
+
+#define NR_TESTS 1
+#define NR_PRODUCERS 4
+#define LOOP 100
+
+static void async_run(struct cds_lfs_stack *queue)
+{
+       struct cds_lfs_node *node = malloc(sizeof(*node));
+
+       cds_lfs_node_init(node);
+
+       cds_lfs_push(queue, node);
+}
+
+static void *async_loop(void *queue)
+{
+       size_t k = 0;
+
+       while (k < LOOP * NR_PRODUCERS) {
+               free(cds_lfs_pop_blocking(queue));
+               ++k;
+       }
+
+       return NULL;
+}
+
+static void *spawn_jobs(void *queue)
+{
+       for (size_t k = 0; k < LOOP; ++k) {
+               async_run(queue);
+       }
+
+       return 0;
+}
+
+int main(void)
+{
+       pthread_t consumer;
+       pthread_t producers[NR_PRODUCERS];
+       struct cds_lfs_stack queue;
+
+       plan_tests(NR_TESTS);
+
+       cds_lfs_init(&queue);
+       pthread_create(&consumer, NULL, async_loop, &queue);
+
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_create(&producers[k], NULL, spawn_jobs, &queue);
+       }
+
+       pthread_join(consumer, NULL);
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_join(producers[k], NULL);
+       }
+
+       ok1("No race conditions");
+
+       return exit_status();
+}
index 5884455904e811ea72b8fab2a39d03ca378320d6..d9c70e0ac912747d5a68fcf7ee90872b0e25a3e8 100644 (file)
@@ -1,24 +1,6 @@
-/*
- * test_uatomic.c
- *
- * Userspace RCU library - test atomic operations
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include <stdio.h>
 #include <urcu/uatomic.h>
 
 #define NR_TESTS 17
 
+#define BYTE_PER_LONG  (sizeof(unsigned long) / sizeof(unsigned char))
+#define SHORT_PER_LONG (sizeof(unsigned long) / sizeof(unsigned short))
+#define INT_PER_LONG   (sizeof(unsigned long) / sizeof(unsigned int))
+
 struct testvals {
 #ifdef UATOMIC_HAS_ATOMIC_BYTE
-       unsigned char c;
+       unsigned char c[BYTE_PER_LONG];
 #endif
 #ifdef UATOMIC_HAS_ATOMIC_SHORT
-       unsigned short s;
+       unsigned short s[SHORT_PER_LONG];
 #endif
-       unsigned int i;
+       unsigned int i[INT_PER_LONG];
        unsigned long l;
 };
 
@@ -93,25 +79,36 @@ do {                                                \
 
 int main(void)
 {
-       int nr_run = 2;
+       int nr_run = INT_PER_LONG + 1;
+       unsigned long i;
+
 #ifdef UATOMIC_HAS_ATOMIC_BYTE
-       nr_run += 1;
+       nr_run += BYTE_PER_LONG;
 #endif
 #ifdef UATOMIC_HAS_ATOMIC_SHORT
-       nr_run += 1;
+       nr_run += SHORT_PER_LONG;
 #endif
 
        plan_tests(nr_run * NR_TESTS);
 #ifdef UATOMIC_HAS_ATOMIC_BYTE
-       diag("Test atomic ops on byte");
-       do_test(&vals.c);
+       for (i = 0; i < BYTE_PER_LONG; i++) {
+               diag("Test atomic ops on byte with %lu byte offset from long alignment",
+                       i);
+               do_test(&vals.c[i]);
+       }
 #endif
 #ifdef UATOMIC_HAS_ATOMIC_SHORT
-       diag("Test atomic ops on short");
-       do_test(&vals.s);
+       for (i = 0; i < SHORT_PER_LONG; i++) {
+               diag("Test atomic ops on short with %lu byte offset from long alignment",
+                       i * sizeof(unsigned short));
+               do_test(&vals.s[i]);
+       }
 #endif
-       diag("Test atomic ops on int");
-       do_test(&vals.i);
+       for (i = 0; i < INT_PER_LONG; i++) {
+               diag("Test atomic ops on int with %lu byte offset from long alignment",
+                       i * sizeof(unsigned int));
+               do_test(&vals.i[i]);
+       }
        diag("Test atomic ops on long");
        do_test(&vals.l);
 
index c5ad40db3b5157b8303e973bc349821e2d9aa760..0f9e2753c36362d2eecc9b3aafd95edf1c384c9b 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_uatomic.c"
index 199818b69c185ea3601f4525f76bfdf488d4b685..460cfa6129afb4831529b719031463a62dce4c09 100644 (file)
@@ -1,30 +1,15 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor-bp.c
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #endif
 
-#define RCU_SIGNAL
 #include <urcu-bp.h>
 #include "test_urcu_multiflavor.h"
 
index 65bb67ccf144769e9e9ce0f704637b5b1245b38a..d38d159e5e3f0cb07dc333420cf65991be8f1729 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_multiflavor-bp.c"
index e4ba6a4d0d3e2fd83ffdf67997f23e9bad180b71..e2d48781aecb1b13cb08cf63c291618015dd7c3b 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor-mb.c
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DYNAMIC_LINK_TEST
index 606b66db110c1d54f14e7a554e4d292a2d5dc004..67691deec00454bb28bbebece754a46dcf3ee869 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_multiflavor-mb.c"
index 583f2e14041f047f1a138d1b88285bc139ba5aec..43d0afa555303ce7b69a5c323968123012e9a16f 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor-memb.c
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DYNAMIC_LINK_TEST
index adda7d03aa166a02314982630fc25d35791b8e95..d9fabefa30a98e8bc031bd88b31a7304774b3dd6 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_multiflavor-memb.c"
index 64f32f4e30547fb12449c70423ed27c782dfdeb6..fa478cae67523582cf6433170a1e156d00600cc0 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor-qsbr.c
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DYNAMIC_LINK_TEST
index a4039ed4232f50029a9b172f771d6ff0c081df1c..b52f783e9b0ae0770741a41676024bf68c2eb8f8 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_multiflavor-qsbr.c"
diff --git a/tests/unit/test_urcu_multiflavor-signal.c b/tests/unit/test_urcu_multiflavor-signal.c
deleted file mode 100644 (file)
index 816c615..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * test_urcu_multiflavor-signal.c
- *
- * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef DYNAMIC_LINK_TEST
-#define _LGPL_SOURCE
-#endif
-
-#define RCU_SIGNAL
-#include <urcu.h>
-#include "test_urcu_multiflavor.h"
-
-int test_mf_signal(void)
-{
-       rcu_register_thread();
-       rcu_read_lock();
-       rcu_read_unlock();
-       synchronize_rcu();
-       rcu_unregister_thread();
-       return 0;
-}
diff --git a/tests/unit/test_urcu_multiflavor-signal_cxx.cpp b/tests/unit/test_urcu_multiflavor-signal_cxx.cpp
deleted file mode 100644 (file)
index 0f77550..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include "test_urcu_multiflavor-signal.c"
index 225161ac87d9f21920ad25ebb8f3828163a077f7..ef7605a1d90c0a47efc7b51d65ff0b41ddb351ed 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor.c
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdlib.h>
 
 int main(void)
 {
-       plan_tests(5);
+       plan_tests(4);
 
        ok1(!test_mf_memb());
 
        ok1(!test_mf_mb());
-       ok1(!test_mf_signal());
        ok1(!test_mf_qsbr());
        ok1(!test_mf_bp());
 
index 419ad5d7cf1b5226b52f3fc1b616a24dd4f97cd4..27e59f0de65fa42a7f1e65ae6a10888226208d98 100644 (file)
@@ -1,29 +1,14 @@
+// SPDX-FileCopyrightText: 2012 Lai Jiangshan <laijs@cn.fujitsu.com>
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor.h
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright February 2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 extern int test_mf_memb(void);
 extern int test_mf_mb(void);
-extern int test_mf_signal(void);
 extern int test_mf_qsbr(void);
 extern int test_mf_bp(void);
 
index 5a370b3a2af4e83b2eb572334d03c9bd52ba4863..6794731171bca17003cdbd81f2dd083a929f469d 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_multiflavor.c"
index aff292a3f50d247d9489a29236884dedc32160fa..5548744e2f6ea4bfb75de28ee9566c552e8c62a7 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
- * test_urcu_multiflavor.c
- *
  * Userspace RCU library - test multiple RCU flavors into one program
- *
- * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DYNAMIC_LINK_TEST
@@ -27,7 +13,6 @@
 #include <urcu/urcu-mb.h>
 #include <urcu/urcu-bp.h>
 #include <urcu/urcu-memb.h>
-#include <urcu/urcu-signal.h>
 #include <urcu/urcu-qsbr.h>
 
 #include <stdlib.h>
@@ -63,16 +48,6 @@ static int test_mf_memb(void)
        return 0;
 }
 
-static int test_mf_signal(void)
-{
-       urcu_signal_register_thread();
-       urcu_signal_read_lock();
-       urcu_signal_read_unlock();
-       urcu_signal_synchronize_rcu();
-       urcu_signal_unregister_thread();
-       return 0;
-}
-
 static int test_mf_qsbr(void)
 {
        urcu_qsbr_register_thread();
@@ -85,12 +60,11 @@ static int test_mf_qsbr(void)
 
 int main(void)
 {
-       plan_tests(5);
+       plan_tests(4);
 
        ok1(!test_mf_mb());
        ok1(!test_mf_bp());
        ok1(!test_mf_memb());
-       ok1(!test_mf_signal());
        ok1(!test_mf_qsbr());
 
        return exit_status();
index ff06d6d2c03da0dab425a4357921b520856b2254..f7cdf215ebca2e202f8e0bb6831f088df82e0dac 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "test_urcu_multiflavor_single_unit.c"
diff --git a/tests/unit/test_wfcqueue.c b/tests/unit/test_wfcqueue.c
new file mode 100644 (file)
index 0000000..45c4988
--- /dev/null
@@ -0,0 +1,107 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * test_wfcqueue.c
+ *
+ * Userspace RCU library - test wfcqueue race conditions
+ */
+
+#define _LGPL_SOURCE
+
+#include <stdlib.h>
+
+#include <pthread.h>
+
+#include <urcu/wfcqueue.h>
+
+#include "tap.h"
+
+#define NR_TESTS 1
+#define NR_PRODUCERS 4
+#define LOOP 100
+
+struct queue {
+       struct cds_wfcq_head head;
+       struct cds_wfcq_tail tail;
+};
+
+static void async_run(struct queue *queue)
+{
+       struct cds_wfcq_node *node = malloc(sizeof(*node));
+
+       cds_wfcq_node_init(node);
+
+       cds_wfcq_enqueue(&queue->head, &queue->tail, node);
+}
+static void do_async_loop(size_t *k, struct queue *queue)
+{
+       struct queue my_queue;
+       enum cds_wfcq_ret state;
+       struct cds_wfcq_node *node, *next;
+
+       cds_wfcq_init(&my_queue.head, &my_queue.tail);
+
+       state = cds_wfcq_splice_blocking(&my_queue.head,
+                                       &my_queue.tail,
+                                       &queue->head,
+                                       &queue->tail);
+
+       if (state == CDS_WFCQ_RET_SRC_EMPTY) {
+               return;
+       }
+
+       __cds_wfcq_for_each_blocking_safe(&my_queue.head,
+                                       &my_queue.tail,
+                                       node, next) {
+               free(node);
+               (*k)++;
+       }
+}
+
+static void *async_loop(void *queue)
+{
+       size_t k = 0;
+
+       while (k < LOOP * NR_PRODUCERS) {
+               (void) poll(NULL, 0, 10);
+               do_async_loop(&k, queue);
+       }
+
+       return NULL;
+}
+
+static void *spawn_jobs(void *queue)
+{
+       for (size_t k = 0; k < LOOP; ++k) {
+               async_run(queue);
+       }
+
+       return 0;
+}
+
+int main(void)
+{
+       pthread_t consumer;
+       pthread_t producers[NR_PRODUCERS];
+       struct queue queue;
+
+       plan_tests(NR_TESTS);
+
+       cds_wfcq_init(&queue.head, &queue.tail);
+       pthread_create(&consumer, NULL, async_loop, &queue);
+
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_create(&producers[k], NULL, spawn_jobs, &queue);
+       }
+
+       pthread_join(consumer, NULL);
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_join(producers[k], NULL);
+       }
+
+       ok1("No race conditions");
+
+       return exit_status();
+}
diff --git a/tests/unit/test_wfqueue.c b/tests/unit/test_wfqueue.c
new file mode 100644 (file)
index 0000000..944c49a
--- /dev/null
@@ -0,0 +1,79 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * test_wfqueue.c
+ *
+ * Userspace RCU library - test wfqueue race conditions
+ */
+
+#define _LGPL_SOURCE
+
+#include <stdlib.h>
+
+#include <pthread.h>
+
+#define CDS_WFQ_DEPRECATED
+#include <urcu/wfqueue.h>
+
+#include "tap.h"
+
+#define NR_TESTS 1
+#define NR_PRODUCERS 4
+#define LOOP 100
+
+static void async_run(struct cds_wfq_queue *queue)
+{
+       struct cds_wfq_node *node = malloc(sizeof(*node));
+
+       cds_wfq_node_init(node);
+
+       cds_wfq_enqueue(queue, node);
+}
+
+static void *async_loop(void *queue)
+{
+       size_t k = 0;
+
+       while (k < LOOP * NR_PRODUCERS) {
+               free(cds_wfq_dequeue_blocking(queue));
+               ++k;
+       }
+
+       return NULL;
+}
+
+static void *spawn_jobs(void *queue)
+{
+       for (size_t k = 0; k < LOOP; ++k) {
+               async_run(queue);
+       }
+
+       return 0;
+}
+
+int main(void)
+{
+       pthread_t consumer;
+       pthread_t producers[NR_PRODUCERS];
+       struct cds_wfq_queue queue;
+
+       plan_tests(NR_TESTS);
+
+       cds_wfq_init(&queue);
+       pthread_create(&consumer, NULL, async_loop, &queue);
+
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_create(&producers[k], NULL, spawn_jobs, &queue);
+       }
+
+       pthread_join(consumer, NULL);
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_join(producers[k], NULL);
+       }
+
+       ok1("No race conditions");
+
+       return exit_status();
+}
diff --git a/tests/unit/test_wfstack.c b/tests/unit/test_wfstack.c
new file mode 100644 (file)
index 0000000..17901ce
--- /dev/null
@@ -0,0 +1,78 @@
+// SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * test_wfstack.c
+ *
+ * Userspace RCU library - test wftack race conditions
+ */
+
+#define _LGPL_SOURCE
+
+#include <stdlib.h>
+
+#include <pthread.h>
+
+#include <urcu/wfstack.h>
+
+#include "tap.h"
+
+#define NR_TESTS 1
+#define NR_PRODUCERS 4
+#define LOOP 100
+
+static void async_run(struct cds_wfs_stack *queue)
+{
+       struct cds_wfs_node *node = malloc(sizeof(*node));
+
+       cds_wfs_node_init(node);
+
+       cds_wfs_push(queue, node);
+}
+
+static void *async_loop(void *queue)
+{
+       size_t k = 0;
+
+       while (k < LOOP * NR_PRODUCERS) {
+               free(cds_wfs_pop_blocking(queue));
+               ++k;
+       }
+
+       return NULL;
+}
+
+static void *spawn_jobs(void *queue)
+{
+       for (size_t k = 0; k < LOOP; ++k) {
+               async_run(queue);
+       }
+
+       return 0;
+}
+
+int main(void)
+{
+       pthread_t consumer;
+       pthread_t producers[NR_PRODUCERS];
+       struct cds_wfs_stack queue;
+
+       plan_tests(NR_TESTS);
+
+       cds_wfs_init(&queue);
+       pthread_create(&consumer, NULL, async_loop, &queue);
+
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_create(&producers[k], NULL, spawn_jobs, &queue);
+       }
+
+       pthread_join(consumer, NULL);
+       for (size_t k = 0; k < NR_PRODUCERS; ++k) {
+               pthread_join(producers[k], NULL);
+       }
+
+       ok1("No race conditions");
+
+       return exit_status();
+}
index b616d3486c90a8d1ad7888e50186e5045f64e460..202854f899cfac02d1a4f1f4f086d6bcaf446fcd 100644 (file)
@@ -1,23 +1,11 @@
+// SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
  * urcu-asm.c
  *
  * Userspace RCU library - assembly dump of primitives
- *
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <urcu.h>
index efba54cc0ad8c53180c3f85ee1473ddf65d58323..883e7b9f939022c42867ed4fad0abe3699ad04aa 100644 (file)
@@ -1,3 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "urcu-asm.c"
index 373c4dda258db7c6134adc82da13f4e759396adb..605d64c953deb5540b3971ad47cd6f828379e608 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS Inc.
+#
+# SPDX-License-Identifier: MIT
+
 AM_CPPFLAGS += -I$(top_srcdir)/src
 
 noinst_LIBRARIES = libtap.a
index a4c2abbc22881e60c57d562533088fc9fd2f9bef..6fa27339e55b6f784e828d0257fd73de2c1f6e22 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
index 629c847c9306ad0ce8ff6c7254e711e73fbf4396..966706fe903447d683e5160d863eca5f9b37b38b 100644 (file)
@@ -41,7 +41,7 @@ __attribute__((format(TAP_PRINTF_FORMAT, 5, 6)))
 unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
 
 int plan_no_plan(void);
-__attribute__((noreturn))
+__attribute__((__noreturn__))
 int plan_skip_all(const char *);
 int plan_tests(unsigned int);
 
index 24ac1aa250d6a092ef9cd8a2c4bb21e9ea75d331..47b140722a36e2d5b67f0c28d7a195f33cf3b569 100755 (executable)
@@ -1,20 +1,9 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
-# Copyright 2010 Patrick LeBoutillier <patrick.leboutillier@gmail.com>
+# SPDX-License-Identifier: GPL-3.0-or-later
 #
-#    This program is 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.
+# SPDX-FileCopyrightText: 2010 Patrick LeBoutillier <patrick.leboutillier@gmail.com>
 #
-#    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/>.
-
 
 _version='1.01'
 
@@ -65,7 +54,7 @@ OTHER:
   diag MSG
 
 EXAMPLE:
-  #!/bin/bash
+  #!/usr/bin/env bash
 
   . tap-functions
 
index 6e712e1ccc37edbb058067736f2a482da6d2231c..5c96fb072256d7cf4632204b459a9ffe1ab69b24 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
This page took 0.674405 seconds and 4 git commands to generate.