summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/readdir.c
Commit message (Collapse)AuthorAgeFilesLines
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.rodrigc2015-09-201-9/+3
|
* Tweak seekdir, telldir and readdir so that when htere are deletes going on,julian2015-05-051-0/+6
| | | | | | | | | | | as seek to teh last location saved will still work. This is needed for Samba to be able to correctly handle delete requests from windows. This does not completely fix seekdir when deletes are present but fixes the worst of the problems. The real solution must involve some changes to the API for eh VFS and getdirentries(2). Obtained from: Panzura inc MFC after: 1 week
* Fix some edge cases with rewinddir():jhb2014-07-111-1/+3
| | | | | | | | | | | | | | | | | | | | | - 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
* Hide DIR definition by making it an opaque struct typedef.gleb2012-05-191-0/+1
| | | | | | | | | | Introduce dirfd() libc exported symbol replacing macro with same name, preserve _dirfd() macro for internal use. Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable name to prevent shadowing global symbol. Sponsored by: Google Summer Of Code 2011
* Do not read away the target directory entry when encountering deletedkib2008-05-051-6/+7
| | | | | | | | | | | | | files after a seekdir(). The seekdir shall set the position for the next readdir operation. When the _readdir_unlocked() encounters deleted entry, dd_loc is already advanced. Continuing the loop leads to premature read of the target entry. Submitted by: Marc Balmer <mbalmer at openbsd org> Obtained from: OpenBSD MFC after: 2 weeks
* Since jb@ fixed the type of dd_lock in <dirent.h>, these casts are nodes2007-12-031-4/+4
| | | | longer required.
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* Include a couple of headers to ensure consistency between the prototype andstefanf2005-09-121-0/+1
| | | | the function definition.
* use _GENERIC_DIRSIZ(dp) to avoid copying too much of the dirent overalfred2002-02-261-2/+2
| | | | | the user supplied buffer. this can be a problem when the user doesn't supply a full dirent and we corrupt their memory.
* Fix SCM ID's.obrien2002-02-011-3/+2
|
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* #endif should not have a non-comment token after it.obrien2000-12-131-1/+1
| | | | GCC 2.97 (snapshot) complains about this.
* Cleanup XXXdir functions to eliminate global hash table ofdeischen2000-12-061-4/+5
| | | | | | | | | | | | | | | | telldir positions. This will allow (future) locking on a per-DIR basis (for MT-safety). For now, this change does the following: o Remove the hash table from telldir.c. Recode to use queue macros. o Remove 'const' from 'telldir(const DIR *)'. o Remove 'register' variables as suggested in a recent thread. No response from: -current
* #include <string.h> for memcpy() prototypekris2000-06-031-0/+1
| | | | Obtained from: OpenBSD
* style fixes, remove extra braces.alfred1999-11-291-17/+20
| | | | | | | | | | | | readdir_r is not POSIX according to POSIX_SOURCE, bruce says: > readdir_r() is in the _POSIX_SOURCE section, but is not a POSIX.1-1990 > function. It's POSIX.1-1996 so it should be under a different feature > test which we don't support yet. make sure errno is saved so that its contents are cleared unless necessary. Submitted by: bde
* Provide a man page for Alfreds lovely readdir_r function. Alsowes1999-11-291-5/+8
| | | | | fixed a minor indentation nit and added a few {}s to make readdir_r easier on old eyes.
* add pthread_cancel, obtained from OpenBSD.alfred1999-11-281-0/+44
| | | | | | | | | | | | | | eischen (Daniel Eischen) added wrappers to protect against cancled threads orphaning internal resources. the cancelability code is still a bit fuzzy but works for test programs of my own, OpenBSD's and some examples from ORA's books. add readdir_r to both libc and libc_r add some 'const' attributes to function parameters Reviewed by: eischen, jasone
* Fix a bogus cast for a bogus pointer check. This only checks if thejb1998-02-201-1/+1
| | | | | pointer is 4-byte aligned. On a 64-bit machine it probably should check that the pointer is 8-byte aligned (eh, Bruce?) 8-)
* Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branchpeter1997-03-111-9/+12
|
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+72
OpenPOWER on IntegriCloud