nix::unistd

Function linkat

source
pub fn linkat<P: ?Sized + NixPath>(
    olddirfd: Option<RawFd>,
    oldpath: &P,
    newdirfd: Option<RawFd>,
    newpath: &P,
    flag: AtFlags,
) -> Result<()>
Expand description

Link one file to another file

Creates a new link (directory entry) at newpath for the existing file at oldpath. In the case of a relative oldpath, the path is interpreted relative to the directory associated with file descriptor olddirfd instead of the current working directory and similiarly for newpath and file descriptor newdirfd. In case flag is AtFlags::AT_SYMLINK_FOLLOW and oldpath names a symoblic link, a new link for the target of the symbolic link is created. If either olddirfd or newdirfd is None, AT_FDCWD is used respectively where oldpath and/or newpath is then interpreted relative to the current working directory of the calling process. If either oldpath or newpath is absolute, then dirfd is ignored.

ยงReferences

See also linkat(2)