|
|
1.1 root 1: .TH GETDENTS 2 "Standard Extension"
2: .SH NAME
3: getdents \- get directory entries in a file system independent format
4: .SH SYNOPSIS
5: .B "#include <sys/types.h>"
6: .br
7: .B "#include <sys/dirent.h>"
8: .P
9: .B "int getdents (fildes, buf, nbyte)"
10: .br
11: .B "int fildes;"
12: .br
13: .B "char \(**buf;"
14: .br
15: .B "unsigned nbyte;"
16: .SH DESCRIPTION
17: .I Fildes
18: is a file descriptor obtained from an
19: .IR open (2)
20: or
21: .IR dup (2)
22: system call.
23: .P
24: .I Getdents
25: attempts to read
26: .I nbyte
27: bytes from the directory associated with
28: .I fildes
29: and to format them as
30: file system independent entries
31: in the buffer pointed to by
32: .IR buf .
33: Since the file system independent directory entries
34: are of variable length,
35: in most cases the actual number of bytes returned
36: will be less than
37: .IR nbyte .
38: .P
39: The file system independent directory entry is specified by the
40: .I dirent
41: structure.
42: For a description of this see
43: .IR dirent (4).
44: .P
45: On devices capable of seeking,
46: .I getdents
47: starts at a position in the file given by
48: the file pointer associated with
49: .IR fildes .
50: Upon return from
51: .IR getdents ,
52: the file pointer has been incremented
53: to point to the next directory entry.
54: .P
55: This system call was developed in order to implement the
56: .I readdir
57: routine
58: [for a description see
59: .IR directory (3C)]
60: and should not be used for other purposes.
61: .SH "SEE ALSO"
62: directory(3C), dirent(4).
63: .SH DIAGNOSTICS
64: Upon successful completion
65: a non-negative integer is returned
66: indicating the number of bytes of
67: .I buf\^
68: actually filled.
69: (This need not be the number actually used
70: in the actual directory file.)\|\|
71: A value of zero
72: indicates the end of the directory has been reached.
73: If
74: .I getdents
75: fails for any other reason,
76: a value of \-1 is returned and
77: the external integer variable
78: .I errno
79: is set to indicate the error.
80: .SH WARNINGS
81: Entries for "." and ".."
82: may not be reported for some file system types.
83: .P
84: The exact set of
85: .I errno
86: values and meanings may vary among implementations.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.