Mono Class Library: Mono.Unix.Native.Syscall Overview | MembersMono.Unix.Native.Syscall.link Method |
Create a hard link from oldpath to newpath. [Edit]
|
On success, zero is returned. On error, -1 is returned and Stdlib.GetLastError returns the translated error.
Usage
The link() system call will fail and no link will be created if:
[Edit]
Error Details Errno.ENOTDIR A component of either path prefix is not a directory.
Errno.ENAMETOOLONG A component of either pathname exceeded 255 characters, or entire length of either path name exceeded 1023 characters.
Errno.ENOENT A component of either path prefix does not exist.
Errno.EOPNOTSUPP The file system containing the file named by name1 does not support links.
Errno.EMLINK The link count of the file named by name1 would exceed 32767.
Errno.EACCES A component of either path prefix denies search permission.
Errno.EACCES The requested link requires writing in a directory with a mode that denies write permission.
Errno.ELOOP Too many symbolic links were encountered in translating one of the pathnames.
Errno.ENOENT The file named by name1 does not exist.
Errno.EEXIST The link named by name2 does exist.
Errno.EPERM The file named by name1 is a directory or is flagged immutable or append-only (see Syscall.chflags(2) ) .
Errno.EXDEV The link named by name2 and the file named by name1 are on different file systems.
Errno.ENOSPC The directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory.
Errno.EDQUOT The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted.
Errno.EIO An I/O error occurred while reading from or writing to the file system to make the directory entry.
Errno.EROFS The requested link requires writing in a directory on a read-only file system.
Errno.EFAULT One of the pathnames specified is outside the process's allocated address space.
The link() system call atomically creates the specified directory entry (hard link) name2 with the attributes of the underlying object pointed at by name1 . If the link is successful: the link count of the underlying object is incremented; name1 and name2 share equal access and rights to the underlying object.
If name1 is removed, the file name2 is not deleted and the link count of the underlying object is decremented.
The object pointed at by the name1 argument must exist for the hard link to succeed and both name1 and name2 must be in the same file system. The name1 argument may not be a directory.
[Edit]
Namespace: Mono.Unix.Native
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0