1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\" 1993 Michael Haardt, Ian Jackson.
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.
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.
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
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1994-08-21 by Michael Haardt
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
29 .\" Modified 2005-04-04, as per suggestion by Michael Hardt for rename.2
31 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
32 .\" all rights reserved.
33 .\" Translated Thu Dec 11 23:47:55 JST 1997
34 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
35 .\" Updated & Modified Tue Feb 8 06:36:08 JST 2005
36 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
37 .\" Updated & Modified Fri Apr 22 02:05:00 JST 2005 by Yuichi SATO
38 .\" Updated 2008-09-07, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.08
41 .\"WORD: hard link ハード・リンク
42 .\"WORD: overwrite 上書き
43 .\"WORD: permission 許可(permission)
44 .\"WORD: ownership 所有者(ownership)
45 .\"WORD: file system ファイル・システム
46 .\"WORD: effective uid 実効ユーザーID
48 .\"WORD: symbolic link シンボリック・リンク
49 .\"WORD: dangling symbolic link 壊れたシンボリック・リンク
50 .\"WORD: directory entry ディレクトリ・エントリ
52 .TH LINK 2 2008-08-21 "Linux" "Linux Programmer's Manual"
55 .\"O link \- make a new name for a file
56 link \- ファイルの新しい名前を作成する
59 .B #include <unistd.h>
61 .BI "int link(const char *" oldpath ", const char *" newpath );
65 .\"O creates a new link (also known as a hard link) to an existing file.
67 は存在するファイルへの新しいリンク (link)
68 (ハード・リンク (hard link) ともいう) を作成する。
76 が存在する場合には上書きは\fIされない\fR。
78 .\"O This new name may be used exactly as the old one for any operation;
79 .\"O both names refer to the same file (and so have the same permissions
80 .\"O and ownership) and it is impossible to tell which name was the
82 この新しい名前は全ての操作において古い名前と完全に同じように使用される;
84 (それで同じ許可 (permission) や所有者 (ownership) となるので)、
85 どちらの名前が本来のものであるか判別できない。
86 .\"O .SH "RETURN VALUE"
88 .\"O On success, zero is returned.
89 .\"O On error, \-1 is returned, and
91 .\"O is set appropriately.
92 成功した場合は 0 が返される。エラーの場合は \-1 が返され、
99 .\"O Write access to the directory containing
101 .\"O is denied, or search permission is denied for one of the directories
102 .\"O in the path prefix of
107 .\"O .BR path_resolution (7).)
109 を含んでいるディレクトリへの書き込みが許されていないか、
114 .RB ( path_resolution (7)
124 .\"O .IR oldpath " or " newpath " points outside your accessible address space."
125 .IR oldpath " または " newpath "
126 がアクセス可能なアドレス空間の外を指している。
129 .\"O An I/O error occurred.
133 .\"O Too many symbolic links were encountered in resolving
134 .\"O .IR oldpath " or " newpath .
135 .IR oldpath " または " newpath
136 を解決する際に遭遇したシンボリック・リンクが多過ぎる。
139 .\"O The file referred to by
141 .\"O already has the maximum number of links to it.
147 .\"O .IR oldpath " or " newpath " was too long."
148 .IR oldpath " または " newpath "
152 .\"O A directory component in
153 .\"O .IR oldpath " or " newpath
154 .\"O does not exist or is a dangling symbolic link.
155 .IR oldpath " または " newpath
157 壊れた(dangling)シンボリック・リンクである。
160 .\"O Insufficient kernel memory was available.
164 .\"O The device containing the file has no room for the new directory
166 そのファイルを含んでいるデバイスに新しいディレクトリ・エントリを
170 .\"O A component used as a directory in
171 .\"O .IR oldpath " or " newpath
172 .\"O is not, in fact, a directory.
173 .IR oldpath " または " newpath
174 のディレクトリ部分が、実際には、ディレクトリでない。
183 .\"O The file system containing
184 .\"O .IR oldpath " and " newpath
185 .\"O does not support the creation of hard links.
186 .IR oldpath " と " newpath
187 を含んでいるファイル・システムがハード・リンクをサポートしていない。
190 .\"O The file is on a read-only file system.
191 ファイルが読み込み専用のファイル・システムに存在する。
194 .\"O .IR oldpath " and " newpath
195 .\"O are not on the same mounted file system.
196 .IR oldpath " と " newpath
197 が同じマウントされたファイル・システムに存在しない。
198 .\"O (Linux permits a file system to be mounted at multiple points, but
200 .\"O does not work across different mount points,
201 .\"O even if the same file system is mounted on both.)
202 (Linux は 1 つのファイル・システムを複数のマウント位置に
206 は、たとえ同じファイル・システムであっても、
207 別々のマウント位置を跨いでは動作しない。)
208 .\"O .SH "CONFORMING TO"
210 .\"O SVr4, 4.3BSD, POSIX.1-2001 (but see NOTES)
211 .\"O .\" SVr4 documents additional ENOLINK and
212 .\"O .\" EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
213 .\"O .\" X/OPEN does not document EFAULT, ENOMEM or EIO.
214 SVr4, 4.3BSD, POSIX.1-2001 (但し「注意」を参照)。
215 .\" SVr4 は他に ENOLINK, EMULTIHOP エラー状態についても記述している。
216 .\" POSIX.1 には ELOOP についての記述はない。
217 .\" X/OPEN には EFAULT, ENOMEM, EIO についての記述はない。
220 .\"O Hard links, as created by
222 .\"O cannot span file systems.
225 .\"O if this is required.
227 でファイル・システムを超えてハード・リンクを作成することはできない。
232 .\"O POSIX.1-2001 says that
234 .\"O should dereference
236 .\"O if it is a symbolic link.
243 の参照を解決すべきであると記述されている。
244 .\"O However, since kernel 2.0,
245 .\"O .\" more precisely: since kernel 1.3.56
246 .\"O Linux does not do so: if
248 .\"O is a symbolic link, then
250 .\"O is created as a (hard) link to the same symbolic link file
252 .\" 正確にはカーネル 1.3.56 以降
257 は同じシンボリック・リンクファイルへの (ハード) リンクとして作成される
260 .\"O becomes a symbolic link to the same file that
267 が参照していた同じファイルへのシンボリックリンクになる)。
268 .\"O Some other implementations behave in the same manner as Linux.
269 他のいくつかの実装でも Linux と同じように動作する。
270 .\"O .\" For example, the default Solaris compilation environment
271 .\"O .\" behaves like Linux, and contributors to a March 2005
272 .\"O .\" thread in the Austin mailing list reported that some
273 .\"O .\" other (System V) implementations did/do the same -- MTK, Apr 05
274 .\" 例えば、デフォルトの Solaris のコンパイル環境では
275 .\" Linux と同じように動作する。そして Austin メーリングリストの
276 .\" 2005 年 3 月のスレッドに投稿した人たちは、
277 .\" その他のいくつかの (System V) 実装でも同じであった/ある、
278 .\" と報告している -- MTK, Apr 05
279 .\"O POSIX.1-2008 changes the specification of
281 .\"O making it implementation-dependent whether or not
283 .\"O is dereferenced if it is a symbolic link.
284 .\"O For precise control over the treatment of symbolic links when
285 .\"O creating a link, see
291 がシンボリック・リンクの場合にシンボリック・リンクの参照を
293 リンク作成時のシンボリック・リンクの扱いについての詳細な制御に
299 .\"O On NFS file systems, the return code may be wrong in case the NFS server
300 .\"O performs the link creation and dies before it can say so.
303 .\"O to find out if the link got created.
304 NFS ファイル・システムでは、NFS サーバーがリンクを作成した後に、
305 それを伝える前に死んだ場合には返り値が不正な場合がある。
306 リンクが作成できたかどうか見つけるためには
318 .BR path_resolution (7),