aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2013-08-16 12:59:05 +0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2013-08-16 18:04:54 +0700
commit10d1cb9f3e515778e7841b61df4c6ad94c3d8352 (patch)
treec7b3f40f6e6ab7ea752886d9a1a2c441816fb5dc /system
parent4e0c5a89b387d5f4ca8248c8b31e2db136652a64 (diff)
Add compat headers, move some things to them.
This is groundwork for landing musl includes which remove some of the deprecated functions or very old BSDisms.
Diffstat (limited to 'system')
-rw-r--r--system/include/compat/math.h14
-rw-r--r--system/include/compat/stdlib.h16
-rw-r--r--system/include/compat/string.h17
-rw-r--r--system/include/compat/sys/stat.h20
-rw-r--r--system/include/compat/sys/timeb.h (renamed from system/include/libc/sys/timeb.h)0
-rw-r--r--system/include/compat/unistd.h16
-rw-r--r--system/include/compat/xlocale.h21
-rw-r--r--system/include/libc/stdlib.h2
-rw-r--r--system/include/libc/string.h2
-rw-r--r--system/include/libc/sys/unistd.h1
-rw-r--r--system/include/xlocale.h7
11 files changed, 105 insertions, 11 deletions
diff --git a/system/include/compat/math.h b/system/include/compat/math.h
new file mode 100644
index 00000000..089cf66b
--- /dev/null
+++ b/system/include/compat/math.h
@@ -0,0 +1,14 @@
+#ifndef _COMPAT_MATH_H_
+#define _COMPAT_MATH_H_
+
+#ifndef isinff
+ #define isinff isinf
+#endif
+
+#ifndef isnanf
+ #define isnanf isnan
+#endif
+
+#include_next <math.h>
+
+#endif /* _COMPAT_MATH_H_ */
diff --git a/system/include/compat/stdlib.h b/system/include/compat/stdlib.h
new file mode 100644
index 00000000..dc01947d
--- /dev/null
+++ b/system/include/compat/stdlib.h
@@ -0,0 +1,16 @@
+#ifndef _COMPAT_STDLIB_H
+#define _COMPAT_STDLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getloadavg(double loadavg[], int nelem);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <stdlib.h>
+
+#endif
diff --git a/system/include/compat/string.h b/system/include/compat/string.h
new file mode 100644
index 00000000..880089cc
--- /dev/null
+++ b/system/include/compat/string.h
@@ -0,0 +1,17 @@
+#ifndef _COMPAT_STRING_H
+#define _COMPAT_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern char* strlwr(char *);
+extern char* strupr(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <string.h>
+
+#endif
diff --git a/system/include/compat/sys/stat.h b/system/include/compat/sys/stat.h
new file mode 100644
index 00000000..731502ea
--- /dev/null
+++ b/system/include/compat/sys/stat.h
@@ -0,0 +1,20 @@
+#ifndef _COMPAT_STAT_H
+#define _COMPAT_STAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include_next <sys/stat.h>
+
+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/system/include/libc/sys/timeb.h b/system/include/compat/sys/timeb.h
index 0a2c3de8..0a2c3de8 100644
--- a/system/include/libc/sys/timeb.h
+++ b/system/include/compat/sys/timeb.h
diff --git a/system/include/compat/unistd.h b/system/include/compat/unistd.h
new file mode 100644
index 00000000..07c3afde
--- /dev/null
+++ b/system/include/compat/unistd.h
@@ -0,0 +1,16 @@
+#ifndef _COMPAT_UNISTD_H
+#define _COMPAT_UNISTD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char * getwd(char *__buf );
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <unistd.h>
+
+#endif
diff --git a/system/include/compat/xlocale.h b/system/include/compat/xlocale.h
new file mode 100644
index 00000000..4bafa27d
--- /dev/null
+++ b/system/include/compat/xlocale.h
@@ -0,0 +1,21 @@
+#ifndef _COMPAT_XLOCALE_H_
+#define _COMPAT_XLOCALE_H_
+
+#include <locale.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+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);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include_next <xlocale.h>
+
+#endif /* _COMPAT_XLOCALE_H_ */
+
diff --git a/system/include/libc/stdlib.h b/system/include/libc/stdlib.h
index 888b6041..6fdef40b 100644
--- a/system/include/libc/stdlib.h
+++ b/system/include/libc/stdlib.h
@@ -223,8 +223,6 @@ extern long double strtold (const char *, char **);
extern long double wcstold (const wchar_t *, wchar_t **);
#endif /* _LDBL_EQ_DBL */
-int getloadavg(double loadavg[], int nelem); /* XXX Emscripten */
-
_END_STD_C
#endif /* _STDLIB_H_ */
diff --git a/system/include/libc/string.h b/system/include/libc/string.h
index 515c71a7..8fd9ea43 100644
--- a/system/include/libc/string.h
+++ b/system/include/libc/string.h
@@ -72,8 +72,6 @@ size_t _EXFUN(strlcpy,(char *, const char *, size_t));
int _EXFUN(strncasecmp,(const char *, const char *, size_t));
size_t _EXFUN(strnlen,(const char *, size_t));
char *_EXFUN(strsep,(char **, const char *));
-char *_EXFUN(strlwr,(char *));
-char *_EXFUN(strupr,(char *));
#if defined(__CYGWIN__) || defined(EMSCRIPTEN)
#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
char *_EXFUN(strsignal, (int __signo));
diff --git a/system/include/libc/sys/unistd.h b/system/include/libc/sys/unistd.h
index 1a414b3c..a4219d4d 100644
--- a/system/include/libc/sys/unistd.h
+++ b/system/include/libc/sys/unistd.h
@@ -102,7 +102,6 @@ uid_t _EXFUN(getuid, (void ));
#endif
#if defined(EMSCRIPTEN) || defined(__CYGWIN__)
char * _EXFUN(getusershell, (void));
-char * _EXFUN(getwd, (char *__buf ));
int _EXFUN(iruserok, (unsigned long raddr, int superuser, const char *ruser, const char *luser));
#endif
int _EXFUN(isatty, (int __fildes ));
diff --git a/system/include/xlocale.h b/system/include/xlocale.h
index bb3b50e5..6867d25f 100644
--- a/system/include/xlocale.h
+++ b/system/include/xlocale.h
@@ -1,4 +1,3 @@
-
#ifndef _XLOCALE_H_
#define _XLOCALE_H_
@@ -9,10 +8,6 @@
extern "C" {
#endif
-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);
-
int strcoll_l(const char *s1, const char *s2, locale_t locale);
int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t locale);
@@ -43,5 +38,5 @@ size_t strftime_l(char *s, size_t maxsize, const char *format, const struct tm *
}
#endif
-#endif /* _LOCALE_H_ */
+#endif /* _XLOCALE_H_ */