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 filesystem.  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

ATTRIBUTES

38       For  an  explanation  of  the  terms  used   in   this   section,   see
39       attributes(7).
40
41       ┌──────────┬───────────────┬─────────┐
42Interface Attribute     Value   
43       ├──────────┼───────────────┼─────────┤
44remove()  │ Thread safety │ MT-Safe │
45       └──────────┴───────────────┴─────────┘

CONFORMING TO

47       POSIX.1-2001, POSIX.1-2008, C89, C99, 4.3BSD.
48

BUGS

50       Infelicities  in  the  protocol underlying NFS can cause the unexpected
51       disappearance of files which are still being used.
52

SEE ALSO

54       rm(1), unlink(1),  link(2),  mknod(2),  open(2),  rename(2),  rmdir(2),
55       unlink(2), mkfifo(3), symlink(7)
56

COLOPHON

58       This  page  is  part of release 5.04 of the Linux man-pages project.  A
59       description of the project, information about reporting bugs,  and  the
60       latest     version     of     this    page,    can    be    found    at
61       https://www.kernel.org/doc/man-pages/.
62
63
64
65GNU                               2017-09-15                         REMOVE(3)
Impressum