]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/remove.3
Add section numbers to page xrefs
[thirdparty/man-pages.git] / man3 / remove.3
CommitLineData
fea681da
MK
1.\" This file is derived from unlink.2, which has the following copyright:
2.\"
3.\" --snip--
4.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
5.\" 1993 Ian Jackson.
6.\"
7.\" Permission is granted to make and distribute verbatim copies of this
8.\" manual provided the copyright notice and this permission notice are
9.\" preserved on all copies.
10.\"
11.\" Permission is granted to copy and distribute modified versions of this
12.\" manual under the conditions for verbatim copying, provided that the
13.\" entire resulting derived work is distributed under the terms of a
14.\" permission notice identical to this one.
c13182ef 15.\"
fea681da
MK
16.\" Since the Linux kernel and libraries are constantly changing, this
17.\" manual page may be incorrect or out-of-date. The author(s) assume no
18.\" responsibility for errors or omissions, or for damages resulting from
19.\" the use of the information contained herein. The author(s) may not
20.\" have taken the same level of care in the production of this manual,
21.\" which is licensed free of charge, as they might when working
22.\" professionally.
c13182ef 23.\"
fea681da
MK
24.\" Formatted or processed versions of this manual, if unaccompanied by
25.\" the source, must acknowledge the copyright and authors of this work.
26.\" --snip--
27.\"
28.\" Edited into remove.3 shape by:
29.\" Graeme W. Wilford (G.Wilford@ee.surrey.ac.uk) on 13th July 1994
30.\"
31.TH REMOVE 3 1994-07-13 Linux "GNU"
32.SH NAME
33remove \- delete a name and possibly the file it refers to
34.SH SYNOPSIS
35.B #include <stdio.h>
36.sp
37.BI "int remove(const char *" pathname );
38.SH DESCRIPTION
e511ffb6 39.BR remove ()
fea681da
MK
40deletes a name from the filesystem.
41It calls
31e9a9ec 42.BR unlink ()
fea681da 43for files, and
31e9a9ec 44.BR rmdir ()
fea681da
MK
45for directories.
46
47If the removed name was the
48last link to a file and no processes have the file open the file is
49deleted and the space it was using is made available for reuse.
50
51If the name was the last link to a file but any processes still have
52the file open the file will remain in existence until the last file
53descriptor referring to it is closed.
54
55If the name referred to a symbolic link the link is removed.
56
57If the name referred to a socket, fifo or device the name for it is
58removed but processes which have the object open may continue to use
59it.
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).
70.SH "CONFORMING TO"
1eb85d14 71C89, C99, 4.3BSD, POSIX.1-2001.
fea681da
MK
72.SH BUGS
73Infelicities in the protocol underlying NFS can cause the unexpected
74disappearance of files which are still being used.
75.SH NOTE
76Under libc4 and libc5,
e511ffb6 77.BR remove ()
e1d6264d
MK
78was an alias for
79.BR unlink ()
80(and hence would not remove directories).
fea681da
MK
81.SH "SEE ALSO"
82.BR rm (1),
83.BR link (2),
84.BR mknod (2),
85.BR open (2),
86.BR rename (2),
87.BR rmdir (2),
88.BR unlink (2),
89.BR mkfifo (3),
90.BR unlink (8)