aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-19 21:55:58 +0300
committermax99x <max99x@gmail.com>2011-07-19 21:55:58 +0300
commit51df7dfe82125f8772b1c998121fbbf6e3cdab80 (patch)
treebba34dcf255c2ab240bb9e6123a8be817bc7dcd1 /src
parent28383aec9e3f762c0ac1ac51acad90c3274aa94f (diff)
Implemented <sys/statvfs.h>.
Diffstat (limited to 'src')
-rw-r--r--src/library.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 226d278d..5ad8dc06 100644
--- a/src/library.js
+++ b/src/library.js
@@ -671,6 +671,43 @@ LibraryManager.library = {
// __01lstat64_: 'stat',
// ==========================================================================
+ // sys/statvfs.h
+ // ==========================================================================
+
+ // TODO: Update this to be auto-created.
+ __statvfs_struct_layout: Runtime.generateStructInfo([
+ 'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail', 'f_files',
+ 'f_ffree', 'f_favail', 'f_fsid', '__f_unused', 'f_flag', 'f_namemax',
+ '__f_spare'
+ ], '%struct.statvfs'
+ ),
+ statvfs__deps: ['$FS', '__statvfs_struct_layout'],
+ statvfs: function(path, buf) {
+ // http://pubs.opengroup.org/onlinepubs/7908799/xsh/stat.html
+ // int statvfs(const char *restrict path, struct statvfs *restrict buf);
+ // NOTE: None of the constant here are true. We're just returning safe and
+ // sane values.
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_bsize', '4096', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_frsize', '4096', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_blocks', '1000000', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_bfree', '500000', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_bavail', '500000', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_files', 'FS.nextInode', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_ffree', '1000000', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_favail', '1000000', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_fsid', '42', 'i32') }}}
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_flag', '2', 'i32') }}} // ST_NOSUID
+ {{{ makeSetValue('buf', '___statvfs_struct_layout.f_namemax', '255', 'i32') }}}
+ return 0;
+ },
+ fstatvfs__deps: ['statvfs'],
+ fstatvfs: function(fildes, buf) {
+ // int fstatvfs(int fildes, struct statvfs *buf);
+ // http://pubs.opengroup.org/onlinepubs/009604499/functions/statvfs.html
+ return _statvfs(0, buf);
+ },
+
+ // ==========================================================================
_scanString: function() {
// Supports %x, %4x, %d.%d, %s