UNLINK(2) — HP-UX
NAME
unlink − remove directory entry; delete file
SYNOPSIS
int unlink (path)
char ∗path;
DESCRIPTION
Unlink removes the directory entry named by the path name pointed to by path.
ERRORS
The named file is unlinked unless one or more of the following are true:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] The named file does not exist (for example, path is null or a component of path does not exist).
[EACCES] Search permission is denied for a component of the path prefix.
[EACCES] Write permission is denied on the directory containing the link to be removed.
[EPERM] The named file is a directory and the effective user ID of the process is not super-user.
[EBUSY] The entry to be unlinked is the mount point for a mounted file system.
[ETXTBSY] The entry to be unlinked is the last link to a pure procedure (shared text) file that is being executed.
[EROFS] The directory entry to be unlinked is part of a read-only file system.
[EFAULT] Path points outside the process’s allocated address space. The reliable detection of this error will be implementation dependent.
[ENAMETOOLONG] The named file exceeds MAXPATHLEN characters.
When all links to a file have been removed and no process has the file open, the space occupied by the file is freed and the file ceases to exist. If one or more processes have the file open when the last link is removed, the removal is postponed until all references to the file have been closed.
HARDWARE DEPENDENCIES
Series 500
The last link to a directory cannot be unlinked if the directory is not empty.
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.
SEE ALSO
rm(1), close(2), link(2), open(2).
Hewlett-Packard Company — Version B.1, May 11, 2021