.\" Copyright (C) 1995 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 .\" .\" Written 11 June 1995 by Andries Brouwer .\" Modified 22 July 1995 by Michael Chastain : .\" In 1.3.X, returns only one entry each time; return value is different. .\" Modified 2004-12-01, mtk, fixed headers listed in SYNOPSIS .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated Sun Feb 23 21:06:24 JST 1997 .\" by HANATAKA Shinya .\" Updated 2013-05-01, Akihiro MOTOKI .\" Updated 2013-07-22, Akihiro MOTOKI .\" .TH READDIR 2 2013\-06\-21 Linux "Linux Programmer's Manual" .SH 名前 readdir \- ディレクトリエントリーを読み込む .SH 書式 .nf .sp \fBint readdir(unsigned int \fP\fIfd\fP\fB, struct old_linux_dirent *\fP\fIdirp\fP\fB,\fP \fB unsigned int \fP\fIcount\fP\fB);\fP .fi \fI注\fP: このシステムコールには glibc のラッパー関数は存在しない。「注意」の節を参照。 .SH 説明 これはあなたの興味をもっている関数ではない。 POSIX 準拠の C ライブラリインターフェースについては \fBreaddir\fP(3) を見ること。 このページは裸のカーネルのシステムコールインターフェースについて 記述しているが、このインターフェースは \fBgetdents\fP(2) によって取って代わられた。 .PP \fBreaddir\fP() は、ファイルディスクリプター \fIfd\fP が参照しているディレクトリから \fIold_linux_dirent\fP 構造体を読み込み、 \fIdirp\fP で指されたバッファーに格納する。 \fIcount\fP 引き数は(ほとんどの \fIold_linux_dirent\fP 構造体の読み込みにおいて)無視される .PP \fIold_linux_dirent\fP 構造体は以下のように宣言される: .PP .in +4n .nf struct old_linux_dirent { long d_ino; /* inode number */ off_t d_off; /* offset to this \fIold_linux_dirent\fP */ unsigned short d_reclen; /* length of this \fId_name\fP */ char d_name[NAME_MAX+1]; /* filename (null\-terminated) */ } .fi .in .PP \fId_ino\fP は inode 番号である。 \fId_off\fP はディレクトリの最初からこの \fIold_linux_dirent\fP まで距離である。 \fId_reclen\fP は \fId_name\fP の大きさで、終端のヌルバイト (\(aq\e0\(aq) を含まない。 \fId_name\fP はヌルバイトで終わるファイル名である。 .SH 返り値 成功した場合は、1 が返される。 ディレクトリの最後では 0 が返される。 エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。 .SH エラー .TP \fBEBADF\fP ファイルディスクリプター \fIfd\fP が不正である。 .TP \fBEFAULT\fP 引き数が呼び出したプロセスのアドレス空間外を指している。 .TP \fBEINVAL\fP 結果用のバッファーが小さすぎる。 .TP \fBENOENT\fP そのようなディレクトリは存在しない。 .TP \fBENOTDIR\fP ファイルディスクリプターがディレクトリを参照していない。 .SH 準拠 このシステムコールは Linux 特有である。 .SH 注意 glibc はこのシステムコールに対するラッパー関数を提供していない。 \fBsyscall\fP(2) を使って呼び出すこと。 \fIold_linux_dirent\fP 構造体を自分自身で定義する必要がある。しかし、たいていはこのシステムコールではなく \fBreaddir\fP(3) を使うべき場面のことが多い。 このシステムコールは x86\-64 では存在しない。 .SH 関連項目 \fBgetdents\fP(2), \fBreaddir\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。