1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
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.
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.
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
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
26 .\" all rights reserved.
27 .\" Translated 2006-09-27 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39
29 .TH OPENAT 2 2009-12-13 "Linux" "Linux Programmer's Manual"
31 openat \- ディレクトリファイルディスクリプタから相対的な位置にあるファイルをオープンする
36 .BI "int openat(int " dirfd ", const char *" pathname ", int " flags );
37 .BI "int openat(int " dirfd ", const char *" pathname ", int " flags \
43 .RB ( feature_test_macros (7)
53 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
62 システムコールは、この man ページで説明している違いがある以外は、
70 で参照されるディレクトリからの相対パス名として解釈される
72 では、相対パスは呼び出し元プロセスのカレントワーキングディレクトリからの
85 カレントワーキングディレクトリからの相対パス名として解釈される。
114 がディレクトリ以外のファイルを参照するファイルディスクリプタである。
117 は Linux カーネル 2.6.16 で追加された。
120 Solaris には、これと同じようなシステムコールが存在する。
121 .\" The 'at' suffix in Solaris is actually double sensed. It
122 .\" primarily referred to "extended *at*tributes", which are
123 .\" handled by Solaris' O_XATTR flag, but was also intended
124 .\" to refer to the notion of "at a relative location".
126 .\" See the following for a discussion of the inconsistent
127 .\" naming of the *at() functions:
128 .\" http://www.opengroup.org/austin/mailarchives/ag/msg09103.html
129 .\" Subject: RE: The naming of at()s is a difficult matter
131 .\" Date: Tue, 14 Feb 2006 14:56:50 -0800 (PST)
135 や "at" が後ろに付いたその他の同様のシステムコールは、
139 カレントワーキングディレクトリ以外のディレクトリにあるファイル群を
141 でオープンするときに起こる可能性がある競合状態 (race condition) を、
143 によってアプリケーションが回避できるためである。
147 (/ で区切られた) いくつかの構成要素 (をオープンする処理) が、
149 を並列に呼び出す処理に変換された場合に起こる。
150 このような競合は、対象ディレクトリのファイルディスクリプタをオープンし、
158 アプリケーションによって管理されるファイルディスクリプタ (群) を使うことで、
160 がスレッド毎のいわゆる「カレントワーキングディレクトリ」を実装できるためである。
162 .IR /proc/self/fd/ dirfd
163 を使った裏技でも実現できるが、あまり効率的ではない)。
180 .BR path_resolution (7)