lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Misc system-specific crap */ |
| 2 | |
| 3 | #ifndef _PORTING_H_ |
| 4 | #define _PORTING_H_ |
| 5 | |
| 6 | #ifdef HAVE_CONFIG_H |
| 7 | #include <config.h> |
| 8 | #endif |
| 9 | |
| 10 | #include <ctype.h> |
| 11 | #include <dirent.h> |
| 12 | #include <errno.h> |
| 13 | #include <fcntl.h> |
| 14 | #include <limits.h> |
| 15 | #include <stdarg.h> |
| 16 | #include <stdint.h> |
| 17 | #include <stdio.h> |
| 18 | #include <string.h> |
| 19 | #include <strings.h> |
| 20 | #include <stdlib.h> |
| 21 | #include <unistd.h> |
| 22 | #include <sys/param.h> |
| 23 | #include <sys/stat.h> |
| 24 | #include <sys/types.h> |
| 25 | |
| 26 | #ifdef __LDSO_LDD_SUPPORT__ |
| 27 | # include <sys/wait.h> |
| 28 | #endif |
| 29 | |
| 30 | #if defined(_WIN32) || defined(_WINNT) |
| 31 | # include "mmap-windows.c" |
| 32 | #else |
| 33 | # include <sys/mman.h> |
| 34 | #endif |
| 35 | |
| 36 | #ifdef BUILDING_LINKAGE |
| 37 | #include <link.h> |
| 38 | /* makefile will include elf.h for us */ |
| 39 | |
| 40 | #include "bswap.h" |
| 41 | #include "dl-defs.h" |
| 42 | #endif |
| 43 | |
| 44 | #ifdef DMALLOC |
| 45 | #include <dmalloc.h> |
| 46 | #endif |
| 47 | |
| 48 | #ifndef ARRAY_SIZE |
| 49 | # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
| 50 | #endif |
| 51 | |
| 52 | /* For SunOS */ |
| 53 | #ifndef PATH_MAX |
| 54 | #define PATH_MAX _POSIX_PATH_MAX |
| 55 | #endif |
| 56 | |
| 57 | #ifndef UCLIBC_RUNTIME_PREFIX |
| 58 | # define UCLIBC_RUNTIME_PREFIX "/" |
| 59 | #endif |
| 60 | |
| 61 | #undef UCLIBC_ENDIAN_HOST |
| 62 | #define UCLIBC_ENDIAN_LITTLE 1234 |
| 63 | #define UCLIBC_ENDIAN_BIG 4321 |
| 64 | #if defined(BYTE_ORDER) |
| 65 | # if BYTE_ORDER == LITTLE_ENDIAN |
| 66 | # define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE |
| 67 | # elif BYTE_ORDER == BIG_ENDIAN |
| 68 | # define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG |
| 69 | # endif |
| 70 | #elif defined(__BYTE_ORDER) |
| 71 | # if __BYTE_ORDER == __LITTLE_ENDIAN |
| 72 | # define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_LITTLE |
| 73 | # elif __BYTE_ORDER == __BIG_ENDIAN |
| 74 | # define UCLIBC_ENDIAN_HOST UCLIBC_ENDIAN_BIG |
| 75 | # endif |
| 76 | #endif |
| 77 | #if !defined(UCLIBC_ENDIAN_HOST) |
| 78 | # error "Unknown host byte order!" |
| 79 | #endif |
| 80 | |
| 81 | #if defined __GNUC__ || defined __ICC |
| 82 | # define attribute_noreturn __attribute__ ((__noreturn__)) |
| 83 | #else |
| 84 | # define attribute_noreturn |
| 85 | #endif |
| 86 | |
| 87 | #endif |