diff options
| author | Paul Eggert | 2012-10-04 00:15:42 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-10-04 00:15:42 -0700 |
| commit | bb1dfdadd507bb4b77595c87875ef807c101ed7b (patch) | |
| tree | eb92a2335896c34e76a9e19362049396b8d0483f /m4/pselect.m4 | |
| parent | 88d69b7ddca305bb96d6e671300f6724e4f147dd (diff) | |
| download | emacs-bb1dfdadd507bb4b77595c87875ef807c101ed7b.tar.gz emacs-bb1dfdadd507bb4b77595c87875ef807c101ed7b.zip | |
Merge from gnulib.
Diffstat (limited to 'm4/pselect.m4')
| -rw-r--r-- | m4/pselect.m4 | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/m4/pselect.m4 b/m4/pselect.m4 index 97bf12cd2d6..5edacd28f85 100644 --- a/m4/pselect.m4 +++ b/m4/pselect.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # pselect.m4 | 1 | # pselect.m4 serial 2 |
| 2 | dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -23,6 +23,44 @@ AC_DEFUN([gl_FUNC_PSELECT], | |||
| 23 | return !p;]])], | 23 | return !p;]])], |
| 24 | [gl_cv_sig_pselect=yes], | 24 | [gl_cv_sig_pselect=yes], |
| 25 | [gl_cv_sig_pselect=no])]) | 25 | [gl_cv_sig_pselect=no])]) |
| 26 | |||
| 27 | dnl On FreeBSD 8.2, pselect() doesn't always reject bad fds. | ||
| 28 | AC_CACHE_CHECK([whether pselect detects invalid fds], | ||
| 29 | [gl_cv_func_pselect_detects_ebadf], | ||
| 30 | [ | ||
| 31 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
| 32 | #include <sys/types.h> | ||
| 33 | #include <sys/time.h> | ||
| 34 | #if HAVE_SYS_SELECT_H | ||
| 35 | # include <sys/select.h> | ||
| 36 | #endif | ||
| 37 | #include <unistd.h> | ||
| 38 | #include <errno.h> | ||
| 39 | ]],[[ | ||
| 40 | fd_set set; | ||
| 41 | dup2(0, 16); | ||
| 42 | FD_ZERO(&set); | ||
| 43 | FD_SET(16, &set); | ||
| 44 | close(16); | ||
| 45 | struct timespec timeout; | ||
| 46 | timeout.tv_sec = 0; | ||
| 47 | timeout.tv_nsec = 5000; | ||
| 48 | return pselect (17, &set, NULL, NULL, &timeout, NULL) != -1 || errno != EBADF; | ||
| 49 | ]])], [gl_cv_func_pselect_detects_ebadf=yes], | ||
| 50 | [gl_cv_func_pselect_detects_ebadf=no], | ||
| 51 | [ | ||
| 52 | case "$host_os" in | ||
| 53 | # Guess yes on glibc systems. | ||
| 54 | *-gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; | ||
| 55 | # If we don't know, assume the worst. | ||
| 56 | *) gl_cv_func_pselect_detects_ebadf="guessing no" ;; | ||
| 57 | esac | ||
| 58 | ]) | ||
| 59 | ]) | ||
| 60 | case $gl_cv_func_pselect_detects_ebadf in | ||
| 61 | *yes) ;; | ||
| 62 | *) REPLACE_PSELECT=1 ;; | ||
| 63 | esac | ||
| 26 | fi | 64 | fi |
| 27 | 65 | ||
| 28 | if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then | 66 | if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then |