int unlink(path) char *path;
unlink() removes the directory entry named by the pathname pointed to by path and decrements the link count of the file referred to by that entry. 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.
If path refers to a directory, the effective user-ID of the calling process must be super-user.
Upon successful completion, unlink() marks for update the st_ctime and st_mtime fields of the parent directory. Also, if the file's link count is not zero, the st_ctime field of the file is marked for update.
unlink() returns:
Write permission is denied for the directory containing the link to be removed.
A pathname component is longer than {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v
In addition to the above, the following may also occur:
Applications should use rmdir.2v to remove directories. Although root may use unlink() on directories, all users may use rmdir().
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97