aboutsummaryrefslogtreecommitdiff
path: root/system/include/compat
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-24 18:25:09 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-24 18:25:09 -0700
commit05b6aa32a5f1633797f7eae390b3a8048b29ca69 (patch)
tree43543261bb5485b1c109e0e9f93dcb2f7bcd227d /system/include/compat
parent6010666be99cd0322babba1174cfbc65c776deb5 (diff)
parent8e2d812b49f7de9487e1c816229106af0cf39d0d (diff)
Merge branch 'incoming'
Diffstat (limited to 'system/include/compat')
-rw-r--r--system/include/compat/ctype.h17
-rw-r--r--system/include/compat/malloc.h48
-rw-r--r--system/include/compat/netdb.h22
-rw-r--r--system/include/compat/stdarg.h16
-rw-r--r--system/include/compat/sys/socketvar.h14
-rw-r--r--system/include/compat/sys/timeb.h10
-rw-r--r--system/include/compat/time.h18
-rw-r--r--system/include/compat/xlocale.h4
8 files changed, 139 insertions, 10 deletions
diff --git a/system/include/compat/ctype.h b/system/include/compat/ctype.h
new file mode 100644
index 00000000..891006d9
--- /dev/null
+++ b/system/include/compat/ctype.h
@@ -0,0 +1,17 @@
+#ifndef _COMPAT_CTYPE_H_
+#define _COMPAT_CTYPE_H_
+
+#define _CTYPE_A 0x00000400 /* Alpha */
+#define _CTYPE_C 0x00000002 /* Control */
+#define _CTYPE_D 0x00000800 /* Digit */
+#define _CTYPE_L 0x00000200 /* Lower */
+#define _CTYPE_P 0x00000004 /* Punct */
+#define _CTYPE_S 0x00002000 /* Space */
+#define _CTYPE_U 0x00000100 /* Upper */
+#define _CTYPE_X 0x00001000 /* X digit */
+#define _CTYPE_B 0x00000001 /* Blank */
+#define _CTYPE_R 0x00004000 /* Print */
+
+#include_next <ctype.h>
+
+#endif /* _COMPAT_CTYPE_H_ */
diff --git a/system/include/compat/malloc.h b/system/include/compat/malloc.h
new file mode 100644
index 00000000..58d93613
--- /dev/null
+++ b/system/include/compat/malloc.h
@@ -0,0 +1,48 @@
+#ifndef _COMPAT_MALLOC_H_
+#define _COMPAT_MALLOC_H_
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This version of struct mallinfo must match the one in
+ system/lib/dlmallo.c. */
+
+struct mallinfo {
+ int arena; /* total space allocated from system */
+ int ordblks; /* number of non-inuse chunks */
+ int smblks; /* unused -- always zero */
+ int hblks; /* number of mmapped regions */
+ int hblkhd; /* total space in mmapped regions */
+ int usmblks; /* unused -- always zero */
+ int fsmblks; /* unused -- always zero */
+ int uordblks; /* total allocated space */
+ int fordblks; /* total non-inuse space */
+ int keepcost; /* top-most, releasable (via malloc_trim) space */
+};
+
+/* The routines. */
+
+extern struct mallinfo mallinfo(void);
+
+extern void malloc_stats(void);
+
+extern int mallopt(int, int);
+
+extern size_t malloc_usable_size(void*);
+
+/* mallopt options */
+
+#define M_TRIM_THRESHOLD -1
+#define M_GRANULARITY -2
+#define M_MMAP_THRESHOLD -3
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <malloc.h>
+
+#endif /* _COMPAT_MALLOC_H_ */
diff --git a/system/include/compat/netdb.h b/system/include/compat/netdb.h
new file mode 100644
index 00000000..2aa1e950
--- /dev/null
+++ b/system/include/compat/netdb.h
@@ -0,0 +1,22 @@
+#ifndef _COMPAT_NETDB_H_
+#define _COMPAT_NETDB_H_
+
+#include_next <netdb.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The musl includes only define these things for old sources or
+ when certain flags are activated. We want these available
+ all of the time for now. */
+struct hostent *gethostbyname (const char *);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
+
+int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _COMPAT_NETDB_H_ */
diff --git a/system/include/compat/stdarg.h b/system/include/compat/stdarg.h
new file mode 100644
index 00000000..06591846
--- /dev/null
+++ b/system/include/compat/stdarg.h
@@ -0,0 +1,16 @@
+#ifndef _COMPAT_STDARG_H
+#define _COMPAT_STDARG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __va_copy(d,s) __builtin_va_copy(d,s)
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <stdarg.h>
+
+#endif
diff --git a/system/include/compat/sys/socketvar.h b/system/include/compat/sys/socketvar.h
new file mode 100644
index 00000000..1e60ac2f
--- /dev/null
+++ b/system/include/compat/sys/socketvar.h
@@ -0,0 +1,14 @@
+#ifndef _COMPAT_SOCKETVAR_H
+#define _COMPAT_SOCKETVAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/socket.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/system/include/compat/sys/timeb.h b/system/include/compat/sys/timeb.h
index 0a2c3de8..2e678893 100644
--- a/system/include/compat/sys/timeb.h
+++ b/system/include/compat/sys/timeb.h
@@ -14,13 +14,9 @@ extern "C" {
#define _SYS_TIMEB_H
-#include <_ansi.h>
-#include <machine/types.h>
+#define __NEED_time_t
-#ifndef __time_t_defined
-typedef _TIME_T_ time_t;
-#define __time_t_defined
-#endif
+#include <bits/alltypes.h>
struct timeb
{
@@ -30,7 +26,7 @@ struct timeb
short dstflag;
};
-extern int ftime _PARAMS ((struct timeb *));
+extern int ftime(struct timeb *);
#ifdef __cplusplus
}
diff --git a/system/include/compat/time.h b/system/include/compat/time.h
new file mode 100644
index 00000000..9adec84e
--- /dev/null
+++ b/system/include/compat/time.h
@@ -0,0 +1,18 @@
+#ifndef _COMPAT_TIME_H
+#define _COMPAT_TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int dysize(int year);
+#define _timezone timezone
+#define _daylight daylight
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <time.h>
+
+#endif
diff --git a/system/include/compat/xlocale.h b/system/include/compat/xlocale.h
index 4bafa27d..52b9b26a 100644
--- a/system/include/compat/xlocale.h
+++ b/system/include/compat/xlocale.h
@@ -9,13 +9,11 @@ extern "C" {
long long strtoll_l(const char *start, char **end, int base, locale_t loc);
unsigned long long strtoull_l(const char *start, char **end, int base, locale_t loc);
-double strtold_l(const char *start, char **end, locale_t loc);
+long double strtold_l(const char *start, char **end, locale_t loc);
#ifdef __cplusplus
}
#endif
-#include_next <xlocale.h>
-
#endif /* _COMPAT_XLOCALE_H_ */