sys_symlink  [fs/namei.c]


Creates a symbolic link.

Symbolic links are interpreted at run-time as if the contents of the link had been substituted into the path being followed to find a file or directory.

Arguments

eax 83
ebx Pointer to a null-terminated string specifying the pathname to whom the link will refer.
ecx Pointer to a null-terminated string specifying the pathname of the link. If pathname exists it will not be overwritten.

Symbolic links may contain .. path components, which (if used at the start of the link) refer to the parent directories of that in which the link resides.
A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent one; the latter case is known as a dangling link.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EPERM The filesystem containing newpath does not support the creation of symbolic links.
-EFAULT ebx or ecx points outside your accessible address space.
-EACCES Write access to the directory containing the new path is not allowed for the process's effective uid, or one of the directories in new path did not allow search (execute) permission.
-ENAMETOOLONG Old path or new path was too long.
-ENOENT A directory component in new path does not exist or is a dangling symbolic link, or old path is the empty string.
-ENOTDIR A component used as a directory in new path is not, in fact, a directory.
-ENOMEM Insufficient kernel memory was available.
-EROFS New path is on a read-only filesystem.
-EEXIST New path already exists.
-ELOOP Too many symbolic links were encountered in resolving the new path.
-ENOSPC The device containing the file has no room for the new directory entry.
-EIO An I/O error occurred.

Remarks

The permissions of a symbolic link are irrelevant; the ownership is ignored when following the link, but is checked when removal or renaming of the link is requested and the link is in a directory with the sticky bit (S_ISVTX) set.

Deleting the name referred to by a symlink will actually delete the file (unless it also has other hard links). If this behavior is not desired, use sys_link.

Compatibility

n/a