comparison m4/nanosleep.m4 @ 12327:9e07d6d6ed00

nanosleep: work around cygwin bug Cygwin 1.5.x mistakenly failed with EINVAL for a duration longer than 49.7 days (2**32 milliseconds). Meanwhile, the existing code for HAVE_BUG_BIG_NANOSLEEP would infloop, instead of return failure, for invalid arguments. * lib/nanosleep.c (rpl_nanosleep) [HAVE_BUG_BIG_NANOSLEEP]: Fix logic bug when nanosleep fails. Work around cygwin 1.5.x bug. (getnow): Delete, not needed. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): No longer require LIB_CLOCK_GETTIME. * modules/nanosleep (Depends-on): Add intprops and verify. Drop clock-time, gettime. * doc/posix-functions/nanosleep.texi (nanosleep): Document the bug. * modules/nanosleep-tests: New test. * tests/test-nanosleep.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Wed, 18 Nov 2009 20:10:42 -0700
parents 8ba00f285749
children bf3fd58aaf19
comparison
equal deleted inserted replaced
12326:25e64e77bb53 12327:9e07d6d6ed00
1 # serial 28 1 # serial 29
2 2
3 dnl From Jim Meyering. 3 dnl From Jim Meyering.
4 dnl Check for the nanosleep function. 4 dnl Check for the nanosleep function.
5 dnl If not found, use the supplied replacement. 5 dnl If not found, use the supplied replacement.
6 dnl 6 dnl
15 [ 15 [
16 dnl Persuade glibc and Solaris <time.h> to declare nanosleep. 16 dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
17 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 17 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
18 18
19 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) 19 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
20 AC_REQUIRE([gl_CLOCK_TIME])
21 AC_CHECK_HEADERS_ONCE([sys/time.h]) 20 AC_CHECK_HEADERS_ONCE([sys/time.h])
22 21
23 nanosleep_save_libs=$LIBS 22 nanosleep_save_libs=$LIBS
24 23
25 # Solaris 2.5.1 needs -lposix4 to get the nanosleep function. 24 # Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
101 else 100 else
102 REPLACE_NANOSLEEP=1 101 REPLACE_NANOSLEEP=1
103 if test "$gl_cv_func_nanosleep" = 'no (mishandles large arguments)'; then 102 if test "$gl_cv_func_nanosleep" = 'no (mishandles large arguments)'; then
104 AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1], 103 AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1],
105 [Define to 1 if nanosleep mishandles large arguments.]) 104 [Define to 1 if nanosleep mishandles large arguments.])
106 for ac_lib in $LIB_CLOCK_GETTIME; do
107 case " $LIB_NANOSLEEP " in
108 *" $ac_lib "*) ;;
109 *) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";;
110 esac
111 done
112 fi 105 fi
113 AC_LIBOBJ([nanosleep]) 106 AC_LIBOBJ([nanosleep])
114 gl_PREREQ_NANOSLEEP 107 gl_PREREQ_NANOSLEEP
115 fi 108 fi
116 109