]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/remove.3
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex...
[thirdparty/man-pages.git] / man3 / remove.3
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.
15 .\"
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.
23 .\"
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 2008-12-03 "GNU" "Linux Programmer's Manual"
32 .SH NAME
33 remove \- remove a file or directory
34 .SH SYNOPSIS
35 .B #include <stdio.h>
36 .sp
37 .BI "int remove(const char *" pathname );
38 .SH DESCRIPTION
39 .BR remove ()
40 deletes a name from the file system.
41 It calls
42 .BR unlink (2)
43 for files, and
44 .BR rmdir (2)
45 for directories.
46
47 If the removed name was the
48 last link to a file and no processes have the file open, the file is
49 deleted and the space it was using is made available for reuse.
50
51 If the name was the last link to a file,
52 but any processes still have the file open,
53 the file will remain in existence until the last file
54 descriptor referring to it is closed.
55
56 If the name referred to a symbolic link, the link is removed.
57
58 If the name referred to a socket, FIFO, or device, the name is removed,
59 but processes which have the object open may continue to use it.
60 .SH RETURN VALUE
61 On success, zero is returned.
62 On error, \-1 is returned, and
63 .I errno
64 is set appropriately.
65 .SH ERRORS
66 The errors that occur are those for
67 .BR unlink (2)
68 and
69 .BR rmdir (2).
70 .SH CONFORMING TO
71 C89, C99, 4.3BSD, POSIX.1-2001.
72 .SH NOTES
73 Under libc4 and libc5,
74 .BR remove ()
75 was an alias for
76 .BR unlink (2)
77 (and hence would not remove directories).
78 .SH BUGS
79 Infelicities in the protocol underlying NFS can cause the unexpected
80 disappearance of files which are still being used.
81 .SH SEE ALSO
82 .BR rm (1),
83 .BR unlink (1),
84 .BR link (2),
85 .BR mknod (2),
86 .BR open (2),
87 .BR rename (2),
88 .BR rmdir (2),
89 .BR unlink (2),
90 .BR mkfifo (3),
91 .BR symlink (7)