John Baldwin 9f72c0322c 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
2014-07-11 16:16:26 +00:00
..
2011-11-26 16:49:25 +00:00
2012-08-11 12:07:24 +00:00
2011-10-01 12:19:48 +00:00
2011-10-01 12:19:48 +00:00
2013-08-18 13:25:18 +00:00
2012-04-26 19:21:58 +00:00
2011-05-25 14:13:53 +00:00
2011-12-20 22:56:13 +00:00
2013-04-11 20:15:37 +00:00
2012-03-26 15:18:14 +00:00
2014-05-29 13:35:13 +00:00
2011-02-04 16:40:50 +00:00
2013-04-23 13:03:03 +00:00
2013-04-23 13:03:03 +00:00
2012-12-12 15:27:33 +00:00
2014-07-07 00:27:09 +00:00