Mercurial > hg > octave-shane > gnulib-hg
view modules/glob @ 17388:3c592b4deb04
utimensat-tests, etc.: try to fix some races
Problem reported by Bernhard Voelker in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-04/msg00071.html>.
I don't know whether this patch fixes that race condition, but it
fixes *some* race conditions, so it should be a win.
* modules/chown-tests (Depends-on):
* modules/fchownat-tests (Depends-on):
* modules/fdutimensat-tests (Depends-on):
* modules/futimens-tests (Depends-on):
* modules/lchown-tests (Depends-on):
* modules/stat-time-tests (Depends-on):
* modules/utimens-tests (Depends-on):
* modules/utimensat-tests (Depends-on):
Depend on nanosleep, not usleep.
* modules/chown-tests (test_chown_LDADD):
* modules/lchown-tests (test_lchown_LDADD):
* modules/stat-time-tests (test_stat_time_LDADD):
New macro.
* modules/fchownat-tests (test_fchownat_LDADD):
* modules/fdutimensat-tests (test_fdutimensat_LDADD):
* modules/futimens-tests (test_futimens_LDADD):
* modules/utimens-tests (test_utimens_LDADD):
* modules/utimensat-tests (test_utimensat_LDADD):
Add $(LIB_NANOSLEEP).
* modules/stat-time-tests (Files): Add tests/nap.h.
* tests/nap.h: Include <limits.h>, for INT_MAX.
(lt_mtime): Remove.
(diff_timespec): New function.
(get_stat): Rename from get_mtime. All callers changed.
(nap_works): Determine the needed delay by inspecting the
file system's timestamp jumps; this should be more reliable.
Look at both mtime and ctime, and take the maximum of the two jumps.
(nap_works, guess_delay):
Return a nanosecond cound, not a microsecond count.
All callers changed.
(nap_works, nap): Use nanosleep, not usleep. Check for nanosleep
failure.
(nap): Multiply the guess by 1.125, to accommodate the case where
the file system's clock is a bit slower than nanosleep's clock.
* tests/test-stat-time.c (BASE): New macro.
Include nap.h.
(nap): Remove; nap.h now defines this. This removes a duplicate
implementation of 'nap'.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 30 Apr 2013 23:14:19 -0700 |
parents | 578b354d30fc |
children |
line wrap: on
line source
Description: glob() function: Search for files and directories with paths matching a pattern, with GNU extensions. Files: lib/glob.in.h lib/glob-libc.h lib/glob.c m4/glob.m4 Depends-on: extensions largefile snippet/arg-nonnull snippet/c++defs snippet/warn-on-use alloca [test -n "$GLOB_H"] closedir [test -n "$GLOB_H"] d-type [test -n "$GLOB_H"] dirfd [test -n "$GLOB_H"] fnmatch [test -n "$GLOB_H"] getlogin_r [test -n "$GLOB_H"] memchr [test -n "$GLOB_H"] mempcpy [test -n "$GLOB_H"] opendir [test -n "$GLOB_H"] readdir [test -n "$GLOB_H"] stdbool [test -n "$GLOB_H"] strdup [test -n "$GLOB_H"] sys_stat [test -n "$GLOB_H"] unistd [test -n "$GLOB_H"] malloc-posix [test -n "$GLOB_H"] configure.ac: gl_GLOB if test -n "$GLOB_H"; then AC_LIBOBJ([glob]) gl_PREREQ_GLOB fi Makefile.am: BUILT_SOURCES += $(GLOB_H) # We need the following in order to create <glob.h> when the system # doesn't have one that works with the given compiler. if GL_GENERATE_GLOB_H glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/glob.in.h; \ } > $@-t && \ mv -f $@-t $@ else glob.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += glob.h glob.h-t Include: <glob.h> License: LGPLv2+ Maintainer: all, glibc