summaryrefslogtreecommitdiff
path: root/libguile/scmsigs.c
diff options
context:
space:
mode:
authorNeil Jerram <neil@ossau.uklinux.net>2009-06-18 20:35:45 +0100
committerNeil Jerram <neil@ossau.uklinux.net>2009-06-18 20:35:45 +0100
commit5e9dc714ca61b12c2300e350dba1b216004016bb (patch)
tree0177a816e07c9ffc43ef81942ef85cf1481215e1 /libguile/scmsigs.c
parentd2cb6b102b16ff074c0e6a3dd7f8f280558d5404 (diff)
downloadguile-5e9dc714ca61b12c2300e350dba1b216004016bb.tar.gz
Remove AC_SYS_RESTARTABLE_SYSCALLS and related code
As the Autoconf documentation says, "These days portable programs [...] should not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays whether a system call is restartable is a dynamic issue, not a configuration-time issue." In other words, if we ever rely on HAVE_RESTARTABLE_SYSCALLS, we are at the mercy of any code that Guile happens to be linked with, because that code could install a signal handler without the SA_RESTART flag, and then a Guile system call could unexpectedly return EINTR. The readline part of this goes back to this problem report: excellent example of the above paragraph. It was noted during the discussion that undefining HAVE_RESTARTABLE_SYSCALLS would fix the problem, but that solution wasn't adopted - I guess because Guile was still using cooperative threads then (not pthreads) and so there was a significant concern (whether founded or not) that not using restartable syscalls (where available) could lead to a loss of performance. Now Guile's default mode of operation is with pthreads, where we already don't assume that HAVE_RESTARTABLE_SYSCALLS is reliable, so there is no possible further performance loss. And in any case we really have no choice, if we want correct operation. * configure.in (AC_SYS_RESTARTABLE_SYSCALLS): Removed. * doc/ref/posix.texi (Signals): Remove statement that Guile always sets SA_RESTART flag. * guile-readline/configure.in (GUILE_SIGWINCH_SA_RESTART_CLEARED): Remove this setting, together with its test code. (HAVE_RL_PRE_INPUT_HOOK): Remove this setting and its code, as no longer needed. * guile-readline/readline.c (sigwinch_enable_restart): Removed. (scm_init_readline): Remove setting of rl_pre_input_hook. * libguile/_scm.h (SCM_SYSCALL): Remove the definition that relies on HAVE_RESTARTABLE_SYSCALLS. * libguile/scmsigs.c (scm_sigaction_for_thread): Don't always set the SA_RESTART flag if available. Update docstring accordingly. (scm_init_scmsigs): Remove code that sets SA_RESTART flag for all signals.
Diffstat (limited to 'libguile/scmsigs.c')
-rw-r--r--libguile/scmsigs.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index e15bbf39c..8c655f1b1 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -282,10 +282,8 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0,
"a scheme procedure has been specified, that procedure will run\n"
"in the given @var{thread}. When no thread has been given, the\n"
"thread that made this call to @code{sigaction} is used.\n"
- "Flags can "
- "optionally be specified for the new handler (@code{SA_RESTART} will\n"
- "always be added if it's available and the system is using restartable\n"
- "system calls.) The return value is a pair with information about the\n"
+ "Flags can optionally be specified for the new handler.\n"
+ "The return value is a pair with information about the\n"
"old handler as described above.\n\n"
"This interface does not provide access to the \"signal blocking\"\n"
"facility. Maybe this is not needed, since the thread support may\n"
@@ -310,14 +308,7 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0,
csig = scm_to_signed_integer (signum, 0, NSIG-1);
#if defined(HAVE_SIGACTION)
-#if defined(SA_RESTART) && defined(HAVE_RESTARTABLE_SYSCALLS)
- /* don't allow SA_RESTART to be omitted if HAVE_RESTARTABLE_SYSCALLS
- is defined, since libguile would be likely to produce spurious
- EINTR errors. */
- action.sa_flags = SA_RESTART;
-#else
action.sa_flags = 0;
-#endif
if (!SCM_UNBNDP (flags))
action.sa_flags |= scm_to_int (flags);
sigemptyset (&action.sa_mask);
@@ -680,29 +671,6 @@ scm_init_scmsigs ()
#else
orig_handlers[i] = SIG_ERR;
#endif
-
-#ifdef HAVE_RESTARTABLE_SYSCALLS
- /* If HAVE_RESTARTABLE_SYSCALLS is defined, it's important that
- signals really are restartable. don't rely on the same
- run-time that configure got: reset the default for every signal.
- */
-#ifdef HAVE_SIGINTERRUPT
- siginterrupt (i, 0);
-#elif defined(SA_RESTART)
- {
- struct sigaction action;
-
- sigaction (i, NULL, &action);
- if (!(action.sa_flags & SA_RESTART))
- {
- action.sa_flags |= SA_RESTART;
- sigaction (i, &action, NULL);
- }
- }
-#endif
- /* if neither siginterrupt nor SA_RESTART are available we may
- as well assume that signals are always restartable. */
-#endif
}
scm_c_define ("NSIG", scm_from_long (NSIG));