Requirements Catalog of LSB Core 3.1

Requirements for the function 'remove'
StandardIDDescription
SUSv3remove.01 The remove() function shall cause the file named by the pathname pointed to by path to be no longer accessible by that name
SUSv3remove.02 A subsequent attempt to open that file using that name shall fail, unless it is created anew
SUSv3remove.31 The rmdir() function shall remove a directory whose name is given by path. The directory shall be removed only if it is an empty directory.
SUSv3remove.40 If the directory is the root directory or the current working directory of any process, it is unspecified whether the function succeeds, or whether it shall fail and set errno to [EBUSY].
SUSv3remove.32 If path names a symbolic link, then rmdir() shall fail and set errno to [ENOTDIR].
SUSv3remove.33 If the path argument refers to a path whose final component is either dot or dot-dot, rmdir() shall fail.
SUSv3remove.34 If the directory's link count becomes 0 and no process has the directory open, the space occupied by the directory shall be freed and the directory shall no longer be accessible.
SUSv3remove.35 If one or more processes have the directory open when the last link is removed, the dot and dot-dot entries, if present, shall be removed before rmdir() returns and no new entries may be created in the directory, but the directory shall not be removed until all references to the directory are closed
SUSv3remove.41 If the directory is not an empty directory, rmdir() shall fail and set errno to [EEXIST] or [ENOTEMPTY].
SUSv3remove.36 Upon successful completion, the rmdir() function shall mark for update the st_ctime and st_mtime fields of the parent directory.
SUSv3remove.37 Upon successful completion, the function rmdir() shall return 0.
SUSv3remove.38 Otherwise, -1 shall be returned, and errno set to indicate the error. If -1 is returned, the named directory shall not be changed.
SUSv3remove.80 The rmdir() function shall fail if
SUSv3remove.80.01 [EACCES] Search permission is denied on a component of the path prefix, or write permission is denied on the parent directory of the directory to be removed.
SUSv3remove.80.02 [EBUSY] The directory to be removed is currently in use by the system or some process and the implementation considers this to be an error.
SUSv3remove.80.03 [EEXIST] or [ENOTEMPTY] The path argument names a directory that is not an empty directory, or there are hard links to the directory other than dot or a single entry in dot-dot.
SUSv3remove.80.04 [EINVAL] The path argument contains a last component that is dot.
SUSv3remove.80.05 [EIO] A physical I/O error has occurred.
SUSv3remove.80.06 [ELOOP] A loop exists in symbolic links encountered during resolution of the path argument.
SUSv3remove.80.07 [ENAMETOOLONG] The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
SUSv3remove.80.08 [ENOENT] A component of path does not name an existing file, or the path argument names a nonexistent directory or points to an empty string.
SUSv3remove.80.10 [ENOTDIR] A component of path is not a directory.
SUSv3remove.80.11 [EPERM] or [EACCES] [XSI]
The S_ISVTX flag is set on the parent directory of the directory to be removed and the caller is not the owner of the directory to be removed, nor is the caller the owner of the parent directory, nor does the caller have the appropriate privileges.
SUSv3remove.80.12 [EROFS] The directory entry to be removed resides on a read-only file system.
SUSv3remove.81 The rmdir() function may fail if:
SUSv3remove.81.01 [ELOOP] More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument.
SUSv3remove.81.02 [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}.
SUSv3remove.05 The unlink() function shall remove a link to a file
SUSv3remove.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
SUSv3remove.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
SUSv3remove.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
SUSv3remove.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.
SUSv3remove.10 The path argument shall not name a directory unless the process has appropriate privileges and the implementation supports using unlink() on directories
SUSv3remove.11 Upon successful completion, unlink() shall mark for update the st_ctime and st_mtime fields of the parent directory
SUSv3remove.12 Also, if the file's link count is not 0, the st_ctime field of the file shall be marked for update
SUSv3remove.13 Upon successful completion, 0 shall be returned
SUSv3remove.14 Otherwise, -1 shall be returned and errno set to indicate the error
SUSv3remove.15 If -1 is returned, the named file shall not be changed
SUSv3remove.90 The unlink() function shall fail and shall not unlink the file if:
SUSv3remove.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.
SUSv3remove.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.
SUSv3remove.90.03 [ELOOP] A loop exists in symbolic links encountered during resolution of the path argument.
SUSv3remove.90.04 [ENAMETOOLONG] The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
SUSv3remove.90.05 [ENOENT] A component of path does not name an existing file or path is an empty string.
SUSv3remove.90.06 [ENOTDIR] A component of the path prefix is not a directory.
SUSv3remove.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.
SUSv3remove.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.
SUSv3remove.90.09 [EROFS] The directory entry to be unlinked is part of a read-only file system.
SUSv3remove.92 The unlink() function may fail and not unlink the file if:
SUSv3remove.92.01 [EBUSY] [XSI] The file named by path is a named STREAM.
SUSv3remove.92.02 [ELOOP] More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument.
SUSv3remove.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}.
SUSv3remove.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