[uim-commit] r1454 - in trunk: . fep
yamamoto at freedesktop.org
yamamoto at freedesktop.org
Wed Sep 7 11:01:16 PDT 2005
Author: yamamoto
Date: 2005-09-07 11:01:14 -0700 (Wed, 07 Sep 2005)
New Revision: 1454
Modified:
trunk/configure.ac
trunk/fep/read.c
Log:
* configure.ac:
- Add check for errno.h.
- Remove check for pselect.
* fep/read.c
- (pselect_) replacement for pselect(2)
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-09-07 17:52:53 UTC (rev 1453)
+++ trunk/configure.ac 2005-09-07 18:01:14 UTC (rev 1454)
@@ -168,7 +168,7 @@
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h unistd.h])
+AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h unistd.h errno.h])
AC_CHECK_HEADERS([string.h sys/ioctl.h sys/socket.h termios.h wchar.h])
AC_CHECK_HEADERS([sys/time.h sys/stat.h sys/un.h getopt.h assert.h signal.h term.h ncurses/term.h ctype.h pwd.h stdarg.h])
AC_CHECK_HEADERS([pty.h utmp.h util.h libutil.h])
@@ -191,7 +191,6 @@
AC_CHECK_FUNCS([wcswidth])
AC_CHECK_FUNCS(getpeereid asprintf vasprintf vsnprintf setenv unsetenv strsep)
AC_CHECK_FUNCS(getpid stat mkdir chmod)
-AC_CHECK_FUNCS([pselect])
AC_CACHE_CHECK([for C99 vsnprintf], uim_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
#include <sys/types.h>
Modified: trunk/fep/read.c
===================================================================
--- trunk/fep/read.c 2005-09-07 17:52:53 UTC (rev 1453)
+++ trunk/fep/read.c 2005-09-07 18:01:14 UTC (rev 1454)
@@ -49,6 +49,9 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
+#ifdef HAVE_ERRNO_H
+#include "errno.h"
+#endif
#include "uim-fep.h"
#include "read.h"
@@ -57,10 +60,8 @@
static int s_buf_size = 0;
-#ifndef HAVE_PSELECT
-static int pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+static int pselect_(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *timeout, const sigset_t *sigmask);
-#endif
/*
* select
@@ -87,7 +88,7 @@
FD_SET(g_win_in, readfds);
return 1;
}
- return pselect(n, readfds, NULL, NULL, NULL, sigmask);
+ return pselect_(n, readfds, NULL, NULL, NULL, sigmask);
}
/*
@@ -126,17 +127,35 @@
s_buf_size += count;
}
-#ifndef HAVE_PSELECT
-static int pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+static int pselect_(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *timeout, const sigset_t *sigmask)
{
int ret;
sigset_t orig_sigmask;
+ sigset_t pending_signals;
+ /* ¥·¥°¥Ê¥ë¤¬ÊÝᤵ¤ì¤Æ¤¤¤ë¤« */
+ sigpending(&pending_signals);
+ if (
+ sigismember(&pending_signals, SIGHUP) ||
+ sigismember(&pending_signals, SIGTERM) ||
+ sigismember(&pending_signals, SIGQUIT) ||
+ sigismember(&pending_signals, SIGINT) ||
+ sigismember(&pending_signals, SIGWINCH) ||
+ sigismember(&pending_signals, SIGUSR1) ||
+ sigismember(&pending_signals, SIGUSR2) ||
+ sigismember(&pending_signals, SIGTSTP) ||
+ sigismember(&pending_signals, SIGCONT)
+ ) {
+ sigprocmask(SIG_SETMASK, sigmask, &orig_sigmask);
+ sigprocmask(SIG_SETMASK, &orig_sigmask, NULL);
+ errno = EINTR;
+ return -1;
+ }
+
+ /* timeout ¤Ï»È¤ï¤Ê¤¤ */
sigprocmask(SIG_SETMASK, sigmask, &orig_sigmask);
- /* timeout ¤Ï»È¤ï¤Ê¤¤ */
ret = select(n, readfds, writefds, exceptfds, NULL);
sigprocmask(SIG_SETMASK, &orig_sigmask, NULL);
return ret;
}
-#endif
More information about the uim-commit
mailing list