OSDN Git Service

(split) LDP: Update release pages based on LDP 3.54 release
[linuxjm/LDP_man-pages.git] / release / man2 / rename.2
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\"             and Copyright (C) 1993 Michael Haardt;
3 .\"             and Copyright (C) 1993,1995 Ian Jackson.
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" Modified Sat Jul 24 00:35:52 1993 by Rik Faith <faith@cs.unc.edu>
28 .\" Modified Thu Jun  4 12:21:13 1998 by Andries Brouwer <aeb@cwi.nl>
29 .\" Modified Thu Mar  3 09:49:35 2005 by Michael Haardt <michael@moria.de>
30 .\" 2007-03-25, mtk, added various text to DESCRIPTION.
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
39 .\"         all rights reserved.
40 .\" Translated Fri Dec 12 00:15:52 JST 1997
41 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
42 .\" Updated & Modified Thu Feb 10 07:23:59 JST 2005
43 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
44 .\" Updated & Modified Fri Apr 22 03:21:04 JST 2005 by Yuichi SATO
45 .\" Updated 2007-05-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.44
46 .\" Updated 2009-04-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.20
47 .\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
48 .\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
49 .\"
50 .TH RENAME 2 2013\-01\-27 Linux "Linux Programmer's Manual"
51 .SH 名前
52 rename \- ファイルの名前や位置を変更する
53 .SH 書式
54 \fB#include <stdio.h>\fP
55 .sp
56 \fBint rename(const char *\fP\fIoldpath\fP\fB, const char *\fP\fInewpath\fP\fB);\fP
57 .SH 説明
58 \fBrename\fP()  はファイルの名前を変更し、必要ならばディレクトリ間の移動を行なう。 そのファイルに対する (\fBlink\fP(2)
59 を使用して作られた) 他のハードリンク (hard link) には影響はない。 オープン済の \fIoldpath\fP
60 に対するファイルディスクリプタにも影響はない。
61
62 \fInewpath\fP が既に存在する場合、それは不可分操作で (atomically) 置き換えられる (ただし、いくつかの条件がある;
63 以下の「エラー」のセクションを参照)。 そのため、 \fInewpath\fP にアクセスしようとしている他のプロセスがファイルを見失うことはない (訳註:
64 常にアクセス可能である)。
65
66 \fIoldpath\fP と \fInewpath\fP がどちらも既存のハードリンクで、同じファイルを参照している場合、 \fBrename\fP()
67 は何も行わず、ステータスとして成功を返す。
68
69 \fInewpath\fP が存在し、何らかの理由で操作が失敗した場合、 \fBrename\fP()  は \fInewpath\fP
70 の実体を元のまま残すことを保証する。
71
72 \fIoldpath\fP にはディレクトリを指定することもできる。 この場合、 \fInewpath\fP は存在しないか、空のディレクトリでなければならない。
73
74 一方で、上書きを行なう場合は、rename が行なわれるファイルを \fIoldpath\fP と \fInewpath\fP
75 の両方で参照できる瞬間がおそらく存在する。
76
77 \fIoldpath\fP がシンボリックリンク (symbolic link) を参照している場合は、 リンクの名前が変更される。 また、
78 \fInewpath\fP がシンボリックリンクを参照している場合は、リンクが上書きされる。
79 .SH 返り値
80 成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
81 .SH エラー
82 .TP 
83 \fBEACCES\fP
84 \fIoldpath\fP または \fInewpath\fP を含んでいるディレクトリの書き込み許可がない。 または、 \fIoldpath\fP または
85 \fInewpath\fP のディレクトリ部分のどれかに検索許可がない。 または、 \fIoldpath\fP がディレクトリで (\fI..\fP
86 エントリを更新するのに必要な) 書き込み許可がない (\fBpath_resolution\fP(7)  も参照)。
87 .TP 
88 \fBEBUSY\fP
89 \fIoldpath\fP または \fInewpath\fP がディレクトリで、何らかのプロセスが使用中
90 (多分、カレントワーキングディレクトリか、ルートディレクトリか、 読み込みのためにオープンされているかでろう)  もしくは、システムが使用中
91 (例えばマウントポイントである)  であり、システムがこれをエラーであると判断したために rename が失敗した。 (このような場合に
92 \fBEBUSY\fP を返すことは規格では要求されていない点に注意すること。 このような場合に、rename をとにかく実行してみるのは何の問題もない。
93 ただし、そのような状況で、システムが他に返すエラーがない場合には \fBEBUSY\fP を返すことが許されている。)
94 .TP 
95 \fBEDQUOT\fP
96 The user's quota of disk blocks on the filesystem has been exhausted.
97 .TP 
98 \fBEFAULT\fP
99 \fIoldpath\fP や \fInewpath\fP がアクセス可能なアドレス空間の外を指している。
100 .TP 
101 \fBEINVAL\fP
102 \fInewpath\fP が \fIoldpath\fP のパス部分を含んでいる。ディレクトリを自分自身のサブディレクトリに
103 変更しようとした場合がほとんどである。
104 .TP 
105 \fBEISDIR\fP
106 \fInewpath\fP は存在しているディレクトリであるが、 \fIoldpath\fP はディレクトリでない。
107 .TP 
108 \fBELOOP\fP
109 \fIoldpath\fP または \fInewpath\fP を解決する際に遭遇したシンボリックリンクが多過ぎる。
110 .TP 
111 \fBEMLINK\fP
112 \fIoldpath\fP は既に最大数までのリンクを持っているか、それがディレクトリで \fInewpath\fP
113 を含んでいるディレクトリが最大数までのリンクを持っている。
114 .TP 
115 \fBENAMETOOLONG\fP
116 \fIoldpath\fP または \fInewpath\fP が長過ぎる。
117 .TP 
118 \fBENOENT\fP
119 \fIoldpath\fP という名前のリンクが存在しない。 または、 \fInewpath\fP というディレクトリが存在しない。 または、 \fIoldpath\fP
120 か \fInewpath\fP が空の文字列である。
121 .TP 
122 \fBENOMEM\fP
123 十分なカーネルメモリーがない。
124 .TP 
125 \fBENOSPC\fP
126 そのファイルを含んでいるデバイスに新しいディレクトリエントリを 作成するための空きがない。
127 .TP 
128 \fBENOTDIR\fP
129 \fIoldpath\fP か \fInewpath\fP に含まれているディレクトリ部分が 実際にはディレクトリでない。 または \fIoldpath\fP
130 がディレクトリで、 \fInewpath\fP が存在してディレクトリでない。
131 .TP 
132 \fBENOTEMPTY  または  EEXIST\fP
133 \fInewpath\fP が空でないディレクトリである。すなわち "." と ".." 以外を含んでいる。
134 .TP 
135 \fBEPERM\fP または \fBEACCES\fP
136 The directory containing \fIoldpath\fP has the sticky bit (\fBS_ISVTX\fP)  set and
137 the process's effective user ID is neither the user ID of the file to be
138 deleted nor that of the directory containing it, and the process is not
139 privileged (Linux: does not have the \fBCAP_FOWNER\fP capability); or
140 \fInewpath\fP is an existing file and the directory containing it has the
141 sticky bit set and the process's effective user ID is neither the user ID of
142 the file to be replaced nor that of the directory containing it, and the
143 process is not privileged (Linux: does not have the \fBCAP_FOWNER\fP
144 capability); or the filesystem containing \fIpathname\fP does not support
145 renaming of the type requested.
146 .TP 
147 \fBEROFS\fP
148 The file is on a read\-only filesystem.
149 .TP 
150 \fBEXDEV\fP
151 \fIoldpath\fP and \fInewpath\fP are not on the same mounted filesystem.  (Linux
152 permits a filesystem to be mounted at multiple points, but \fBrename\fP()  does
153 not work across different mount points, even if the same filesystem is
154 mounted on both.)
155 .SH 準拠
156 4.3BSD, C89, C99, POSIX.1\-2001.
157 .SH バグ
158 On NFS filesystems, you can not assume that if the operation failed the file
159 was not renamed.  If the server does the rename operation and then crashes,
160 the retransmitted RPC which will be processed when the server is up again
161 causes a failure.  The application is expected to deal with this.  See
162 \fBlink\fP(2)  for a similar problem.
163 .SH 関連項目
164 \fBmv\fP(1), \fBchmod\fP(2), \fBlink\fP(2), \fBrenameat\fP(2), \fBsymlink\fP(2),
165 \fBunlink\fP(2), \fBpath_resolution\fP(7), \fBsymlink\fP(7)
166 .SH この文書について
167 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
168 である。プロジェクトの説明とバグ報告に関する情報は
169 http://www.kernel.org/doc/man\-pages/ に書かれている。