.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" This manpage is Copyright (C) 2006, Michael Kerrisk .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" FIXME: Linux 2.6.39 added AT_EMPTY_PATH .\" .\" Japanese Version Copyright (c) 2006 Yuichi SATO .\" all rights reserved. .\" Translated 2006-09-30 by Yuichi SATO , LDP v2.39 .\" .TH LINKAT 2 2009-12-13 "Linux" "Linux Programmer's Manual" .SH 名前 linkat \- ディレクトリファイルディスクリプタから相対的な位置にファイルリンクを作成する .SH 書式 .nf .B #include /* AT_* 定数の定義 */ .B #include .sp .BI "int linkat(int " olddirfd ", const char *" oldpath , .BI " int " newdirfd ", const char *" newpath ", int " flags ); .fi .sp .in -4n glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR linkat (): .PD 0 .ad l .RS 4 .TP 4 glibc 2.10 以降: _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L .TP glibc 2.10 より前: _ATFILE_SOURCE .RE .ad .PD .SH 説明 .BR linkat () システムコールは、この man ページで説明する違い以外は、 .BR link (2) と全く同じように動作する。 .I oldpath で指定されるパス名が相対パス名である場合、 ファイルディスクリプタ .I olddirfd で参照されるディレクトリからの相対パス名として解釈される .RB ( link (2) では、相対パスは呼び出し元プロセスの カレントワーキングディレクトリからの相対パスとなる)。 .I oldpath が相対パスであり、かつ .I olddirfd が特別な値 .B AT_FDCWD である場合、 .I oldpath は .RB ( link (2) と同じように) 呼び出し元プロセスの カレントワーキングディレクトリからの相対パス名として解釈される。 .I oldpath が絶対パスである場合、 .I olddirfd は無視される。 .I newpath の解釈は .I oldpath と同様であるが、 相対パス名はファイルディスクリプタ .I newdirfd で参照されるディレクトリからの相対パス名として解釈される。 デフォルトでは、 .I oldpath がシンボリック・リンクの場合、 .RB ( link (2) 同様) .BR linkat () は .I oldpath の参照の解決を行わない。 Linux 2.6.18 以降では、 .B AT_SYMLINK_FOLLOW フラグを .I flags に指定することができる。このフラグを指定すると、 .I oldpath がシンボリック・リンクの場合、 .I oldpath の参照の解決を行う。 2.6.18 以前のカーネルでは、 .I flags 引き数は使用されず、 0 を指定しなければならなかった。 .SH 返り値 成功した場合、 .BR linkat () は 0 を返す。 エラーの場合、\-1 が返されて、 .I errno にはエラーを示す値が設定される。 .SH エラー .BR link (2) と同じエラーが .BR linkat () でも起こる。 .BR linkat () では、その他に以下のエラーが起こる: .TP .B EBADF .I olddirfd または .I newdirfd が有効なファイルディスクリプタでない。 .TP .B ENOTDIR .I oldpath が相対パスで、かつ .I olddirfd がディレクトリ以外のファイルを参照するファイルディスクリプタである。 または .I newpath と .I newdirfd について、同様のことが起きている。 .SH バージョン .BR linkat () は Linux カーネル 2.6.16 で追加された。 .SH 準拠 POSIX.1-2008. .SH 注意 .BR linkat () が必要な理由については、 .BR openat (2) を参照すること。 .SH 関連項目 .BR link (2), .BR openat (2), .BR path_resolution (7), .BR symlink (7)