OSDN Git Service

f64aeaca05479aa0bd1f656c1bd9c17e5e6043d2
[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 The user's quota of disk blocks on the filesystem has been exhausted.
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 The filesystem containing \fIoldpath\fP and \fInewpath\fP does not support the
107 creation of hard links.
108 .TP 
109 \fBEPERM\fP (Linux 3.6 以降)
110 呼び出し元にこのファイルへのハードリンクを作成する許可がなかった (\fBproc\fP(5) の
111 \fI/proc/sys/fs/protected_hardlink\fP の説明を参照)。
112 .TP 
113 \fBEROFS\fP
114 The file is on a read\-only filesystem.
115 .TP 
116 \fBEXDEV\fP
117 \fIoldpath\fP and \fInewpath\fP are not on the same mounted filesystem.  (Linux
118 permits a filesystem to be mounted at multiple points, but \fBlink\fP()  does
119 not work across different mount points, even if the same filesystem is
120 mounted on both.)
121 .SH 準拠
122 .\" SVr4 documents additional ENOLINK and
123 .\" EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
124 .\" X/OPEN does not document EFAULT, ENOMEM or EIO.
125 SVr4, 4.3BSD, POSIX.1\-2001 (但し「注意」を参照)。
126 .SH 注意
127 Hard links, as created by \fBlink\fP(), cannot span filesystems.  Use
128 \fBsymlink\fP(2)  if this is required.
129
130 .\" more precisely: since kernel 1.3.56
131 .\" For example, the default Solaris compilation environment
132 .\" behaves like Linux, and contributors to a March 2005
133 .\" thread in the Austin mailing list reported that some
134 .\" other (System V) implementations did/do the same -- MTK, Apr 05
135 POSIX.1\-2001 では、 \fIoldpath\fP がシンボリックリンクである場合、 \fBlink\fP()  は \fIoldpath\fP
136 の参照を解決すべきであると記述されている。 しかし、カーネル 2.0 以降の Linux ではそのようになっていない。 \fIoldpath\fP
137 がシンボリックリンクである場合、 \fInewpath\fP は同じシンボリックリンクファイルへの (ハード) リンクとして作成される (つまり
138 \fInewpath\fP は \fIoldpath\fP が参照していた同じファイルへのシンボリックリンクになる)。 他のいくつかの実装でも Linux
139 と同じように動作する。 POSIX.1\-2008 では \fBlink\fP()  の仕様が変更され、 \fIoldpath\fP
140 がシンボリックリンクの場合にシンボリックリンクの参照を 解決するかどうかは実装依存となった。
141 リンク作成時のシンボリックリンクの扱いについての詳細な制御に 関しては \fBlinkat\fP(2)  を参照のこと。
142 .SH バグ
143 On NFS filesystems, the return code may be wrong in case the NFS server
144 performs the link creation and dies before it can say so.  Use \fBstat\fP(2)
145 to find out if the link got created.
146 .SH 関連項目
147 \fBln\fP(1), \fBlinkat\fP(2), \fBopen\fP(2), \fBrename\fP(2), \fBstat\fP(2), \fBsymlink\fP(2),
148 \fBunlink\fP(2), \fBpath_resolution\fP(7), \fBsymlink\fP(7)
149 .SH この文書について
150 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
151 である。プロジェクトの説明とバグ報告に関する情報は
152 http://www.kernel.org/doc/man\-pages/ に書かれている。