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"
54 link \- ファイルの新しい名前を作成する
56 .B #include <unistd.h>
58 .BI "int link(const char *" oldpath ", const char *" newpath );
61 は存在するファイルへの新しいリンク (link)
62 (ハード・リンク (hard link) ともいう) を作成する。
65 が存在する場合には上書きは\fIされない\fR。
67 この新しい名前は全ての操作において古い名前と完全に同じように使用される;
69 (それで同じ許可 (permission) や所有者 (ownership) となるので)、
70 どちらの名前が本来のものであるか判別できない。
72 成功した場合は 0 が返される。エラーの場合は \-1 が返され、
79 を含んでいるディレクトリへの書き込みが許されていないか、
84 .RB ( path_resolution (7)
92 .IR oldpath " または " newpath "
93 がアクセス可能なアドレス空間の外を指している。
99 .IR oldpath " または " newpath
100 を解決する際に遭遇したシンボリック・リンクが多過ぎる。
108 .IR oldpath " または " newpath "
112 .IR oldpath " または " newpath
114 壊れた(dangling)シンボリック・リンクである。
120 そのファイルを含んでいるデバイスに新しいディレクトリ・エントリを
124 .IR oldpath " または " newpath
125 のディレクトリ部分が、実際には、ディレクトリでない。
132 .IR oldpath " と " newpath
133 を含んでいるファイル・システムがハード・リンクをサポートしていない。
136 ファイルが読み込み専用のファイル・システムに存在する。
139 .IR oldpath " と " newpath
140 が同じマウントされたファイル・システムに存在しない。
141 (Linux は 1 つのファイル・システムを複数のマウント位置に
145 は、たとえ同じファイル・システムであっても、
146 別々のマウント位置を跨いでは動作しない。)
148 SVr4, 4.3BSD, POSIX.1-2001 (但し「注意」を参照)。
149 .\" SVr4 は他に ENOLINK, EMULTIHOP エラー状態についても記述している。
150 .\" POSIX.1 には ELOOP についての記述はない。
151 .\" X/OPEN には EFAULT, ENOMEM, EIO についての記述はない。
154 でファイル・システムを超えてハード・リンクを作成することはできない。
165 の参照を解決すべきであると記述されている。
167 .\" 正確にはカーネル 1.3.56 以降
172 は同じシンボリック・リンクファイルへの (ハード) リンクとして作成される
177 が参照していた同じファイルへのシンボリックリンクになる)。
178 他のいくつかの実装でも Linux と同じように動作する。
179 .\" 例えば、デフォルトの Solaris のコンパイル環境では
180 .\" Linux と同じように動作する。そして Austin メーリングリストの
181 .\" 2005 年 3 月のスレッドに投稿した人たちは、
182 .\" その他のいくつかの (System V) 実装でも同じであった/ある、
183 .\" と報告している -- MTK, Apr 05
188 がシンボリック・リンクの場合にシンボリック・リンクの参照を
190 リンク作成時のシンボリック・リンクの扱いについての詳細な制御に
195 NFS ファイル・システムでは、NFS サーバーがリンクを作成した後に、
196 それを伝える前に死んだ場合には返り値が不正な場合がある。
197 リンクが作成できたかどうか見つけるためには
208 .BR path_resolution (7),