From keithp at keithp.com Sun Jan 29 20:20:21 2012 From: keithp at keithp.com (Keith Packard) Date: Sun, 29 Jan 2012 20:20:21 -0800 (PST) Subject: [Nickle] nickle: Branch 'master' - 2 commits Message-ID: <20120130042021.2B235D74029@keithp.com> configure.in | 2 +- debian/changelog | 6 ++++++ file.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) New commits: commit 8515fa7a571f4e7bf0e66e09b1b73e747fa597c6 Author: Keith Packard Date: Mon Nov 28 22:27:33 2011 -0800 Switch version to 2.72 in preparation for an eventual release Signed-off-by: Keith Packard diff --git a/configure.in b/configure.in index ac54f95..832e15e 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ dnl for licensing information. AC_PREREQ([2.68]) -AC_INIT([nickle],[2.71],[http://nickle.org],[nickle]) +AC_INIT([nickle],[2.72],[http://nickle.org],[nickle]) AC_CONFIG_SRCDIR([nickle.h]) AC_CONFIG_HEADERS([config.h]) diff --git a/debian/changelog b/debian/changelog index f1b0193..0ebbde7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nickle (2.72-1) unstable; urgency=low + + * don't infinite loop when wait3 returns 0 + + -- Keith Packard Fri, 25 Nov 2011 12:15:26 -0800 + nickle (2.71-1) unstable; urgency=low * Update old-school variable length struct allocation to ansi-C commit 395b70966490f406c7b40a41d18c8f7b93c057a8 Author: Keith Packard Date: Fri Nov 25 12:11:07 2011 -0800 wait3 returns 0 when there's nothing left to do Don't keep looping when wait3 is done Signed-off-by: Keith Packard diff --git a/file.c b/file.c index 8dbdd7c..de51268 100644 --- a/file.c +++ b/file.c @@ -467,6 +467,8 @@ ProcessInterrupt () int status; pid = wait3 (&status, WNOHANG, NULL); + if (pid == 0) + break; if (pid < 0 && errno == ECHILD) break; } From keithp at keithp.com Sun Jan 29 21:59:58 2012 From: keithp at keithp.com (Keith Packard) Date: Sun, 29 Jan 2012 21:59:58 -0800 (PST) Subject: [Nickle] nickle: Branch 'master' - 3 commits Message-ID: <20120130055958.B0096D74029@keithp.com> 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 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 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 ]) + AC_CHECK_DECL(rl_reset_after_signal, + AC_DEFINE(HAVE_RL_RESET_AFTER_SIGNAL,1,[Has rl_reset_after_signal]),,[#include ]) + AC_CHECK_DECL(rl_cleanup_after_signal, + AC_DEFINE(HAVE_RL_CLEANUP_AFTER_SIGNAL,1,[Has rl_cleanup_after_signal]),,[#include ]) +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 #endif +#if HAVE_LIBREADLINE +#include +#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 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 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 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 From keithp at keithp.com Sun Jan 29 22:05:48 2012 From: keithp at keithp.com (Keith Packard) Date: Sun, 29 Jan 2012 22:05:48 -0800 (PST) Subject: [Nickle] nickle: Branch 'master' Message-ID: <20120130060548.0D330D74029@keithp.com> debian/changelog | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 9e373c7f302b194b33fc83c10b66d7d367a821d8 Author: Keith Packard Date: Sun Jan 29 22:05:21 2012 -0800 Update to version 2.72 diff --git a/debian/changelog b/debian/changelog index 0ebbde7..e295385 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,11 @@ nickle (2.72-1) unstable; urgency=low - * don't infinite loop when wait3 returns 0 + * wait3 returns 0 when there's nothing left to do + * Rename configure.in to configure.ac + * Block in select instead of sigsuspend when waiting for I/O + * Keep readline from catching signals - -- Keith Packard Fri, 25 Nov 2011 12:15:26 -0800 + -- Keith Packard Sun, 29 Jan 2012 22:03:44 -0800 nickle (2.71-1) unstable; urgency=low From keithp at keithp.com Sun Jan 29 22:05:48 2012 From: keithp at keithp.com (Keith Packard) Date: Sun, 29 Jan 2012 22:05:48 -0800 (PST) Subject: [Nickle] nickle: Changes to 'refs/tags/2.72' Message-ID: <20120130060548.6E752D74031@keithp.com> Tag '2.72' created by Keith Packard at 2012-01-30 06:05 -0800 Version 2.72 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iD8DBQBPJjMsQp8BWwlsTdMRAp/tAJ0YYQH6Uk3ze2qF15f4tSc0bz2R2gCggiih mMFEB/ATtiadO7FtrqUCSJg= =yRox -----END PGP SIGNATURE----- Changes since 2.71-5: --- 0 files changed ---