Even though int is 32-bit on all architectures supported by liburcu so
far, make it future-proof by uint a int32_t, which enforces the same
type width used by the system call in the kernel.
Using int32_t and not uint32_t to make comparison with 0 more
straightforward.
Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#include <assert.h>
#include <errno.h>
#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <poll.h>
#include <urcu/arch.h>
#include <urcu/futex.h>
#include <urcu/arch.h>
#include <urcu/futex.h>
* Waiter will relinquish the CPU until woken up.
*/
* Waiter will relinquish the CPU until woken up.
*/
-int compat_futex_noasync(int *uaddr, int op, int val,
- const struct timespec *timeout, int *uaddr2, int val3)
+int compat_futex_noasync(int32_t *uaddr, int op, int32_t val,
+ const struct timespec *timeout, int32_t *uaddr2, int32_t val3)
* Waiter will busy-loop trying to read the condition.
*/
* Waiter will busy-loop trying to read the condition.
*/
-int compat_futex_async(int *uaddr, int op, int val,
- const struct timespec *timeout, int *uaddr2, int val3)
+int compat_futex_async(int32_t *uaddr, int op, int32_t val,
+ const struct timespec *timeout, int32_t *uaddr2, int32_t val3)
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
struct call_rcu_data {
struct cds_wfq_queue cbs;
unsigned long flags;
struct call_rcu_data {
struct cds_wfq_queue cbs;
unsigned long flags;
unsigned long qlen; /* maintained for debugging. */
pthread_t tid;
int cpu_affinity;
unsigned long qlen; /* maintained for debugging. */
pthread_t tid;
int cpu_affinity;
#include <sys/time.h>
#include <syscall.h>
#include <unistd.h>
#include <sys/time.h>
#include <syscall.h>
#include <unistd.h>
static pthread_mutex_t rcu_defer_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t defer_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t rcu_defer_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t defer_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
-static int defer_thread_futex;
+static int32_t defer_thread_futex;
/*
* Written to only by each individual deferer. Read by both the deferer and
/*
* Written to only by each individual deferer. Read by both the deferer and
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
/*
* Global grace period counter.
/*
* Global grace period counter.
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
/*
* Global grace period counter.
/*
* Global grace period counter.
*/
#include <urcu/config.h>
*/
#include <urcu/config.h>
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
extern "C" {
#define futex_async(uaddr, op, val, timeout, uaddr2, val3) \
futex(uaddr, op, val, timeout, uaddr2, val3)
#else
#define futex_async(uaddr, op, val, timeout, uaddr2, val3) \
futex(uaddr, op, val, timeout, uaddr2, val3)
#else
-extern int compat_futex_noasync(int *uaddr, int op, int val,
- const struct timespec *timeout, int *uaddr2, int val3);
+extern int compat_futex_noasync(int32_t *uaddr, int op, int32_t val,
+ const struct timespec *timeout, int32_t *uaddr2, int32_t val3);
#define futex_noasync(uaddr, op, val, timeout, uaddr2, val3) \
compat_futex_noasync(uaddr, op, val, timeout, uaddr2, val3)
#define futex_noasync(uaddr, op, val, timeout, uaddr2, val3) \
compat_futex_noasync(uaddr, op, val, timeout, uaddr2, val3)
-extern int compat_futex_async(int *uaddr, int op, int val,
- const struct timespec *timeout, int *uaddr2, int val3);
+extern int compat_futex_async(int32_t *uaddr, int op, int32_t val,
+ const struct timespec *timeout, int32_t *uaddr2, int32_t val3);
#define futex_async(uaddr, op, val, timeout, uaddr2, val3) \
compat_futex_async(uaddr, op, val, timeout, uaddr2, val3)
#endif
#define futex_async(uaddr, op, val, timeout, uaddr2, val3) \
compat_futex_async(uaddr, op, val, timeout, uaddr2, val3)
#endif
#include <limits.h>
#include <syscall.h>
#include <unistd.h>
#include <limits.h>
#include <syscall.h>
#include <unistd.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
extern struct rcu_reader __thread rcu_reader;
extern struct rcu_reader __thread rcu_reader;
+extern int32_t gp_futex;
/*
* Wake-up waiting synchronize_rcu(). Called from many concurrent threads.
/*
* Wake-up waiting synchronize_rcu(). Called from many concurrent threads.
#include <pthread.h>
#include <syscall.h>
#include <unistd.h>
#include <pthread.h>
#include <syscall.h>
#include <unistd.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
extern struct rcu_reader __thread rcu_reader;
extern struct rcu_reader __thread rcu_reader;
+extern int32_t gp_futex;
/*
* Wake-up waiting synchronize_rcu(). Called from many concurrent threads.
/*
* Wake-up waiting synchronize_rcu(). Called from many concurrent threads.