Requirements Catalog of LSB Core 3.1

Requirements for the function 'unlink'
StandardIDDescription
SUSv3unlink.05 The unlink() function shall remove a link to a file
SUSv3unlink.06 If path names a symbolic link, unlink() shall remove the symbolic link named by path and shall not affect any file or directory named by the contents of the symbolic link
SUSv3unlink.07 Otherwise, unlink() shall remove the link named by the pathname pointed to by path and shall decrement the link count of the file referenced by the link
SUSv3unlink.08 When the file's link count becomes 0 and no process has the file open, the space occupied by the file shall be freed and the file shall no longer be accessible
SUSv3unlink.09 If one or more processes have the file open when the last link is removed, the link shall be removed before unlink() returns, but the removal of the file contents shall be postponed until all references to the file are closed.
SUSv3unlink.10 The path argument shall not name a directory unless the process has appropriate privileges and the implementation supports using unlink() on directories
SUSv3unlink.11 Upon successful completion, unlink() shall mark for update the st_ctime and st_mtime fields of the parent directory
SUSv3unlink.12 Also, if the file's link count is not 0, the st_ctime field of the file shall be marked for update
SUSv3unlink.13 Upon successful completion, 0 shall be returned
SUSv3unlink.14 Otherwise, -1 shall be returned and errno set to indicate the error
SUSv3unlink.15 If -1 is returned, the named file shall not be changed
SUSv3unlink.90 The unlink() function shall fail and shall not unlink the file if:
SUSv3unlink.90.01 [EACCES] Search permission is denied for a component of the path prefix, or write permission is denied on the directory containing the directory entry to be removed.
SUSv3unlink.90.02 [EBUSY] The file named by the path argument cannot be unlinked because it is being used by the system or another process and the implementation considers this an error.
SUSv3unlink.90.03 [ELOOP] A loop exists in symbolic links encountered during resolution of the path argument.
SUSv3unlink.90.04 [ENAMETOOLONG] The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
SUSv3unlink.90.05 [ENOENT] A component of path does not name an existing file or path is an empty string.
SUSv3unlink.90.06 [ENOTDIR] A component of the path prefix is not a directory.
SUSv3unlink.90.07 [EPERM] The file named by path is a directory, and either the calling process does not have appropriate privileges, or the implementation prohibits using unlink() on directories.
SUSv3unlink.90.08 [EPERM] or [EACCES] [XSI]
The S_ISVTX flag is set on the directory containing the file referred to by the path argument and the caller is not the file owner, nor is the caller the directory owner, nor does the caller have appropriate privileges.
SUSv3unlink.90.09 [EROFS] The directory entry to be unlinked is part of a read-only file system.
LSBunlink.90.30 If path specifies a directory, the implementation may return EISDIR instead of EPERM as specified by ISO POSIX (2003).
SUSv3unlink.92 The unlink() function may fail and not unlink the file if:
SUSv3unlink.92.01 [EBUSY] [XSI] The file named by path is a named STREAM.
SUSv3unlink.92.02 [ELOOP] More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument.
SUSv3unlink.92.03 [ENAMETOOLONG] As a result of encountering a symbolic link in resolution of the path argument, the length of the substituted pathname string exceeded {PATH_MAX}.
SUSv3unlink.92.04 [ETXTBSY] The entry to be unlinked is the last directory entry to a pure procedure (shared text) file that is being executed.
The text in the Description column of SUSv3 requirements is reproduced from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html