1 #ifndef _PTWQ_POSIX_PLATFORM_H
2 #define _PTWQ_POSIX_PLATFORM_H 1
4 /* Workaround to get visibility for _SC_NPROCESSORS_ONLN on FreeBSD */
5 #define __BSD_VISIBLE 1
7 #include <sys/resource.h>
16 # include <sys/loadavg.h>
19 /* GCC atomic builtins.
20 * See: http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
24 # define atomic_inc atomic_inc_32
25 # define atomic_dec atomic_dec_32
26 # define atomic_and atomic_and_uint_nv
27 # define atomic_or atomic_or_uint_nv
29 # define atomic_inc(p) __sync_add_and_fetch((p), 1)
30 # define atomic_dec(p) __sync_sub_and_fetch((p), 1)
31 # define atomic_and(p,v) __sync_and_and_fetch((p), (v))
32 # define atomic_or(p,v) __sync_or_and_fetch((p), (v))
38 # define CONSTRUCTOR __attribute__ ((constructor))
40 #define VISIBLE __attribute__((visibility("default")))
43 #endif /* _PTWQ_POSIX_PLATFORM_H */