Index wasi args_get args_sizes_get clock_res_get clock_time_get environ_get environ_sizes_get fd_advise fd_allocate fd_close fd_datasync fd_fdstat_get fd_fdstat_set_flags fd_fdstat_set_rights fd_filestat_get fd_filestat_set_size fd_filestat_set_times fd_pread fd_prestat_dir_name fd_prestat_get fd_pwrite fd_read fd_readdir fd_renumber fd_seek fd_sync fd_tell fd_write file_stat_flags filestat iovec lookup_flags path_create_directory path_filestat_get path_filestat_set_times path_link path_open path_readlink path_remove_directory path_rename path_symlink path_unlink_file poll_oneoff proc_exit proc_raise random_get sched_yield sock_accept sock_recv sock_send sock_shutdown
Get the directory name associated with a preopened file descriptor
fd_prestat_dir_name (
fd: i32The preopened file descriptor to queryfd: pathA pointer to a buffer where the directory name will be writtenfd: path_lenThe maximum length of the buffer
) =>
error: i32 

The fd_prestat_dir_name() function is used to retrieve the directory name associated with a preopened file descriptor (fd). It retrieves the directory name from the file system and writes it into the provided buffer (path) up to the specified length (path_len). The function returns an error code indicating the success or failure of the operation.

When working with preopened file descriptors, which represent files opened by the WebAssembly module's host environment, it can be useful to obtain information about the directory from which the file was opened. The fd_prestat_dir_name() function provides a convenient way to retrieve the directory name associated with a preopened file descriptor.

Note

The fd_prestat_dir_name() function retrieves the directory name associated with a preopened file descriptor. It writes the directory name into the provided buffer (path) up to the specified length (path_len). The function returns an error code to indicate the success or failure of the operation. If the directory name is successfully written into the buffer, it returns Errno::Success. Otherwise, it returns an appropriate error code.

Read More