MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / wasmfs_create_file

Function wasmfs_create_file

system/lib/wasmfs/syscalls.cpp:569–573  ·  view source on GitHub ↗

This function is exposed to users and allows users to create a file in a specific backend. An fd to an open file is returned.

Source from the content-addressed store, hash-verified

567// This function is exposed to users and allows users to create a file in a
568// specific backend. An fd to an open file is returned.
569int wasmfs_create_file(const char* pathname, mode_t mode, backend_t backend) {
570 static_assert(std::is_same_v<decltype(doOpen(0, 0, 0, 0)), unsigned int>,
571 "unexpected conversion from result of doOpen to int");
572 return doOpen(path::parseParent(pathname), O_CREAT | O_EXCL, mode, backend);
573}
574
575// TODO: Test this with non-AT_FDCWD values.
576int __syscall_openat(int dirfd, const char* path, int flags, ...) {

Callers 10

mainFunction · 0.85
test_url_relativeFunction · 0.85
test_url_absoluteFunction · 0.85
test_directory_absFunction · 0.85
test_defaultFunction · 0.85
test_small_readsFunction · 0.85
test_small_chunksFunction · 0.85
test_nonexistentFunction · 0.85
test_big_chunksFunction · 0.85

Calls 2

doOpenFunction · 0.85
parseParentFunction · 0.85

Tested by 9

test_url_relativeFunction · 0.68
test_url_absoluteFunction · 0.68
test_directory_absFunction · 0.68
test_defaultFunction · 0.68
test_small_readsFunction · 0.68
test_small_chunksFunction · 0.68
test_nonexistentFunction · 0.68
test_big_chunksFunction · 0.68