link(3)

DESCRIPTION

Adds a second tmpfs directory entry for an existing regular file. linkat accepts only flags equal to zero.

SYNOPSIS

#include <unistd.h>

int link(const char *old_path, const char *new_path);
int linkat(int olddirfd, const char *old_path, int newdirfd, const char *new_path, int flags);

RETURN VALUE

  • Returns zero, or -1 and sets errno.

ERRORS

  • -EFAULT
    • A pathname is invalid or inaccessible.
  • -EEXIST
    • New_path already exists.
  • -ENOENT
    • A pathname or parent directory does not exist.
  • -EPERM
    • The source is a directory or the filesystem does not support hard links.
  • -EXDEV
    • The paths name different mounts.

NOTES

Astia hard links share the inode, open file object, data, and link count. The source final symlink is followed; the destination is never replaced. The operation is native tmpfs-only and does not access a host filesystem.