Add MAP_ANONYMOUS mapping to MAP_ANON for BSD build
[urcu.git] / urcu / futex.h
CommitLineData
49617de1
MD
1#ifndef _URCU_FUTEX_H
2#define _URCU_FUTEX_H
3
4/*
5 * urcu-futex.h
6 *
7 * Userspace RCU - sys_futex/compat_futex header.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include <urcu/config.h>
6d841bc2 25#include <stdint.h>
49617de1 26
36bc70a8
MD
27#ifdef __cplusplus
28extern "C" {
29#endif
30
49617de1
MD
31#define FUTEX_WAIT 0
32#define FUTEX_WAKE 1
33
34/*
35 * sys_futex compatibility header.
36 * Use *only* *either of* futex_noasync OR futex_async on a given address.
37 *
38 * futex_noasync cannot be executed in signal handlers, but ensures that
39 * it will be put in a wait queue even in compatibility mode.
40 *
41 * futex_async is signal-handler safe for the wakeup. It uses polling
42 * on the wait-side in compatibility mode.
43 */
44
02be5561 45#ifdef CONFIG_RCU_HAVE_FUTEX
49617de1
MD
46#include <sys/syscall.h>
47#define futex(...) syscall(__NR_futex, __VA_ARGS__)
48#define futex_noasync(uaddr, op, val, timeout, uaddr2, val3) \
49 futex(uaddr, op, val, timeout, uaddr2, val3)
50#define futex_async(uaddr, op, val, timeout, uaddr2, val3) \
51 futex(uaddr, op, val, timeout, uaddr2, val3)
52#else
6d841bc2
MD
53extern int compat_futex_noasync(int32_t *uaddr, int op, int32_t val,
54 const struct timespec *timeout, int32_t *uaddr2, int32_t val3);
49617de1
MD
55#define futex_noasync(uaddr, op, val, timeout, uaddr2, val3) \
56 compat_futex_noasync(uaddr, op, val, timeout, uaddr2, val3)
6d841bc2
MD
57extern int compat_futex_async(int32_t *uaddr, int op, int32_t val,
58 const struct timespec *timeout, int32_t *uaddr2, int32_t val3);
49617de1
MD
59#define futex_async(uaddr, op, val, timeout, uaddr2, val3) \
60 compat_futex_async(uaddr, op, val, timeout, uaddr2, val3)
61#endif
62
36bc70a8
MD
63#ifdef __cplusplus
64}
65#endif
66
49617de1 67#endif /* _URCU_FUTEX_H */
This page took 0.026828 seconds and 4 git commands to generate.