diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-04 08:37:16 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-04 08:37:16 -0800 |
commit | 0086d64c19c523b949589a86398fda85481ddd4a (patch) | |
tree | 802a8a0e322741dbae3720ce48fc18bda00177b1 | |
parent | 56610cf496a124108701181163492b8961db924d (diff) |
misc header improvements for building llvm
-rw-r--r-- | system/include/bsd/sys/mman.h | 2 | ||||
-rw-r--r-- | system/include/libc/stdlib.h | 1 | ||||
-rw-r--r-- | system/include/libc/string.h | 2 | ||||
-rw-r--r-- | system/include/libc/sys/_default_fcntl.h | 1 | ||||
-rw-r--r-- | system/include/libc/sys/dirent.h | 1 | ||||
-rw-r--r-- | system/include/libc/sys/resource.h | 7 | ||||
-rw-r--r-- | system/include/libc/sys/signal.h | 6 | ||||
-rw-r--r-- | system/include/libc/sys/stat.h | 3 | ||||
-rw-r--r-- | system/include/libc/sys/time.h | 3 | ||||
-rw-r--r-- | system/include/libc/sys/unistd.h | 1 | ||||
-rw-r--r-- | system/include/libc/sys/utime.h | 2 | ||||
-rw-r--r-- | system/include/sys/uio.h | 22 | ||||
-rw-r--r-- | tests/runner.py | 1 |
13 files changed, 48 insertions, 4 deletions
diff --git a/system/include/bsd/sys/mman.h b/system/include/bsd/sys/mman.h index d99d7711..cf0d7582 100644 --- a/system/include/bsd/sys/mman.h +++ b/system/include/bsd/sys/mman.h @@ -37,6 +37,8 @@ #ifndef _SYS_MMAN_H_ #define _SYS_MMAN_H_ +#include <stddef.h> /* XXX Emscripten for size_t */ + /* XXX Emscripten #include <sys/_posix.h> */ /* diff --git a/system/include/libc/stdlib.h b/system/include/libc/stdlib.h index b5de59ee..d8cf911b 100644 --- a/system/include/libc/stdlib.h +++ b/system/include/libc/stdlib.h @@ -148,6 +148,7 @@ _VOID _EXFUN(_Exit,(int __status)); /* _ATTRIBUTE ((noreturn))); */ int _EXFUN(putenv,(char *__string)); int _EXFUN(_putenv_r,(struct _reent *, char *__string)); _PTR _EXFUN(_reallocf_r,(struct _reent *, _PTR, size_t)); +char *realpath(const char *file_name, char *resolved_name); /* XXX Emscripten */ int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); int _EXFUN(_setenv_r,(struct _reent *, const char *__string, const char *__value, int __overwrite)); diff --git a/system/include/libc/string.h b/system/include/libc/string.h index 146d602c..515c71a7 100644 --- a/system/include/libc/string.h +++ b/system/include/libc/string.h @@ -74,7 +74,7 @@ size_t _EXFUN(strnlen,(const char *, size_t)); char *_EXFUN(strsep,(char **, const char *)); char *_EXFUN(strlwr,(char *)); char *_EXFUN(strupr,(char *)); -#ifdef __CYGWIN__ +#if defined(__CYGWIN__) || defined(EMSCRIPTEN) #ifndef DEFS_H /* Kludge to work around problem compiling in gdb */ char *_EXFUN(strsignal, (int __signo)); #endif diff --git a/system/include/libc/sys/_default_fcntl.h b/system/include/libc/sys/_default_fcntl.h index 0bc4fcfa..0f2ffb07 100644 --- a/system/include/libc/sys/_default_fcntl.h +++ b/system/include/libc/sys/_default_fcntl.h @@ -186,6 +186,7 @@ struct eflock { #include <sys/stat.h> /* sigh. for the mode bits for open/creat */ extern int open _PARAMS ((const char *, int, ...)); +extern int open64 _PARAMS ((const char *, int, ...)); /* XXX Emscripten */ extern int creat _PARAMS ((const char *, mode_t)); extern int fcntl _PARAMS ((int, int, ...)); #ifdef __CYGWIN__ diff --git a/system/include/libc/sys/dirent.h b/system/include/libc/sys/dirent.h index edcc5746..da0eb4ac 100644 --- a/system/include/libc/sys/dirent.h +++ b/system/include/libc/sys/dirent.h @@ -9,6 +9,7 @@ extern "C" { #endif /* XXX Emscripten */ +#include <sys/types.h> struct dirent { ino_t d_ino; char d_name[MAXNAMLEN]; diff --git a/system/include/libc/sys/resource.h b/system/include/libc/sys/resource.h index fb5d10f2..37757e88 100644 --- a/system/include/libc/sys/resource.h +++ b/system/include/libc/sys/resource.h @@ -16,7 +16,14 @@ struct rusage { int getrusage(int who, struct rusage *r_usage); /* XXX Emscripten */ +#define RLIMIT_CORE 100 #define RLIMIT_CPU 1 +#define RLIMIT_DATA 2 +#define RLIMIT_FSIZE 3 +#define RLIMIT_NOFILE 4 +#define RLIMIT_STACK 5 +#define RLIMIT_AS 6 + typedef unsigned rlim_t; struct rlimit { rlim_t rlim_cur; diff --git a/system/include/libc/sys/signal.h b/system/include/libc/sys/signal.h index e1c2b34a..543b626e 100644 --- a/system/include/libc/sys/signal.h +++ b/system/include/libc/sys/signal.h @@ -14,7 +14,7 @@ extern "C" { typedef unsigned long sigset_t; -#if defined(__rtems__) +#if defined(__rtems__) || defined(EMSCRIPTEN) #if defined(_POSIX_REALTIME_SIGNALS) @@ -71,6 +71,8 @@ typedef struct { #define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */ #define SA_SIGINFO 2 /* Invoke the signal catching function with */ /* three arguments instead of one. */ +#define SA_NODEFER 4 /* XXX Emscripten */ +#define SA_RESETHAND 8 /* XXX Emscripten */ /* struct sigaction notes from POSIX: * @@ -80,7 +82,7 @@ typedef struct { * application should not use both simultaneously. */ -typedef void (*_sig_func_ptr)(); +typedef void (*_sig_func_ptr)(int); /* XXX Emscripten */ struct sigaction { int sa_flags; /* Special flags to affect behavior of signal */ diff --git a/system/include/libc/sys/stat.h b/system/include/libc/sys/stat.h index fd955d66..b31dc079 100644 --- a/system/include/libc/sys/stat.h +++ b/system/include/libc/sys/stat.h @@ -145,13 +145,16 @@ struct stat int _EXFUN(chmod,( const char *__path, mode_t __mode )); int _EXFUN(fchmod,(int __fd, mode_t __mode)); int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); +int _EXFUN(fstat64,( int __fd, struct stat *__sbuf )); /* XXX Emscripten */ int _EXFUN(mkdir,( const char *_path, mode_t __mode )); int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); int _EXFUN(stat,( const char *__path, struct stat *__sbuf )); +int _EXFUN(stat64,( const char *__path, struct stat *__sbuf )); /* XXX Emscripten */ mode_t _EXFUN(umask,( mode_t __mask )); #if defined(EMSCRIPTEN) || defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__) int _EXFUN(lstat,( const char *__path, struct stat *__buf )); +int _EXFUN(lstat64,( const char *__path, struct stat *__buf )); /* XXX Emscripten */ int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev )); #endif diff --git a/system/include/libc/sys/time.h b/system/include/libc/sys/time.h index d48839f6..2bd2421e 100644 --- a/system/include/libc/sys/time.h +++ b/system/include/libc/sys/time.h @@ -7,6 +7,7 @@ #include <_ansi.h> #include <sys/types.h> +#include <time.h> /* XXX Emscripten */ #ifdef __cplusplus extern "C" { @@ -40,7 +41,7 @@ struct itimerval { }; /* BSD time macros used by RTEMS code */ -#if defined (__rtems__) || defined (__CYGWIN__) +#if defined (__rtems__) || defined (__CYGWIN__) || defined (EMSCRIPTEN) /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ diff --git a/system/include/libc/sys/unistd.h b/system/include/libc/sys/unistd.h index 06259b66..05b9286a 100644 --- a/system/include/libc/sys/unistd.h +++ b/system/include/libc/sys/unistd.h @@ -116,6 +116,7 @@ int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const c int _EXFUN(nice, (int __nice_value )); #if !defined(__INSIDE_CYGWIN__) off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); +off_t _EXFUN(lseek64, (int __fildes, off_t __offset, int __whence )); /* XXX Emscripten */ #endif #if defined(EMSCRIPTEN) || defined(__SPU__) || defined(__CYGWIN__) #define F_ULOCK 0 diff --git a/system/include/libc/sys/utime.h b/system/include/libc/sys/utime.h index cf08b164..07fa6c2a 100644 --- a/system/include/libc/sys/utime.h +++ b/system/include/libc/sys/utime.h @@ -9,6 +9,8 @@ extern "C" { #endif +#include <time.h> /* XXX Emscripten */ + struct utimbuf { time_t actime; diff --git a/system/include/sys/uio.h b/system/include/sys/uio.h new file mode 100644 index 00000000..f273d6d7 --- /dev/null +++ b/system/include/sys/uio.h @@ -0,0 +1,22 @@ + +#ifndef _SYS_POLL_H +#define _SYS_POLL_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +ssize_t readv(int, const struct iovec *, int); +ssize_t writev(int, const struct iovec *, int); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/tests/runner.py b/tests/runner.py index 2efe5c35..de35fbe3 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -5276,6 +5276,7 @@ Options that are modified or new in %s include: self.assertContained('side got: hello from main, over', self.run_llvm_interpreter(['combined.bc'])) # TODO: Add an argument for EMCC_JS_PROCESSOR to make it simpler to use, other simplifications there (allow non-py, just run it if not .py) + # Add in files test a clear example of using disablePermissions, and link to it from the wiki # TODO: test normal project linking, static and dynamic: get_library should not need to be told what to link! # TODO: deprecate llvm optimizations, dlmalloc, etc. in emscripten.py. |