aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2014-07-11 16:16:26 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2014-07-11 16:16:26 +0000
commit9f72c0322cff595213c2087d6d04928f72e23b0d (patch)
treea72bb3c64d43279b6eaf568a4cd2bf9745ccad27 /include
parentfcc34a238c98d30088284e1090fce1bad4409de9 (diff)
downloadsrc-9f72c0322cff595213c2087d6d04928f72e23b0d.tar.gz
src-9f72c0322cff595213c2087d6d04928f72e23b0d.zip
Fix some edge cases with rewinddir():
- In the unionfs case, opendir() and fdopendir() read the directory's full contents and cache it. This cache is not refreshed when rewinddir() is called, so rewinddir() will not notice updates to a directory. Fix this by splitting the code to fetch a directory's contents out of __opendir_common() into a new _filldir() function and call this from rewinddir() when operating on a unionfs directory. - If rewinddir() is called on a directory opened with fdopendir() before any directory entries are fetched, rewinddir() will not adjust the seek location of the backing file descriptor. If the file descriptor passed to fdopendir() had a non-zero offset, the rewinddir() will not rewind to the beginning. Fix this by always seeking back to 0 in rewinddir(). This means the dd_rewind hack can also be removed. While here, add missing locking to rewinddir(). CR: https://phabric.freebsd.org/D312 Reviewed by: jilles MFC after: 1 week
Notes
Notes: svn path=/head/; revision=268531
Diffstat (limited to 'include')
-rw-r--r--include/dirent.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/dirent.h b/include/dirent.h
index c77d844e399b..b894bb845329 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -63,6 +63,7 @@ typedef struct _dirdesc DIR;
#define DTF_NODUP 0x0002 /* don't return duplicate names */
#define DTF_REWIND 0x0004 /* rewind after reading union stack */
#define __DTF_READALL 0x0008 /* everything has been read */
+#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */
#else /* !__BSD_VISIBLE */