Function nix::unistd::linkat

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

Link one file to another file

Creates a new hard 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, use AT_FDCWD if you want to make it relative to the current working directory. Similarly for newpath and file descriptor newdirfd. If either oldpath or newpath is absolute, then dirfd is ignored.

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.

§References

See also linkat(2)