Skip to content

Commit b1d5a90

Browse files
committed
Implement file metadata, read, and write APIs.
This also improves how HANDLEs are, well, handled a bit. STDIN/ERR/OUT are now proper pseudo-handles. The invalid handle is added and encode/decodes to exactly 0xFFFFFFFF correctly. Unix shims require changes to hoist FdTable up, so that Windows can share most of its implementation.
1 parent 3018386 commit b1d5a90

File tree

16 files changed

+1420
-650
lines changed

16 files changed

+1420
-650
lines changed

Diff for: src/shims/files.rs

+420
Large diffs are not rendered by default.

Diff for: src/shims/io_error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const WINDOWS_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = {
8787
("ERROR_ACCESS_DENIED", PermissionDenied),
8888
("ERROR_FILE_NOT_FOUND", NotFound),
8989
("ERROR_INVALID_PARAMETER", InvalidInput),
90+
("ERROR_FILE_EXISTS", AlreadyExists),
9091
]
9192
};
9293

Diff for: src/shims/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod unix;
88
mod wasi;
99
mod windows;
1010
mod x86;
11+
mod files;
1112

1213
pub mod env;
1314
pub mod extern_static;
@@ -18,7 +19,8 @@ pub mod panic;
1819
pub mod time;
1920
pub mod tls;
2021

21-
pub use self::unix::{DirTable, EpollInterestTable, FdTable};
22+
pub use self::unix::{DirTable, EpollInterestTable};
23+
pub use self::files::FdTable;
2224

2325
/// What needs to be done after emulating an item (a shim or an intrinsic) is done.
2426
pub enum EmulateItemResult {

0 commit comments

Comments
 (0)