[Nickle] nickle: Branch 'master' - 3 commits
Keith Packard
keithp at keithp.com
Sun Jan 29 21:59:58 PST 2012
configure.ac | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.in | 126 -------------------------------------------------------
file.c | 10 ++++
lex.l | 3 +
main.c | 19 ++++++++
sched.c | 14 ++----
6 files changed, 172 insertions(+), 135 deletions(-)
New commits:
commit d5a82d02ea1ae6d02a4c14898d9737d03ddb9cc7
Author: Keith Packard <keithp at keithp.com>
Date: Sun Jan 29 21:48:07 2012 -0800
Keep readline from catching signals
This stops readline from catching signals, letting nickle handle them
all by itself.
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/configure.ac b/configure.ac
index 832e15e..0482ada 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,15 @@ AC_FUNC_GETPGRP
dnl The readline test is complicated enough to rate its own file
AC_LIB_READLINE
+if test "x$ac_cv_header_readline_readline_h" = xyes; then
+ AC_CHECK_DECL(rl_catch_signals,
+ AC_DEFINE(HAVE_RL_CATCH_SIGNALS,1,[Has rl_catch_signals]),,[#include <readline/readline.h>])
+ AC_CHECK_DECL(rl_reset_after_signal,
+ AC_DEFINE(HAVE_RL_RESET_AFTER_SIGNAL,1,[Has rl_reset_after_signal]),,[#include <readline/readline.h>])
+ AC_CHECK_DECL(rl_cleanup_after_signal,
+ AC_DEFINE(HAVE_RL_CLEANUP_AFTER_SIGNAL,1,[Has rl_cleanup_after_signal]),,[#include <readline/readline.h>])
+fi
+
if test "x$prefix" = xNONE; then
prefix="$ac_default_prefix"
fi
diff --git a/lex.l b/lex.l
index 4b4bc2c..8e9c76c 100644
--- a/lex.l
+++ b/lex.l
@@ -96,6 +96,9 @@ LexInit (void)
{
ENTER ();
+#if HAVE_RL_CATCH_SIGNALS
+ rl_catch_signals = 0;
+#endif
LexInputReference = NewReference ((void **) &lexInput);
MemAddRoot (LexInputReference);
EXIT ();
diff --git a/main.c b/main.c
index 8190f9d..3baaf01 100644
--- a/main.c
+++ b/main.c
@@ -29,6 +29,10 @@
#include <sys/resource.h>
#endif
+#if HAVE_LIBREADLINE
+#include <readline/readline.h>
+#endif
+
int stdin_interactive;
static void
@@ -161,6 +165,9 @@ intr (int sig)
if (signalInterrupt) {
int ret = write(2,"Double interrupt, exiting\n", 26);
(void) ret;
+#if HAVE_RL_CLEANUP_AFTER_SIGNAL
+ rl_cleanup_after_signal();
+#endif
exit(1);
}
SetSignalInterrupt ();
@@ -171,6 +178,9 @@ stop (int sig)
{
sigset_t set, oset;
+#if HAVE_RL_CLEANUP_AFTER_SIGNAL
+ rl_cleanup_after_signal();
+#endif
sigfillset (&set);
sigprocmask (SIG_SETMASK, &set, &oset);
IoStop ();
@@ -182,12 +192,18 @@ stop (int sig)
sigprocmask (SIG_SETMASK, &oset, &set);
IoStart ();
catchSignal (sig, stop);
+#if HAVE_RL_RESET_AFTER_SIGNAL
+ rl_reset_after_signal();
+#endif
}
void
die (int sig)
{
IoStop ();
+#if HAVE_RL_CLEANUP_AFTER_SIGNAL
+ rl_cleanup_after_signal();
+#endif
_exit (sig);
}
@@ -195,6 +211,9 @@ void
segv (int sig)
{
IoStop ();
+#if HAVE_RL_CLEANUP_AFTER_SIGNAL
+ rl_cleanup_after_signal();
+#endif
releaseSignal (SIGSEGV);
/* return and reexecute the fatal instruction */
}
commit 8b7aef95d231edf71b5388702b16b706e3425000
Author: Keith Packard <keithp at keithp.com>
Date: Sun Jan 29 20:19:09 2012 -0800
Block in select instead of sigsuspend when waiting for I/O
The kernel doesn't appear to reliably deliver SIGIO while the
application is blocked, so sit in select instead of sigsuspend to make
sure we hear about pending I/O.
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/file.c b/file.c
index de51268..daa78f6 100644
--- a/file.c
+++ b/file.c
@@ -1927,6 +1927,14 @@ FileCheckBlocked (Bool block)
#ifdef NO_PIPE_SIGIO
anyPipeReadBlocked = False;
#endif
+ if (block) {
+ sigset_t set, oset;
+ sigfillset (&set);
+ sigprocmask (SIG_SETMASK, &set, &oset);
+ if (!signaling && !running)
+ sigsuspend(&oset);
+ sigprocmask (SIG_SETMASK, &oset, &set);
+ }
}
if (n > 0)
{
@@ -1934,6 +1942,8 @@ FileCheckBlocked (Bool block)
#ifdef NO_PIPE_SIGIO
readPipeBlocked = False;
#endif
+ if (block)
+ signaling = True;
for (prev = &fileBlocked; (blocked = *prev); )
{
fd = blocked->file.fd;
diff --git a/sched.c b/sched.c
index 994d1c1..ffa9d6a 100644
--- a/sched.c
+++ b/sched.c
@@ -524,16 +524,12 @@ ThreadsBlock (void)
if (bh->handler)
(*bh->handler) (bh->closure);
}
- if (!running)
- {
- sigset_t set, oset;
- sigfillset (&set);
- sigprocmask (SIG_SETMASK, &set, &oset);
- if (!signaling)
- sigsuspend (&oset);
- sigprocmask (SIG_SETMASK, &oset, &set);
- }
+ /* Pend in either select or sigsuspend, depending
+ * on whether there are files blocked
+ */
+ if (!running)
+ FileCheckBlocked(True);
}
ReferencePtr RunningReference, StoppedReference;
commit 6719d500e3bcc2a3428680a7b4176b7660ecbe1b
Author: Keith Packard <keithp at keithp.com>
Date: Mon Nov 28 22:29:53 2011 -0800
rename configure.in to configure.ac
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..832e15e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,126 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl Copyright © 1988-2004 Keith Packard and Bart Massey.
+dnl All Rights Reserved. See the file COPYING in this directory
+dnl for licensing information.
+
+AC_PREREQ([2.68])
+
+AC_INIT([nickle],[2.72],[http://nickle.org],[nickle])
+
+AC_CONFIG_SRCDIR([nickle.h])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_AUX_DIR(.)
+
+AM_INIT_AUTOMAKE([foreign])
+
+AM_MAINTAINER_MODE
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AM_PROG_LEX
+dnl AC_PROG_YACC
+AC_CHECK_PROGS([YACC], byacc yacc bison, yacc)
+case "$YACC" in
+*bison) YACC="$YACC -y" ;;
+esac
+AC_PROG_AWK
+AC_CHECK_PROGS([DATE], date)
+
+dnl Checks for libraries.
+AC_CHECK_FUNC(log,,AC_CHECK_LIB(m, log))
+AC_CHECK_FUNC(gethostbyname,,AC_CHECK_LIB(nsl, gethostbyname))
+AC_CHECK_FUNC(socket,,AC_CHECK_LIB(socket, socket)
+ AC_CHECK_LIB(resolv, hstrerror))
+AC_CHECK_LIB(dl, dlopen)
+
+dnl as-compiler-flag.m4 0.0.1
+dnl autostars m4 macro for detection of compiler flags
+dnl
+dnl ds at schleef.org
+
+AC_DEFUN([AS_COMPILER_FLAG],
+[
+ AC_MSG_CHECKING([to see if compiler understands $1])
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[return 0])], [flag_ok=yes], [flag_ok=no])
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes; then
+ $2
+ true
+ else
+ $3
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
+
+AS_COMPILER_FLAG([-Wl,-E], GCC_EXTERN="yes", GCC_EXTERN="no")
+if test $GCC_EXTERN = yes; then
+ NICKLE_LDFLAGS="-Wl,-E"
+ AC_DEFINE([HAVE_EXTERN_SYMS], 1, [C compilers can extern program symbols])
+else
+ NICKLE_LDFLAGS=""
+fi
+AC_SUBST(NICKLE_LDFLAGS)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h strings.h time.h sys/time.h unistd.h sys/resource.h)
+AC_CHECK_HEADERS(stropts.h)
+AC_CHECK_HEADERS(dlfcn.h)
+
+dnl Checks for precise integer types
+AC_CHECK_HEADERS(stdint.h)
+case "$ac_cv_header_stdint_h" in
+ no)
+ AC_CHECK_SIZEOF([unsigned long long], 0)
+ AC_CHECK_SIZEOF([unsigned long], 0)
+ AC_CHECK_SIZEOF([unsigned int], 0)
+ AC_CHECK_SIZEOF([unsigned short], 0)
+ ;;
+ yes)
+ AC_MSG_CHECKING([for uint64_t])
+ AC_EGREP_HEADER([uint64_t], stdint.h,
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_UINT64_T], 1, [Has uint64_t datatype]),
+ AC_MSG_RESULT(no))
+ ;;
+esac
+
+dnl Checks for library functions.
+
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS(unsetenv setenv putenv gettimeofday hstrerror select)
+AC_CHECK_FUNCS(sigaction sigrelse sigignore setrlimit getrlimit)
+AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
+
+AC_FUNC_GETPGRP
+
+dnl The readline test is complicated enough to rate its own file
+AC_LIB_READLINE
+
+if test "x$prefix" = xNONE; then
+ prefix="$ac_default_prefix"
+fi
+
+nicklelibdir=`eval echo ${datadir}`/nickle
+
+AC_SUBST(nicklelibdir)
+
+AC_CONFIG_FILES(
+ Makefile
+ test/Makefile
+ bench/Makefile
+ examples/Makefile
+ examples/smlng/Makefile
+ examples/turtle/Makefile
+ date-sh)
+
+AC_OUTPUT
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 832e15e..0000000
--- a/configure.in
+++ /dev/null
@@ -1,126 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-dnl Copyright © 1988-2004 Keith Packard and Bart Massey.
-dnl All Rights Reserved. See the file COPYING in this directory
-dnl for licensing information.
-
-AC_PREREQ([2.68])
-
-AC_INIT([nickle],[2.72],[http://nickle.org],[nickle])
-
-AC_CONFIG_SRCDIR([nickle.h])
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_AUX_DIR(.)
-
-AM_INIT_AUTOMAKE([foreign])
-
-AM_MAINTAINER_MODE
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AM_PROG_LEX
-dnl AC_PROG_YACC
-AC_CHECK_PROGS([YACC], byacc yacc bison, yacc)
-case "$YACC" in
-*bison) YACC="$YACC -y" ;;
-esac
-AC_PROG_AWK
-AC_CHECK_PROGS([DATE], date)
-
-dnl Checks for libraries.
-AC_CHECK_FUNC(log,,AC_CHECK_LIB(m, log))
-AC_CHECK_FUNC(gethostbyname,,AC_CHECK_LIB(nsl, gethostbyname))
-AC_CHECK_FUNC(socket,,AC_CHECK_LIB(socket, socket)
- AC_CHECK_LIB(resolv, hstrerror))
-AC_CHECK_LIB(dl, dlopen)
-
-dnl as-compiler-flag.m4 0.0.1
-dnl autostars m4 macro for detection of compiler flags
-dnl
-dnl ds at schleef.org
-
-AC_DEFUN([AS_COMPILER_FLAG],
-[
- AC_MSG_CHECKING([to see if compiler understands $1])
-
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
-
- AC_LINK_IFELSE([AC_LANG_PROGRAM([],[return 0])], [flag_ok=yes], [flag_ok=no])
- CFLAGS="$save_CFLAGS"
-
- if test "X$flag_ok" = Xyes; then
- $2
- true
- else
- $3
- true
- fi
- AC_MSG_RESULT([$flag_ok])
-])
-
-AS_COMPILER_FLAG([-Wl,-E], GCC_EXTERN="yes", GCC_EXTERN="no")
-if test $GCC_EXTERN = yes; then
- NICKLE_LDFLAGS="-Wl,-E"
- AC_DEFINE([HAVE_EXTERN_SYMS], 1, [C compilers can extern program symbols])
-else
- NICKLE_LDFLAGS=""
-fi
-AC_SUBST(NICKLE_LDFLAGS)
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h strings.h time.h sys/time.h unistd.h sys/resource.h)
-AC_CHECK_HEADERS(stropts.h)
-AC_CHECK_HEADERS(dlfcn.h)
-
-dnl Checks for precise integer types
-AC_CHECK_HEADERS(stdint.h)
-case "$ac_cv_header_stdint_h" in
- no)
- AC_CHECK_SIZEOF([unsigned long long], 0)
- AC_CHECK_SIZEOF([unsigned long], 0)
- AC_CHECK_SIZEOF([unsigned int], 0)
- AC_CHECK_SIZEOF([unsigned short], 0)
- ;;
- yes)
- AC_MSG_CHECKING([for uint64_t])
- AC_EGREP_HEADER([uint64_t], stdint.h,
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_UINT64_T], 1, [Has uint64_t datatype]),
- AC_MSG_RESULT(no))
- ;;
-esac
-
-dnl Checks for library functions.
-
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(unsetenv setenv putenv gettimeofday hstrerror select)
-AC_CHECK_FUNCS(sigaction sigrelse sigignore setrlimit getrlimit)
-AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
-
-AC_FUNC_GETPGRP
-
-dnl The readline test is complicated enough to rate its own file
-AC_LIB_READLINE
-
-if test "x$prefix" = xNONE; then
- prefix="$ac_default_prefix"
-fi
-
-nicklelibdir=`eval echo ${datadir}`/nickle
-
-AC_SUBST(nicklelibdir)
-
-AC_CONFIG_FILES(
- Makefile
- test/Makefile
- bench/Makefile
- examples/Makefile
- examples/smlng/Makefile
- examples/turtle/Makefile
- date-sh)
-
-AC_OUTPUT
More information about the Nickle
mailing list