MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / create_file

Function create_file

crates/test-programs/src/preview1.rs:43–50  ·  view source on GitHub ↗
(dir_fd: wasip1::Fd, filename: &str)

Source from the content-addressed store, hash-verified

41}
42
43pub 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.

Callers 12

test_path_open_lotsFunction · 0.50
test_interesting_pathsFunction · 0.50
test_path_linkFunction · 0.50
test_readlinkFunction · 0.50
test_path_renameFunction · 0.50
test_remove_directoryFunction · 0.50
test_path_existsFunction · 0.50

Calls 3

path_openFunction · 0.85
fd_closeFunction · 0.85
expectMethod · 0.45

Tested by 12

test_path_open_lotsFunction · 0.40
test_interesting_pathsFunction · 0.40
test_path_linkFunction · 0.40
test_readlinkFunction · 0.40
test_path_renameFunction · 0.40
test_remove_directoryFunction · 0.40
test_path_existsFunction · 0.40