mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-08 07:42:09 +03:00
![Rich Felker](/assets/img/avatar_default.png)
this change is motivated by the intersection of several factors. presently, despite being a nonstandard header, endian.h is exposing the unprefixed byte order macros and functions only if _BSD_SOURCE or _GNU_SOURCE is defined. this is to accommodate use of endian.h from other headers, including bits headers, which need to define structure layout in terms of endianness. with time64 switch-over, even more headers will need to do this. at the same time, the resolution of Austin Group issue 162 makes endian.h a standard header for POSIX-future, requiring that it expose the unprefixed macros and the functions even in standards-conforming profiles. changes to meet this new requirement would break existing internal usage of endian.h by causing it to violate namespace where it's used. instead, have the arch's alltypes.h define __BYTE_ORDER, either as a fixed constant or depending on the right arch-specific predefined macros for determining endianness. explicit literals 1234 and 4321 are used instead of __LITTLE_ENDIAN and __BIG_ENDIAN so that there's no danger of getting the wrong result if a macro is undefined and implicitly evaluates to 0 at the preprocessor level. the powerpc (32-bit) bits/endian.h being removed had logic for varying endianness, but our powerpc arch has never supported that and has always been big-endian-only. this logic is not carried over to the new __BYTE_ORDER definition in alltypes.h.
83 lines
2.1 KiB
C
83 lines
2.1 KiB
C
#define __LITTLE_ENDIAN 1234
|
|
#define __BIG_ENDIAN 4321
|
|
|
|
TYPEDEF unsigned _Addr size_t;
|
|
TYPEDEF unsigned _Addr uintptr_t;
|
|
TYPEDEF _Addr ptrdiff_t;
|
|
TYPEDEF _Addr ssize_t;
|
|
TYPEDEF _Addr intptr_t;
|
|
TYPEDEF _Addr regoff_t;
|
|
TYPEDEF _Reg register_t;
|
|
|
|
TYPEDEF signed char int8_t;
|
|
TYPEDEF signed short int16_t;
|
|
TYPEDEF signed int int32_t;
|
|
TYPEDEF signed _Int64 int64_t;
|
|
TYPEDEF signed _Int64 intmax_t;
|
|
TYPEDEF unsigned char uint8_t;
|
|
TYPEDEF unsigned short uint16_t;
|
|
TYPEDEF unsigned int uint32_t;
|
|
TYPEDEF unsigned _Int64 uint64_t;
|
|
TYPEDEF unsigned _Int64 u_int64_t;
|
|
TYPEDEF unsigned _Int64 uintmax_t;
|
|
|
|
TYPEDEF unsigned mode_t;
|
|
TYPEDEF unsigned _Reg nlink_t;
|
|
TYPEDEF _Int64 off_t;
|
|
TYPEDEF unsigned _Int64 ino_t;
|
|
TYPEDEF unsigned _Int64 dev_t;
|
|
TYPEDEF long blksize_t;
|
|
TYPEDEF _Int64 blkcnt_t;
|
|
TYPEDEF unsigned _Int64 fsblkcnt_t;
|
|
TYPEDEF unsigned _Int64 fsfilcnt_t;
|
|
|
|
TYPEDEF unsigned wint_t;
|
|
TYPEDEF unsigned long wctype_t;
|
|
|
|
TYPEDEF void * timer_t;
|
|
TYPEDEF int clockid_t;
|
|
TYPEDEF long clock_t;
|
|
STRUCT timeval { time_t tv_sec; suseconds_t tv_usec; };
|
|
STRUCT timespec { time_t tv_sec; long tv_nsec; };
|
|
|
|
TYPEDEF int pid_t;
|
|
TYPEDEF unsigned id_t;
|
|
TYPEDEF unsigned uid_t;
|
|
TYPEDEF unsigned gid_t;
|
|
TYPEDEF int key_t;
|
|
TYPEDEF unsigned useconds_t;
|
|
|
|
#ifdef __cplusplus
|
|
TYPEDEF unsigned long pthread_t;
|
|
#else
|
|
TYPEDEF struct __pthread * pthread_t;
|
|
#endif
|
|
TYPEDEF int pthread_once_t;
|
|
TYPEDEF unsigned pthread_key_t;
|
|
TYPEDEF int pthread_spinlock_t;
|
|
TYPEDEF struct { unsigned __attr; } pthread_mutexattr_t;
|
|
TYPEDEF struct { unsigned __attr; } pthread_condattr_t;
|
|
TYPEDEF struct { unsigned __attr; } pthread_barrierattr_t;
|
|
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
|
|
|
|
STRUCT _IO_FILE { char __x; };
|
|
TYPEDEF struct _IO_FILE FILE;
|
|
|
|
TYPEDEF __builtin_va_list va_list;
|
|
TYPEDEF __builtin_va_list __isoc_va_list;
|
|
|
|
TYPEDEF struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
|
|
|
|
TYPEDEF struct __locale_struct * locale_t;
|
|
|
|
TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
|
|
|
|
STRUCT iovec { void *iov_base; size_t iov_len; };
|
|
|
|
TYPEDEF unsigned socklen_t;
|
|
TYPEDEF unsigned short sa_family_t;
|
|
|
|
#undef _Addr
|
|
#undef _Int64
|
|
#undef _Reg
|