Function nc::call::futimesat

source ·
pub unsafe fn futimesat<P: AsRef<Path>>(
    dirfd: i32,
    filename: P,
    times: &[timeval_t; 2]
) -> Result<(), Errno>
Expand description

Change timestamp of a file relative to a directory file discriptor.

§Example

let path = "/tmp/nc-futimesat";
let fd = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_WRONLY | nc::O_CREAT, 0o644) };
assert!(fd.is_ok());
let fd = fd.unwrap();
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());
let times = [
    nc::timeval_t {
        tv_sec: 100,
        tv_usec: 0,
    },
    nc::timeval_t {
        tv_sec: 10,
        tv_usec: 0,
    },
];
let ret = unsafe { nc::futimesat(nc::AT_FDCWD, path, &times) };
assert!(ret.is_ok());
let ret = unsafe { nc::unlinkat(nc::AT_FDCWD, path, 0) };
assert!(ret.is_ok());