OSDN Git Service

(split) LDP: Update release pages
[linuxjm/LDP_man-pages.git] / release / man2 / link.2
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
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
30 .\"
31 .\"*******************************************************************
32 .\"
33 .\" This file was generated with po4a. Translate the source file.
34 .\"
35 .\"*******************************************************************
36 .\"
37 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
38 .\"         all rights reserved.
39 .\" Translated Thu Dec 11 23:47:55 JST 1997
40 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
41 .\" Updated & Modified Tue Feb  8 06:36:08 JST 2005
42 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
43 .\" Updated & Modified Fri Apr 22 02:05:00 JST 2005 by Yuichi SATO
44 .\" Updated 2008-09-07, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.08
45 .\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
46 .\"
47 .TH LINK 2 2013\-01\-27 Linux "Linux Programmer's Manual"
48 .SH 名前
49 link \- ファイルの新しい名前を作成する
50 .SH 書式
51 \fB#include <unistd.h>\fP
52 .sp
53 \fBint link(const char *\fP\fIoldpath\fP\fB, const char *\fP\fInewpath\fP\fB);\fP
54 .SH 説明
55 \fBlink\fP()  は存在するファイルへの新しいリンク (link)  (ハードリンク (hard link) ともいう) を作成する。
56
57 \fInewpath\fP が存在する場合には上書きは\fIされない\fP。
58
59 この新しい名前は全ての操作において古い名前と完全に同じように使用される; 両方の名前は同じファイルを参照しており (それで同じ許可
60 (permission) や所有者 (ownership) となるので)、 どちらの名前が本来のものであるか判別できない。
61 .SH 返り値
62 成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
63 .SH エラー
64 .TP 
65 \fBEACCES\fP
66 \fInewpath\fP を含んでいるディレクトリへの書き込みが許されていないか、 \fIoldpath\fP または \fInewpath\fP
67 へのディレクトリのどれかに検索許可がない (\fBpath_resolution\fP(7)  を参照)。
68 .TP 
69 \fBEDQUOT\fP
70 ディスクブロックか inode がそのファイルシステムのユーザクォータに達していた。
71 .TP 
72 \fBEEXIST\fP
73 \fInewpath\fP が既に存在する。
74 .TP 
75 \fBEFAULT\fP
76 \fIoldpath\fP や \fInewpath\fP がアクセス可能なアドレス空間の外を指している。
77 .TP 
78 \fBEIO\fP
79 I/O エラーが発生した。
80 .TP 
81 \fBELOOP\fP
82 \fIoldpath\fP または \fInewpath\fP を解決する際に遭遇したシンボリックリンクが多過ぎる。
83 .TP 
84 \fBEMLINK\fP
85 \fIoldpath\fP によって参照されるファイルは 既に最大数までのリンクを持っている。
86 .TP 
87 \fBENAMETOOLONG\fP
88 \fIoldpath\fP または \fInewpath\fP が長過ぎる。
89 .TP 
90 \fBENOENT\fP
91 \fIoldpath\fP または \fInewpath\fP のディレクトリ部分が存在しないか、 壊れた(dangling)シンボリックリンクである。
92 .TP 
93 \fBENOMEM\fP
94 十分なカーネルメモリーがない。
95 .TP 
96 \fBENOSPC\fP
97 そのファイルを含んでいるデバイスに新しいディレクトリエントリを 作成するための空きがない。
98 .TP 
99 \fBENOTDIR\fP
100 \fIoldpath\fP または \fInewpath\fP のディレクトリ部分が、実際には、ディレクトリでない。
101 .TP 
102 \fBEPERM\fP
103 \fIoldpath\fP がディレクトリである。
104 .TP 
105 \fBEPERM\fP
106 \fIoldpath\fP と \fInewpath\fP を含んでいるファイルシステムがハードリンクをサポートしていない。
107 .TP 
108 \fBEPERM\fP (Linux 3.6 以降)
109 呼び出し元にこのファイルへのハードリンクを作成する許可がなかった (\fBproc\fP(5) の
110 \fI/proc/sys/fs/protected_hardlink\fP の説明を参照)。
111 .TP 
112 \fBEROFS\fP
113 ファイルが読み込み専用のファイルシステムに存在する。
114 .TP 
115 \fBEXDEV\fP
116 \fIoldpath\fP と \fInewpath\fP が同じマウントされたファイルシステムに存在しない。 (Linux は 1
117 つのファイルシステムを複数のマウント位置に マウントすることを許可している。 しかし \fBlink\fP()  は、たとえ同じファイルシステムであっても、
118 別々のマウント位置を跨いでは動作しない。)
119 .SH 準拠
120 .\" SVr4 documents additional ENOLINK and
121 .\" EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
122 .\" X/OPEN does not document EFAULT, ENOMEM or EIO.
123 SVr4, 4.3BSD, POSIX.1\-2001 (但し「注意」を参照)。
124 .SH 注意
125 \fBlink\fP()  でファイルシステムを超えてハードリンクを作成することはできない。 このような場合は \fBsymlink\fP(2)  を使用すること。
126
127 .\" more precisely: since kernel 1.3.56
128 .\" For example, the default Solaris compilation environment
129 .\" behaves like Linux, and contributors to a March 2005
130 .\" thread in the Austin mailing list reported that some
131 .\" other (System V) implementations did/do the same -- MTK, Apr 05
132 POSIX.1\-2001 では、 \fIoldpath\fP がシンボリックリンクである場合、 \fBlink\fP()  は \fIoldpath\fP
133 の参照を解決すべきであると記述されている。 しかし、カーネル 2.0 以降の Linux ではそのようになっていない。 \fIoldpath\fP
134 がシンボリックリンクである場合、 \fInewpath\fP は同じシンボリックリンクファイルへの (ハード) リンクとして作成される (つまり
135 \fInewpath\fP は \fIoldpath\fP が参照していた同じファイルへのシンボリックリンクになる)。 他のいくつかの実装でも Linux
136 と同じように動作する。 POSIX.1\-2008 では \fBlink\fP()  の仕様が変更され、 \fIoldpath\fP
137 がシンボリックリンクの場合にシンボリックリンクの参照を 解決するかどうかは実装依存となった。
138 リンク作成時のシンボリックリンクの扱いについての詳細な制御に 関しては \fBlinkat\fP(2)  を参照のこと。
139 .SH バグ
140 NFS ファイルシステムでは、NFS サーバーがリンクを作成した後に、 それを伝える前に死んだ場合には返り値が不正な場合がある。
141 リンクが作成できたかどうか見つけるためには \fBstat\fP(2)  を使用すること。
142 .SH 関連項目
143 \fBln\fP(1), \fBlinkat\fP(2), \fBopen\fP(2), \fBrename\fP(2), \fBstat\fP(2), \fBsymlink\fP(2),
144 \fBunlink\fP(2), \fBpath_resolution\fP(7), \fBsymlink\fP(7)
145 .SH この文書について
146 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
147 である。プロジェクトの説明とバグ報告に関する情報は
148 http://www.kernel.org/doc/man\-pages/ に書かれている。