2 .\" Copyright 1989 AT&T Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH GETDENTS 2 "Jul 17, 2001"
8 getdents \- read directory entries and put in a file system independent format
14 \fBint\fR \fBgetdents\fR(\fBint\fR \fIfildes\fR, \fBstruct dirent *\fR\fIbuf\fR, \fBsize_t\fR \fInbyte\fR);
20 The \fBgetdents()\fR function attempts to read \fInbyte\fR bytes from the
21 directory associated with the file descriptor \fIfildes\fR and to format them
22 as file system independent directory entries in the buffer pointed to by
23 \fIbuf\fR. Since the file system independent directory entries are of variable
24 lengths, in most cases the actual number of bytes returned will be less than
25 \fInbyte\fR. The file system independent directory entry is specified by the
26 \fBdirent\fR structure. See \fBdirent.h\fR(3HEAD).
29 On devices capable of seeking, \fBgetdents()\fR starts at a position in the
30 file given by the file pointer associated with \fIfildes\fR. Upon return from
31 \fBgetdents()\fR, the file pointer is incremented to point to the next
36 Upon successful completion, a non-negative integer is returned indicating the
37 number of bytes actually read. A return value of \fB0\fR indicates the end of
38 the directory has been reached. Otherwise, \fB\(mi1\fR is returned and
39 \fBerrno\fR is set to indicate the error.
43 The \fBgetdents()\fR function will fail if:
50 The \fIfildes\fR argument is not a valid file descriptor open for reading.
59 The \fIbuf\fR argument points to an illegal address.
68 The \fInbyte\fR argument is not large enough for one directory entry.
77 An I/O error occurred while accessing the file system.
86 The current file pointer for the directory is not located at a valid entry.
95 The \fIfildes\fR argument points to a remote machine and the link to that
96 machine is no longer active.
105 The \fIfildes\fR argument is not a directory.
111 \fB\fBEOVERFLOW\fR\fR
114 The value of the \fBdirent\fR structure member \fBd_ino\fR or \fBd_off\fR
115 cannot be represented in an \fBino_t\fR or \fBoff_t\fR.
121 The \fBgetdents()\fR function was developed to implement the \fBreaddir\fR(3C)
122 function and should not be used for other purposes.
125 The \fBgetdents()\fR function has a transitional interface for 64-bit file
126 offsets. See \fBlf64\fR(5).
130 \fBreaddir\fR(3C), \fBdirent.h\fR(3HEAD), \fBlf64\fR(5)