OSDN Git Service

Merge branch 'work-coreutils'
[linuxjm/jm.git] / manual / LDP_man-pages / release / man2 / readdir.2
1 .\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
24 .\" Modified 22 July 1995 by Michael Chastain <mec@duracef.shout.net>:
25 .\"   In 1.3.X, returns only one entry each time; return value is different.
26 .\" Modified 2004-12-01, mtk, fixed headers listed in SYNOPSIS
27 .\"
28 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
29 .\"         all rights reserved.
30 .\" Translated Sun Feb 23 21:06:24 JST 1997
31 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
32 .\"
33 .\"WORD:        directory               ディレクトリ
34 .\"WORD:        entry                   エントリ
35 .\"WORD:        kernel                  カーネル
36 .\"WORD:        system call             システム・コール
37 .\"WORD:        memory                  メモリ
38 .\"WORD:        inode number            inode 番号
39 .\"WORD:        null                    ヌル文字
40 .\"
41 .TH READDIR 2  2008-10-02 "Linux" "Linux Programmer's Manual"
42 .SH 名前
43 readdir \- ディレクトリ・エントリを読み込む
44 .SH 書式
45 .nf
46 .sp
47 .BI "int readdir(unsigned int " fd ", struct old_linux_dirent *" dirp ","
48 .BI "            unsigned int " count );
49 .fi
50 .SH 説明
51 これはあなたの興味をもっている関数ではない。
52 POSIX 準拠の C ライブラリ・インターフェースについては
53 .BR readdir (3)
54 を見ること。
55 このページは裸のカーネルのシステムコール・インターフェースについて
56 記述しているが、このインターフェースは
57 .BR getdents (2)
58 によって取って代わられた。
59 .PP
60 .BR readdir ()
61 は、ファイルディスクリプタ
62 .I fd
63 が参照しているディレクトリから
64 .I old_linux_dirent
65 構造体を読み込み、
66 .I dirp
67 で指されたバッファに格納する。
68 .I count
69 引き数は(ほとんどの
70 .I old_linux_dirent
71 構造体の読み込みにおいて)無視される
72 .PP
73 .I old_linux_dirent
74 構造体は以下のように宣言される:
75 .PP
76 .in +4n
77 .nf
78 struct old_linux_dirent {
79     long  d_ino;              /* inode number */
80     off_t d_off;              /* offset to this \fIold_linux_dirent\fP */
81     unsigned short d_reclen;  /* length of this \fId_name\fP */
82     char  d_name[NAME_MAX+1]; /* filename (null-terminated) */
83 }
84 .fi
85 .in
86 .PP
87 .I d_ino
88 は inode 番号である。
89 .I d_off
90 はディレクトリの最初からこの
91 .I old_linux_dirent
92 まで距離である。
93 .I d_reclen
94
95 .I d_name
96 の大きさで、終端のヌルバイト (null byte) を含まない。
97 .I d_name
98 はヌルバイトで終わるファイル名である。
99 .SH 返り値
100 成功した場合は、1 が返される。
101 ディレクトリの最後では 0 が返される。
102 エラーの場合は \-1 が返され、
103 .I errno
104 が適切に設定される。
105 .SH エラー
106 .TP
107 .B EBADF
108 ファイル・ディスクリプター
109 .I fd
110 が不正である。
111 .TP
112 .B EFAULT
113 引き数のポインターが呼び出したプロセスがアクセス可能な空間の
114 外部を指している。
115 .TP
116 .B EINVAL
117 結果用のバッファーが小さ過ぎる。
118 .TP
119 .B ENOENT
120 そのようなディレクトリは存在しない。
121 .TP
122 .B ENOTDIR
123 ファイル・ディスクリプターがディレクトリを参照していない。
124 .SH 準拠
125 このシステム・コールは Linux 特有である。
126 .SH 注意
127 glibc はこのシステムコールに対するラッパー関数を提供していない。
128 .BR syscall (2)
129 を使って呼び出すこと。
130 .I old_linux_dirent
131 構造体を自分自身で定義する必要がある。
132 .SH 関連項目
133 .BR getdents (2),
134 .BR readdir (3)