de8b497c9d9fc02b78136079521c8a2741d1964e
[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 <sys/poll.h>
15 #include <pthread.h>
16
17 #ifdef __UCLIBC__
18 #include <bits/libc-lock.h>
19 #else
20 #undef __UCLIBC_MUTEX_STATIC
21 #undef __UCLIBC_MUTEX_LOCK
22 #undef __UCLIBC_MUTEX_UNLOCK
23 #define __UCLIBC_MUTEX_STATIC(M,I) static pthread_mutex_t M = I
24 #define __UCLIBC_MUTEX_LOCK(M) pthread_mutex_lock(&(M))
25 #define __UCLIBC_MUTEX_UNLOCK(M) pthread_mutex_unlock(&(M))
26 #endif
27
28 #define smallint int
29
30 #define _(...) __VA_ARGS__
31 #define internal_function
32 #define attribute_hidden
33 #define attribute_unused
34 #define attribute_noreturn
35 #define libc_hidden_def(...)
36
37 #ifndef libc_hidden_proto
38 #define libc_hidden_proto(name, attrs...)
39 #endif
40
41 #define __set_errno(_val) errno = _val
42
43 # define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
44
45 # define __libc_tsd_define(CLASS, KEY)  \
46   CLASS __thread void *__libc_tsd_##KEY attribute_tls_model_ie;
47
48 # define __libc_tsd_address(KEY)    (&__libc_tsd_##KEY)
49 # define __libc_tsd_get(KEY)        (__libc_tsd_##KEY)
50 # define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
51
52
53 #endif