| 39 | } |
| 40 | |
| 41 | void FdTable::release(i32_t fd) { |
| 42 | auto it = table_.find(fd); |
| 43 | if(it == table_.end()) return; |
| 44 | FdEntry& e = it->second; |
| 45 | if(!e.is_dir && e.os_fd >= 3) { |
| 46 | // Never close the host's own stdin/stdout/stderr. |
| 47 | WasmVM::sysenv_compat::sys_close(e.os_fd); |
| 48 | } |
| 49 | // Directory iterator handles release automatically via shared_ptr. |
| 50 | table_.erase(it); |
| 51 | } |
| 52 | |
| 53 | // ---- Linear-memory helpers -------------------------------------------------- |
| 54 | // |
no test coverage detected