]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/remove.3
Changes: Ready for 5.02
[thirdparty/man-pages.git] / man3 / remove.3
CommitLineData
fea681da
MK
1.\" This file is derived from unlink.2, which has the following copyright:
2.\"
fea681da 3.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
ac56b6a8 4.\" and Copyright (C) 1993 Ian Jackson.
fea681da 5.\"
1fcd9102
MK
6.\" Edited into remove.3 shape by:
7.\" Graeme W. Wilford (G.Wilford@ee.surrey.ac.uk) on 13th July 1994
8.\"
93015253 9.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
10.\" Permission is granted to make and distribute verbatim copies of this
11.\" manual provided the copyright notice and this permission notice are
12.\" preserved on all copies.
13.\"
14.\" Permission is granted to copy and distribute modified versions of this
15.\" manual under the conditions for verbatim copying, provided that the
16.\" entire resulting derived work is distributed under the terms of a
17.\" permission notice identical to this one.
c13182ef 18.\"
fea681da
MK
19.\" Since the Linux kernel and libraries are constantly changing, this
20.\" manual page may be incorrect or out-of-date. The author(s) assume no
21.\" responsibility for errors or omissions, or for damages resulting from
22.\" the use of the information contained herein. The author(s) may not
23.\" have taken the same level of care in the production of this manual,
24.\" which is licensed free of charge, as they might when working
25.\" professionally.
c13182ef 26.\"
fea681da
MK
27.\" Formatted or processed versions of this manual, if unaccompanied by
28.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 29.\" %%%LICENSE_END
fea681da 30.\"
4b8c67d9 31.TH REMOVE 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da 32.SH NAME
46c0fadf 33remove \- remove a file or directory
fea681da
MK
34.SH SYNOPSIS
35.B #include <stdio.h>
68e4db0a 36.PP
fea681da
MK
37.BI "int remove(const char *" pathname );
38.SH DESCRIPTION
e511ffb6 39.BR remove ()
9ee4a2b6 40deletes a name from the filesystem.
fea681da 41It calls
fb186734 42.BR unlink (2)
fea681da 43for files, and
fb186734 44.BR rmdir (2)
fea681da 45for directories.
847e0d88 46.PP
fea681da 47If the removed name was the
46c0fadf 48last link to a file and no processes have the file open, the file is
fea681da 49deleted and the space it was using is made available for reuse.
847e0d88 50.PP
46c0fadf
MK
51If the name was the last link to a file,
52but any processes still have the file open,
53the file will remain in existence until the last file
fea681da 54descriptor referring to it is closed.
847e0d88 55.PP
46c0fadf 56If the name referred to a symbolic link, the link is removed.
847e0d88 57.PP
46c0fadf
MK
58If the name referred to a socket, FIFO, or device, the name is removed,
59but processes which have the object open may continue to use it.
47297adb 60.SH RETURN VALUE
c13182ef
MK
61On success, zero is returned.
62On error, \-1 is returned, and
fea681da
MK
63.I errno
64is set appropriately.
65.SH ERRORS
66The errors that occur are those for
67.BR unlink (2)
68and
69.BR rmdir (2).
aaff622e 70.SH ATTRIBUTES
692646ca
PH
71For an explanation of the terms used in this section, see
72.BR attributes (7).
73.TS
74allbox;
75lb lb lb
76l l l.
77Interface Attribute Value
78T{
aaff622e 79.BR remove ()
692646ca
PH
80T} Thread safety MT-Safe
81.TE
47297adb 82.SH CONFORMING TO
88d3b8a9 83POSIX.1-2001, POSIX.1-2008, C89, C99, 4.3BSD.
f5ccb6a7
MK
84.\" .SH NOTES
85.\" Under libc4 and libc5,
86.\" .BR remove ()
87.\" was an alias for
88.\" .BR unlink (2)
89.\" (and hence would not remove directories).
2b2581ee
MK
90.SH BUGS
91Infelicities in the protocol underlying NFS can cause the unexpected
92disappearance of files which are still being used.
47297adb 93.SH SEE ALSO
fea681da 94.BR rm (1),
49ec013c 95.BR unlink (1),
fea681da
MK
96.BR link (2),
97.BR mknod (2),
98.BR open (2),
99.BR rename (2),
100.BR rmdir (2),
101.BR unlink (2),
a9cfde1d
MK
102.BR mkfifo (3),
103.BR symlink (7)