diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2013-09-06 16:18:01 +0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 10:07:03 -0700 |
commit | 595d7eeae698d985ea2da9d3b98d27af9e035f6c (patch) | |
tree | bc6557125f58c9a585eb907764224baab6182b7d | |
parent | b9c8b95795849264c58be7d1496da3c4078df96c (diff) |
Change various 64 bit typedefs over to 32 bit.
This also removes all of the changes that were needed for those
typedefs to be 64 bit.
-rw-r--r-- | src/library.js | 85 | ||||
-rw-r--r-- | system/include/libc/bits/alltypes.h | 12 | ||||
-rw-r--r-- | system/include/libc/sys/resource.h | 2 | ||||
-rw-r--r-- | tests/zlib/ref.txt | 2 |
4 files changed, 44 insertions, 57 deletions
diff --git a/src/library.js b/src/library.js index af0e8c97..6f731dbf 100644 --- a/src/library.js +++ b/src/library.js @@ -29,8 +29,8 @@ LibraryManager.library = { // ========================================================================== __dirent_struct_layout: Runtime.generateStructInfo([ - ['i64', 'd_ino'], - ['i64', 'd_off'], + ['i32', 'd_ino'], + ['i32', 'd_off'], ['i16', 'd_reclen'], ['i8', 'd_type'], ['b256', 'd_name']]), @@ -82,7 +82,7 @@ LibraryManager.library = { seekdir: function(dirp, loc) { // void seekdir(DIR *dirp, long int loc); // http://pubs.opengroup.org/onlinepubs/007908799/xsh/seekdir.html - _lseek(dirp, loc, 0, {{{ cDefine('SEEK_SET') }}}); + _lseek(dirp, loc, {{{ cDefine('SEEK_SET') }}}); }, rewinddir__deps: ['seekdir'], rewinddir: function(dirp) { @@ -254,27 +254,25 @@ LibraryManager.library = { // ========================================================================== __stat_struct_layout: Runtime.generateStructInfo([ - ['i64', 'st_dev'], + ['i32', 'st_dev'], ['i32', '__st_dev_padding'], ['i32', '__st_ino_truncated'], ['i32', 'st_mode'], ['i32', 'st_nlink'], ['i32', 'st_uid'], ['i32', 'st_gid'], - ['i64', 'st_rdev'], + ['i32', 'st_rdev'], ['i32', '__st_rdev_padding'], - ['i32', '__st_rdev_padding2'], - ['i64', 'st_size'], + ['i32', 'st_size'], ['i32', 'st_blksize'], - ['i32', '__st_blksize_padding'], - ['i64', 'st_blocks'], + ['i32', 'st_blocks'], ['i32', 'st_atim_secs'], ['i32', 'st_atim_nsecs'], ['i32', 'st_mtim_secs'], ['i32', 'st_mtim_nsecs'], ['i32', 'st_ctim_secs'], ['i32', 'st_ctim_nsecs'], - ['i64', 'st_ino']]), + ['i32', 'st_ino']]), stat__deps: ['$FS', '__stat_struct_layout'], stat: function(path, buf, dontResolveLastLink) { // http://pubs.opengroup.org/onlinepubs/7908799/xsh/stat.html @@ -293,10 +291,8 @@ LibraryManager.library = { {{{ makeSetValue('buf', '___stat_struct_layout.st_gid', 'stat.gid', 'i32') }}} {{{ makeSetValue('buf', '___stat_struct_layout.st_rdev', 'stat.rdev', 'i32') }}} {{{ makeSetValue('buf', '___stat_struct_layout.__st_rdev_padding', '0', 'i32') }}}; - {{{ makeSetValue('buf', '___stat_struct_layout.__st_rdev_padding2', '0', 'i32') }}}; {{{ makeSetValue('buf', '___stat_struct_layout.st_size', 'stat.size', 'i32') }}} {{{ makeSetValue('buf', '___stat_struct_layout.st_blksize', '4096', 'i32') }}} - {{{ makeSetValue('buf', '___stat_struct_layout.__st_blksize_padding', '0', 'i32') }}} {{{ makeSetValue('buf', '___stat_struct_layout.st_blocks', 'stat.blocks', 'i32') }}} {{{ makeSetValue('buf', '___stat_struct_layout.st_atim_secs', 'Math.floor(stat.atime.getTime() / 1000)', 'i32') }}} {{{ makeSetValue('buf', '___stat_struct_layout.st_atim_nsecs', '0', 'i32') }}} @@ -329,7 +325,7 @@ LibraryManager.library = { return _stat(stream.path, buf); }, mknod__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - mknod: function(path, mode, dev_lo, dev_hi) { + mknod: function(path, mode, dev) { // int mknod(const char *path, mode_t mode, dev_t dev); // http://pubs.opengroup.org/onlinepubs/7908799/xsh/mknod.html path = Pointer_stringify(path); @@ -347,7 +343,7 @@ LibraryManager.library = { return -1; } try { - FS.mknod(path, mode, dev_lo); + FS.mknod(path, mode, dev); return 0; } catch (e) { FS.handleFSError(e); @@ -443,12 +439,12 @@ LibraryManager.library = { __statvfs_struct_layout: Runtime.generateStructInfo([ ['i32', 'f_bsize'], ['i32', 'f_frsize'], - ['i64', 'f_blocks'], - ['i64', 'f_bfree'], - ['i64', 'f_bavail'], - ['i64', 'f_files'], - ['i64', 'f_ffree'], - ['i64', 'f_favail'], + ['i32', 'f_blocks'], + ['i32', 'f_bfree'], + ['i32', 'f_bavail'], + ['i32', 'f_files'], + ['i32', 'f_ffree'], + ['i32', 'f_favail'], ['i32', 'f_fsid'], ['i32', '__padding'], ['i32', 'f_flag'], @@ -497,8 +493,7 @@ LibraryManager.library = { ['i16', 'l_whence'], ['i32', 'l_start'], ['i32', 'l_len'], - ['i16', 'l_pid'], - ['i16', 'l_xxx']]), + ['i16', 'l_pid']]), open__deps: ['$FS', '__setErrNo', '$ERRNO_CODES', '__dirent_struct_layout'], open: function(path, oflag, varargs) { // int open(const char *path, int oflag, ...); @@ -586,7 +581,7 @@ LibraryManager.library = { // Should never be reached. Only to silence strict warnings. return -1; }, - posix_fadvise: function(fd, offset_lo, offset_hi, len_lo, len_hi, advice) { + posix_fadvise: function(fd, offset, len, advice) { // int posix_fadvise(int fd, off_t offset, off_t len, int advice); // http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html // Advise as much as you wish. We don't care. @@ -594,7 +589,7 @@ LibraryManager.library = { }, posix_madvise: 'posix_fadvise', posix_fallocate__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - posix_fallocate: function(fd, offset_lo, offset_hi, len_lo, len_hi) { + posix_fallocate: function(fd, offset, len) { // int posix_fallocate(int fd, off_t offset, off_t len); // http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_fallocate.html var stream = FS.getStream(fd); @@ -603,7 +598,7 @@ LibraryManager.library = { return -1; } try { - FS.allocate(stream, offset_lo, len_lo); + FS.allocate(stream, offset, len); return 0; } catch (e) { FS.handleFSError(e); @@ -882,13 +877,13 @@ LibraryManager.library = { }, fdatasync: 'fsync', truncate__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - truncate: function(path, length_lo, length_hi) { + truncate: function(path, length) { // int truncate(const char *path, off_t length); // http://pubs.opengroup.org/onlinepubs/000095399/functions/truncate.html // NOTE: The path argument may be a string, to simplify ftruncate(). if (typeof path !== 'string') path = Pointer_stringify(path); try { - FS.truncate(path, length_lo); + FS.truncate(path, length); return 0; } catch (e) { FS.handleFSError(e); @@ -896,11 +891,11 @@ LibraryManager.library = { } }, ftruncate__deps: ['$FS', '__setErrNo', '$ERRNO_CODES', 'truncate'], - ftruncate: function(fildes, length_lo, length_hi) { + ftruncate: function(fildes, length) { // int ftruncate(int fildes, off_t length); // http://pubs.opengroup.org/onlinepubs/000095399/functions/ftruncate.html try { - FS.ftruncate(fildes, length_lo); + FS.ftruncate(fildes, length); return 0; } catch (e) { FS.handleFSError(e); @@ -962,7 +957,7 @@ LibraryManager.library = { return -1; }, lockf__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - lockf: function(fildes, func, size_lo, size_hi) { + lockf: function(fildes, func, size) { // int lockf(int fildes, int function, off_t size); // http://pubs.opengroup.org/onlinepubs/000095399/functions/lockf.html var stream = FS.getStream(fildes); @@ -976,17 +971,16 @@ LibraryManager.library = { } }, lseek__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - lseek: function(fildes, offset_lo, offset_hi, whence) { + lseek: function(fildes, offset, whence) { // off_t lseek(int fildes, off_t offset, int whence); // http://pubs.opengroup.org/onlinepubs/000095399/functions/lseek.html var stream = FS.getStream(fildes); - tempRet0 = 0; if (!stream) { ___setErrNo(ERRNO_CODES.EBADF); return -1; } try { - return FS.llseek(stream, offset_lo, whence); + return FS.llseek(stream, offset, whence); } catch (e) { FS.handleFSError(e); return -1; @@ -1002,7 +996,7 @@ LibraryManager.library = { return -1; }, pread__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - pread: function(fildes, buf, nbyte, offset_lo, offset_hi) { + pread: function(fildes, buf, nbyte, offset) { // ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset); // http://pubs.opengroup.org/onlinepubs/000095399/functions/read.html var stream = FS.getStream(fildes); @@ -1017,7 +1011,7 @@ LibraryManager.library = { SAFE_HEAP_FILL_HISTORY(buf, buf+nbyte, 'i8'); // VFS does not use makeSetValues, so we need to do it manually #endif #endif - return FS.read(stream, slab, buf, nbyte, offset_lo); + return FS.read(stream, slab, buf, nbyte, offset); } catch (e) { FS.handleFSError(e); return -1; @@ -1137,7 +1131,7 @@ LibraryManager.library = { return str.length; }, pwrite__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - pwrite: function(fildes, buf, nbyte, offset_lo, offset_hi) { + pwrite: function(fildes, buf, nbyte, offset) { // ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset); // http://pubs.opengroup.org/onlinepubs/000095399/functions/write.html var stream = FS.getStream(fildes); @@ -1152,7 +1146,7 @@ LibraryManager.library = { SAFE_HEAP_FILL_HISTORY(buf, buf+nbyte, 'i8'); // VFS does not use makeSetValues, so we need to do it manually #endif #endif - return FS.write(stream, slab, buf, nbyte, offset_lo); + return FS.write(stream, slab, buf, nbyte, offset); } catch (e) { FS.handleFSError(e); return -1; @@ -2555,7 +2549,7 @@ LibraryManager.library = { fseek: function(stream, offset, whence) { // int fseek(FILE *stream, long offset, int whence); // http://pubs.opengroup.org/onlinepubs/000095399/functions/fseek.html - var ret = _lseek(stream, offset, 0, whence); + var ret = _lseek(stream, offset, whence); if (ret == -1) { return -1; } @@ -2563,8 +2557,8 @@ LibraryManager.library = { stream.eof = false; return 0; }, - fseeko: 'lseek', - fseeko64: 'lseek', + fseeko: 'fseek', + fseeko64: 'fseek', fsetpos__deps: ['$FS', 'lseek', '__setErrNo', '$ERRNO_CODES'], fsetpos: function(stream, pos) { // int fsetpos(FILE *stream, const fpos_t *pos); @@ -2600,15 +2594,8 @@ LibraryManager.library = { return stream.position; } }, - ftello__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], - ftello: function(stream) { - // off_t ftello(FILE *stream); - // http://pubs.opengroup.org/onlinepubs/000095399/functions/ftello.html - var result = ftell(stream); - tempRet0 = result << 32; - return 0; - }, - ftello64: 'ftello', + 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); diff --git a/system/include/libc/bits/alltypes.h b/system/include/libc/bits/alltypes.h index e7f3bdc7..c4eb1f84 100644 --- a/system/include/libc/bits/alltypes.h +++ b/system/include/libc/bits/alltypes.h @@ -210,17 +210,17 @@ typedef unsigned _Reg nlink_t; #endif #if defined(__NEED_off_t) && !defined(__DEFINED_off_t) -typedef _Int64 off_t; +typedef int off_t; #define __DEFINED_off_t #endif #if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t) -typedef unsigned _Int64 ino_t; +typedef unsigned int ino_t; #define __DEFINED_ino_t #endif #if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t) -typedef unsigned _Int64 dev_t; +typedef unsigned int dev_t; #define __DEFINED_dev_t #endif @@ -230,17 +230,17 @@ typedef long blksize_t; #endif #if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t) -typedef _Int64 blkcnt_t; +typedef int blkcnt_t; #define __DEFINED_blkcnt_t #endif #if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t) -typedef unsigned _Int64 fsblkcnt_t; +typedef unsigned int fsblkcnt_t; #define __DEFINED_fsblkcnt_t #endif #if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t) -typedef unsigned _Int64 fsfilcnt_t; +typedef unsigned int fsfilcnt_t; #define __DEFINED_fsfilcnt_t #endif diff --git a/system/include/libc/sys/resource.h b/system/include/libc/sys/resource.h index 0cfbcf44..22ff2f3b 100644 --- a/system/include/libc/sys/resource.h +++ b/system/include/libc/sys/resource.h @@ -16,7 +16,7 @@ extern "C" { #include <bits/alltypes.h> -typedef unsigned long long rlim_t; +typedef unsigned long rlim_t; struct rlimit { diff --git a/tests/zlib/ref.txt b/tests/zlib/ref.txt index bdbc4c1f..7211459e 100644 --- a/tests/zlib/ref.txt +++ b/tests/zlib/ref.txt @@ -1,4 +1,4 @@ -zlib version 1.2.5 = 4688, compile flags = 149 +zlib version 1.2.5 = 4688, compile flags = 85 uncompress(): hello, hello! inflate(): hello, hello! large_inflate(): OK |