| 1564 | } |
| 1565 | |
| 1566 | static int |
| 1567 | doStatFS(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 | |
| 1590 | int __syscall_statfs64(const char* path, size_t size, struct statfs* buf) { |
| 1591 | auto parsed = path::parseFile(path); |
no test coverage detected