(dir_fd: wasip1::Fd, filename: &str)
| 41 | } |
| 42 | |
| 43 | pub unsafe fn create_file(dir_fd: wasip1::Fd, filename: &str) { |
| 44 | unsafe { |
| 45 | let file_fd = wasip1::path_open(dir_fd, 0, filename, wasip1::OFLAGS_CREAT, 0, 0, 0) |
| 46 | .expect("creating a file"); |
| 47 | assert!(file_fd > STDERR_FD, "file descriptor range check",); |
| 48 | wasip1::fd_close(file_fd).expect("closing a file"); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Small workaround to get the crate's macros, through the |
| 53 | // `#[macro_export]` attribute below, also available from this module. |