1 #ifndef CONFIG_COMPAT_COMPAT_H
2 #define CONFIG_COMPAT_COMPAT_H
3
4 #define gettext
5 #define _gettext
6 #define _dgettext
7
8 #include <sys/types.h>
9 #include <sys/endian.h>
10
11 typedef off_t __off64_t;
12
13 #define __LITTLE_ENDIAN (1234)
14 #define __BIG_ENDIAN (4321)
15 #define __BYTE_ORDER __LITTLE_ENDIAN
16
17 #include <stddef.h>
18 #include <locale.h> //LC_MESSAGES
19 #include <assert.h>
20 #include <stdlib.h>
21 #include <stdarg.h>
22 #include <string.h>
23 #include <errno.h>
24 #include <stdio.h>
25
26 #define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
27
error(int status,int errnum,const char * fmt,...)28 static inline void __attribute__((noreturn)) error(int status, int errnum, const char *fmt, ...)
29 {
30 va_list lst;
31 va_start(lst, fmt);
32 vfprintf(stderr, fmt, lst);
33 fprintf(stderr, "error %d: %s\n", errnum, strerror(errno));
34 va_end(lst);
35 exit(status);
36 }
37
dcgettext(char * __domainname,char * __msgid,int __category)38 static inline char *dcgettext (char *__domainname, char *__msgid, int __category)
39 {
40 error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__);
41 return NULL;
42 }
43
strnlen(const char * __string,size_t __maxlen)44 static inline size_t strnlen (const char *__string, size_t __maxlen)
45 {
46 int len = 0;
47 while (__maxlen-- && *__string++)
48 len++;
49 return len;
50 }
51
mempcpy(void * __dest,const void * __src,size_t __n)52 static inline void *mempcpy (void * __dest, const void * __src, size_t __n)
53 {
54 memcpy(__dest, __src, __n);
55 return ((char *)__dest) + __n;
56 }
57
58 #define __mempcpy mempcpy
59
wmempcpy(wchar_t * __restrict __s1,__const wchar_t * __restrict __s2,size_t __n)60 static inline wchar_t *wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n)
61 {
62 error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__);
63 return NULL;
64 }
65
66
67 #define bswap_16 bswap16
68 #define bswap_32 bswap32
69 #define bswap_64 bswap64
70
71 extern int ___libelf_fill_byte;
72
73 #endif /*CONFIG_COMPAT_DARWIN_H*/
74