summaryrefslogtreecommitdiffstats
path: root/include/dirent.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC 268531,269079,269204:jhb2014-08-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix various edge cases with rewinddir(), seekdir(), and telldir(): - 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. - Add missing locking to rewinddir() - POSIX says that passing a location returned by telldir() to seekdir() after an intervening call to rewinddir() is undefined, so reclaim any pending telldir() cookies in the directory when rewinddir() is called. - If telldir() is called immediately after a call to seekdir(), POSIX requires the return value of telldir() to equal the value passed to seekdir(). The current seekdir code with SINGLEUSE enabled breaks this case as each call to telldir() allocates a new cookie. Instead, remove the SINGLEUSE code and change telldir() to look for an existing cookie for the directory's current location rather than always creating a new cookie. PR: 121656
* Implement fdclosedir(3) function, which is equivalent to the closedir(3)pjd2013-08-181-0/+1
| | | | | | | function, but returns directory file descriptor instead of closing it. Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org> Sponsored by: Google Summer of Code 2013
* Hide DIR definition by making it an opaque struct typedef.gleb2012-05-191-18/+3
| | | | | | | | | | 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
* Remove the Berkeley clause 3's.imp2010-02-161-5/+1
| | | | Add a few $FreeBSD$
* Move scandir(3) and alphasort(3) into XSI namespace.kib2010-01-051-2/+4
| | | | | Noted and reviewed by: bde MFC after: 2 weeks
* Modernize scandir(3) and alphasort(3) interfaces according to the IEEEkib2010-01-041-2/+3
| | | | | | | | | | | | | | | | | | | | Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions, so we better follow too (older glibc used old BSDish alphasort prototype and corresponding type of the comparision function for scandir). While there, change the definitions of the functions to ANSI C and fix several style issues nearby. Remove requirement for "sys/types.h" include for functions from manpage. POSIX also requires that alphasort(3) sorts as if strcoll(3) was used, but leave the strcmp(3) call in the function for now. Adapt in-tree callers of scandir(3) to new declaration. The fact that select_sections() from catman(1) could modify supplied struct dirent is a bug. PR: standards/142255 MFC after: 2 weeks
* Implement fdopendir(3) by splitting __opendir2() into two parts, the upper partdelphij2008-04-161-0/+1
| | | | | | deals with the usual __opendir2() calls, and the rest part with an interface translator to expose fdopendir(3) functionality. Manual page was obtained from kib@'s work for *at(2) system calls.
* Use a forward definition of an opaque structure rather than a voidjb2007-11-201-1/+2
| | | | to avoid a strict alias type check failure in gcc 4.2.
* Change the definition of NULL on ia64 (for LP64 compilations) frommarcel2003-12-071-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | an int constant to a long constant. This change improves consistency in the following two ways: 1. The first 8 arguments are always passed in registers on ia64, which by virtue of the generated code implicitly widens ints to longs and allows the use of an 32-bit integral type for 64-bit arguments. Subsequent arguments are passed onto the memory stack, which does not exhibit the same behaviour and consequently do not allow this. In practice this means that variadic functions taking pointers and given NULL (without cast) work as long as the NULL is passed in one of the first 8 arguments. A SIGSEGV is more likely the result if such would be done for stack-based arguments. This is due to the fact that the upper 4 bytes remain undefined. 2. All 64-bit platforms that FreeBSD supports, with the obvious exception of ia64, allow 32-bit integral types (specifically NULL) when 64-bit pointers are expected in variadic functions by way of how the compiler generates code. As such, code that works correctly (whether rightfully so or not) on any platform other than ia64, may fail on ia64. To more easily allow tweaking of the definition of NULL, this commit removes the 12 definitions in the various headers and puts it in a new header that can be included whenever NULL is to be made visible. This commit fixes GNOME, emacs, xemacs and a whole bunch of ports that I don't particularly care about at this time...
* Fix namespace issues by using the relatively new visibilitymike2002-09-101-17/+30
| | | | primitives.
* style(9): line up function names.mike2002-09-091-13/+14
|
* Breath deep and take __P out of the system include files.imp2002-03-231-13/+13
| | | | | | # This appears to not break X11, but I'm having problems compiling the # glide part of the server with or without this patch, so I can't tell # for sure.
* Add a lock to DIR to make telldir and friends MT-safe.deischen2001-01-241-0/+1
| | | | | | | Clean up stdio.h a bit and remove _THREAD_SAFE. Some of the usual macros getc, putc, getchar, putchar are no longer macros. Approved by: -arch
* Move telldir position recording type definitions and prototypesdeischen2000-12-111-4/+2
| | | | | | | to "telldir.h" in order to prevent namespace pollution in <dirent.h> (which was including <sys/queue.h>). Add $FreeBSD$ to rewinddir.c and seekdir.c.
* Add a LIST_HEAD to DIR for a queue of telldir positions.deischen2000-12-061-1/+6
| | | | | Also add a location count (used as the magic for telldir) to DIR. A future change will also add a mutex/lock.
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-2/+2
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* Fixed missing declaration of getdents(2).bde1999-12-231-0/+1
|
* style fixes, remove extra braces.alfred1999-11-291-3/+1
| | | | | | | | | | | | 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
* add pthread_cancel, obtained from OpenBSD.alfred1999-11-281-0/+4
| | | | | | | | | | | | | | 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
* Merge Lite2 changes onto mainline:peter1997-03-111-1/+9
| | | | | - declare opendir2(), which is used to control how readdir() handles whiteouts etc.
* Remove trailing whitespace.rgrimes1995-05-301-1/+1
|
* BSD 4.4 Lite Include Sourcesrgrimes1994-05-241-0/+94
OpenPOWER on IntegriCloud