remove - delete (unlink) a file
Standard C Library (libc, -lc)
remove(const char *pathname);
The name of the file referred to by pathname is removed from the filesystem. The actual file itself is not removed until no further references to it exist, whether those references are on disk or in memory.
It is an error for pathname to not specify an existing file or to refer to a directory.
The call (like all system calls) should be atomic. Other processes should not be able to see a half-removed file. If implementing a recoverable filesystem, recovery must yield a volume where the remove either has been fully completed or has not been done at all.
On success, remove returns 0. On error, -1 is returned, and errno is set according to the error encountered.
The following error codes should be returned under the conditions given. Other error codes may be returned for other cases not mentioned here.
|ENODEV||The device prefix of filename did not exist.|
|ENOTDIR||A non-final component of pathname was not a directory.|
|EISDIR||pathname referred to a directory.|
|ENOENT||The target file did not exist.|
|EIO||A hard I/O error occurred.|
|EFAULT||pathname was an invalid pointer.|