summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>2000-03-23 22:09:40 +0000
committerDavid Leonard <d@cvs.openbsd.org>2000-03-23 22:09:40 +0000
commitd67a85516067d0dac47c359d0efe714b743ac778 (patch)
treee521a4fb2e6eabe327d1ece463e923433e8f27bb /lib/libc/gen
parenta1e87d3b0bd42349559131d21b2808184d268bd2 (diff)
readdir_r. ok aaron@
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/directory.329
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3
index dea7a5f60c3..0518a2d8732 100644
--- a/lib/libc/gen/directory.3
+++ b/lib/libc/gen/directory.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: directory.3,v 1.10 1999/07/09 13:35:16 aaron Exp $
+.\" $OpenBSD: directory.3,v 1.11 2000/03/23 22:09:39 d Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -37,6 +37,7 @@
.Sh NAME
.Nm opendir ,
.Nm readdir ,
+.Nm readdir_r ,
.Nm telldir ,
.Nm seekdir ,
.Nm rewinddir ,
@@ -50,6 +51,8 @@
.Fn opendir "const char *filename"
.Ft struct dirent *
.Fn readdir "DIR *dirp"
+.Ft int
+.Fn readdir_r "DIR *dirp" "struct dirent *entry" "struct dirent **result"
.Ft long
.Fn telldir "const DIR *dirp"
.Ft void
@@ -90,6 +93,30 @@ upon reaching the end of the directory or detecting an invalid
operation.
.Pp
The
+.Fn readdir_r
+function (much like
+.Fn readdir )
+initalizes the dirent structure referenced by
+.Fa entry
+to represent the next directory entry in the named directory stream
+.Fa dirp ,
+and stores a pointer to this structure at the location referenced by
+.Fa result .
+The storage pointed to by
+.Fa entry
+must be large enough for a dirent with a
+.Fa d_name
+array member containing at least
+.Dv NAME_MAX
+plus one elements.
+On successful return, the pointer returned at
+.Fa "*result"
+will have the same value as the argument
+.Fa entry .
+Upon reaching the end of the directory stream, this pointer shall have the value
+.Dv NULL.
+.Pp
+The
.Fn telldir
function
returns the current location associated with the named