2004-11-03 13:51:07 +00:00
|
|
|
.\" This file is derived from unlink.2, which has the following copyright:
|
|
|
|
.\"
|
|
|
|
.\" --snip--
|
|
|
|
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
|
|
|
|
.\" 1993 Ian Jackson.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" --snip--
|
|
|
|
.\"
|
|
|
|
.\" Edited into remove.3 shape by:
|
|
|
|
.\" Graeme W. Wilford (G.Wilford@ee.surrey.ac.uk) on 13th July 1994
|
|
|
|
.\"
|
2008-12-03 21:53:48 +00:00
|
|
|
.TH REMOVE 3 2008-12-03 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
2008-12-03 21:53:48 +00:00
|
|
|
remove \- remove a file or directory
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <stdio.h>
|
|
|
|
.sp
|
|
|
|
.BI "int remove(const char *" pathname );
|
|
|
|
.SH DESCRIPTION
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR remove ()
|
2008-03-19 07:26:08 +00:00
|
|
|
deletes a name from the file system.
|
2004-11-03 13:51:07 +00:00
|
|
|
It calls
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR unlink (2)
|
2004-11-03 13:51:07 +00:00
|
|
|
for files, and
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR rmdir (2)
|
2004-11-03 13:51:07 +00:00
|
|
|
for directories.
|
|
|
|
|
|
|
|
If the removed name was the
|
2008-12-03 21:53:48 +00:00
|
|
|
last link to a file and no processes have the file open, the file is
|
2004-11-03 13:51:07 +00:00
|
|
|
deleted and the space it was using is made available for reuse.
|
|
|
|
|
2008-12-03 21:53:48 +00:00
|
|
|
If the name was the last link to a file,
|
|
|
|
but any processes still have the file open,
|
|
|
|
the file will remain in existence until the last file
|
2004-11-03 13:51:07 +00:00
|
|
|
descriptor referring to it is closed.
|
|
|
|
|
2008-12-03 21:53:48 +00:00
|
|
|
If the name referred to a symbolic link, the link is removed.
|
2004-11-03 13:51:07 +00:00
|
|
|
|
2008-12-03 21:53:48 +00:00
|
|
|
If the name referred to a socket, FIFO, or device, the name is removed,
|
|
|
|
but processes which have the object open may continue to use it.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
2007-04-12 22:42:49 +00:00
|
|
|
On success, zero is returned.
|
|
|
|
On error, \-1 is returned, and
|
2004-11-03 13:51:07 +00:00
|
|
|
.I errno
|
|
|
|
is set appropriately.
|
|
|
|
.SH ERRORS
|
|
|
|
The errors that occur are those for
|
|
|
|
.BR unlink (2)
|
|
|
|
and
|
|
|
|
.BR rmdir (2).
|
|
|
|
.SH "CONFORMING TO"
|
2006-12-16 22:11:08 +00:00
|
|
|
C89, C99, 4.3BSD, POSIX.1-2001.
|
2007-05-16 02:54:18 +00:00
|
|
|
.SH NOTES
|
2004-11-03 13:51:07 +00:00
|
|
|
Under libc4 and libc5,
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR remove ()
|
2005-10-19 07:29:28 +00:00
|
|
|
was an alias for
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR unlink (2)
|
2005-10-19 07:29:28 +00:00
|
|
|
(and hence would not remove directories).
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH BUGS
|
|
|
|
Infelicities in the protocol underlying NFS can cause the unexpected
|
|
|
|
disappearance of files which are still being used.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR rm (1),
|
2007-10-14 18:33:54 +00:00
|
|
|
.BR unlink (1),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR link (2),
|
|
|
|
.BR mknod (2),
|
|
|
|
.BR open (2),
|
|
|
|
.BR rename (2),
|
|
|
|
.BR rmdir (2),
|
|
|
|
.BR unlink (2),
|
2008-06-11 21:50:53 +00:00
|
|
|
.BR mkfifo (3),
|
|
|
|
.BR symlink (7)
|