.\" Copyright (C) 2002 Andries Brouwer (aeb@cwi.nl) .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2002-2003 Yuichi SATO .\" all rights reserved. .\" Translated Mon May 6 21:32:36 JST 2002 .\" by Yuichi SATO .\" Updated & Modified Sun Sep 7 01:23:08 JST 2003 .\" by Yuichi SATO .\" .TH DIRFD 3 2013\-07\-05 Linux "Linux Programmer's Manual" .SH 名前 dirfd \- ディレクトリストリームのファイルディスクリプタを取得する .SH 書式 \fB#include \fP .br \fB#include \fP .sp \fBint dirfd(DIR *\fP\fIdirp\fP\fB);\fP .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBdirfd\fP(): .br .RS 4 .PD 0 .ad l _BSD_SOURCE || _SVID_SOURCE .br || /* glibc 2.10 以降: */ .RS 4 (_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700) .RE .PD .RE .ad .SH 説明 関数 \fBdirfd\fP() はディレクトリストリーム \fIdirp\fP に関連づけられたファイルディスクリプタを返す。 .LP このディスクリプタはディレクトリストリームが内部で使用するものである。 よって、ファイルの位置に依存せず、かつその位置を変更しない関数 \fBfstat\fP(2) や \fBfchdir\fP(2) などでしか役に立たない。 このディスクリプタは \fBclosedir\fP(3) が呼ばれたときに自動的にクローズされる。 .SH 返り値 成功すると、負でない値のファイルディスクリプタが返される。 エラーの場合は \-1 が返され、 \fIerrno\fP にエラーの原因を示す値が設定される。 .SH エラー .\" glibc 2.8 POSIX.1\-2008 では 2 つのエラーが規定されている。 現在の実装ではどちらのエラーも返されない。 .TP \fBEINVAL\fP \fIdirp\fP が有効なディレクトリストリームを参照していない。 .TP \fBENOTSUP\fP この実装では、ファイルディスクリプタのディレクトリとの関連付けが サポートされていない。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" \fBdirfd\fP() 関数はスレッドセーフである。 .SH 準拠 .\" It is present in libc5 (since 5.1.2) and in glibc2. POSIX.1\-2008. この関数は BSD 拡張であった。 4.3BSD\-Reno には存在するが、4.2BSD には存在しない。 .SH 注意 \fBdirfd\fP() のプロトタイプが使用可能なのは、 \fB_BSD_SOURCE\fP または \fB_SVID_SOURCE\fP が定義されたときのみである。 .SH 関連項目 \fBopen\fP(2), \fBclosedir\fP(3), \fBopendir\fP(3), \fBreaddir\fP(3), \fBrewinddir\fP(3), \fBscandir\fP(3), \fBseekdir\fP(3), \fBtelldir\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。