Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ unlink(2) — SunOS 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

link(2)

rmdir(2)

UNLINK(2)  —  SYSTEM CALLS

NAME

unlink − remove directory entry

SYNOPSIS

int unlink(path)
char ∗path;

DESCRIPTION

unlink() removes the directory entry named by the path name pointed to by path. If this entry was the last link to the file, and no process has the file open, then all resources associated with the file are reclaimed. If, however, the file was open in any process, the actual resource reclamation is delayed until it is closed, even though the directory entry has disappeared.

RETURN VALUE

Upon successful completion, a value of 0 is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

ERRORS

The unlink() succeeds unless:

ENOTDIR A component of the path prefix of path is not a directory. 

ENAMETOOLONG The length of a component of path exceeds 255 characters, or the length of path exceeds 1023 characters. 

ENOENT The file referred to by path does not exist. 

EINVAL The file referred to by path is the current directory, ‘.’. 

EACCES Search permission is denied for a component of the path prefix of path.

EACCES Write permission is denied for the directory containing the link to be removed. 

ELOOP Too many symbolic links were encountered in translating path.

EPERM The file referred to by path is a directory and the effective user ID of the process is not the super-user. 

EBUSY The entry to be unlinked is the mount point for a mounted file system. 

EIO An I/O error occurred while reading from or writing to the file system. 

EROFS The file referred to by path resides on a read-only file system. 

EFAULT path points outside the process’s allocated address space. 

SEE ALSO

close(2), link(2), rmdir(2)

Sun Release 4.0  —  Last change: 22 November 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026