summaryrefslogtreecommitdiff
path: root/lib/libc/gen/readdir.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean up the vcs ID strings in libc's gen/ directory.John Baldwin2018-07-031-3/+1
| | | | | | | | | | | | | | | | | | | | - Move CSRG IDs into __SCCSID(). - When a file has been copied, consistently use 'From: <tag>' for strings referencing the version of the source file copied from in the license block comment. - Some of the 'From:' tags were using $FreeBSD$ that was being expanded on each checkout. Fix those to hardcode the FreeBSD tag from the file that was copied at the time of the copy. - When multiple strings are present list them in "chronological" order, so CSRG (__SCCSID) before FreeBSD (__FBSDID). If a file came from OtherBSD and contains a CSRG ID from the OtherBSD file, use the order CSRG -> OtherBSD -> FreeBSD. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D15831 Notes: svn path=/head/; revision=335898
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Commit the 64-bit inode project.Konstantin Belousov2017-05-231-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the ino_t, dev_t, nlink_t types to 64-bit ints. Modify struct dirent layout to add d_off, increase the size of d_fileno to 64-bits, increase the size of d_namlen to 16-bits, and change the required alignment. Increase struct statfs f_mntfromname[] and f_mntonname[] array length MNAMELEN to 1024. ABI breakage is mitigated by providing compatibility using versioned symbols, ingenious use of the existing padding in structures, and by employing other tricks. Unfortunately, not everything can be fixed, especially outside the base system. For instance, third-party APIs which pass struct stat around are broken in backward and forward incompatible ways. Kinfo sysctl MIBs ABI is changed in backward-compatible way, but there is no general mechanism to handle other sysctl MIBS which return structures where the layout has changed. It was considered that the breakage is either in the management interfaces, where we usually allow ABI slip, or is not important. Struct xvnode changed layout, no compat shims are provided. For struct xtty, dev_t tty device member was reduced to uint32_t. It was decided that keeping ABI compat in this case is more useful than reporting 64-bit dev_t, for the sake of pstat. Update note: strictly follow the instructions in UPDATING. Build and install the new kernel with COMPAT_FREEBSD11 option enabled, then reboot, and only then install new world. Credits: The 64-bit inode project, also known as ino64, started life many years ago as a project by Gleb Kurtsou (gleb). Kirk McKusick (mckusick) then picked up and updated the patch, and acted as a flag-waver. Feedback, suggestions, and discussions were carried by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles), and Rick Macklem (rmacklem). Kris Moore (kris) performed an initial ports investigation followed by an exp-run by Antoine Brodin (antoine). Essential and all-embracing testing was done by Peter Holm (pho). The heavy lifting of coordinating all these efforts and bringing the project to completion were done by Konstantin Belousov (kib). Sponsored by: The FreeBSD Foundation (emaste, kib) Differential revision: https://reviews.freebsd.org/D10439 Notes: svn path=/head/; revision=318736
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues2015-09-201-9/+3
| | | | Notes: svn path=/head/; revision=288029
* Tweak seekdir, telldir and readdir so that when htere are deletes going on,Julian Elischer2015-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 Notes: svn path=/head/; revision=282485
* Fix some edge cases with rewinddir():John Baldwin2014-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 Notes: svn path=/head/; revision=268531
* Hide DIR definition by making it an opaque struct typedef.Gleb Kurtsou2012-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 Notes: svn path=/head/; revision=235647
* Do not read away the target directory entry when encountering deletedKonstantin Belousov2008-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 Notes: svn path=/head/; revision=178772
* Since jb@ fixed the type of dd_lock in <dirent.h>, these casts are noDag-Erling Smørgrav2007-12-031-4/+4
| | | | | | | longer required. Notes: svn path=/head/; revision=174221
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-091-4/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Include a couple of headers to ensure consistency between the prototype andStefan Farfeleder2005-09-121-0/+1
| | | | | | | the function definition. Notes: svn path=/head/; revision=150065
* use _GENERIC_DIRSIZ(dp) to avoid copying too much of the dirent overAlfred Perlstein2002-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. Notes: svn path=/head/; revision=91330
* Fix SCM ID's.David E. O'Brien2002-02-011-3/+2
| | | | Notes: svn path=/head/; revision=90039
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-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 Notes: svn path=/head/; revision=71579
* #endif should not have a non-comment token after it.David E. O'Brien2000-12-131-1/+1
| | | | | | | GCC 2.97 (snapshot) complains about this. Notes: svn path=/head/; revision=69968
* Cleanup XXXdir functions to eliminate global hash table ofDaniel Eischen2000-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 Notes: svn path=/head/; revision=69656
* #include <string.h> for memcpy() prototypeKris Kennaway2000-06-031-0/+1
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=61193
* style fixes, remove extra braces.Alfred Perlstein1999-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 Notes: svn path=/head/; revision=53892
* Provide a man page for Alfreds lovely readdir_r function. AlsoWes Peters1999-11-291-5/+8
| | | | | | | | fixed a minor indentation nit and added a few {}s to make readdir_r easier on old eyes. Notes: svn path=/head/; revision=53872
* add pthread_cancel, obtained from OpenBSD.Alfred Perlstein1999-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 Notes: svn path=/head/; revision=53812
* Fix a bogus cast for a bogus pointer check. This only checks if theJohn Birrell1998-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-) Notes: svn path=/head/; revision=33665
* Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branchPeter Wemm1997-03-111-0/+75
Notes: svn path=/vendor/CSRG/dist/; revision=23658