History log of /openbsd-current/lib/libc/gen/readdir.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.22 12-Sep-2015 guenther

Wrap <dirent.h> so that internal calls go direct and they're all weak symbols


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.21 10-Mar-2014 schwarze

Optimization, no functional change:
Save a cookie pointing to the very first entry in the DIR.dd_buf
cache buffer and use that to speed up seekdir(3) when rewinding
to that first entry.
No libc bump because DIR is an opaque struct.

When the optimization applies, which in particular it always does
for rewinddir(3) after reading less than about 500 entries,
seekdir(3) execution time drops from 100 to 0.05 milliseconds
on my i386 notebook. Other cases are not slowed down.

Based on an idea from and ok by guenther@.


Revision tags: OPENBSD_5_5_BASE
# 1.20 06-Nov-2013 schwarze

Nowadays, seekdir(3) doesn't call _readdir_unlocked().
Consequently, the "skipdeleted" argument is always == 1.
Remove it, effectively reverting readdir.c rev. 1.14.
ok millert@ guenther@


# 1.19 06-Oct-2013 guenther

Remove an unnecessary (void *) cast


# 1.18 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.17 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@


Revision tags: OPENBSD_5_1_BASE
# 1.16 04-Feb-2012 guenther

If the internal consistency check fails, set errno so that it doesn't
just look like end-of-directory.

ok krw@ otto@ miod@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.15 18-Nov-2009 guenther

More shrinkage, a bit for ramdisks but mostly for static binaries:
- wrap with #ifndef NO_LOG_BAD_DNS_RESPONSES libc code that uses
p_class() and p_type() for diagnostics, then add that define to
libstub to avoid pulling in res_debug_syms.o
- split rcmd() and ruserok() into separate files, as nothing uses both
- split readdir_r() to its own file
- split syslog_r() from syslog(), as the latter needs localtime(); many
binaries no longer need to pull in all the time code after this; switch
from usleep() to nanosleep() while we're at it

(The profit of analysis of -Wl,-M,--cref output)

Chops 888kB from /bin and /sbin on i386

ok deraadt@, miod@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.14 01-May-2008 otto

Be carefull not to read away the target entry when encountering
deleted files after a seekdir(); testcase produced by mbalmer@; fix
with and ok mbalmer; ok millert@


# 1.13 04-Apr-2008 okan

alter internal _readdir_unlocked() api to be less confusing, so that
callers may respond accordingly and correctly.

this fixes an issue where readdir_r() could not decipher the difference
between an error or no more entires.

feedback and ok kurt@, ok millert@


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.12 05-Jun-2007 kurt

branches: 1.12.2; 1.12.4;
_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.11 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_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.10 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.9 16-Jun-2005 millert

bye bye whiteouts


# 1.8 25-Mar-2005 otto

deregister (and deauto!). ok millert@ marco@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.7 18-May-2004 jfb

ansify function definitions and zap some `register'

ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.6 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_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.5 17-May-2001 rees

don't copy past end of record in readdir_r (ok by art)


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.4 01-Sep-1999 deraadt

string.h for memcpy proto


Revision tags: OPENBSD_2_5_BASE
# 1.3 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_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE
# 1.2 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision