fix build with uclibc-ng
[project/librpc-uclibc.git] / rpc / compat.h
1 #ifndef __UCLIBC_COMPAT_H
2 #define __UCLIBC_COMPAT_H
3
4 #define _XOPEN_SOURCE
5 #define _GNU_SOURCE
6
7 #include <features.h>
8 #include <errno.h>
9
10 #ifndef __UCLIBC_HAS_THREADS__
11 #define __UCLIBC_HAS_THREADS__
12 #endif
13
14 #include <poll.h>
15 #include <pthread.h>
16
17 #undef __UCLIBC_MUTEX_STATIC
18 #undef __UCLIBC_MUTEX_LOCK
19 #undef __UCLIBC_MUTEX_UNLOCK
20 #define __UCLIBC_MUTEX_STATIC(M,I) static pthread_mutex_t M = I
21 #define __UCLIBC_MUTEX_LOCK(M) pthread_mutex_lock(&(M))
22 #define __UCLIBC_MUTEX_UNLOCK(M) pthread_mutex_unlock(&(M))
23
24 #define smallint int
25
26 #define _(...) __VA_ARGS__
27 #define internal_function
28 #define attribute_hidden
29 #define attribute_unused
30 #define attribute_noreturn
31 #define libc_hidden_def(...)
32
33 #ifndef libc_hidden_proto
34 #define libc_hidden_proto(name, attrs...)
35 #endif
36
37 #define __set_errno(_val) errno = _val
38
39 # define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
40
41 # define __libc_tsd_define(CLASS, KEY) \
42 CLASS __thread void *__libc_tsd_##KEY attribute_tls_model_ie;
43
44 # define __libc_tsd_address(KEY) (&__libc_tsd_##KEY)
45 # define __libc_tsd_get(KEY) (__libc_tsd_##KEY)
46 # define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
47
48
49 #endif