|
|
HP-UX Reference > Uunlink(2)HP-UX 11i Version 2: December 2007 Update |
|
NAMEunlink() — remove directory entry; delete file DESCRIPTIONThe unlink() system call removes the directory entry named by the path name pointed to by path. 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, only the directory entry is removed immediately so that processes that do not already have the file open cannot access the file. After all processes close their references to the file, if there are no more links to the file, the space occupied by the file is then freed and the file ceases to exist. RETURN VALUEunlink() returns the following values:
ERRORSIf unlink() fails, errno is set to one of the following values:
WARNINGSIf unlink() is used on a directory that is not empty (contains files other than . and ..), the directory is unlinked, the files become orphans, and the directory link count is left with an inaccurate value unless they are linked by some other directory. If unlink() is used on a directory that is empty (contains only the files . and ..), the directory is unlinked, but the parent directory's link count is left with an inaccurate value. In either of the above cases, the file system should be checked using fsck (see fsck(1M)). To avoid these types of problems, use rmdir() instead (see rmdir(2)). |
|