Cleanup: remove leftover manual pthread detection
[urcu.git] / urcu-bp.c
index 6b78af8bd8dfc77545a8a11adcfec997434e57bd..cbdebf407a892c2d201d42d948025723702414e7 100644 (file)
--- a/urcu-bp.c
+++ b/urcu-bp.c
@@ -36,6 +36,7 @@
 #include <unistd.h>
 #include <sys/mman.h>
 
+#include "urcu/arch.h"
 #include "urcu/wfcqueue.h"
 #include "urcu/map/urcu-bp.h"
 #include "urcu/static/urcu-bp.h"
@@ -94,16 +95,9 @@ void *mremap_wrapper(void *old_address, size_t old_size,
 static
 int rcu_bp_refcount;
 
-/*
- * RCU_MEMBARRIER is only possibly available on Linux.
- */
-#ifdef __linux__
-#include <urcu/syscall-compat.h>
-#endif
-
-/* If the headers do not support SYS_membarrier, fall back on RCU_MB */
-#ifdef SYS_membarrier
-# define membarrier(...)               syscall(SYS_membarrier, __VA_ARGS__)
+/* If the headers do not support membarrier system call, fall back smp_mb. */
+#ifdef __NR_membarrier
+# define membarrier(...)               syscall(__NR_membarrier, __VA_ARGS__)
 #else
 # define membarrier(...)               -ENOSYS
 #endif
@@ -385,7 +379,7 @@ void expand_arena(struct registry_arena *arena)
                        -1, 0);
                if (new_chunk == MAP_FAILED)
                        abort();
-               bzero(new_chunk, new_chunk_len);
+               memset(new_chunk, 0, new_chunk_len);
                new_chunk->data_len =
                        new_chunk_len - sizeof(struct registry_chunk);
                cds_list_add_tail(&new_chunk->node, &arena->chunk_list);
@@ -405,7 +399,7 @@ void expand_arena(struct registry_arena *arena)
        if (new_chunk != MAP_FAILED) {
                /* Should not have moved. */
                assert(new_chunk == last_chunk);
-               bzero((char *) last_chunk + old_chunk_len,
+               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);
@@ -419,7 +413,7 @@ void expand_arena(struct registry_arena *arena)
                -1, 0);
        if (new_chunk == MAP_FAILED)
                abort();
-       bzero(new_chunk, new_chunk_len);
+       memset(new_chunk, 0, new_chunk_len);
        new_chunk->data_len =
                new_chunk_len - sizeof(struct registry_chunk);
        cds_list_add_tail(&new_chunk->node, &arena->chunk_list);
@@ -618,6 +612,7 @@ void rcu_bp_exit(void)
                        munmap(chunk, chunk->data_len
                                        + sizeof(struct registry_chunk));
                }
+               CDS_INIT_LIST_HEAD(&registry_arena.chunk_list);
                ret = pthread_key_delete(urcu_bp_key);
                if (ret)
                        abort();
This page took 0.023109 seconds and 4 git commands to generate.