OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man2 / linkat.2
1 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .\"
31 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
32 .\"         all rights reserved.
33 .\" Translated 2006-09-30 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39
34 .\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com>, LDP v3.53
35 .\"
36 .TH LINKAT 2 2013\-07\-21 Linux "Linux Programmer's Manual"
37 .SH 名前
38 linkat \- ディレクトリファイルディスクリプタから相対的な位置にファイルリンクを作成する
39 .SH 書式
40 .nf
41 \fB#include <fcntl.h> /* AT_* 定数の定義 */\fP
42 \fB#include <unistd.h>\fP
43 .sp
44 \fBint linkat(int \fP\fIolddirfd\fP\fB, const char *\fP\fIoldpath\fP\fB,\fP
45 \fB           int \fP\fInewdirfd\fP\fB, const char *\fP\fInewpath\fP\fB, int \fP\fIflags\fP\fB);\fP
46 .fi
47 .sp
48 .in -4n
49 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
50 .in
51 .sp
52 \fBlinkat\fP():
53 .PD 0
54 .ad l
55 .RS 4
56 .TP  4
57 glibc 2.10 以降:
58 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
59 .TP 
60 glibc 2.10 より前:
61 _ATFILE_SOURCE
62 .RE
63 .ad
64 .PD
65 .SH 説明
66 \fBlinkat\fP()  システムコールは、この man ページで説明する違い以外は、 \fBlink\fP(2)  と全く同じように動作する。
67
68 \fIoldpath\fP で指定されるパス名が相対パス名である場合、 ファイルディスクリプタ \fIolddirfd\fP
69 で参照されるディレクトリからの相対パス名として解釈される (\fBlink\fP(2)  では、相対パスは呼び出し元プロセスの
70 カレントワーキングディレクトリからの相対パスとなる)。
71
72 \fIoldpath\fP が相対パスであり、かつ \fIolddirfd\fP が特別な値 \fBAT_FDCWD\fP である場合、 \fIoldpath\fP は
73 (\fBlink\fP(2)  と同じように) 呼び出し元プロセスの カレントワーキングディレクトリからの相対パス名として解釈される。
74
75 \fIoldpath\fP が絶対パスである場合、 \fIolddirfd\fP は無視される。
76
77 \fInewpath\fP の解釈は \fIoldpath\fP と同様であるが、 相対パス名はファイルディスクリプタ \fInewdirfd\fP
78 で参照されるディレクトリからの相対パス名として解釈される。
79
80 \fIflags\fP に以下の値をビット毎の論理和 (OR) で指定することができる。
81 .TP 
82 \fBAT_EMPTY_PATH\fP (Linux 2.6.39 以降)
83 .\" commit 11a7b371b64ef39fc5fb1b6f2218eef7c4d035e3
84 \fIoldpath\fP が空の文字列の場合、 \fIolddirfd\fP が参照するファイルへのリンクを作成する (\fIolddirfd\fP は
85 \fBopen\fP(2) の \fBO_PATH\fP フラグを使って取得することができる)。 この場合、 \fIolddirfd\fP は、
86 ディレクトリだけでなく、任意の種類のファイルを参照することができる。 このフラグを使うためには、 呼び出し側は
87 \fBCAP_DAC_READ_SEARCH\fP ケーパビリティを持っていなければならない。 これは、 UNIX
88 ドメインソケット経由で受信したファイルディスクリプタを使って、 任意のユーザがハードリンクを作成するのを防止するためである (\fBunix\fP(7) の
89 \fBSCM_RIGHTS\fP に関する議論を参照)。
90 .TP 
91  \fBAT_SYMLINK_FOLLOW\fP (since Linux 2.6.18)
92 デフォルトでは、 \fIoldpath\fP がシンボリック・リンクの場合、 (\fBlink\fP(2)  同様)  \fBlinkat\fP()  は
93 \fIoldpath\fP の参照の解決を行わない。 \fBAT_SYMLINK_FOLLOW\fP フラグを \fIflags\fP
94 に指定することができる。このフラグを指定すると、 \fIoldpath\fP がシンボリック・リンクの場合、 \fIoldpath\fP の参照の解決を行う。
95 .PP
96 バージョン 2.6.18 以前のカーネルでは、 \fIflags\fP 引き数は使用されず、 0 を指定しなければならなかった。
97 .SH 返り値
98 成功した場合、 \fBlinkat\fP()  は 0 を返す。 エラーの場合、\-1 が返されて、 \fIerrno\fP にはエラーを示す値が設定される。
99 .SH エラー
100 \fBlink\fP(2)  と同じエラーが \fBlinkat\fP()  でも起こる。 \fBlinkat\fP()  では、その他に以下のエラーが起こる:
101 .TP 
102 \fBEBADF\fP
103 \fIolddirfd\fP または \fInewdirfd\fP が有効なファイルディスクリプタでない。
104 .TP 
105 \fBENOENT\fP
106 \fIflags\fP に \fBAT_EMPTY_PATH\fP が指定されたが、呼び出し側が \fBCAP_DAC_READ_SEARCH\fP
107 ケーパビリティを持っていなかった。
108 .TP 
109 \fBENOTDIR\fP
110 .TP 
111 \fBENOTDIR\fP
112 \fIoldpath\fP が相対パスで、かつ \fIolddirfd\fP がディレクトリ以外のファイルを参照するファイルディスクリプタである。 または
113 \fInewpath\fP と \fInewdirfd\fP について、同様のことが起きている。
114 .SH バージョン
115 \fBlinkat\fP()  は Linux カーネル 2.6.16 で追加された。
116 ライブラリによるサポートは glibc バージョン 2.4 で追加された。
117 .SH 準拠
118 POSIX.1\-2008.
119 .SH 注意
120 \fBlinkat\fP()  が必要な理由については、 \fBopenat\fP(2)  を参照すること。
121 .SH 関連項目
122 \fBlink\fP(2), \fBopenat\fP(2), \fBpath_resolution\fP(7), \fBsymlink\fP(7)
123 .SH この文書について
124 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
125 である。プロジェクトの説明とバグ報告に関する情報は
126 http://www.kernel.org/doc/man\-pages/ に書かれている。