porting.h 1.7 KB

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