openat

Function openat 

Source
pub fn openat(fd: RawFd, path: CString, flags: i32) -> OperationProgress<OpenAt> 
Expand description

Opens a file relative to a directory file descriptor.

§Returns

This function returns OperationProgress<OpenAt>. This function signature is equivalent to:

async fn openat(RawFd, CString, i32) -> std::io::Result<i32>

§Behavior

As soon as this function is called, the operation is submitted into the io-driver used by the current platform (for example io-uring). If the user then chooses to drop OperationProgress before the Future is ready, the operation will NOT tried be cancelled, but instead “detached”.

See more what methods are available to the return type.

§Examples

use std::ffi::CString;

async fn openat_example() -> std::io::Result<()> {
    let path = CString::new("/tmp/test.txt").unwrap();
    let fd = lio::openat(libc::AT_FDCWD, path, libc::O_RDONLY).await?;
    println!("Opened file with fd: {}", fd);
    Ok(())
}