Permalink
Browse files

Added some libc I/O stubs to get Python module importing to work:

  * fdopen: no-op.
  * __01lseek64_: linked tp fseek.
  * __01open64_: calls open() with swapped args.
  * unlink: no-op.
  * __01fstat64_: linked to fstat.
Added myself to AUTHORS.
  • Loading branch information...
1 parent b8d7596 commit 9d0ea81c35d7194d3a36c9ed4012b073d8b33ea5 @max99x committed Jun 24, 2011
Showing with 20 additions and 2 deletions.
  1. +1 −1 AUTHORS
  2. +19 −1 src/library.js
View
@@ -3,4 +3,4 @@ under the licensing terms detailed in LICENSE.
* Alon Zakai <alonzakai@gmail.com> (copyright owned by Mozilla Foundation)
* Tim Dawborn <tim.dawborn@gmail.com>
-
+* Max Shawabkeh <max99x@gmail.com>
View
@@ -368,6 +368,11 @@ var Library = {
},
__01fopen64_: 'fopen',
+ fdopen: function(descriptor, mode) {
+ // TODO: Check whether mode is acceptable for the current stream.
+ return descriptor;
+ },
+
rewind__deps: ['$STDIO'],
rewind: function(stream) {
var info = STDIO.streams[stream];
@@ -388,6 +393,7 @@ var Library = {
return 0;
},
__01fseeko64_: 'fseek',
+ __01lseek64_: 'fseek',
ftell__deps: ['$STDIO'],
ftell: function(stream) {
@@ -511,6 +517,13 @@ var Library = {
}
},
+ __01open64___deps: ['open'],
+ __01open64_: function(filename, mode, flags) {
+ // open(), but with flags and mode switched.
+ // TODO: Verify why this happens at all.
+ return _open(filename, flags, mode);
+ },
+
close: function(stream) {
return 0;
},
@@ -1211,6 +1224,11 @@ var Library = {
return 0; // NULL
},
+ unlink: function(filename) {
+ // TODO: Actually implement.
+ return 0;
+ },
+
// time.h
time: function(ptr) {
@@ -1259,7 +1277,7 @@ var Library = {
// stat.h
__01stat64_: function() { return -1 },
- __01fstat64_: function() { return -1 },
+ __01fstat64_: 'fstat',
// locale.h

0 comments on commit 9d0ea81

Please sign in to comment.