}
#define DEFINE_RCU_FLAVOR_ALIAS(x, y) _DEFINE_RCU_FLAVOR_ALIAS(x, y)
+#ifdef __APPLE__
+#define _DEFINE_RCU_FLAVOR_ALIAS(x, y)
+#else
#define _DEFINE_RCU_FLAVOR_ALIAS(x, y) \
__attribute__((alias(#x))) \
extern const struct rcu_flavor_struct y;
+#endif
extern const struct rcu_flavor_struct rcu_flavor;
#include <urcu/tls-compat.h>
#include "urcu-die.h"
+#include "urcu-utils.h"
#define URCU_API_MAP
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
static pthread_key_t urcu_bp_key;
struct urcu_bp_gp urcu_bp_gp = { .ctr = URCU_BP_GP_COUNT };
-__attribute__((alias("urcu_bp_gp"))) extern struct urcu_bp_gp rcu_gp_bp;
+URCU_ATTR_ALIAS("urcu_bp_gp") extern struct urcu_bp_gp rcu_gp_bp;
/*
* Pointer to registry elements. Written to only by each individual reader. Read
* by both the reader and the writers.
*/
DEFINE_URCU_TLS(struct urcu_bp_reader *, urcu_bp_reader);
-__attribute__((alias("urcu_bp_reader")))
+URCU_ATTR_ALIAS("urcu_bp_reader")
extern struct urcu_bp_reader *rcu_reader_bp;
static CDS_LIST_HEAD(registry);
ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
assert(!ret);
}
-__attribute__((alias("urcu_bp_synchronize_rcu"))) void synchronize_rcu_bp();
+URCU_ATTR_ALIAS("urcu_bp_synchronize_rcu") void synchronize_rcu_bp();
/*
* library wrappers to be used by non-LGPL compatible source code.
{
_urcu_bp_read_lock();
}
-__attribute__((alias("urcu_bp_read_lock"))) void rcu_read_lock_bp();
+URCU_ATTR_ALIAS("urcu_bp_read_lock") void rcu_read_lock_bp();
void urcu_bp_read_unlock(void)
{
_urcu_bp_read_unlock();
}
-__attribute__((alias("urcu_bp_read_unlock"))) void rcu_read_unlock_bp();
+URCU_ATTR_ALIAS("urcu_bp_read_unlock") void rcu_read_unlock_bp();
int urcu_bp_read_ongoing(void)
{
return _urcu_bp_read_ongoing();
}
-__attribute__((alias("urcu_bp_read_ongoing"))) int rcu_read_ongoing_bp();
+URCU_ATTR_ALIAS("urcu_bp_read_ongoing") int rcu_read_ongoing_bp();
/*
* Only grow for now. If empty, allocate a ARENA_INIT_ALLOC sized chunk.
if (ret)
abort();
}
-__attribute__((alias("urcu_bp_register"))) void rcu_bp_register();
+URCU_ATTR_ALIAS("urcu_bp_register") void rcu_bp_register();
/* Disable signals, take mutex, remove from registry */
static
mutex_lock(&rcu_registry_lock);
saved_fork_signal_mask = oldmask;
}
-__attribute__((alias("urcu_bp_before_fork"))) void rcu_bp_before_fork();
+URCU_ATTR_ALIAS("urcu_bp_before_fork") void rcu_bp_before_fork();
void urcu_bp_after_fork_parent(void)
{
ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
assert(!ret);
}
-__attribute__((alias("urcu_bp_after_fork_parent")))
+URCU_ATTR_ALIAS("urcu_bp_after_fork_parent")
void rcu_bp_after_fork_parent(void);
/*
ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
assert(!ret);
}
-__attribute__((alias("urcu_bp_after_fork_child")))
+URCU_ATTR_ALIAS("urcu_bp_after_fork_child")
void rcu_bp_after_fork_child(void);
void *urcu_bp_dereference_sym(void *p)
{
return _rcu_dereference(p);
}
-__attribute__((alias("urcu_bp_dereference_sym")))
+URCU_ATTR_ALIAS("urcu_bp_dereference_sym")
void *rcu_dereference_sym_bp();
void *urcu_bp_set_pointer_sym(void **p, void *v)
uatomic_set(p, v);
return v;
}
-__attribute__((alias("urcu_bp_set_pointer_sym")))
+URCU_ATTR_ALIAS("urcu_bp_set_pointer_sym")
void *rcu_set_pointer_sym_bp();
void *urcu_bp_xchg_pointer_sym(void **p, void *v)
cmm_wmb();
return uatomic_xchg(p, v);
}
-__attribute__((alias("urcu_bp_xchg_pointer_sym")))
+URCU_ATTR_ALIAS("urcu_bp_xchg_pointer_sym")
void *rcu_xchg_pointer_sym_bp();
void *urcu_bp_cmpxchg_pointer_sym(void **p, void *old, void *_new)
cmm_wmb();
return uatomic_cmpxchg(p, old, _new);
}
-__attribute__((alias("urcu_bp_cmpxchg_pointer_sym")))
+URCU_ATTR_ALIAS("urcu_bp_cmpxchg_pointer_sym")
void *rcu_cmpxchg_pointer_sym_bp();
DEFINE_RCU_FLAVOR(rcu_flavor);
return NULL;
return rcu_dereference(pcpu_crdp[cpu]);
}
-__attribute__((alias(urcu_stringify(get_cpu_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(get_cpu_call_rcu_data))
struct call_rcu_data *alias_get_cpu_call_rcu_data();
/*
{
return crdp->tid;
}
-__attribute__((alias(urcu_stringify(get_call_rcu_thread))))
+URCU_ATTR_ALIAS(urcu_stringify(get_call_rcu_thread))
pthread_t alias_get_call_rcu_thread();
/*
return crdp;
}
-__attribute__((alias(urcu_stringify(create_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(create_call_rcu_data))
struct call_rcu_data *alias_create_call_rcu_data();
struct call_rcu_data *create_call_rcu_data(unsigned long flags,
int cpu_affinity)
call_rcu_unlock(&call_rcu_mutex);
return 0;
}
-__attribute__((alias(urcu_stringify(set_cpu_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(set_cpu_call_rcu_data))
int alias_set_cpu_call_rcu_data();
/*
call_rcu_unlock(&call_rcu_mutex);
return default_call_rcu_data;
}
-__attribute__((alias(urcu_stringify(get_default_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(get_default_call_rcu_data))
struct call_rcu_data *alias_get_default_call_rcu_data();
/*
return get_default_call_rcu_data();
}
-__attribute__((alias(urcu_stringify(get_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(get_call_rcu_data))
struct call_rcu_data *alias_get_call_rcu_data();
/*
{
return URCU_TLS(thread_call_rcu_data);
}
-__attribute__((alias(urcu_stringify(get_thread_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(get_thread_call_rcu_data))
struct call_rcu_data *alias_get_thread_call_rcu_data();
/*
{
URCU_TLS(thread_call_rcu_data) = crdp;
}
-__attribute__((alias(urcu_stringify(set_thread_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(set_thread_call_rcu_data))
void alias_set_thread_call_rcu_data();
/*
}
return 0;
}
-__attribute__((alias(urcu_stringify(create_all_cpu_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(create_all_cpu_call_rcu_data))
int alias_create_all_cpu_call_rcu_data();
/*
_call_rcu(head, func, crdp);
_rcu_read_unlock();
}
-__attribute__((alias(urcu_stringify(call_rcu)))) void alias_call_rcu();
+URCU_ATTR_ALIAS(urcu_stringify(call_rcu)) void alias_call_rcu();
/*
* Free up the specified call_rcu_data structure, terminating the
free(crdp);
}
-__attribute__((alias(urcu_stringify(call_rcu_data_free))))
+URCU_ATTR_ALIAS(urcu_stringify(call_rcu_data_free))
void alias_call_rcu_data_free();
/*
#ifdef RCU_QSBR
/* ABI6 has a non-namespaced free_all_cpu_call_rcu_data for qsbr */
#undef free_all_cpu_call_rcu_data
-__attribute__((alias("urcu_qsbr_free_all_cpu_call_rcu_data")))
+URCU_ATTR_ALIAS("urcu_qsbr_free_all_cpu_call_rcu_data")
void free_all_cpu_call_rcu_data();
#define free_all_cpu_call_rcu_data urcu_qsbr_free_all_cpu_call_rcu_data
#else
-__attribute__((alias(urcu_stringify(free_all_cpu_call_rcu_data))))
+URCU_ATTR_ALIAS(urcu_stringify(free_all_cpu_call_rcu_data))
void alias_free_all_cpu_call_rcu_data();
#endif
if (was_online)
rcu_thread_online();
}
-__attribute__((alias(urcu_stringify(rcu_barrier))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_barrier))
void alias_rcu_barrier();
/*
(void) poll(NULL, 0, 1);
}
}
-__attribute__((alias(urcu_stringify(call_rcu_before_fork))))
+URCU_ATTR_ALIAS(urcu_stringify(call_rcu_before_fork))
void alias_call_rcu_before_fork();
/*
atfork->after_fork_parent(atfork->priv);
call_rcu_unlock(&call_rcu_mutex);
}
-__attribute__((alias(urcu_stringify(call_rcu_after_fork_parent))))
+URCU_ATTR_ALIAS(urcu_stringify(call_rcu_after_fork_parent))
void alias_call_rcu_after_fork_parent();
/*
call_rcu_data_free(crdp);
}
}
-__attribute__((alias(urcu_stringify(call_rcu_after_fork_child))))
+URCU_ATTR_ALIAS(urcu_stringify(call_rcu_after_fork_child))
void alias_call_rcu_after_fork_child();
void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork)
end:
call_rcu_unlock(&call_rcu_mutex);
}
-__attribute__((alias(urcu_stringify(urcu_register_rculfhash_atfork))))
+URCU_ATTR_ALIAS(urcu_stringify(urcu_register_rculfhash_atfork))
void alias_urcu_register_rculfhash_atfork();
void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork)
end:
call_rcu_unlock(&call_rcu_mutex);
}
-__attribute__((alias(urcu_stringify(urcu_unregister_rculfhash_atfork))))
+URCU_ATTR_ALIAS(urcu_stringify(urcu_unregister_rculfhash_atfork))
void alias_urcu_unregister_rculfhash_atfork();
_rcu_defer_barrier_thread();
mutex_unlock(&rcu_defer_mutex);
}
-__attribute__((alias(urcu_stringify(rcu_defer_barrier_thread))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_defer_barrier_thread))
void alias_rcu_defer_barrier_thread();
/*
end:
mutex_unlock(&rcu_defer_mutex);
}
-__attribute__((alias(urcu_stringify(rcu_defer_barrier))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_defer_barrier))
void alias_rcu_defer_barrier();
/*
{
_defer_rcu(fct, p);
}
-__attribute__((alias(urcu_stringify(defer_rcu)))) void alias_defer_rcu();
+URCU_ATTR_ALIAS(urcu_stringify(defer_rcu)) void alias_defer_rcu();
static void start_defer_thread(void)
{
mutex_unlock(&defer_thread_mutex);
return 0;
}
-__attribute__((alias(urcu_stringify(rcu_defer_register_thread))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_defer_register_thread))
int alias_rcu_defer_register_thread();
void rcu_defer_unregister_thread(void)
stop_defer_thread();
mutex_unlock(&defer_thread_mutex);
}
-__attribute__((alias(urcu_stringify(rcu_defer_unregister_thread))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_defer_unregister_thread))
void alias_rcu_defer_unregister_thread();
void rcu_defer_exit(void)
{
assert(cds_list_empty(®istry_defer));
}
-__attribute__((alias(urcu_stringify(rcu_defer_exit))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_defer_exit))
void alias_rcu_defer_exit();
#endif /* _URCU_DEFER_IMPL_H */
#include "urcu-die.h"
#include "urcu-wait.h"
+#include "urcu-utils.h"
#define URCU_API_MAP
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
*/
static pthread_mutex_t rcu_registry_lock = PTHREAD_MUTEX_INITIALIZER;
struct urcu_gp urcu_qsbr_gp = { .ctr = URCU_QSBR_GP_ONLINE };
-__attribute__((alias("urcu_qsbr_gp"))) extern struct urcu_gp rcu_gp_qsbr;
+URCU_ATTR_ALIAS("urcu_qsbr_gp") extern struct urcu_gp rcu_gp_qsbr;
/*
* Active attempts to check for reader Q.S. before calling futex().
* writers.
*/
DEFINE_URCU_TLS(struct urcu_qsbr_reader, urcu_qsbr_reader);
-__attribute__((alias("urcu_qsbr_reader")))
+URCU_ATTR_ALIAS("urcu_qsbr_reader")
extern struct urcu_qsbr_reader rcu_reader_qsbr;
static CDS_LIST_HEAD(registry);
cmm_smp_mb();
}
#endif /* !(CAA_BITS_PER_LONG < 64) */
-__attribute__((alias("urcu_qsbr_synchronize_rcu")))
+URCU_ATTR_ALIAS("urcu_qsbr_synchronize_rcu")
void synchronize_rcu_qsbr();
/*
{
_urcu_qsbr_read_lock();
}
-__attribute__((alias("urcu_qsbr_read_lock"))) void rcu_read_lock_qsbr();
+URCU_ATTR_ALIAS("urcu_qsbr_read_lock") void rcu_read_lock_qsbr();
void urcu_qsbr_read_unlock(void)
{
_urcu_qsbr_read_unlock();
}
-__attribute__((alias("urcu_qsbr_read_unlock"))) void rcu_read_unlock_qsbr();
+URCU_ATTR_ALIAS("urcu_qsbr_read_unlock") void rcu_read_unlock_qsbr();
int urcu_qsbr_read_ongoing(void)
{
return _urcu_qsbr_read_ongoing();
}
-__attribute__((alias("urcu_qsbr_read_ongoing")))
+URCU_ATTR_ALIAS("urcu_qsbr_read_ongoing")
void rcu_read_ongoing_qsbr();
void urcu_qsbr_quiescent_state(void)
{
_urcu_qsbr_quiescent_state();
}
-__attribute__((alias("urcu_qsbr_quiescent_state")))
+URCU_ATTR_ALIAS("urcu_qsbr_quiescent_state")
void rcu_quiescent_state_qsbr();
void urcu_qsbr_thread_offline(void)
{
_urcu_qsbr_thread_offline();
}
-__attribute__((alias("urcu_qsbr_thread_offline")))
+URCU_ATTR_ALIAS("urcu_qsbr_thread_offline")
void rcu_thread_offline_qsbr();
void urcu_qsbr_thread_online(void)
{
_urcu_qsbr_thread_online();
}
-__attribute__((alias("urcu_qsbr_thread_online")))
+URCU_ATTR_ALIAS("urcu_qsbr_thread_online")
void rcu_thread_online_qsbr();
void urcu_qsbr_register_thread(void)
mutex_unlock(&rcu_registry_lock);
_urcu_qsbr_thread_online();
}
-__attribute__((alias("urcu_qsbr_register_thread")))
+URCU_ATTR_ALIAS("urcu_qsbr_register_thread")
void rcu_register_thread_qsbr();
void urcu_qsbr_unregister_thread(void)
cds_list_del(&URCU_TLS(urcu_qsbr_reader).node);
mutex_unlock(&rcu_registry_lock);
}
-__attribute__((alias("urcu_qsbr_unregister_thread")))
+URCU_ATTR_ALIAS("urcu_qsbr_unregister_thread")
void rcu_unregister_thread_qsbr();
void urcu_qsbr_exit(void)
* assert(cds_list_empty(®istry));
*/
}
-__attribute__((alias("urcu_qsbr_exit"))) void rcu_exit_qsbr();
+URCU_ATTR_ALIAS("urcu_qsbr_exit") void rcu_exit_qsbr();
DEFINE_RCU_FLAVOR(rcu_flavor);
DEFINE_RCU_FLAVOR_ALIAS(rcu_flavor, alias_rcu_flavor);
#define urcu_stringify(a) _urcu_stringify(a)
#define _urcu_stringify(a) #a
+/* There is no concept of symbol aliases on MacOS */
+#ifdef __APPLE__
+#define URCU_ATTR_ALIAS(x)
+#else
+#define URCU_ATTR_ALIAS(x) __attribute__((alias(x)))
+#endif
+
#endif /* _URCU_UTILS_H */
* uninitialized variable.
*/
int urcu_memb_has_sys_membarrier = 0;
-__attribute__((alias("urcu_memb_has_sys_membarrier")))
+URCU_ATTR_ALIAS("urcu_memb_has_sys_membarrier")
extern int rcu_has_sys_membarrier_memb;
#endif
void rcu_init(void)
{
}
-__attribute__((alias(urcu_stringify(rcu_init))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_init))
void alias_rcu_init(void);
#endif
*/
static pthread_mutex_t rcu_registry_lock = PTHREAD_MUTEX_INITIALIZER;
struct urcu_gp rcu_gp = { .ctr = URCU_GP_COUNT };
-__attribute__((alias(urcu_stringify(rcu_gp))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_gp))
extern struct urcu_gp alias_rcu_gp;
/*
* writers.
*/
DEFINE_URCU_TLS(struct urcu_reader, rcu_reader);
-__attribute__((alias(urcu_stringify(rcu_reader))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_reader))
extern struct urcu_reader alias_rcu_reader;
static CDS_LIST_HEAD(registry);
*/
urcu_wake_all_waiters(&waiters);
}
-__attribute__((alias(urcu_stringify(synchronize_rcu))))
+URCU_ATTR_ALIAS(urcu_stringify(synchronize_rcu))
void alias_synchronize_rcu();
/*
{
_rcu_read_lock();
}
-__attribute__((alias(urcu_stringify(rcu_read_lock))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_read_lock))
void alias_rcu_read_lock();
void rcu_read_unlock(void)
{
_rcu_read_unlock();
}
-__attribute__((alias(urcu_stringify(rcu_read_unlock))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_read_unlock))
void alias_rcu_read_unlock();
int rcu_read_ongoing(void)
{
return _rcu_read_ongoing();
}
-__attribute__((alias(urcu_stringify(rcu_read_ongoing))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_read_ongoing))
void alias_rcu_read_ongoing();
void rcu_register_thread(void)
cds_list_add(&URCU_TLS(rcu_reader).node, ®istry);
mutex_unlock(&rcu_registry_lock);
}
-__attribute__((alias(urcu_stringify(rcu_register_thread))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_register_thread))
void alias_rcu_register_thread();
void rcu_unregister_thread(void)
cds_list_del(&URCU_TLS(rcu_reader).node);
mutex_unlock(&rcu_registry_lock);
}
-__attribute__((alias(urcu_stringify(rcu_unregister_thread))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_unregister_thread))
void alias_rcu_unregister_thread();
#ifdef RCU_MEMBARRIER
init_done = 1;
rcu_sys_membarrier_init();
}
-__attribute__((alias(urcu_stringify(rcu_init))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_init))
void alias_rcu_init(void);
#endif
if (ret)
urcu_die(errno);
}
-__attribute__((alias(urcu_stringify(rcu_init))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_init))
void alias_rcu_init(void);
void rcu_exit(void)
* assert(cds_list_empty(®istry));
*/
}
-__attribute__((alias(urcu_stringify(rcu_exit))))
+URCU_ATTR_ALIAS(urcu_stringify(rcu_exit))
void alias_rcu_exit(void);
#endif /* #ifdef RCU_SIGNAL */