Loading...
--- Libc/Libc-1725.40.4/gen/FreeBSD/rewinddir.c
+++ Libc/Libc-320/gen/FreeBSD/rewinddir.c
@@ -10,6 +10,10 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,37 +35,18 @@
static char sccsid[] = "@(#)rewinddir.c 8.1 (Berkeley) 6/8/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libc/gen/rewinddir.c,v 1.5 2002/02/01 00:57:29 obrien Exp $");
-#include "namespace.h"
#include <sys/types.h>
#include <dirent.h>
-#include <pthread.h>
-#include <unistd.h>
-#include "un-namespace.h"
-#include "libc_private.h"
#include "telldir.h"
void
-rewinddir(DIR *dirp)
+rewinddir(dirp)
+ DIR *dirp;
{
- if (__isthreaded)
- _pthread_mutex_lock(&dirp->dd_lock);
- dirp->dd_flags &= ~(__DTF_SKIPREAD | __DTF_ATEND); /* current contents are invalid */
- if (dirp->dd_flags & __DTF_READALL)
- _filldir(dirp, false);
- else {
- (void) lseek(dirp->dd_fd, 0, SEEK_SET);
-#if __DARWIN_64_BIT_INO_T
- dirp->dd_td->seekoff = 0;
-#else /* !__DARWIN_64_BIT_INO_T */
- dirp->dd_seek = 0;
-#endif /* __DARWIN_64_BIT_INO_T */
- }
- dirp->dd_loc = 0;
- _reclaim_telldir(dirp);
- if (__isthreaded)
- _pthread_mutex_unlock(&dirp->dd_lock);
+ _seekdir(dirp, dirp->dd_rewind);
+ dirp->dd_rewind = telldir(dirp);
}