Access metadata about a file or directory.
path_filestat_get() function allows accessing metadata (file statistics) for a file or directory specified by a path relative to the given directory. It retrieves information such as the size, timestamps, and file type.
On POSIX systems, a similar functionality is provided by the
lstat() functions, depending on whether symbolic links should be followed or not. These functions retrieve information about a file or symbolic link and store it in a
struct stat object.
;;; Note: This is similar to `stat` in POSIX. ;;; Return the attributes of a file or directory. (@interface func (export "path_filestat_get") (param $fd $fd) ;;; Flags determining the method of how the path is resolved. (param $flags $lookupflags) ;;; The path of the file or directory to inspect. (param $path string) ;;; The buffer where the file's attributes are stored. (result $error (expected $filestat (error $errno))) )
ctx: A mutable reference to the function environment.
fd: The file descriptor representing the directory that the
pathis relative to.
flags: Flags to control how the
path: A wasm pointer to a null-terminated string containing the file path.
path_len: The length of the
buf: A wasm pointer to a
Filestatobject where the metadata will be stored.
The function returns an
Errno value indicating the success or failure of the operation. If the operation is successful, it returns
Errno::Success. Otherwise, it returns an appropriate
This function has been instrumented with trace-level logging. It will log the following information:
%fd: The file descriptor representing the directory.
path: The path string.
path_filestat_get() function allows accessing metadata (file statistics) for a file or directory specified by a path relative to the given directory. It checks if the specified directory has the necessary rights and retrieves the file statistics accordingly. On POSIX systems, a similar functionality is provided by the