diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-02-25 11:54:49 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-02-25 12:28:47 -0800 |
commit | 2510ffcdcdad4e5cd20455b4891de4f5e128072a (patch) | |
tree | 8c79ede1f9ecd68bc1176816f9ad24d9e1a3f13f /m4 | |
parent | 23cca8268d21f5d58ed0209002d5673d0518c426 (diff) | |
download | gnulib-2510ffcdcdad4e5cd20455b4891de4f5e128072a.tar.gz |
nanosleep: simplify by using pselect
GNU Emacs avoids Gnulib’s ‘select’ module and uses only pselect,
which it implements in a special way on MS-DOS.
Unfortunately, though, nanosleep uses ‘select’;
problem reported by Lars Ingebrigtsen (Bug#32452#74).
As far as I can tell, Gnulib nanosleep's use of
‘select’ with signals is only for ancient platforms
that Gnulib no longer cares about, so remove that use of ‘select’.
I don’t know of any platforms that still need this fallback code,
but just in case, fall back to pselect instead, while removing
signal handling that it shouldn’t be needed nowadays.
* lib/nanosleep.c: Do not include sig-handler.h, sys/time.h.
(SIGCONT, suspended, sighandler, my_usleep): Remove.
(nanosleep) [!HAVE_BUG_BIG_NANOSLEEP && !(_WIN32 && !__CYGWIN__)]:
Just call pselect.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Do not check for sys/time.h
or call gl_FUNC_SELECT. Do not include sys/time.h or worry
about LIBSOCKET.
(gl_PREREQ_NANOSLEEP): Remove as it’s no longer needed.
All uses removed.
* modules/nanosleep (Depends-on): Add pselect.
Remove select, sigaction, sys_time.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/nanosleep.m4 | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4 index 6a51f28e30..1964b1ea47 100644 --- a/m4/nanosleep.m4 +++ b/m4/nanosleep.m4 @@ -1,4 +1,4 @@ -# serial 40 +# serial 41 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -19,9 +19,6 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], dnl Persuade glibc and Solaris <time.h> to declare nanosleep. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_HEADERS_ONCE([sys/time.h]) - AC_REQUIRE([gl_FUNC_SELECT]) - AC_CHECK_DECLS_ONCE([alarm]) nanosleep_save_libs=$LIBS @@ -53,9 +50,6 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], #include <errno.h> #include <limits.h> #include <signal.h> - #if HAVE_SYS_TIME_H - #include <sys/time.h> - #endif #include <time.h> #include <unistd.h> #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) @@ -135,15 +129,6 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1], [Define to 1 if nanosleep mishandles large arguments.]) ;; - *) - # The replacement uses select(). Add $LIBSOCKET to $LIB_NANOSLEEP. - for ac_lib in $LIBSOCKET; do - case " $LIB_NANOSLEEP " in - *" $ac_lib "*) ;; - *) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";; - esac - done - ;; esac ;; esac @@ -152,10 +137,3 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], fi LIBS=$nanosleep_save_libs ]) - -# Prerequisites of lib/nanosleep.c. -AC_DEFUN([gl_PREREQ_NANOSLEEP], -[ - AC_CHECK_HEADERS_ONCE([sys/select.h]) - gl_PREREQ_SIG_HANDLER_H -]) |