aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Colascione2012-10-07 14:31:58 -0800
committerDaniel Colascione2012-10-07 14:31:58 -0800
commit36a305a723c63fd345be65c536c52fe9765c14be (patch)
treefb89d9e103552863214c60297a65320917109357 /lib
parent2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (diff)
parent795b1482a9e314cda32d62ac2988f573d359366e (diff)
downloademacs-36a305a723c63fd345be65c536c52fe9765c14be.tar.gz
emacs-36a305a723c63fd345be65c536c52fe9765c14be.zip
Merge from trunk
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk3
-rw-r--r--lib/pselect.c34
-rw-r--r--lib/stdlib.in.h13
3 files changed, 47 insertions, 3 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index d49eb4fdf7a..23749331a83 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings 24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
@@ -857,6 +857,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
857 -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ 857 -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
858 -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ 858 -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
859 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ 859 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
860 -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
860 -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ 861 -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
861 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ 862 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
862 -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ 863 -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
diff --git a/lib/pselect.c b/lib/pselect.c
index d8ebc70f6c6..1b6d099dccf 100644
--- a/lib/pselect.c
+++ b/lib/pselect.c
@@ -33,6 +33,8 @@
33 pointer parameter stands for no descriptors, an infinite timeout, 33 pointer parameter stands for no descriptors, an infinite timeout,
34 or an unaffected signal mask. */ 34 or an unaffected signal mask. */
35 35
36#if !HAVE_PSELECT
37
36int 38int
37pselect (int nfds, fd_set *restrict rfds, 39pselect (int nfds, fd_set *restrict rfds,
38 fd_set *restrict wfds, fd_set *restrict xfds, 40 fd_set *restrict wfds, fd_set *restrict xfds,
@@ -74,3 +76,35 @@ pselect (int nfds, fd_set *restrict rfds,
74 76
75 return select_result; 77 return select_result;
76} 78}
79
80#else /* HAVE_PSELECT */
81# include <unistd.h>
82# undef pselect
83
84int
85rpl_pselect (int nfds, fd_set *restrict rfds,
86 fd_set *restrict wfds, fd_set *restrict xfds,
87 struct timespec const *restrict timeout,
88 sigset_t const *restrict sigmask)
89{
90 int i;
91
92 /* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */
93 if (nfds < 0 || nfds > FD_SETSIZE)
94 {
95 errno = EINVAL;
96 return -1;
97 }
98 for (i = 0; i < nfds; i++)
99 {
100 if (((rfds && FD_ISSET (i, rfds))
101 || (wfds && FD_ISSET (i, wfds))
102 || (xfds && FD_ISSET (i, xfds)))
103 && dup2 (i, i) != i)
104 return -1;
105 }
106
107 return pselect (nfds, rfds, wfds, xfds, timeout, sigmask);
108}
109
110#endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 1d67ec64c66..65558402bf3 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -457,10 +457,19 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
457#if @GNULIB_PTSNAME@ 457#if @GNULIB_PTSNAME@
458/* Return the pathname of the pseudo-terminal slave associated with 458/* Return the pathname of the pseudo-terminal slave associated with
459 the master FD is open on, or NULL on errors. */ 459 the master FD is open on, or NULL on errors. */
460# if !@HAVE_PTSNAME@ 460# if @REPLACE_PTSNAME@
461# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
462# undef ptsname
463# define ptsname rpl_ptsname
464# endif
465_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
466_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
467# else
468# if !@HAVE_PTSNAME@
461_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 469_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
462# endif 470# endif
463_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 471_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
472# endif
464_GL_CXXALIASWARN (ptsname); 473_GL_CXXALIASWARN (ptsname);
465#elif defined GNULIB_POSIXCHECK 474#elif defined GNULIB_POSIXCHECK
466# undef ptsname 475# undef ptsname