summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/alltypes.h.in65
-rw-r--r--include/arpa/inet.h10
-rw-r--r--include/dirent.h2
-rw-r--r--include/langinfo.h3
-rw-r--r--include/math.h19
-rw-r--r--include/netdb.h7
-rw-r--r--include/netinet/in.h14
-rw-r--r--include/nl_types.h6
-rw-r--r--include/signal.h32
-rw-r--r--include/stdint.h28
-rw-r--r--include/stdio.h2
-rw-r--r--include/sys/resource.h3
-rw-r--r--include/sys/statfs.h2
-rw-r--r--include/sys/types.h10
-rw-r--r--include/sys/wait.h11
-rw-r--r--include/utmpx.h1
-rw-r--r--include/wchar.h2
-rw-r--r--include/wctype.h3
18 files changed, 133 insertions, 87 deletions
diff --git a/include/alltypes.h.in b/include/alltypes.h.in
new file mode 100644
index 00000000..b2454365
--- /dev/null
+++ b/include/alltypes.h.in
@@ -0,0 +1,65 @@
+TYPEDEF unsigned _Addr size_t;
+TYPEDEF unsigned _Addr uintptr_t;
+TYPEDEF _Addr ptrdiff_t;
+TYPEDEF _Addr ssize_t;
+TYPEDEF _Addr intptr_t;
+
+TYPEDEF signed char int8_t;
+TYPEDEF short int16_t;
+TYPEDEF int int32_t;
+TYPEDEF _Int64 int64_t;
+TYPEDEF _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 uintmax_t;
+
+TYPEDEF unsigned mode_t;
+TYPEDEF unsigned 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 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 int pthread_key_t;
+TYPEDEF int pthread_spinlock_t;
+TYPEDEF unsigned pthread_mutexattr_t;
+TYPEDEF unsigned pthread_condattr_t;
+TYPEDEF unsigned pthread_barrierattr_t;
+TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
+
+TYPEDEF struct _IO_FILE FILE;
+
+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;
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index e47a41f6..5dcadaae 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -7,16 +7,6 @@ extern "C" {
#include <features.h>
#include <netinet/in.h>
-#include <inttypes.h>
-
-#define __NEED_socklen_t
-#define __NEED_in_addr_t
-#define __NEED_in_port_t
-#define __NEED_uint16_t
-#define __NEED_uint32_t
-#define __NEED_struct_in_addr
-
-#include <bits/alltypes.h>
uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);
diff --git a/include/dirent.h b/include/dirent.h
index d445f80a..5aa8510b 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -15,7 +15,7 @@ extern "C" {
#include <bits/alltypes.h>
-typedef struct __DIR_s DIR;
+typedef struct __dirstream DIR;
struct dirent
{
diff --git a/include/langinfo.h b/include/langinfo.h
index b9c55695..c6349ad1 100644
--- a/include/langinfo.h
+++ b/include/langinfo.h
@@ -5,7 +5,8 @@
extern "C" {
#endif
-#define __NEED_nl_item
+#include <nl_types.h>
+
#define __NEED_locale_t
#include <bits/alltypes.h>
diff --git a/include/math.h b/include/math.h
index 01428152..c029156a 100644
--- a/include/math.h
+++ b/include/math.h
@@ -9,9 +9,6 @@ extern "C" {
#define __NEED_float_t
#define __NEED_double_t
-#define __NEED___uint16_t
-#define __NEED___uint32_t
-#define __NEED___uint64_t
#include <bits/alltypes.h>
#if 100*__GNUC__+__GNUC_MINOR__ >= 303
@@ -43,14 +40,14 @@ int __fpclassify(double);
int __fpclassifyf(float);
int __fpclassifyl(long double);
-static __inline __uint32_t __FLOAT_BITS(float __f)
+static __inline unsigned __FLOAT_BITS(float __f)
{
- union {float __f; __uint32_t __i;} __u = {__f};
+ union {float __f; unsigned __i;} __u = {__f};
return __u.__i;
}
-static __inline __uint64_t __DOUBLE_BITS(double __f)
+static __inline unsigned long long __DOUBLE_BITS(double __f)
{
- union {double __f; __uint64_t __i;} __u = {__f};
+ union {double __f; unsigned long long __i;} __u = {__f};
return __u.__i;
}
@@ -61,22 +58,22 @@ static __inline __uint64_t __DOUBLE_BITS(double __f)
#define isinf(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & (__uint64_t)-1>>1) == (__uint64_t)0x7ff<<52 : \
+ sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
__fpclassifyl(x) == FP_INFINITE)
#define isnan(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & (__uint64_t)-1>>1) > (__uint64_t)0x7ff<<52 : \
+ sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
__fpclassifyl(x) == FP_NAN)
#define isnormal(x) ( \
sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
- sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+((__uint64_t)1<<52)) & (__uint64_t)-1>>1) >= (__uint64_t)1<<53 : \
+ sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
__fpclassifyl(x) == FP_NORMAL)
#define isfinite(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & (__uint64_t)-1>>1) < (__uint64_t)0x7ff<<52 : \
+ sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
__fpclassifyl(x) > FP_INFINITE)
int __signbit(double);
diff --git a/include/netdb.h b/include/netdb.h
index 3cda7114..8a7013ad 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -6,15 +6,12 @@ extern "C" {
#endif
#include <features.h>
+#include <netinet/in.h>
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __NEED_size_t
-#endif
-
-#define __NEED_socklen_t
-#define __NEED_uint32_t
-
#include <bits/alltypes.h>
+#endif
struct addrinfo
{
diff --git a/include/netinet/in.h b/include/netinet/in.h
index fcab298b..d886fc28 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -6,16 +6,12 @@ extern "C" {
#endif
#include <features.h>
+#include <inttypes.h>
+#include <sys/socket.h>
-#define __NEED_in_addr_t
-#define __NEED_in_port_t
-#define __NEED_sa_family_t
-#define __NEED_struct_in_addr
-#define __NEED_uint8_t
-#define __NEED_uint16_t
-#define __NEED_uint32_t
-
-#include <bits/alltypes.h>
+typedef uint16_t in_port_t;
+typedef uint32_t in_addr_t;
+struct in_addr { in_addr_t s_addr; };
struct sockaddr_in
{
diff --git a/include/nl_types.h b/include/nl_types.h
index ca61efb6..7c2d48e0 100644
--- a/include/nl_types.h
+++ b/include/nl_types.h
@@ -8,10 +8,8 @@ extern "C" {
#define NL_SETD 1
#define NL_CAT_LOCALE 1
-#define __NEED_nl_item
-#include <bits/alltypes.h>
-
-typedef long nl_catd;
+typedef int nl_item;
+typedef void *nl_catd;
nl_catd catopen (const char *, int);
char *catgets (nl_catd, int, int, const char *);
diff --git a/include/signal.h b/include/signal.h
index 242b4ad2..ee20372b 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -12,7 +12,6 @@ extern "C" {
|| defined(_BSD_SOURCE)
#ifdef _GNU_SOURCE
-#define __siginfo siginfo
#define __ucontext ucontext
#endif
@@ -25,7 +24,6 @@ extern "C" {
#define __NEED_time_t
#define __NEED_clock_t
#define __NEED_sigset_t
-#define __NEED_siginfo_t
#include <bits/alltypes.h>
@@ -77,19 +75,7 @@ extern "C" {
#define CLD_STOPPED 5
#define CLD_CONTINUED 6
-struct sigaction {
- union {
- void (*sa_handler)(int);
- void (*sa_sigaction)(int, siginfo_t *, void *);
- } __sa_handler;
- sigset_t sa_mask;
- int sa_flags;
- void (*sa_restorer)(void);
-};
-#define sa_handler __sa_handler.sa_handler
-#define sa_sigaction __sa_handler.sa_sigaction
-
-typedef struct {
+typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
@@ -100,7 +86,7 @@ union sigval {
void *sival_ptr;
};
-struct __siginfo {
+typedef struct {
int si_signo, si_errno, si_code;
union {
char __pad[128 - 2*sizeof(int) - sizeof(long)];
@@ -126,7 +112,7 @@ struct __siginfo {
int si_fd;
} __sigpoll;
} __si_fields;
-};
+} siginfo_t;
#define si_pid __si_fields.__sigchld.si_pid
#define si_uid __si_fields.__sigchld.si_uid
#define si_status __si_fields.__sigchld.si_status
@@ -141,6 +127,18 @@ struct __siginfo {
#define si_ptr __si_fields.__rt.si_sigval.sival_ptr
#define si_int __si_fields.__rt.si_sigval.sival_int
+struct sigaction {
+ union {
+ void (*sa_handler)(int);
+ void (*sa_sigaction)(int, siginfo_t *, void *);
+ } __sa_handler;
+ sigset_t sa_mask;
+ int sa_flags;
+ void (*sa_restorer)(void);
+};
+#define sa_handler __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
struct sigevent {
union sigval sigev_value;
int sigev_signo;
diff --git a/include/stdint.h b/include/stdint.h
index 76284048..a783ad96 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -11,16 +11,6 @@
#define __NEED_uint32_t
#define __NEED_uint64_t
-#define __NEED_int_fast8_t
-#define __NEED_int_fast16_t
-#define __NEED_int_fast32_t
-#define __NEED_int_fast64_t
-
-#define __NEED_uint_fast8_t
-#define __NEED_uint_fast16_t
-#define __NEED_uint_fast32_t
-#define __NEED_uint_fast64_t
-
#define __NEED_intptr_t
#define __NEED_uintptr_t
@@ -29,11 +19,17 @@
#include <bits/alltypes.h>
+typedef int8_t int_fast8_t;
+typedef int64_t int_fast64_t;
+
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint64_t uint_fast64_t;
+
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
@@ -54,16 +50,25 @@ typedef uint64_t uint_least64_t;
#define UINT32_MAX (0xffffffff)
#define UINT64_MAX (0xffffffffffffffff)
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST64_MIN INT64_MIN
+
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST64_MAX INT64_MAX
+
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
@@ -84,6 +89,9 @@ typedef uint64_t uint_least64_t;
#define WCHAR_MIN (-1-0x7fffffff+L'\0')
#endif
+#define SIG_ATOMIC_MIN INT32_MIN
+#define SIG_ATOMIC_MAX INT32_MAX
+
#include <bits/stdint.h>
#define INT8_C(c) c
diff --git a/include/stdio.h b/include/stdio.h
index ad407fb1..cd60bb55 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -43,7 +43,7 @@ extern "C" {
#define TMP_MAX 10000
#define L_tmpnam 20
-typedef union {
+typedef union _G_fpos64_t {
char __opaque[16];
double __align;
} fpos_t;
diff --git a/include/sys/resource.h b/include/sys/resource.h
index ff8ee205..0cfbcf44 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -6,10 +6,9 @@ extern "C" {
#endif
#include <features.h>
+#include <sys/time.h>
#define __NEED_id_t
-#define __NEED_time_t
-#define __NEED_struct_timeval
#ifdef _GNU_SOURCE
#define __NEED_pid_t
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index d8128a25..6f4c6230 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -9,7 +9,7 @@ extern "C" {
#include <sys/statvfs.h>
-typedef struct {
+typedef struct __fsid_t {
int __val[2];
} fsid_t;
diff --git a/include/sys/types.h b/include/sys/types.h
index 6ead8b6e..db8661bf 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -25,10 +25,6 @@ extern "C" {
#define __NEED_int32_t
#define __NEED_int64_t
-#define __NEED___uint16_t
-#define __NEED___uint32_t
-#define __NEED___uint64_t
-
#define __NEED_blkcnt_t
#define __NEED_fsblkcnt_t
#define __NEED_fsfilcnt_t
@@ -57,9 +53,9 @@ extern "C" {
#include <bits/alltypes.h>
typedef unsigned char u_int8_t;
-typedef __uint16_t u_int16_t;
-typedef __uint32_t u_int32_t;
-typedef __uint64_t u_int64_t;
+typedef unsigned short u_int16_t;
+typedef unsigned u_int32_t;
+typedef unsigned long long u_int64_t;
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef char *caddr_t;
diff --git a/include/sys/wait.h b/include/sys/wait.h
index b8d6432e..b6dfe01d 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -10,10 +10,13 @@ extern "C" {
#define __NEED_pid_t
#define __NEED_id_t
-#define __NEED_siginfo_t
#include <bits/alltypes.h>
-typedef int idtype_t;
+typedef enum {
+ P_ALL = 0,
+ P_PID = 1,
+ P_PGID = 2
+} idtype_t;
pid_t wait (int *);
int waitid (idtype_t, id_t, siginfo_t *, int);
@@ -37,10 +40,6 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);
#define __WALL 0x40000000
#define __WCLONE 0x80000000
-#define P_ALL 0
-#define P_PID 1
-#define P_PGID 2
-
#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
#define WTERMSIG(s) ((s) & 0x7f)
#define WSTOPSIG(s) WEXITSTATUS(s)
diff --git a/include/utmpx.h b/include/utmpx.h
index 0b3f6232..fd5f515a 100644
--- a/include/utmpx.h
+++ b/include/utmpx.h
@@ -7,6 +7,7 @@ extern "C" {
#define __NEED_pid_t
#define __NEED_time_t
+#define __NEED_suseconds_t
#define __NEED_struct_timeval
#include <bits/alltypes.h>
diff --git a/include/wchar.h b/include/wchar.h
index 0f1f6d26..a6742e37 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -38,7 +38,7 @@ extern "C" {
#undef WEOF
#define WEOF (-1)
-typedef struct
+typedef struct __mbstate_t
{
unsigned __opaque1, __opaque2;
} mbstate_t;
diff --git a/include/wctype.h b/include/wctype.h
index abc7d36f..5640eddb 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -8,7 +8,6 @@ extern "C" {
#include <features.h>
#define __NEED_wint_t
-#define __NEED_wctrans_t
#define __NEED_wctype_t
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
@@ -18,6 +17,8 @@ extern "C" {
#include <bits/alltypes.h>
+typedef const int * wctrans_t;
+
#undef WEOF
#define WEOF (-1)