MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / doStatFS

Function doStatFS

system/lib/wasmfs/syscalls.cpp:1566–1588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1564}
1565
1566static int
1567doStatFS(std::shared_ptr<File>& file, size_t size, struct statfs* buf) {
1568 if (size != sizeof(struct statfs)) {
1569 // We only know how to write to a standard statfs, not even a truncated one.
1570 return -EINVAL;
1571 }
1572
1573 // NOTE: None of the constants here are true. We're just returning safe and
1574 // sane values, that match the long-existing JS FS behavior (except for
1575 // the inode number, where we can do better).
1576 buf->f_type = 0;
1577 buf->f_bsize = 4096;
1578 buf->f_frsize = 4096;
1579 buf->f_blocks = 1000000;
1580 buf->f_bfree = 500000;
1581 buf->f_bavail = 500000;
1582 buf->f_files = file->getIno();
1583 buf->f_ffree = 1000000;
1584 buf->f_fsid = {0, 0};
1585 buf->f_flags = ST_NOSUID;
1586 buf->f_namelen = 255;
1587 return 0;
1588}
1589
1590int __syscall_statfs64(const char* path, size_t size, struct statfs* buf) {
1591 auto parsed = path::parseFile(path);

Callers 2

__syscall_statfs64Function · 0.85
__syscall_fstatfs64Function · 0.85

Calls 1

getInoMethod · 0.80

Tested by

no test coverage detected