| 1292 | } |
| 1293 | |
| 1294 | int __syscall_ftruncate64(int fd, off_t size) { |
| 1295 | auto openFile = wasmFS.getFileTable().locked().getEntry(fd); |
| 1296 | if (!openFile) { |
| 1297 | return -EBADF; |
| 1298 | } |
| 1299 | auto ret = doTruncate(openFile->locked().getFile(), size); |
| 1300 | // XXX It is not clear from the docs why ftruncate would differ from |
| 1301 | // truncate here. However, on Linux this definitely happens, and the old |
| 1302 | // FS matches that as well, so do the same here. |
| 1303 | if (ret == -EACCES) { |
| 1304 | ret = -EINVAL; |
| 1305 | } |
| 1306 | return ret; |
| 1307 | } |
| 1308 | |
| 1309 | static bool isTTY(std::shared_ptr<File>& file) { |
| 1310 | // TODO: Full TTY support. For now, just see stdin/out/err as terminals and |
no test coverage detected