REMOVE(3C) SysV REMOVE(3C)
NAME
remove - remove a file
SYNOPSIS
#include <stdio.h>
int remove(filename)
const char *filename;
DESCRIPTION
The remove function removes the directory entry pointed to by filename.
If this entry was the last link to the file and no process has the file
open, the system frees the space occupied by the file and the file ceases
to exist. If a process has the file open, the system postpones the
removal until all references to the file have been closed.
remove calls unlink(2) to remove the directory entry.
SEE ALSO
close(2), link(2), open(2), unlink(2).
rm(1) in the SysV Command Reference.
DIAGNOSTICS
A successful call returns 0. A failed call returns one of the following:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path
prefix.
[EACCES] Write permission is denied on the directory containing the
entry to be removed.
[EPERM] The named file is a directory and the effective user ID of
the process is not super-user.
[EBUSY] The entry to be removed is the mount point for a mounted
file system.
[ETXTBSY] The entry to be removed is the last link to a pure
procedure (shared text) file that is being executed.
[EROFS] The directory entry to be removed is part of a read-only
file system.
[EFAULT] filename points outside the process' allocated address
space.
[EINTR] A signal was caught during the unlink system call.