summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/opendir.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2000-12-11 04:00:36 +0000
committerdeischen <deischen@FreeBSD.org>2000-12-11 04:00:36 +0000
commit45428979ecbb7d5c9a2ca5dc110aee85e48d7de2 (patch)
tree4ff93d9c2aa5d2573156e1b352a4574235595006 /lib/libc/gen/opendir.c
parentdb0edd3c391b9475070b42d03b53f9a058882b13 (diff)
downloadFreeBSD-src-45428979ecbb7d5c9a2ca5dc110aee85e48d7de2.zip
FreeBSD-src-45428979ecbb7d5c9a2ca5dc110aee85e48d7de2.tar.gz
Move telldir position recording type definitions and prototypes
to "telldir.h" in order to prevent namespace pollution in <dirent.h> (which was including <sys/queue.h>). Add $FreeBSD$ to rewinddir.c and seekdir.c.
Diffstat (limited to 'lib/libc/gen/opendir.c')
-rw-r--r--lib/libc/gen/opendir.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 90aaec3..bd7fc82 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -47,6 +47,8 @@ static char sccsid[] = "@(#)opendir.c 8.8 (Berkeley) 5/1/95";
#include <stdlib.h>
#include <unistd.h>
+#include "telldir.h"
+
/*
* Open a directory.
*/
@@ -90,9 +92,13 @@ __opendir2(name, flags)
goto fail;
}
if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
- (dirp = malloc(sizeof(DIR))) == NULL)
+ (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
goto fail;
+ dirp->dd_td = (void *)dirp + sizeof(DIR);
+ LIST_INIT(&dirp->dd_td->td_locq);
+ dirp->dd_td->td_loccnt = 0;
+
/*
* Use the system page size if that is a multiple of DIRBLKSIZ.
* Hopefully this can be a big win someday by allowing page
@@ -259,8 +265,6 @@ __opendir2(name, flags)
dirp->dd_loc = 0;
dirp->dd_fd = fd;
dirp->dd_flags = flags;
- dirp->dd_loccnt = 0;
- LIST_INIT(&dirp->dd_locq);
/*
* Set up seek point for rewinddir.
OpenPOWER on IntegriCloud