OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man2 / link.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\"                               1993 Michael Haardt, Ian Jackson.
5 .\"
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 .\"
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 .TH LINK 2 2008\-08\-21 Linux "Linux Programmer's Manual"
37 .SH 名前
38 link \- ファイルの新しい名前を作成する
39 .SH 書式
40 \fB#include <unistd.h>\fP
41 .sp
42 \fBint link(const char *\fP\fIoldpath\fP\fB, const char *\fP\fInewpath\fP\fB);\fP
43 .SH 説明
44 \fBlink\fP()  は存在するファイルへの新しいリンク (link)  (ハード・リンク (hard link) ともいう) を作成する。
45
46 \fInewpath\fP が存在する場合には上書きは\fIされない\fP。
47
48 この新しい名前は全ての操作において古い名前と完全に同じように使用される; 両方の名前は同じファイルを参照しており (それで同じ許可
49 (permission) や所有者 (ownership) となるので)、 どちらの名前が本来のものであるか判別できない。
50 .SH 返り値
51 成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
52 .SH エラー
53 .TP 
54 \fBEACCES\fP
55 \fInewpath\fP を含んでいるディレクトリへの書き込みが許されていないか、 \fIoldpath\fP または \fInewpath\fP
56 へのディレクトリのどれかに検索許可がない (\fBpath_resolution\fP(7)  を参照)。
57 .TP 
58 \fBEEXIST\fP
59 \fInewpath\fP が既に存在する。
60 .TP 
61 \fBEFAULT\fP
62 \fIoldpath\fP や \fInewpath\fP がアクセス可能なアドレス空間の外を指している。
63 .TP 
64 \fBEIO\fP
65 I/O エラーが発生した。
66 .TP 
67 \fBELOOP\fP
68 \fIoldpath\fP または \fInewpath\fP を解決する際に遭遇したシンボリック・リンクが多過ぎる。
69 .TP 
70 \fBEMLINK\fP
71 \fIoldpath\fP によって参照されるファイルは 既に最大数までのリンクを持っている。
72 .TP 
73 \fBENAMETOOLONG\fP
74 \fIoldpath\fP または \fInewpath\fP が長過ぎる。
75 .TP 
76 \fBENOENT\fP
77 \fIoldpath\fP または \fInewpath\fP のディレクトリ部分が存在しないか、 壊れた(dangling)シンボリック・リンクである。
78 .TP 
79 \fBENOMEM\fP
80 十分なカーネルメモリーがない。
81 .TP 
82 \fBENOSPC\fP
83 そのファイルを含んでいるデバイスに新しいディレクトリ・エントリを 作成するための空きがない。
84 .TP 
85 \fBENOTDIR\fP
86 \fIoldpath\fP または \fInewpath\fP のディレクトリ部分が、実際には、ディレクトリでない。
87 .TP 
88 \fBEPERM\fP
89 \fIoldpath\fP がディレクトリである。
90 .TP 
91 \fBEPERM\fP
92 \fIoldpath\fP と \fInewpath\fP を含んでいるファイル・システムがハード・リンクをサポートしていない。
93 .TP 
94 \fBEROFS\fP
95 ファイルが読み込み専用のファイル・システムに存在する。
96 .TP 
97 \fBEXDEV\fP
98 \fIoldpath\fP と \fInewpath\fP が同じマウントされたファイル・システムに存在しない。 (Linux は 1
99 つのファイル・システムを複数のマウント位置に マウントすることを許可している。 しかし \fBlink\fP()
100 は、たとえ同じファイル・システムであっても、 別々のマウント位置を跨いでは動作しない。)
101 .SH 準拠
102 .\" SVr4 documents additional ENOLINK and
103 .\" EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
104 .\" X/OPEN does not document EFAULT, ENOMEM or EIO.
105 SVr4, 4.3BSD, POSIX.1\-2001 (但し「注意」を参照)。
106 .SH 注意
107 \fBlink\fP()  でファイル・システムを超えてハード・リンクを作成することはできない。 このような場合は \fBsymlink\fP(2)
108 を使用すること。
109
110 .\" more precisely: since kernel 1.3.56
111 .\" For example, the default Solaris compilation environment
112 .\" behaves like Linux, and contributors to a March 2005
113 .\" thread in the Austin mailing list reported that some
114 .\" other (System V) implementations did/do the same -- MTK, Apr 05
115 POSIX.1\-2001 では、 \fIoldpath\fP がシンボリック・リンクである場合、 \fBlink\fP()  は \fIoldpath\fP
116 の参照を解決すべきであると記述されている。 しかし、カーネル 2.0 以降の Linux ではそのようになっていない。 \fIoldpath\fP
117 がシンボリック・リンクである場合、 \fInewpath\fP は同じシンボリック・リンクファイルへの (ハード) リンクとして作成される (つまり
118 \fInewpath\fP は \fIoldpath\fP が参照していた同じファイルへのシンボリックリンクになる)。 他のいくつかの実装でも Linux
119 と同じように動作する。 POSIX.1\-2008 では \fBlink\fP()  の仕様が変更され、 \fIoldpath\fP
120 がシンボリック・リンクの場合にシンボリック・リンクの参照を 解決するかどうかは実装依存となった。
121 リンク作成時のシンボリック・リンクの扱いについての詳細な制御に 関しては \fBlinkat\fP(2)  を参照のこと。
122 .SH バグ
123 NFS ファイル・システムでは、NFS サーバーがリンクを作成した後に、 それを伝える前に死んだ場合には返り値が不正な場合がある。
124 リンクが作成できたかどうか見つけるためには \fBstat\fP(2)  を使用すること。
125 .SH 関連項目
126 \fBln\fP(1), \fBlinkat\fP(2), \fBopen\fP(2), \fBrename\fP(2), \fBstat\fP(2), \fBsymlink\fP(2),
127 \fBunlink\fP(2), \fBpath_resolution\fP(7), \fBsymlink\fP(7)