1REMOVE(3) GNU REMOVE(3)
2
3
4
6 remove - delete a name and possibly the file it refers to
7
9 #include <stdio.h>
10
11 int remove(const char *pathname);
12
14 remove() deletes a name from the filesystem. It calls unlink() for
15 files, and rmdir() for directories.
16
17 If the removed name was the last link to a file and no processes have
18 the file open the file is deleted and the space it was using is made
19 available for reuse.
20
21 If the name was the last link to a file but any processes still have
22 the file open the file will remain in existence until the last file
23 descriptor referring to it is closed.
24
25 If the name referred to a symbolic link the link is removed.
26
27 If the name referred to a socket, fifo or device the name for it is
28 removed but processes which have the object open may continue to use
29 it.
30
32 On success, zero is returned. On error, -1 is returned, and errno is
33 set appropriately.
34
36 The errors that occur are those for unlink(2) and rmdir(2).
37
39 C89, C99, 4.3BSD, POSIX.1-2001.
40
42 Infelicities in the protocol underlying NFS can cause the unexpected
43 disappearance of files which are still being used.
44
46 Under libc4 and libc5, remove() was an alias for unlink() (and hence
47 would not remove directories).
48
50 rm(1), link(2), mknod(2), open(2), rename(2), rmdir(2), unlink(2),
51 mkfifo(3), unlink(8)
52
53
54
55Linux 1994-07-13 REMOVE(3)