OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[linuxjm/LDP_man-pages.git] / original / man3 / remove.3
1 .\" This file is derived from unlink.2, which has the following copyright:
2 .\"
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\"                               1993 Ian Jackson.
5 .\"
6 .\" Edited into remove.3 shape by:
7 .\" Graeme W. Wilford (G.Wilford@ee.surrey.ac.uk) on 13th July 1994
8 .\"
9 .\" %%%LICENSE_START(VERBATIM)
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.
18 .\"
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.
26 .\"
27 .\" Formatted or processed versions of this manual, if unaccompanied by
28 .\" the source, must acknowledge the copyright and authors of this work.
29 .\" %%%LICENSE_END
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)