aboutsummaryrefslogtreecommitdiff
path: root/system/include/libc
diff options
context:
space:
mode:
Diffstat (limited to 'system/include/libc')
-rw-r--r--system/include/libc/stdio.h9
-rw-r--r--system/include/libc/sys/types.h7
-rw-r--r--system/include/libc/sys/unistd.h7
3 files changed, 15 insertions, 8 deletions
diff --git a/system/include/libc/stdio.h b/system/include/libc/stdio.h
index 19e460a3..4e14df79 100644
--- a/system/include/libc/stdio.h
+++ b/system/include/libc/stdio.h
@@ -142,6 +142,7 @@ typedef _fpos64_t fpos64_t;
#define TMP_MAX 26
+#if 0 /* XXX Emscripten: do not use impure stuff for std*, it makes comparing to native builds harder */
#ifndef _REENT_ONLY
#define stdin (_REENT->_stdin)
#define stdout (_REENT->_stdout)
@@ -151,6 +152,14 @@ typedef _fpos64_t fpos64_t;
#define stdout (_impure_ptr->_stdout)
#define stderr (_impure_ptr->_stderr)
#endif /* _REENT_ONLY */
+#else
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+#define stdin stdin
+#define stdout stdout
+#define stderr stderr
+#endif
#define _stdin_r(x) ((x)->_stdin)
#define _stdout_r(x) ((x)->_stdout)
diff --git a/system/include/libc/sys/types.h b/system/include/libc/sys/types.h
index ab6e895b..77acc92e 100644
--- a/system/include/libc/sys/types.h
+++ b/system/include/libc/sys/types.h
@@ -24,7 +24,7 @@
#include <machine/_types.h>
-#if defined(__rtems__) || defined(__XMK__)
+#if defined(__rtems__) || defined(__XMK__) || defined(EMSCRIPTEN)
/*
* The following section is RTEMS specific and is needed to more
* closely match the types defined in the BSD sys/types.h.
@@ -140,14 +140,11 @@ typedef unsigned long vm_size_t;
#define __BIT_TYPES_DEFINED__
+// XXX Emscripten: removed unsigned types which are already defined
typedef signed char int8_t;
-typedef unsigned char u_int8_t;
typedef short int16_t;
-typedef unsigned short u_int16_t;
typedef int int32_t;
-typedef unsigned int u_int32_t;
typedef long long int64_t;
-typedef unsigned long long u_int64_t;
typedef int32_t register_t;
#endif /* __MS_types__ */
diff --git a/system/include/libc/sys/unistd.h b/system/include/libc/sys/unistd.h
index 05b9286a..082c5e4d 100644
--- a/system/include/libc/sys/unistd.h
+++ b/system/include/libc/sys/unistd.h
@@ -260,9 +260,10 @@ int _EXFUN(unlinkat, (int, const char *, int));
#include <sys/features.h>
-#define STDIN_FILENO 0 /* standard input file descriptor */
-#define STDOUT_FILENO 1 /* standard output file descriptor */
-#define STDERR_FILENO 2 /* standard error file descriptor */
+/* XXX Emscripten: start these at 1, we can use pointers as equals to file descriptors */
+#define STDIN_FILENO 1 /* standard input file descriptor */
+#define STDOUT_FILENO 2 /* standard output file descriptor */
+#define STDERR_FILENO 3 /* standard error file descriptor */
/*
* sysconf values per IEEE Std 1003.1, 2008 Edition