.\" 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. .\" .\" 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. .\" .\" 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 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH REMOVE 3 2008\-12\-03 GNU "Linux Programmer's Manual" .SH 名前 remove \- ファイルやディレクトリを削除する .SH 書式 \fB#include \fP .sp \fBint remove(const char *\fP\fIpathname\fP\fB);\fP .SH 説明 \fBremove\fP() はファイルシステムからファイル名を削除する。 ファイルに対しては \fBunlink\fP(2) を、ディレクトリに対しては \fBrmdir\fP(2) を呼び出す。 もしその名前が ファイルへの最後のリンクで、かつ、どのプロセスもそのファイルを 開いていないなら、ファイルも削除する。ファイルの占めていた 領域は他で使うことができるようになる。 名前がファイルへの最後のリンクであっても、どこかのプロセスが そのファイルを開いているなら、ファイルの最後のファイル記述子 (file descriptor) が閉じられるまでファイルは存在し続ける。 名前が指しているのがシンボリックリンクなら、そのリンクを削除する。 名前が指しているのがソケット、FIFO、デバイスの場合、名前は削除されるが、 そのソケットなどを開いているプロセスはそのまま使い続けることができる。 .SH 返り値 成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。 .SH エラー 発生するエラーは \fBunlink\fP(2) および \fBrmdir\fP(2) と同じものである。 .SH 準拠 C89, C99, 4.3BSD, POSIX.1\-2001. .SH 注意 libc4 と libc5 においては、 \fBremove\fP() は \fBunlink\fP(2) の別名であった (従ってディレクトリを削除できなかった)。 .SH バグ NFS プロトコルに内在する問題により、まだ使用中のファイルが想定外に消えてしまうことがありえる。 .SH 関連項目 \fBrm\fP(1), \fBunlink\fP(1), \fBlink\fP(2), \fBmknod\fP(2), \fBopen\fP(2), \fBrename\fP(2), \fBrmdir\fP(2), \fBunlink\fP(2), \fBmkfifo\fP(3), \fBsymlink\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。