aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/library.js b/src/library.js
index a628e323..1f32678d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -802,9 +802,12 @@ LibraryManager.library = {
_umask.cmask = newMask;
return oldMask;
},
+ stat64: 'stat',
+ fstat64: 'fstat',
__01fstat64_: 'fstat',
__01stat64_: 'stat',
__01lstat64_: 'lstat',
+
// TODO: Check if other aliases are needed.
// ==========================================================================
@@ -998,6 +1001,7 @@ LibraryManager.library = {
// Synchronization and blocking flags are irrelevant to us.
return 0;
case 5: // F_GETLK.
+ case 12: // F_GETLK64.
var arg = {{{ makeGetValue('varargs', 0, 'i32') }}};
var offset = ___flock_struct_layout.l_type;
// We're always unlocked.
@@ -1005,6 +1009,8 @@ LibraryManager.library = {
return 0;
case 6: // F_SETLK.
case 7: // F_SETLKW.
+ case 13: // F_SETLK64.
+ case 14: // F_SETLKW64.
// Pretend that the locking is successful.
return 0;
case 8: // F_SETOWN.
@@ -2101,6 +2107,9 @@ LibraryManager.library = {
self.DATASIZE += alignMemoryPage(bytes);
return ret; // Previous break location.
},
+ open64: 'open',
+ lseek64: 'lseek',
+ ftruncate64: 'ftruncate',
__01open64_: 'open',
__01lseek64_: 'lseek',
__01truncate64_: 'truncate',
@@ -2330,9 +2339,9 @@ LibraryManager.library = {
var argText;
var prefix = '';
if (next == 'd'.charCodeAt(0) || next == 'i'.charCodeAt(0)) {
- argText = currAbsArg.toString(10);
+ argText = reSign(currArg, 8 * argSize, 1).toString(10);
} else if (next == 'u'.charCodeAt(0)) {
- argText = unSign(currArg, 8 * argSize).toString(10);
+ argText = unSign(currArg, 8 * argSize, 1).toString(10);
currArg = Math.abs(currArg);
} else if (next == 'o'.charCodeAt(0)) {
argText = (flagAlternative ? '0' : '') + currAbsArg.toString(8);
@@ -2369,11 +2378,13 @@ LibraryManager.library = {
}
}
- // Add sign.
- if (currArg < 0) {
- prefix = '-' + prefix;
- } else if (flagAlwaysSigned) {
- prefix = '+' + prefix;
+ // Add sign if needed
+ if (flagAlwaysSigned) {
+ if (currArg < 0) {
+ prefix = '-' + prefix;
+ } else {
+ prefix = '+' + prefix;
+ }
}
// Add padding.
@@ -2815,6 +2826,7 @@ LibraryManager.library = {
}
},
fseeko: 'fseek',
+ fseeko64: 'fseek',
fsetpos__deps: ['$FS', 'lseek', '__setErrNo', '$ERRNO_CODES'],
fsetpos: function(stream, pos) {
// int fsetpos(FILE *stream, const fpos_t *pos);
@@ -2853,6 +2865,7 @@ LibraryManager.library = {
}
},
ftello: 'ftell',
+ ftello64: 'ftell',
fwrite__deps: ['$FS', 'write'],
fwrite: function(ptr, size, nitems, stream) {
// size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
@@ -3078,6 +3091,7 @@ LibraryManager.library = {
vscanf: 'scanf',
vfscanf: 'fscanf',
vsscanf: 'sscanf',
+ fopen64: 'fopen',
__01fopen64_: 'fopen',
__01freopen64_: 'freopen',
__01fseeko64_: 'fseek',
@@ -4131,6 +4145,13 @@ LibraryManager.library = {
return ret;
},
+ llvm_expect_i32: function(x, y) {
+ return x == y; // TODO: inline this
+ },
+
+ llvm_lifetime_start: function() {},
+ llvm_lifetime_end: function() {},
+
// ==========================================================================
// iostream.h
// ==========================================================================
@@ -5294,6 +5315,9 @@ LibraryManager.library = {
pthread_mutex_init: function() {},
pthread_mutex_destroy: function() {},
+ pthread_mutexattr_init: function() {},
+ pthread_mutexattr_settype: function() {},
+ pthread_mutexattr_destroy: function() {},
pthread_mutex_lock: function() {},
pthread_mutex_unlock: function() {},
pthread_cond_broadcast: function() {},