History log of /openbsd-current/include/dirent.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.35 15-Apr-2024 florian

Add scandirat(3); from freebsd

To be used in httpd(8) shortly to prevent toctu issues.

This makes __fdopendir internally accessible to avoid unnecessary
syscalls in scandirat(3). Suggested & diff by guenther

suggested by & OK millert
tweak & OK guenther
OK tb, jca

This rides the libc crank.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.34 09-Sep-2016 millert

Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11. OK deraadt@ guenther@ kettenis@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 13-Dec-2013 zhuk

Zap some getdirentries() leftovers.

okay guenther@


# 1.32 16-Aug-2013 guenther

Tweak the getdents() kernel prototype to use "void *"
Provide a declaration for userspace
Fix the kernel's sanity check on the buflen argument

lack of prototype pointed out by sthen@ and landry@
ok kettenis@ otto@


Revision tags: OPENBSD_5_4_BASE
# 1.31 02-Jun-2013 guenther

XPG 4 apparently exposed d_ino and ino_t. Also, always pull in
<sys/_types.h> for the internal types

ok matthew@


# 1.30 24-Mar-2013 deraadt

I can see no reason for #ifndef _KERNEL check in a /usr/include
(ie. non-kernel) .h file


Revision tags: OPENBSD_5_3_BASE
# 1.29 29-Nov-2012 guenther

Change scandir()'s 'select' argument from
int (*)(struct dirent *)
to
int (*)(const struct dirent *)
to match POSIX.

ok millert@, ports check by naddy@


Revision tags: OPENBSD_5_2_BASE
# 1.28 24-Mar-2012 guenther

Provide the old prototypes for scandir() and alphasort() for code that
requests the pre-standardized version

requested by millert@


# 1.27 22-Mar-2012 matthew

Make DIR a private type within libc, give it the same underlying
typedef regardless of __BSD_VISIBLE, and eliminate the dirfd() macro.

ok guenther@


# 1.26 22-Mar-2012 guenther

Update alphasort() and scandir()'s argument types to match POSIX:
use "const struct dirent **" instead of "const void *". Also, add
__restrict to readdir_r().

ok matthew@


# 1.25 22-Mar-2012 matthew

Add dirfd() as a function to libc per POSIX requirement; dirfd() macro
to be pruned later when DIR is made an opaque type.

ok guenther@; prodding by brad@ for VLC and other ports


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.24 18-Jul-2011 matthew

Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).

"Minor" libc bump.

Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@


# 1.23 14-Jul-2011 deraadt

__opendir2, DTF_NODUP, and __DTF_READALL can die. struct dirent
dd_flags is renamed to the placeholder position dd_unused so that
we can spot "broken software" which assumes we have Jan Simon Pendry's
union mounts (we don't have them, and won't have them ever again).
__opendir2 question spotted by matthew
verified to not break ports by sthen


# 1.22 03-Jul-2011 jsg

As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@


# 1.21 06-Apr-2011 miod

Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.


Revision tags: OPENBSD_4_9_BASE
# 1.20 31-Dec-2010 guenther

Standards compliance: expose dirfd with XPG7 and scandir and alphasort
with POSIX 2008

ok millert@


# 1.19 28-Oct-2010 millert

Change basep parameter of getdirentries() to be off_t *, not long *
so it works correctly with large offsets (and matches other systems).
This requires adding a new getdirentries syscall, with the old one
renamed to ogetdirentries. All in-tree consumers of getdirentries()
have been updated. Bump libc and libpthread major numbers.
OK and with deraadt@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 05-Jun-2007 kurt

_FD_LOCK/UNLOCK() is libpthread specific and not needed for librthread, so
isolate its usage to libpthread only and replace with generic non-static
mutex support in the one place it is needed:
- remove _FD_LOCK/UNLOCK from lseek and ftruncate in libc and make the
functions weak so that libpthread can override with its own new
versions that do the locking.
- remove _thread_fd_lock/unlock() weak functions from libc and adjust
libpthread for the change.
- add generic _thread_mutex_lock/unlock/destroy() weak functions in libc
to support non-static mutexes in libc and add libpthread and librthread
implementations for them. libc can utilize non-static mutexes via the
new _MUTEX_LOCK/UNLOCK/DESTROY() macros. Actually these new macros can
support both static and non-static mutexes but currently only using
them for non-static.
- make opendir/closedir/readdir/readdir_r/seekdir/telldir() thread-safe
for both thread libraries by using a non-static mutex in the struct
_dirdesc (typedef DIR), utilizing it in the *dir functions and remove
remaining and incorrect _FD_LOCK/UNLOCK() use in libc.
- add comments to both thread libraries to indicate libc depends on the
current implementation of static mutex initialization. suggested by
marc@
- major bump libc and libpthread due to function removal, structure
change and weak symbol conversions.
okay marc@, tedu@


Revision tags: OPENBSD_4_1_BASE
# 1.17 08-Feb-2007 millert

g/c __DTF_READALL. It was a flag to the internal __opendir2() but
is never set now that the unionfs support has been removed from
readdir(). OK pedro@


Revision tags: OPENBSD_4_0_BASE
# 1.16 01-Apr-2006 otto

- Plug huge mem leak; mostly samba was suffering.
- Fix semantics: seekdir(pos); telldir() shoud return pos. The code
that implements this will be made faster in a later commit.
- We loose documented behaviour (after closedir() the telldir()
positions are not valid anymore). This was never in Posix, and most
other systems have nothing like it.

Diff originally from Paul Thorn, rewritten by me using some FreeBSD
code. "slap it in" deraadt@


Revision tags: OPENBSD_3_9_BASE
# 1.15 13-Dec-2005 millert

First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace
pollution issues, including the byte order defines. OK deraadt@


Revision tags: OPENBSD_3_8_BASE
# 1.14 18-Jun-2005 millert

Remove remaining whiteout tentacles; OK deraadt@ miod@ weingart@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.13 01-Aug-2003 avsm

add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@


# 1.12 26-Jun-2003 avsm

backout the __bounded__ attributes for a while; requested by deraadt@


# 1.11 26-Jun-2003 avsm

Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok


# 1.10 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.9 25-Oct-2002 millert

NULL is now 0L so it is the same size as a pointer.
OK mickey@ and discussed with deraadt@


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.8 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.7 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.6 17-Sep-1999 espie

Be thorough about NULL as __null for C++.


# 1.5 11-Jun-1999 espie

Define NULL to be __null for C++: better quality of implementation.
__null is a magic constant of integral type that converts to a null pointer
as should be, but warns for ambiguity when used to resolved an overload
between an integral type and a pointer type.


Revision tags: OPENBSD_2_5_BASE
# 1.4 20-Nov-1998 d

Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.3 21-Sep-1997 niklas

Well, as we are heading for a release people are encouraged to rebuild their
entire trees for testing anyway, I might as well do this intrusive touching
of include files now. Added openBSD tags.


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE
# 1.2 23-Nov-1995 deraadt

include sys/types.h as mandated by X/Open XPG 4.2; from agc@sde.uts.amdahl.com; netbsd pr#1785


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision