aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/include/libc/stdio.h2
-rw-r--r--system/include/libc/sys/resource.h16
-rw-r--r--system/include/libc/sys/termios.h8
-rw-r--r--system/include/sys/statvfs.h5
-rw-r--r--system/lib/debugging.cpp22
5 files changed, 51 insertions, 2 deletions
diff --git a/system/include/libc/stdio.h b/system/include/libc/stdio.h
index 1b0c30f5..19e460a3 100644
--- a/system/include/libc/stdio.h
+++ b/system/include/libc/stdio.h
@@ -670,7 +670,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
__swbuf_r(_REENT, (int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0))
#define L_cuserid 9 /* posix says it goes in stdio.h :( */
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(EMSCRIPTEN)
#define L_ctermid 16
#endif
#endif
diff --git a/system/include/libc/sys/resource.h b/system/include/libc/sys/resource.h
index 37757e88..a7fbe4dd 100644
--- a/system/include/libc/sys/resource.h
+++ b/system/include/libc/sys/resource.h
@@ -9,7 +9,21 @@
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
- int ru_maxrss; /* XXX Emscripten */
+ /* XXX Emscripten */
+ int ru_maxrss;
+ int ru_ixrss;
+ int ru_idrss;
+ int ru_isrss;
+ int ru_minflt;
+ int ru_majflt;
+ int ru_nswap;
+ int ru_inblock;
+ int ru_oublock;
+ int ru_msgsnd;
+ int ru_msgrcv;
+ int ru_nsignals;
+ int ru_nvcsw;
+ int ru_nivcsw;
};
/* XXX Emscripten */
diff --git a/system/include/libc/sys/termios.h b/system/include/libc/sys/termios.h
index 14174a43..88e8ad16 100644
--- a/system/include/libc/sys/termios.h
+++ b/system/include/libc/sys/termios.h
@@ -262,6 +262,14 @@ __END_DECLS
#endif /* !KERNEL */
+/* XXX Emscripten */
+struct winsize {
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel;
+ unsigned short ws_ypixel;
+};
+
/*
* END OF PROTECTED INCLUDE.
*/
diff --git a/system/include/sys/statvfs.h b/system/include/sys/statvfs.h
index 9b7490b5..cf0a8c96 100644
--- a/system/include/sys/statvfs.h
+++ b/system/include/sys/statvfs.h
@@ -1,4 +1,7 @@
+#ifndef _SYS_STATVFS_H
+#define _SYS_STATVFS_H
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -23,3 +26,5 @@ int statvfs(char *path, struct statvfs *s);
}
#endif
+#endif
+
diff --git a/system/lib/debugging.cpp b/system/lib/debugging.cpp
new file mode 100644
index 00000000..ff9e0d68
--- /dev/null
+++ b/system/lib/debugging.cpp
@@ -0,0 +1,22 @@
+
+// Some stuff to patch up an emscripten-sdk build so it can be built natively (see nativize_llvm)
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern "C" {
+
+int *__errno()
+{
+ static int e = 0;
+ return &e;
+}
+
+void __assert_func(const char *file, int line, const char *assertt, const char *cond)
+{
+ printf("assert-func: %s : %d : %s : %s\n", file, line, assertt, cond);
+ abort();
+}
+
+}
+