summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMike Pritchard <mpp@FreeBSD.org>1999-07-30 11:33:41 +0000
committerMike Pritchard <mpp@FreeBSD.org>1999-07-30 11:33:41 +0000
commit079baedc49c2ce8148f969c20d6c21a088844968 (patch)
treee8e2c3e5601e8b8179d69d94d99a958f8eb71fb9 /lib/libc
parent125a2a96ffdc4a2c7214e495f97772ba5fe670e6 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/Makefile.inc3
-rw-r--r--lib/libc/sys/getdirentries.238
2 files changed, 28 insertions, 13 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 0df2efbe8ef7..27534b7afc99 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
-# $Id: Makefile.inc,v 1.57.2.2 1999/07/30 09:05:42 mpp Exp $
+# $Id: Makefile.inc,v 1.57.2.3 1999/07/30 10:09:28 mpp Exp $
# sys sources
.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/sys ${.CURDIR}/../libc/sys
@@ -107,6 +107,7 @@ MLINKS+=chflags.2 fchflags.2
MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2
MLINKS+=chown.2 fchown.2 chown.2 lchown.2
MLINKS+=clock_gettime.2 clock_getres.2 clock_gettime.2 clock_settime.2
+MLINKS+=getdirentries.2 getdents.2
MLINKS+=getgid.2 getegid.2
MLINKS+=getitimer.2 setitimer.2
MLINKS+=getlogin.2 setlogin.2
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
index 329b6502b3a7..f9093697127d 100644
--- a/lib/libc/sys/getdirentries.2
+++ b/lib/libc/sys/getdirentries.2
@@ -35,16 +35,22 @@
.Dt GETDIRENTRIES 2
.Os
.Sh NAME
-.Nm getdirentries
+.Nm getdirentries ,
+.Nm getdents
.Nd "get directory entries in a filesystem independent format"
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <dirent.h>
.Ft int
.Fn getdirentries "int fd" "char *buf" "int nbytes" "long *basep"
+.Ft int
+.Fn getdents "int fd" "char *buf" "int nbytes"
.Sh DESCRIPTION
-.Fn Getdirentries
-reads directory entries from the directory
+The
+.Fn getdirentries
+and
+.Fn getdents
+functions read directory entries from the directory
referenced by the file descriptor
.Fa fd
into the buffer pointed to by
@@ -53,13 +59,13 @@ in a filesystem independent format.
Up to
.Fa nbytes
of data will be transferred.
-.Fa Nbytes
-must be greater than or equal to the
+The
+.Fa nbytes
+argument must be greater than or equal to the
block size associated with the file,
see
.Xr stat 2 .
-Some filesystems may not support
-.Fn getdirentries
+Some filesystems may not support these functions
with buffers smaller than this size.
.Pp
The data in the buffer is a series of
@@ -113,19 +119,23 @@ The current position pointer associated with
.Fa fd
is set to point to the next block of entries.
The pointer may not advance by the number of bytes returned by
-.Fn getdirentries .
+.Fn getdirentries
+or
+.Fn getdents .
A value of zero is returned when
the end of the directory has been reached.
.Pp
-.Fn Getdirentries
-writes the position of the block read into the location pointed to by
+The
+.Fn getdirentries
+function writes the position of the block read into the location pointed to by
.Fa basep .
Alternatively, the current position pointer may be set and retrieved by
.Xr lseek 2 .
The current position pointer should only be set to a value returned by
.Xr lseek 2 ,
a value returned in the location pointed to by
-.Fa basep ,
+.Fa basep ( Ns Fn getdirentries
+only)
or zero.
.Sh IMPLEMENTATION NOTES
.Pp
@@ -157,7 +167,7 @@ is set to indicate the error.
.Sh ERRORS
.Fn Getdirentries
will fail if:
-.Bl -tag -width [EFAULT]
+.Bl -tag -width Er
.It Bq Er EBADF
.Fa fd
is not a valid file descriptor open for reading.
@@ -187,3 +197,7 @@ The
.Fn getdirentries
function first appeared in
.Bx 4.4 .
+The
+.Fn getdents
+function first appeared in
+.Fx 3.0 .