summaryrefslogtreecommitdiff
path: root/libguile/scmsigs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/scmsigs.c')
-rw-r--r--libguile/scmsigs.c79
1 files changed, 11 insertions, 68 deletions
diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index eb7cec67b..d9b36c574 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -1,18 +1,19 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
@@ -147,32 +148,6 @@ take_signal (int signum)
#endif
}
-typedef struct {
- ssize_t res;
- int fd;
- char *buf;
- size_t n;
-} read_without_guile_data;
-
-static void *
-do_read_without_guile (void *raw_data)
-{
- read_without_guile_data *data = (read_without_guile_data *)raw_data;
- data->res = read (data->fd, data->buf, data->n);
- return NULL;
-}
-
-static ssize_t
-read_without_guile (int fd, char *buf, size_t n)
-{
- read_without_guile_data data;
- data.fd = fd;
- data.buf = buf;
- data.n = n;
- scm_without_guile (do_read_without_guile, &data);
- return data.res;
-}
-
static SCM
signal_delivery_thread (void *data)
{
@@ -186,7 +161,7 @@ signal_delivery_thread (void *data)
while (1)
{
- n = read_without_guile (signal_pipe[0], &sigbyte, 1);
+ n = read (signal_pipe[0], &sigbyte, 1);
sig = sigbyte;
if (n == 1 && sig >= 0 && sig < NSIG)
{
@@ -305,10 +280,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"
@@ -332,14 +305,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);
@@ -712,29 +678,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));