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.
| 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. |
| 569 | int 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. |
| 576 | int __syscall_openat(int dirfd, const char* path, int flags, ...) { |