From bd289655cb8f258561c7cd6dd2b6bbdebdd91f7b Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 11 Aug 2021 14:26:45 -0400 Subject: [PATCH] Add missing dependency __sys_fstatfs64 Fixes: #14602 --- src/library_syscall.js | 1 + tests/test_core.py | 3 +++ tests/unistd/fstatfs.c | 12 ++++++++++++ tests/unistd/fstatfs.out | 1 + 4 files changed, 17 insertions(+) create mode 100644 tests/unistd/fstatfs.c create mode 100644 tests/unistd/fstatfs.out diff --git a/src/library_syscall.js b/src/library_syscall.js index e9eb9134ba056..9197ff2c1252c 100644 --- a/src/library_syscall.js +++ b/src/library_syscall.js @@ -1173,6 +1173,7 @@ var SyscallsLibrary = { {{{ makeSetValue('buf', C_STRUCTS.statfs.f_namelen, '255', 'i32') }}}; return 0; }, + __sys_fstatfs64__deps: ['__sys_statfs64'], __sys_fstatfs64: function(fd, size, buf) { var stream = SYSCALLS.getStreamFromFD(fd); return ___sys_statfs64(0, size, buf); diff --git a/tests/test_core.py b/tests/test_core.py index 2f358761d83ab..b186adf5ae9eb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5476,6 +5476,9 @@ def test_unistd_misc(self): self.emcc_args += ['-lnodefs.js'] self.do_run_in_out_file_test('unistd/misc.c', js_engines=[config.NODE_JS], interleaved_output=False) + def test_unistd_fstatfs(self): + self.do_run_in_out_file_test('unistd/fstatfs.c') + # i64s in the API, which we'd need to legalize for JS, so in standalone mode # all we can test is wasm VMs @also_with_standalone_wasm(wasm2c=True) diff --git a/tests/unistd/fstatfs.c b/tests/unistd/fstatfs.c new file mode 100644 index 0000000000000..6d9cf08d2413b --- /dev/null +++ b/tests/unistd/fstatfs.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +int main() { + struct statfs buf; + int rtn = fstatfs(STDOUT_FILENO, &buf); + assert(rtn == 0); + printf("f_type: %ld\n", buf.f_type); + return 0; +} diff --git a/tests/unistd/fstatfs.out b/tests/unistd/fstatfs.out new file mode 100644 index 0000000000000..e81b29ca00505 --- /dev/null +++ b/tests/unistd/fstatfs.out @@ -0,0 +1 @@ +f_type: 0