]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/remove.3
Many pages: Use correct letter case in page titles (TH)
[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.\"
5fbde956 9.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da 10.\"
4c1c5274 11.TH remove 3 (date) "Linux man-pages (unreleased)"
fea681da 12.SH NAME
46c0fadf 13remove \- remove a file or directory
4d8af955
AC
14.SH LIBRARY
15Standard C library
8fc3b2cf 16.RI ( libc ", " \-lc )
fea681da 17.SH SYNOPSIS
c7db92b9 18.nf
fea681da 19.B #include <stdio.h>
68e4db0a 20.PP
fea681da 21.BI "int remove(const char *" pathname );
c7db92b9 22.fi
fea681da 23.SH DESCRIPTION
e511ffb6 24.BR remove ()
9ee4a2b6 25deletes a name from the filesystem.
fea681da 26It calls
fb186734 27.BR unlink (2)
fea681da 28for files, and
fb186734 29.BR rmdir (2)
fea681da 30for directories.
847e0d88 31.PP
fea681da 32If the removed name was the
46c0fadf 33last link to a file and no processes have the file open, the file is
fea681da 34deleted and the space it was using is made available for reuse.
847e0d88 35.PP
46c0fadf
MK
36If the name was the last link to a file,
37but any processes still have the file open,
38the file will remain in existence until the last file
fea681da 39descriptor referring to it is closed.
847e0d88 40.PP
46c0fadf 41If the name referred to a symbolic link, the link is removed.
847e0d88 42.PP
46c0fadf
MK
43If the name referred to a socket, FIFO, or device, the name is removed,
44but processes which have the object open may continue to use it.
47297adb 45.SH RETURN VALUE
c13182ef
MK
46On success, zero is returned.
47On error, \-1 is returned, and
fea681da 48.I errno
f6a4078b 49is set to indicate the error.
fea681da
MK
50.SH ERRORS
51The errors that occur are those for
52.BR unlink (2)
53and
54.BR rmdir (2).
aaff622e 55.SH ATTRIBUTES
692646ca
PH
56For an explanation of the terms used in this section, see
57.BR attributes (7).
c466875e
MK
58.ad l
59.nh
692646ca
PH
60.TS
61allbox;
c466875e 62lbx lb lb
692646ca
PH
63l l l.
64Interface Attribute Value
65T{
aaff622e 66.BR remove ()
692646ca
PH
67T} Thread safety MT-Safe
68.TE
c466875e
MK
69.hy
70.ad
71.sp 1
3113c7f3 72.SH STANDARDS
88d3b8a9 73POSIX.1-2001, POSIX.1-2008, C89, C99, 4.3BSD.
f5ccb6a7
MK
74.\" .SH NOTES
75.\" Under libc4 and libc5,
76.\" .BR remove ()
77.\" was an alias for
78.\" .BR unlink (2)
79.\" (and hence would not remove directories).
2b2581ee
MK
80.SH BUGS
81Infelicities in the protocol underlying NFS can cause the unexpected
82disappearance of files which are still being used.
47297adb 83.SH SEE ALSO
fea681da 84.BR rm (1),
49ec013c 85.BR unlink (1),
fea681da
MK
86.BR link (2),
87.BR mknod (2),
88.BR open (2),
89.BR rename (2),
90.BR rmdir (2),
91.BR unlink (2),
a9cfde1d
MK
92.BR mkfifo (3),
93.BR symlink (7)