Browse Source

ensure that sys/types.h includes endian definitions

OPENBSD_5_8
Brent Cook 9 years ago
parent
commit
87be206389
3 changed files with 45 additions and 0 deletions
  1. +1
    -0
      include/Makefile.am
  2. +40
    -0
      include/machine/endian.h
  3. +4
    -0
      include/sys/types.h

+ 1
- 0
include/Makefile.am View File

@ -1,6 +1,7 @@
noinst_HEADERS =
noinst_HEADERS += signal.h
noinst_HEADERS += unistd.h
noinst_HEADERS += machine/endian.h
noinst_HEADERS += sys/cdefs.h
noinst_HEADERS += sys/queue.h
noinst_HEADERS += sys/socket.h


+ 40
- 0
include/machine/endian.h View File

@ -0,0 +1,40 @@
/*
* Public domain
* machine/endian.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#if defined(_WIN32)
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#define PDP_ENDIAN 3412
/*
* Use GCC and Visual Studio compiler defines to determine endian.
*/
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#elif defined(__linux__)
#include <endian.h>
#elif defined(__sun) || defined(_AIX) || defined(__hpux)
#include <sys/types.h>
#include <arpa/nameser_compat.h>
#elif defined(__sgi)
#include <standards.h>
#include <sys/endian.h>
#else
#include_next <machine/endian.h>
#endif
#endif

+ 4
- 0
include/sys/types.h View File

@ -30,4 +30,8 @@ typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
#ifndef BYTE_ORDER
#include <machine/endian.h>
#endif
#endif

Loading…
Cancel
Save