Module Name: src
Committed By: jruoho
Date: Wed Apr 14 09:06:00 UTC 2010
Modified Files:
src/lib/libc/sys: getdents.2
Log Message:
Use a list and sort it by the entries in the structure.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/sys/getdents.2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/sys/getdents.2
diff -u src/lib/libc/sys/getdents.2:1.18 src/lib/libc/sys/getdents.2:1.19
--- src/lib/libc/sys/getdents.2:1.18 Mon Dec 26 19:40:15 2005
+++ src/lib/libc/sys/getdents.2 Wed Apr 14 09:06:00 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: getdents.2,v 1.18 2005/12/26 19:40:15 perry Exp $
+.\" $NetBSD: getdents.2,v 1.19 2010/04/14 09:06:00 jruoho Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)getdirentries.2 8.1 (Berkeley) 6/9/93
.\"
-.Dd September 6, 2005
+.Dd April 14, 2010
.Dt GETDENTS 2
.Os
.Sh NAME
@@ -68,10 +68,13 @@
ino_t d_fileno;
uint16_t d_reclen;
uint16_t d_namlen;
-uint8_t d_type;
-char d_name[MAXNAMLEN + 1]; /* see below */
+uint8_t d_type;
+char d_name[MAXNAMLEN + 1];
.Ed
.Pp
+These are:
+.Bl -enum -offset indent
+.It
The
.Fa d_fileno
entry is a number which is unique for each
@@ -83,11 +86,20 @@
If
.Fa d_fileno
is zero, the entry refers to a deleted file.
-.Pp
+.It
The
.Fa d_reclen
entry is the length, in bytes, of the directory record.
-.Pp
+.It
+The
+.Fa d_namlen
+entry specifies the length of the file name excluding the NUL.
+Thus the actual size of
+.Fa d_name
+may vary from 1 to
+.Dv MAXNAMLEN
+\&+ 1.
+.It
The
.Fa d_type
is the type of file, where the following are possible types:
@@ -101,19 +113,11 @@
.Dv DT_SOCK ,
and
.Dv DT_WHT .
-.Pp
+.It
The
-.Fa d_namlen
-entry specifies the length of the file name excluding the null byte.
-Thus the actual size of
.Fa d_name
-may vary from 1 to
-.Dv MAXNAMLEN
-\&+ 1.
-.Pp
-The
-.Fa d_name
-entry contains a null terminated file name.
+entry contains a NUL-terminated file name.
+.El
.Pp
Entries may be separated by extra space.
The
@@ -144,7 +148,7 @@
.Sh ERRORS
.Fn getdents
will fail if:
-.Bl -tag -width Er
+.Bl -tag -width "[EINVAL]"
.It Bq Er EBADF
.Fa fd
is not a valid file descriptor open for reading.