1REMOVE(3)                  Linux Programmer's Manual                 REMOVE(3)
2
3
4

NAME

6       remove - remove a file or directory
7

SYNOPSIS

9       #include <stdio.h>
10
11       int remove(const char *pathname);
12

DESCRIPTION

14       remove()  deletes  a name from the file system.  It calls unlink(2) for
15       files, and rmdir(2) 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 is removed,
28       but processes which have the object open may continue to use it.
29

RETURN VALUE

31       On  success,  zero is returned.  On error, -1 is returned, and errno is
32       set appropriately.
33

ERRORS

35       The errors that occur are those for unlink(2) and rmdir(2).
36

CONFORMING TO

38       C89, C99, 4.3BSD, POSIX.1-2001.
39

NOTES

41       Under libc4 and libc5, remove() was an alias for unlink(2)  (and  hence
42       would not remove directories).
43

BUGS

45       Infelicities  in  the  protocol underlying NFS can cause the unexpected
46       disappearance of files which are still being used.
47

SEE ALSO

49       rm(1), unlink(1),  link(2),  mknod(2),  open(2),  rename(2),  rmdir(2),
50       unlink(2), mkfifo(3), symlink(7)
51

COLOPHON

53       This  page  is  part of release 3.25 of the Linux man-pages project.  A
54       description of the project, and information about reporting  bugs,  can
55       be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59GNU                               2008-12-03                         REMOVE(3)
Impressum