2008-08-27 23:05:44 +02:00
|
|
|
|
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
|
2000-06-10 13:24:28 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2009-06-17 00:22:09 +01:00
|
|
|
|
* 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.
|
2000-06-10 13:24:28 +00:00
|
|
|
|
*
|
2009-06-17 00:22:09 +01:00
|
|
|
|
* This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
* Lesser General Public License for more details.
|
2000-06-10 13:24:28 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-06-17 00:22:09 +01:00
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
|
|
* 02110-1301 USA
|
2003-04-05 19:15:35 +00:00
|
|
|
|
*/
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2008-09-13 15:35:27 +02:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2003-03-25 23:59:37 +00:00
|
|
|
|
# include <config.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2007-01-15 23:42:45 +00:00
|
|
|
|
#include <fcntl.h> /* for mingw */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#include <signal.h>
|
2005-03-02 20:42:01 +00:00
|
|
|
|
#include <stdio.h>
|
* _scm.h: Removed #include <errno.h>.
* error.c, net_db.c, putenv.c, stime.c: Removed declaration of
errno variable (can be a macro on some systems, for example when
using linux libc with threads).
* error.c, filesys.c, gc.c, ioext.c, iselect.c, net_db.c, ports.c,
posix.c, print.c, putenv.c, scmsigs.c, script.c, simpos.c, smob.c,
socket.c, srcprop.c, stime.c, strop.c, unif.c, vports.c: Added
#include <errno.h> in these 20 out of 100 files.
2001-03-10 16:56:09 +00:00
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/async.h"
|
|
|
|
|
|
#include "libguile/eval.h"
|
2001-06-26 15:46:40 +00:00
|
|
|
|
#include "libguile/root.h"
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/vectors.h"
|
2007-10-20 11:09:58 +00:00
|
|
|
|
#include "libguile/threads.h"
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/validate.h"
|
|
|
|
|
|
#include "libguile/scmsigs.h"
|
C files should #include only the header files they need, not
libguile.h (which #includes all the header files); the pointless
recompilation was wasting my time.
* Makefile.in (all .o dependency lists): Regenerated.
* libguile.h: Don't try to get a definition for size_t here...
* __scm.h: Do it here.
* _scm.h: Since this is the internal libguile header, put things
here that all (or a majority) of the libguile files will want.
Don't #include <libguile.h> here; that generates dependencies on
way too much. Instead, get "__scm.h", "error.h", "pairs.h",
"list.h", "gc.h", "gsubr.h", "procs.h", "numbers.h", "symbols.h",
"boolean.h", "strings.h", "vectors.h", "root.h", "ports.h", and
"async.h".
* alist.c: Get "eq.h", "list.h", "alist.h".
* append.c: Get "append.h", "list.h".
* arbiters.c: Get "arbiters.h", "smob.h".
* async.c: Get "async.h", "smob.h", "throw.h", "eval.h".
* boolean.c: Get "boolean.h".
* chars.c: Get "chars.h".
* continuations.c: Get "continuations.h", "dynwind.h", "debug.h",
"stackchk.h".
* debug.c: Get "debug.h", "feature.h", "read.h", "strports.h",
"continuations.h", "alist.h", "srcprop.h", "procprop.h", "smob.h",
"genio.h", "throw.h", "eval.h".
* dynwind.c: Get "dynwind.h", "alist.h", "eval.h".
* eq.c: Get "eq.h", "unif.h", "smob.h", "strorder.h",
"stackchk.h".
* error.c: Get "error.h", "throw.h", "genio.h", "pairs.h".
* eval.c: Get "eval.h", "stackchk.h", "srcprop.h", "debug.h",
"hashtab.h", "procprop.h", "markers.h", "smob.h", "throw.h",
"continuations.h", "eq.h", "sequences.h", "alist.h", "append.h",
"debug.h".
* fdsocket.c: Get "fdsocket.h", "unif.h", "filesys.h".
* feature.c: Get "feature.h".
* files.c: Get "files.h".
* filesys.c: Get "filesys.h", "smob.h", "genio.h".
* fports.c: Get "fports.h", "markers.h".
* gc.c: Get "async.h", "unif.h", "smob.h", "weaks.h",
"genio.h", "struct.h", "stackchk.h", "stime.h".
* gdbint.c: Get "gdbint.h", "chars.h", "eval.h", "print.h",
"read.h", "strports.h", "tag.h".
* genio.c: Get "genio.h", "chars.h".
* gsubr.c: Get "gsubr.h", "genio.h".
* hash.c: Get "hash.h", "chars.h".
* hashtab.c: Get "hashtab.h", "eval.h", "hash.h", "alist.h".
* init.c: Get everyone who has an scm_init_mumble function:
"weaks.h", "vports.h", "version.h", "vectors.h", "variable.h",
"unif.h", "throw.h", "tag.h", "symbols.h", "struct.h",
"strports.h", "strorder.h", "strop.h", "strings.h", "stime.h",
"stackchk.h", "srcprop.h", "socket.h", "simpos.h", "sequences.h",
"scmsigs.h", "read.h", "ramap.h", "procs.h", "procprop.h",
"print.h", "posix.h", "ports.h", "pairs.h", "options.h",
"objprop.h", "numbers.h", "mbstrings.h", "mallocs.h", "load.h",
"list.h", "kw.h", "ioext.h", "hashtab.h", "hash.h", "gsubr.h",
"gdbint.h", "gc.h", "fports.h", "filesys.h", "files.h",
"feature.h", "fdsocket.h", "eval.h", "error.h", "eq.h",
"dynwind.h", "debug.h", "continuations.h", "chars.h", "boolean.h",
"async.h", "arbiters.h", "append.h", "alist.h".
* ioext.c: Get "ioext.h", "fports.h".
* kw.c: Get "kw.h", "smob.h", "mbstrings.h", "genio.h".
* list.c: Get "list.h", "eq.h".
* load.c: Get "load.h", "eval.h", "read.h", "fports.h".
* mallocs.c: Get "smob.h", "genio.h".
* markers.c: Get "markers.h".
* mbstrings.c: Get "mbstrings.h", "read.h", "genio.h", "unif.h",
"chars.h".
* numbers.c: Get "unif.h", "genio.h".
* objprop.c: Get "objprop.h", "weaks.h", "alist.h", "hashtab.h".
* options.c: Get "options.h".
* ports.c: Get "ports.h", "vports.h", "strports.h", "fports.h",
"markers.h", "chars.h", "genio.h".
* posix.c: Get "posix.h", "sequences.h", "feature.h", "unif.h",
"read.h", "scmsigs.h", "genio.h", "fports.h".
* print.c: Get "print.h", "unif.h", "weaks.h", "read.h",
"procprop.h", "eval.h", "smob.h", "mbstrings.h", "genio.h",
"chars.h".
* procprop.c: Get "procprop.h", "eval.h", "alist.h".
* procs.c: Get "procs.h".
* ramap.c: Get "ramap.h", "feature.h", "eval.h", "eq.h",
"chars.h", "smob.h", "unif.h".
* read.c: Get "alist.h", "kw.h", "mbstrings.h", "unif.h",
"eval.h", "genio.h", "chars.h".
* root.c: Get "root.h", "stackchk.h".
* scmsigs.c: Get "scmsigs.h".
* sequences.c: Get "sequences.h".
* simpos.c: Get "simpos.h", "scmsigs.h".
* smob.c: Get "smob.h".
* socket.c: Get "socket.h", "feature.h".
* srcprop.c: Get "srcprop.h", "weaks.h", "hashtab.h", "debug.h",
"alist.h", "smob.h".
* stackchk.c: Get "stackchk.h", "genio.h".
* stime.c: Get "stime.h"."libguile/continuations.h".
* strings.c: Get "strings.h", "chars.h".
* strop.c: Get "strop.h", "chars.h".
* strorder.c: Get "strorder.h", "chars.h".
* strports.c: Get "strports.h", "print.h", "eval.h", "unif.h".
* struct.c: Get "struct.h", "chars.h".
* symbols.c: Get "symbols.h", "mbstrings.h", "alist.h",
"variable.h", "eval.h", "chars.h".
* tag.c: Get "tag.h", "struct.h", "chars.h".
* throw.c: Get "throw.h", "continuations.h", "debug.h",
"dynwind.h", "eval.h", "alist.h", "smob.h", "genio.h".
* unif.c: Get "unif.h", "feature.h", "strop.h", "sequences.h",
"smob.h", "genio.h", "eval.h", "chars.h".
* variable.c: Get "variable.h", "smob.h", "genio.h".
* vectors.c: Get "vectors.h", "eq.h".
* version.c: Get "version.h".
* vports.c: Get "vports.h", "fports.h", "chars.h", "eval.h".
* weaks.c: Get "weaks.h".
1996-09-10 02:26:07 +00:00
|
|
|
|
|
2007-01-15 23:42:45 +00:00
|
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
|
|
#include <io.h> /* for mingw _pipe() */
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_PROCESS_H
|
|
|
|
|
|
#include <process.h> /* for mingw */
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2001-07-21 21:11:16 +00:00
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
#define alarm(sec) (0)
|
|
|
|
|
|
/* This weird comma expression is because Sleep is void under Windows. */
|
|
|
|
|
|
#define sleep(sec) (Sleep ((sec) * 1000), 0)
|
2001-11-02 00:16:57 +00:00
|
|
|
|
#define usleep(usec) (Sleep ((usec) / 1000), 0)
|
2007-01-15 23:42:45 +00:00
|
|
|
|
#define pipe(fd) _pipe (fd, 256, O_BINARY)
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2008-11-30 18:43:41 +01:00
|
|
|
|
#include <full-write.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
/* SIGRETTYPE is the type that signal handlers return. See <signal.h> */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
#ifdef RETSIGTYPE
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
# define SIGRETTYPE RETSIGTYPE
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#else
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
# ifdef STDC_HEADERS
|
|
|
|
|
|
# define SIGRETTYPE void
|
|
|
|
|
|
# else
|
|
|
|
|
|
# define SIGRETTYPE int
|
|
|
|
|
|
# endif
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
/* take_signal is installed as the C signal handler whenever a Scheme
|
2005-03-02 20:42:01 +00:00
|
|
|
|
handler is set. When a signal arrives, take_signal will write a
|
|
|
|
|
|
byte into the 'signal pipe'. The 'signal delivery thread' will
|
|
|
|
|
|
read this pipe and queue the appropriate asyncs.
|
|
|
|
|
|
|
|
|
|
|
|
When Guile is built without threads, the signal handler will
|
|
|
|
|
|
install the async directly.
|
|
|
|
|
|
*/
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2002-10-04 14:13:26 +00:00
|
|
|
|
/* Scheme vectors with information about a signal. signal_handlers
|
2005-03-02 20:42:01 +00:00
|
|
|
|
contains the handler procedure or #f, signal_handler_asyncs
|
|
|
|
|
|
contains the thunk to be marked as an async when the signal arrives
|
|
|
|
|
|
(or the cell with the thunk in a singlethreaded Guile), and
|
2002-10-27 20:25:17 +00:00
|
|
|
|
signal_handler_threads points to the thread that a signal should be
|
|
|
|
|
|
delivered to.
|
2002-10-04 14:13:26 +00:00
|
|
|
|
*/
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
static SCM *signal_handlers;
|
2005-03-02 20:42:01 +00:00
|
|
|
|
static SCM signal_handler_asyncs;
|
2002-10-04 14:13:26 +00:00
|
|
|
|
static SCM signal_handler_threads;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2007-10-20 11:09:58 +00:00
|
|
|
|
/* The signal delivery thread. */
|
|
|
|
|
|
scm_i_thread *scm_i_signal_delivery_thread = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* The mutex held when launching the signal delivery thread. */
|
|
|
|
|
|
static scm_i_pthread_mutex_t signal_delivery_thread_mutex =
|
|
|
|
|
|
SCM_I_PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
/* saves the original C handlers, when a new handler is installed.
|
|
|
|
|
|
set to SIG_ERR if the original handler is installed. */
|
|
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
static struct sigaction orig_handlers[NSIG];
|
|
|
|
|
|
#else
|
2000-05-01 22:19:33 +00:00
|
|
|
|
static SIGRETTYPE (*orig_handlers[NSIG])(int);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
close_1 (SCM proc, SCM arg)
|
|
|
|
|
|
{
|
|
|
|
|
|
return scm_primitive_eval_x (scm_list_3 (scm_sym_lambda, SCM_EOL,
|
|
|
|
|
|
scm_list_2 (proc, arg)));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if SCM_USE_PTHREAD_THREADS
|
2007-01-15 23:42:45 +00:00
|
|
|
|
/* On mingw there's no notion of inter-process signals, only a raise()
|
|
|
|
|
|
within the process itself which apparently invokes the registered handler
|
|
|
|
|
|
immediately. Not sure how well the following code will cope in this
|
|
|
|
|
|
case. It builds but it may not offer quite the same scheme-level
|
|
|
|
|
|
semantics as on a proper system. If you're relying on much in the way of
|
|
|
|
|
|
signal handling on mingw you probably lose anyway. */
|
2005-03-02 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
|
static int signal_pipe[2];
|
2002-10-27 20:25:17 +00:00
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
static SIGRETTYPE
|
|
|
|
|
|
take_signal (int signum)
|
|
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
char sigbyte = signum;
|
2008-11-30 18:43:41 +01:00
|
|
|
|
full_write (signal_pipe[1], &sigbyte, 1);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
|
2002-10-04 14:13:26 +00:00
|
|
|
|
#ifndef HAVE_SIGACTION
|
|
|
|
|
|
signal (signum, take_signal);
|
|
|
|
|
|
#endif
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2005-12-06 20:02:19 +00:00
|
|
|
|
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)
|
|
|
|
|
|
{
|
2005-12-14 00:15:00 +00:00
|
|
|
|
read_without_guile_data *data = (read_without_guile_data *)raw_data;
|
2005-12-06 20:02:19 +00:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
signal_delivery_thread (void *data)
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
int n, sig;
|
|
|
|
|
|
char sigbyte;
|
2007-01-15 23:42:45 +00:00
|
|
|
|
#if HAVE_PTHREAD_SIGMASK /* not on mingw, see notes above */
|
|
|
|
|
|
sigset_t all_sigs;
|
2005-03-02 20:42:01 +00:00
|
|
|
|
sigfillset (&all_sigs);
|
|
|
|
|
|
scm_i_pthread_sigmask (SIG_SETMASK, &all_sigs, NULL);
|
2007-01-15 23:42:45 +00:00
|
|
|
|
#endif
|
2005-03-02 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
|
{
|
2005-12-06 20:02:19 +00:00
|
|
|
|
n = read_without_guile (signal_pipe[0], &sigbyte, 1);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
sig = sigbyte;
|
|
|
|
|
|
if (n == 1 && sig >= 0 && sig < NSIG)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM h, t;
|
|
|
|
|
|
|
|
|
|
|
|
h = SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, sig);
|
|
|
|
|
|
t = SCM_SIMPLE_VECTOR_REF (signal_handler_threads, sig);
|
|
|
|
|
|
if (scm_is_true (h))
|
|
|
|
|
|
scm_system_async_mark_for_thread (h, t);
|
|
|
|
|
|
}
|
2007-10-20 11:09:58 +00:00
|
|
|
|
else if (n == 0)
|
|
|
|
|
|
break; /* the signal pipe was closed. */
|
2005-03-02 20:42:01 +00:00
|
|
|
|
else if (n < 0 && errno != EINTR)
|
|
|
|
|
|
perror ("error in signal delivery thread");
|
|
|
|
|
|
}
|
2005-05-10 20:04:14 +00:00
|
|
|
|
|
2007-10-20 11:09:58 +00:00
|
|
|
|
return SCM_UNSPECIFIED; /* not reached unless all other threads exited */
|
2002-10-04 14:13:26 +00:00
|
|
|
|
}
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
static void
|
|
|
|
|
|
start_signal_delivery_thread (void)
|
2002-10-04 14:13:26 +00:00
|
|
|
|
{
|
2007-10-20 11:09:58 +00:00
|
|
|
|
SCM signal_thread;
|
|
|
|
|
|
|
|
|
|
|
|
scm_i_pthread_mutex_lock (&signal_delivery_thread_mutex);
|
|
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
if (pipe (signal_pipe) != 0)
|
|
|
|
|
|
scm_syserror (NULL);
|
2007-10-20 11:09:58 +00:00
|
|
|
|
signal_thread = scm_spawn_thread (signal_delivery_thread, NULL,
|
|
|
|
|
|
scm_handle_by_message,
|
|
|
|
|
|
"signal delivery thread");
|
|
|
|
|
|
scm_i_signal_delivery_thread = SCM_I_THREAD_DATA (signal_thread);
|
|
|
|
|
|
|
|
|
|
|
|
scm_i_pthread_mutex_unlock (&signal_delivery_thread_mutex);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2007-10-20 11:09:58 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_i_ensure_signal_delivery_thread ()
|
2005-03-02 20:42:01 +00:00
|
|
|
|
{
|
|
|
|
|
|
static scm_i_pthread_once_t once = SCM_I_PTHREAD_ONCE_INIT;
|
|
|
|
|
|
scm_i_pthread_once (&once, start_signal_delivery_thread);
|
|
|
|
|
|
}
|
2002-10-27 20:25:17 +00:00
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
#else /* !SCM_USE_PTHREAD_THREADS */
|
2002-10-27 20:25:17 +00:00
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
static SIGRETTYPE
|
|
|
|
|
|
take_signal (int signum)
|
2002-10-27 20:25:17 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM cell = SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, signum);
|
|
|
|
|
|
scm_i_thread *t = SCM_I_CURRENT_THREAD;
|
|
|
|
|
|
|
|
|
|
|
|
if (scm_is_false (SCM_CDR (cell)))
|
2002-10-27 20:25:17 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM_SETCDR (cell, t->active_asyncs);
|
|
|
|
|
|
t->active_asyncs = cell;
|
|
|
|
|
|
t->pending_asyncs = 1;
|
2002-10-27 20:25:17 +00:00
|
|
|
|
}
|
2005-03-02 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_SIGACTION
|
|
|
|
|
|
signal (signum, take_signal);
|
|
|
|
|
|
#endif
|
2002-10-27 20:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2007-10-20 11:09:58 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_i_ensure_signal_delivery_thread ()
|
2002-10-27 20:25:17 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2002-10-27 20:25:17 +00:00
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
#endif /* !SCM_USE_PTHREAD_THREADS */
|
2002-10-27 20:25:17 +00:00
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
static void
|
|
|
|
|
|
install_handler (int signum, SCM thread, SCM handler)
|
|
|
|
|
|
{
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_false (handler))
|
2002-10-27 20:25:17 +00:00
|
|
|
|
{
|
2005-01-02 20:49:04 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (*signal_handlers, signum, SCM_BOOL_F);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (signal_handler_asyncs, signum, SCM_BOOL_F);
|
2002-10-27 20:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM async = close_1 (handler, scm_from_int (signum));
|
|
|
|
|
|
#if !SCM_USE_PTHREAD_THREADS
|
|
|
|
|
|
async = scm_cons (async, SCM_BOOL_F);
|
|
|
|
|
|
#endif
|
2005-01-02 20:49:04 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (*signal_handlers, signum, handler);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (signal_handler_asyncs, signum, async);
|
2002-10-27 20:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (signal_handler_threads, signum, thread);
|
2002-10-27 20:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM
|
|
|
|
|
|
scm_sigaction (SCM signum, SCM handler, SCM flags)
|
2002-10-27 20:25:17 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
return scm_sigaction_for_thread (signum, handler, flags, SCM_UNDEFINED);
|
2002-10-27 20:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
/* user interface for installation of signal handlers. */
|
2002-10-04 14:13:26 +00:00
|
|
|
|
SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0,
|
|
|
|
|
|
(SCM signum, SCM handler, SCM flags, SCM thread),
|
2000-06-05 22:57:51 +00:00
|
|
|
|
"Install or report the signal handler for a specified signal.\n\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@var{signum} is the signal number, which can be specified using the value\n"
|
|
|
|
|
|
"of variables such as @code{SIGINT}.\n\n"
|
2002-10-04 14:13:26 +00:00
|
|
|
|
"If @var{handler} is omitted, @code{sigaction} returns a pair: the\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"CAR is the current\n"
|
|
|
|
|
|
"signal hander, which will be either an integer with the value @code{SIG_DFL}\n"
|
|
|
|
|
|
"(default action) or @code{SIG_IGN} (ignore), or the Scheme procedure which\n"
|
|
|
|
|
|
"handles the signal, or @code{#f} if a non-Scheme procedure handles the\n"
|
|
|
|
|
|
"signal. The CDR contains the current @code{sigaction} flags for the handler.\n\n"
|
2002-10-04 14:13:26 +00:00
|
|
|
|
"If @var{handler} is provided, it is installed as the new handler for\n"
|
|
|
|
|
|
"@var{signum}. @var{handler} can be a Scheme procedure taking one\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"argument, or the value of @code{SIG_DFL} (default action) or\n"
|
|
|
|
|
|
"@code{SIG_IGN} (ignore), or @code{#f} to restore whatever signal handler\n"
|
2002-10-04 14:13:26 +00:00
|
|
|
|
"was installed before @code{sigaction} was first used. When\n"
|
|
|
|
|
|
"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 "
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"optionally be specified for the new handler (@code{SA_RESTART} will\n"
|
2000-06-05 22:57:51 +00:00
|
|
|
|
"always be added if it's available and the system is using restartable\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"system calls.) 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"
|
|
|
|
|
|
"provide solutions to the problem of consistent access to data\n"
|
|
|
|
|
|
"structures.")
|
2002-10-04 14:13:26 +00:00
|
|
|
|
#define FUNC_NAME s_scm_sigaction_for_thread
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
int csig;
|
|
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
struct sigaction action;
|
|
|
|
|
|
struct sigaction old_action;
|
|
|
|
|
|
#else
|
2002-01-28 21:15:55 +00:00
|
|
|
|
SIGRETTYPE (* chandler) (int) = SIG_DFL;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
SIGRETTYPE (* old_chandler) (int);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
int query_only = 0;
|
|
|
|
|
|
int save_handler = 0;
|
2002-07-20 14:08:34 +00:00
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
SCM old_handler;
|
|
|
|
|
|
|
* validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible. Changed all uses to scm_to_size_t
or similar.
2004-07-10 14:35:36 +00:00
|
|
|
|
csig = scm_to_signed_integer (signum, 0, NSIG-1);
|
|
|
|
|
|
|
1999-09-20 21:32:23 +00:00
|
|
|
|
#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. */
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
action.sa_flags = SA_RESTART;
|
|
|
|
|
|
#else
|
|
|
|
|
|
action.sa_flags = 0;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
if (!SCM_UNBNDP (flags))
|
* validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible. Changed all uses to scm_to_size_t
or similar.
2004-07-10 14:35:36 +00:00
|
|
|
|
action.sa_flags |= scm_to_int (flags);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
sigemptyset (&action.sa_mask);
|
2002-10-11 13:02:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2002-10-04 14:13:26 +00:00
|
|
|
|
if (SCM_UNBNDP (thread))
|
|
|
|
|
|
thread = scm_current_thread ();
|
|
|
|
|
|
else
|
2002-10-27 20:25:17 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM_VALIDATE_THREAD (4, thread);
|
|
|
|
|
|
if (scm_c_thread_exited_p (thread))
|
|
|
|
|
|
SCM_MISC_ERROR ("thread has already exited", SCM_EOL);
|
|
|
|
|
|
}
|
2002-10-11 13:02:50 +00:00
|
|
|
|
|
2007-10-20 11:09:58 +00:00
|
|
|
|
scm_i_ensure_signal_delivery_thread ();
|
2005-03-02 20:42:01 +00:00
|
|
|
|
|
|
|
|
|
|
SCM_CRITICAL_SECTION_START;
|
2005-01-02 20:49:04 +00:00
|
|
|
|
old_handler = SCM_SIMPLE_VECTOR_REF (*signal_handlers, csig);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
if (SCM_UNBNDP (handler))
|
|
|
|
|
|
query_only = 1;
|
2004-07-23 15:43:02 +00:00
|
|
|
|
else if (scm_is_integer (handler))
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
long handler_int = scm_to_long (handler);
|
|
|
|
|
|
|
|
|
|
|
|
if (handler_int == (long) SIG_DFL || handler_int == (long) SIG_IGN)
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
#ifdef HAVE_SIGACTION
|
2005-03-02 20:42:01 +00:00
|
|
|
|
action.sa_handler = (SIGRETTYPE (*) (int)) handler_int;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#else
|
2005-03-02 20:42:01 +00:00
|
|
|
|
chandler = (SIGRETTYPE (*) (int)) handler_int;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#endif
|
2002-10-27 20:25:17 +00:00
|
|
|
|
install_handler (csig, SCM_BOOL_F, SCM_BOOL_F);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_OUT_OF_RANGE (2, handler);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
2004-07-06 10:59:25 +00:00
|
|
|
|
else if (scm_is_false (handler))
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
/* restore the default handler. */
|
|
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
if (orig_handlers[csig].sa_handler == SIG_ERR)
|
|
|
|
|
|
query_only = 1;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
action = orig_handlers[csig];
|
|
|
|
|
|
orig_handlers[csig].sa_handler = SIG_ERR;
|
2002-10-27 20:25:17 +00:00
|
|
|
|
install_handler (csig, SCM_BOOL_F, SCM_BOOL_F);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
#else
|
|
|
|
|
|
if (orig_handlers[csig] == SIG_ERR)
|
|
|
|
|
|
query_only = 1;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
chandler = orig_handlers[csig];
|
|
|
|
|
|
orig_handlers[csig] = SIG_ERR;
|
2002-10-27 20:25:17 +00:00
|
|
|
|
install_handler (csig, SCM_BOOL_F, SCM_BOOL_F);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2000-06-10 13:24:28 +00:00
|
|
|
|
}
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-05-10 22:09:04 +00:00
|
|
|
|
SCM_VALIDATE_PROC (2, handler);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
action.sa_handler = take_signal;
|
|
|
|
|
|
if (orig_handlers[csig].sa_handler == SIG_ERR)
|
|
|
|
|
|
save_handler = 1;
|
|
|
|
|
|
#else
|
|
|
|
|
|
chandler = take_signal;
|
|
|
|
|
|
if (orig_handlers[csig] == SIG_ERR)
|
|
|
|
|
|
save_handler = 1;
|
|
|
|
|
|
#endif
|
2002-10-27 20:25:17 +00:00
|
|
|
|
install_handler (csig, thread, handler);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
2000-06-10 13:24:28 +00:00
|
|
|
|
|
2000-06-05 22:57:51 +00:00
|
|
|
|
/* XXX - Silently ignore setting handlers for `program error signals'
|
|
|
|
|
|
because they can't currently be handled by Scheme code.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
switch (csig)
|
|
|
|
|
|
{
|
|
|
|
|
|
/* This list of program error signals is from the GNU Libc
|
|
|
|
|
|
Reference Manual */
|
|
|
|
|
|
case SIGFPE:
|
|
|
|
|
|
case SIGILL:
|
|
|
|
|
|
case SIGSEGV:
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#ifdef SIGBUS
|
2000-06-05 22:57:51 +00:00
|
|
|
|
case SIGBUS:
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#endif
|
2000-06-05 22:57:51 +00:00
|
|
|
|
case SIGABRT:
|
2000-06-18 12:06:01 +00:00
|
|
|
|
#if defined(SIGIOT) && (SIGIOT != SIGABRT)
|
2000-06-05 22:57:51 +00:00
|
|
|
|
case SIGIOT:
|
|
|
|
|
|
#endif
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#ifdef SIGTRAP
|
2000-06-05 22:57:51 +00:00
|
|
|
|
case SIGTRAP:
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#endif
|
2000-06-05 22:57:51 +00:00
|
|
|
|
#ifdef SIGEMT
|
|
|
|
|
|
case SIGEMT:
|
|
|
|
|
|
#endif
|
2000-06-10 13:24:28 +00:00
|
|
|
|
#ifdef SIGSYS
|
2000-06-05 22:57:51 +00:00
|
|
|
|
case SIGSYS:
|
2000-06-10 13:24:28 +00:00
|
|
|
|
#endif
|
2000-06-05 22:57:51 +00:00
|
|
|
|
query_only = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
if (query_only)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sigaction (csig, 0, &old_action) == -1)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sigaction (csig, &action , &old_action) == -1)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
if (save_handler)
|
|
|
|
|
|
orig_handlers[csig] = old_action;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN)
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
old_handler = scm_from_long ((long) old_action.sa_handler);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM_CRITICAL_SECTION_END;
|
2004-07-23 15:43:02 +00:00
|
|
|
|
return scm_cons (old_handler, scm_from_int (old_action.sa_flags));
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#else
|
|
|
|
|
|
if (query_only)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((old_chandler = signal (csig, SIG_IGN)) == SIG_ERR)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
if (signal (csig, old_chandler) == SIG_ERR)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((old_chandler = signal (csig, chandler)) == SIG_ERR)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
if (save_handler)
|
|
|
|
|
|
orig_handlers[csig] = old_chandler;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (old_chandler == SIG_DFL || old_chandler == SIG_IGN)
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
old_handler = scm_from_long ((long) old_chandler);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM_CRITICAL_SECTION_END;
|
2004-07-23 15:43:02 +00:00
|
|
|
|
return scm_cons (old_handler, scm_from_int (0));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
|
2000-06-10 13:24:28 +00:00
|
|
|
|
SCM_DEFINE (scm_restore_signals, "restore-signals", 0, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(void),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Return all signal handlers to the values they had before any call to\n"
|
|
|
|
|
|
"@code{sigaction} was made. The return value is unspecified.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_restore_signals
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
int i;
|
|
|
|
|
|
for (i = 0; i < NSIG; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
if (orig_handlers[i].sa_handler != SIG_ERR)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sigaction (i, &orig_handlers[i], NULL) == -1)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
orig_handlers[i].sa_handler = SIG_ERR;
|
2005-01-02 20:49:04 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (*signal_handlers, i, SCM_BOOL_F);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
#else
|
|
|
|
|
|
if (orig_handlers[i] != SIG_ERR)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (signal (i, orig_handlers[i]) == SIG_ERR)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
orig_handlers[i] = SIG_ERR;
|
2005-01-02 20:49:04 +00:00
|
|
|
|
SCM_SIMPLE_VECTOR_SET (*signal_handlers, i, SCM_BOOL_F);
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-06-10 13:24:28 +00:00
|
|
|
|
SCM_DEFINE (scm_alarm, "alarm", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM i),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Set a timer to raise a @code{SIGALRM} signal after the specified\n"
|
|
|
|
|
|
"number of seconds (an integer). It's advisable to install a signal\n"
|
|
|
|
|
|
"handler for\n"
|
|
|
|
|
|
"@code{SIGALRM} beforehand, since the default action is to terminate\n"
|
|
|
|
|
|
"the process.\n\n"
|
|
|
|
|
|
"The return value indicates the time remaining for the previous alarm,\n"
|
|
|
|
|
|
"if any. The new value replaces the previous alarm. If there was\n"
|
|
|
|
|
|
"no previous alarm, the return value is zero.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_alarm
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
* validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible. Changed all uses to scm_to_size_t
or similar.
2004-07-10 14:35:36 +00:00
|
|
|
|
return scm_from_uint (alarm (scm_to_uint (i)));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2001-07-19 17:43:22 +00:00
|
|
|
|
#ifdef HAVE_SETITIMER
|
|
|
|
|
|
SCM_DEFINE (scm_setitimer, "setitimer", 5, 0, 0,
|
|
|
|
|
|
(SCM which_timer,
|
|
|
|
|
|
SCM interval_seconds, SCM interval_microseconds,
|
|
|
|
|
|
SCM value_seconds, SCM value_microseconds),
|
|
|
|
|
|
"Set the timer specified by @var{which_timer} according to the given\n"
|
|
|
|
|
|
"@var{interval_seconds}, @var{interval_microseconds},\n"
|
|
|
|
|
|
"@var{value_seconds}, and @var{value_microseconds} values.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"Return information about the timer's previous setting."
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"Errors are handled as described in the guile info pages under ``POSIX\n"
|
|
|
|
|
|
"Interface Conventions''.\n"
|
|
|
|
|
|
"\n"
|
2001-11-11 15:01:52 +00:00
|
|
|
|
"The timers available are: @code{ITIMER_REAL}, @code{ITIMER_VIRTUAL},\n"
|
2001-07-19 17:43:22 +00:00
|
|
|
|
"and @code{ITIMER_PROF}.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"The return value will be a list of two cons pairs representing the\n"
|
|
|
|
|
|
"current state of the given timer. The first pair is the seconds and\n"
|
|
|
|
|
|
"microseconds of the timer @code{it_interval}, and the second pair is\n"
|
2001-11-11 15:01:52 +00:00
|
|
|
|
"the seconds and microseconds of the timer @code{it_value}.")
|
2001-07-19 17:43:22 +00:00
|
|
|
|
#define FUNC_NAME s_scm_setitimer
|
|
|
|
|
|
{
|
|
|
|
|
|
int rv;
|
|
|
|
|
|
int c_which_timer;
|
|
|
|
|
|
struct itimerval new_timer;
|
|
|
|
|
|
struct itimerval old_timer;
|
|
|
|
|
|
|
|
|
|
|
|
c_which_timer = SCM_NUM2INT(1, which_timer);
|
|
|
|
|
|
new_timer.it_interval.tv_sec = SCM_NUM2LONG(2, interval_seconds);
|
|
|
|
|
|
new_timer.it_interval.tv_usec = SCM_NUM2LONG(3, interval_microseconds);
|
|
|
|
|
|
new_timer.it_value.tv_sec = SCM_NUM2LONG(4, value_seconds);
|
|
|
|
|
|
new_timer.it_value.tv_usec = SCM_NUM2LONG(5, value_microseconds);
|
|
|
|
|
|
|
|
|
|
|
|
SCM_SYSCALL(rv = setitimer(c_which_timer, &new_timer, &old_timer));
|
|
|
|
|
|
|
|
|
|
|
|
if(rv != 0)
|
|
|
|
|
|
SCM_SYSERROR;
|
|
|
|
|
|
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
return scm_list_2 (scm_cons (scm_from_long (old_timer.it_interval.tv_sec),
|
|
|
|
|
|
scm_from_long (old_timer.it_interval.tv_usec)),
|
|
|
|
|
|
scm_cons (scm_from_long (old_timer.it_value.tv_sec),
|
|
|
|
|
|
scm_from_long (old_timer.it_value.tv_usec)));
|
2001-07-19 17:43:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
#endif /* HAVE_SETITIMER */
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GETITIMER
|
|
|
|
|
|
SCM_DEFINE (scm_getitimer, "getitimer", 1, 0, 0,
|
|
|
|
|
|
(SCM which_timer),
|
|
|
|
|
|
"Return information about the timer specified by @var{which_timer}"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"Errors are handled as described in the guile info pages under ``POSIX\n"
|
|
|
|
|
|
"Interface Conventions''.\n"
|
|
|
|
|
|
"\n"
|
2001-11-11 15:01:52 +00:00
|
|
|
|
"The timers available are: @code{ITIMER_REAL}, @code{ITIMER_VIRTUAL},\n"
|
2001-07-19 17:43:22 +00:00
|
|
|
|
"and @code{ITIMER_PROF}.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"The return value will be a list of two cons pairs representing the\n"
|
|
|
|
|
|
"current state of the given timer. The first pair is the seconds and\n"
|
|
|
|
|
|
"microseconds of the timer @code{it_interval}, and the second pair is\n"
|
2001-11-11 15:01:52 +00:00
|
|
|
|
"the seconds and microseconds of the timer @code{it_value}.")
|
2001-07-19 17:43:22 +00:00
|
|
|
|
#define FUNC_NAME s_scm_getitimer
|
|
|
|
|
|
{
|
|
|
|
|
|
int rv;
|
|
|
|
|
|
int c_which_timer;
|
|
|
|
|
|
struct itimerval old_timer;
|
|
|
|
|
|
|
|
|
|
|
|
c_which_timer = SCM_NUM2INT(1, which_timer);
|
|
|
|
|
|
|
|
|
|
|
|
SCM_SYSCALL(rv = getitimer(c_which_timer, &old_timer));
|
|
|
|
|
|
|
|
|
|
|
|
if(rv != 0)
|
|
|
|
|
|
SCM_SYSERROR;
|
|
|
|
|
|
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
return scm_list_2 (scm_cons (scm_from_long (old_timer.it_interval.tv_sec),
|
|
|
|
|
|
scm_from_long (old_timer.it_interval.tv_usec)),
|
|
|
|
|
|
scm_cons (scm_from_long (old_timer.it_value.tv_sec),
|
|
|
|
|
|
scm_from_long (old_timer.it_value.tv_usec)));
|
2001-07-19 17:43:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
#endif /* HAVE_GETITIMER */
|
|
|
|
|
|
|
Changes to compile under gnu-win32, from Marcus Daniels:
* stime.c (tzset): If tzset isn't provided, make it a NOP.
(scm_localtime): Change SCM_EOF to SCM_EOL.
(scm_mktime): Likewise.
* socket.c: Don't include sys/un.h unless autoconf tells
us Unix domain sockets are available.
(scm_fill_sockaddr): Ignore Unix domain code.
(scm_addr_vector): Likewise.
(scm_init_addr_buffer): Likewise.
(scm_socketpair): Don't include unless socketpair was
found during autoconf.
* simpos.c (SYSTNAME): Treat cygwin like Unix.
* scmsigs.c (scm_pause): Don't include unless pause was found
during autoconf.
* posix.c (scm_getgroups): Don't include unless support function
was found during autoconf (in this case, getgroups).
(scm_setpwent): For setpwent.
(scm_setegid): For setegid.
* net_db.c (scm_inet_netof): Don't include unless support
function was found during autoconf (in this case, inet_netof).
(scm_lnaof): For inet_lnaof.
(scm_inet_makeaddr): For inet_makeaddr.
(scm_getnet): For getnetent, getnetbyname, getnetbyaddr.
(scm_getproto): For getprotoent.
(scm_getserv): For getservent.
(scm_sethost): For sethostent, endhostent.
(scm_setnet): For setnetent, endnetent.
(scm_setproto): For setprotoent, endprotoent.
(scm_setserv): For setservent, endservent.
* scmconfig.h.in: Regenerated.
1997-07-11 05:43:36 +00:00
|
|
|
|
#ifdef HAVE_PAUSE
|
2000-06-10 13:24:28 +00:00
|
|
|
|
SCM_DEFINE (scm_pause, "pause", 0, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Pause the current process (thread?) until a signal arrives whose\n"
|
|
|
|
|
|
"action is to either terminate the current process or invoke a\n"
|
|
|
|
|
|
"handler procedure. The return value is unspecified.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_pause
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
pause ();
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
Changes to compile under gnu-win32, from Marcus Daniels:
* stime.c (tzset): If tzset isn't provided, make it a NOP.
(scm_localtime): Change SCM_EOF to SCM_EOL.
(scm_mktime): Likewise.
* socket.c: Don't include sys/un.h unless autoconf tells
us Unix domain sockets are available.
(scm_fill_sockaddr): Ignore Unix domain code.
(scm_addr_vector): Likewise.
(scm_init_addr_buffer): Likewise.
(scm_socketpair): Don't include unless socketpair was
found during autoconf.
* simpos.c (SYSTNAME): Treat cygwin like Unix.
* scmsigs.c (scm_pause): Don't include unless pause was found
during autoconf.
* posix.c (scm_getgroups): Don't include unless support function
was found during autoconf (in this case, getgroups).
(scm_setpwent): For setpwent.
(scm_setegid): For setegid.
* net_db.c (scm_inet_netof): Don't include unless support
function was found during autoconf (in this case, inet_netof).
(scm_lnaof): For inet_lnaof.
(scm_inet_makeaddr): For inet_makeaddr.
(scm_getnet): For getnetent, getnetbyname, getnetbyaddr.
(scm_getproto): For getprotoent.
(scm_getserv): For getservent.
(scm_sethost): For sethostent, endhostent.
(scm_setnet): For setnetent, endnetent.
(scm_setproto): For setprotoent, endprotoent.
(scm_setserv): For setservent, endservent.
* scmconfig.h.in: Regenerated.
1997-07-11 05:43:36 +00:00
|
|
|
|
#endif
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-06-10 13:24:28 +00:00
|
|
|
|
SCM_DEFINE (scm_sleep, "sleep", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM i),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Wait for the given number of seconds (an integer) or until a signal\n"
|
|
|
|
|
|
"arrives. The return value is zero if the time elapses or the number\n"
|
2007-03-07 23:12:36 +00:00
|
|
|
|
"of seconds remaining otherwise.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"See also @code{usleep}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_sleep
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
return scm_from_uint (scm_std_sleep (scm_to_uint (i)));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-06-10 13:24:28 +00:00
|
|
|
|
SCM_DEFINE (scm_usleep, "usleep", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM i),
|
2007-03-07 23:12:36 +00:00
|
|
|
|
"Wait the given period @var{usecs} microseconds (an integer).\n"
|
|
|
|
|
|
"If a signal arrives the wait stops and the return value is the\n"
|
|
|
|
|
|
"time remaining, in microseconds. If the period elapses with no\n"
|
|
|
|
|
|
"signal the return is zero.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"On most systems the process scheduler is not microsecond accurate and\n"
|
|
|
|
|
|
"the actual period slept by @code{usleep} may be rounded to a system\n"
|
|
|
|
|
|
"clock tick boundary. Traditionally such ticks were 10 milliseconds\n"
|
|
|
|
|
|
"apart, and that interval is often still used.\n"
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
"See also @code{sleep}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_usleep
|
1998-04-20 00:40:09 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
return scm_from_ulong (scm_std_usleep (scm_to_ulong (i)));
|
1998-10-13 23:17:34 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1998-04-20 00:40:09 +00:00
|
|
|
|
|
2000-06-10 13:24:28 +00:00
|
|
|
|
SCM_DEFINE (scm_raise, "raise", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM sig),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Sends a specified signal @var{sig} to the current process, where\n"
|
|
|
|
|
|
"@var{sig} is as described for the kill procedure.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_raise
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2007-01-15 23:42:45 +00:00
|
|
|
|
if (raise (scm_to_int (sig)) != 0)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-20 11:09:58 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_i_close_signal_pipe()
|
|
|
|
|
|
{
|
|
|
|
|
|
/* SIGNAL_DELIVERY_THREAD_MUTEX is only locked while the signal delivery
|
|
|
|
|
|
thread is being launched. The thread that calls this function is
|
|
|
|
|
|
already holding the thread admin mutex, so if the delivery thread hasn't
|
|
|
|
|
|
been launched at this point, it never will be before shutdown. */
|
|
|
|
|
|
scm_i_pthread_mutex_lock (&signal_delivery_thread_mutex);
|
|
|
|
|
|
|
2008-08-27 23:05:44 +02:00
|
|
|
|
#if SCM_USE_PTHREAD_THREADS
|
2007-10-20 11:09:58 +00:00
|
|
|
|
if (scm_i_signal_delivery_thread != NULL)
|
|
|
|
|
|
close (signal_pipe[1]);
|
2008-08-27 23:05:44 +02:00
|
|
|
|
#endif
|
2007-10-20 11:09:58 +00:00
|
|
|
|
|
|
|
|
|
|
scm_i_pthread_mutex_unlock (&signal_delivery_thread_mutex);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_init_scmsigs ()
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
signal_handlers =
|
2001-05-15 14:57:22 +00:00
|
|
|
|
SCM_VARIABLE_LOC (scm_c_define ("signal-handlers",
|
|
|
|
|
|
scm_c_make_vector (NSIG, SCM_BOOL_F)));
|
2005-03-02 20:42:01 +00:00
|
|
|
|
signal_handler_asyncs =
|
2002-10-27 20:25:17 +00:00
|
|
|
|
scm_permanent_object (scm_c_make_vector (NSIG, SCM_BOOL_F));
|
2002-10-04 14:13:26 +00:00
|
|
|
|
signal_handler_threads =
|
|
|
|
|
|
scm_permanent_object (scm_c_make_vector (NSIG, SCM_BOOL_F));
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NSIG; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
#ifdef HAVE_SIGACTION
|
|
|
|
|
|
orig_handlers[i].sa_handler = SIG_ERR;
|
1999-06-12 17:26:22 +00:00
|
|
|
|
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#else
|
|
|
|
|
|
orig_handlers[i] = SIG_ERR;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
1999-06-12 17:26:22 +00:00
|
|
|
|
|
1999-09-18 17:13:38 +00:00
|
|
|
|
#ifdef HAVE_RESTARTABLE_SYSCALLS
|
1999-09-20 21:32:23 +00:00
|
|
|
|
/* If HAVE_RESTARTABLE_SYSCALLS is defined, it's important that
|
2000-06-10 13:24:28 +00:00
|
|
|
|
signals really are restartable. don't rely on the same
|
1999-09-20 21:32:23 +00:00
|
|
|
|
run-time that configure got: reset the default for every signal.
|
|
|
|
|
|
*/
|
|
|
|
|
|
#ifdef HAVE_SIGINTERRUPT
|
|
|
|
|
|
siginterrupt (i, 0);
|
1999-09-20 22:04:51 +00:00
|
|
|
|
#elif defined(SA_RESTART)
|
1999-06-12 17:26:22 +00:00
|
|
|
|
{
|
|
|
|
|
|
struct sigaction action;
|
|
|
|
|
|
|
|
|
|
|
|
sigaction (i, NULL, &action);
|
|
|
|
|
|
if (!(action.sa_flags & SA_RESTART))
|
|
|
|
|
|
{
|
2000-06-14 00:09:31 +00:00
|
|
|
|
action.sa_flags |= SA_RESTART;
|
1999-06-12 17:26:22 +00:00
|
|
|
|
sigaction (i, &action, NULL);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-09-20 21:32:23 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
/* if neither siginterrupt nor SA_RESTART are available we may
|
|
|
|
|
|
as well assume that signals are always restartable. */
|
1999-06-12 17:26:22 +00:00
|
|
|
|
#endif
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
}
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
scm_c_define ("NSIG", scm_from_long (NSIG));
|
|
|
|
|
|
scm_c_define ("SIG_IGN", scm_from_long ((long) SIG_IGN));
|
|
|
|
|
|
scm_c_define ("SIG_DFL", scm_from_long ((long) SIG_DFL));
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#ifdef SA_NOCLDSTOP
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
scm_c_define ("SA_NOCLDSTOP", scm_from_long (SA_NOCLDSTOP));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
* scmsigs.h, async.h: updated.
* _scm.h: if HAVE_RESTARTS is defined then don't use a SYSCALL
loop.
* posix.c (scm_uname): interpret only negative values as an error.
Solaris normally returns a positive value.
* script.c (scm_compile_shell_switches): if we are not going into
an interactive repl, set scm_mask_ints to zero so that asyncs can
run.
* simpos.c (scm_system): don't ignore/unignore signals around
the "system" call.
* posix.c (scm_open_pipe): don't ignore/unignore signals around
the "popen" call.
* init.c (scm_boot_guile_1): don't call scm_init_signals, it's
done in boot-9.scm instead.
* scmsigs.c, async.c: Major rewriting of signal handling code.
(scm_sigaction): new procedure.
(scm_sleep): don't wrap sleep in SCM_SYSCALL, it would mess up the
timing.
(scm_raise): return unspecified, throw error on failure.
* boot-9.scm: signal-handler, alarm-thunk: removed.
don't define ticks-interrupt etc.
top-repl: install signal handlers for SIGINT, SIGFPE, SIGSEGV, SIGBUS
during call to scm-style-repl.
* acconfig.h: mention HAVE_RESTARTS.
* configure.in: check for sigaction and restartable system calls.
1997-05-31 19:02:38 +00:00
|
|
|
|
#ifdef SA_RESTART
|
* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*. Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
|
|
|
|
scm_c_define ("SA_RESTART", scm_from_long (SA_RESTART));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
2001-07-19 17:43:22 +00:00
|
|
|
|
#if defined(HAVE_SETITIMER) || defined(HAVE_GETITIMER)
|
|
|
|
|
|
/* Stuff needed by setitimer and getitimer. */
|
2004-07-23 15:43:02 +00:00
|
|
|
|
scm_c_define ("ITIMER_REAL", scm_from_int (ITIMER_REAL));
|
|
|
|
|
|
scm_c_define ("ITIMER_VIRTUAL", scm_from_int (ITIMER_VIRTUAL));
|
|
|
|
|
|
scm_c_define ("ITIMER_PROF", scm_from_int (ITIMER_PROF));
|
2001-07-19 17:43:22 +00:00
|
|
|
|
#endif /* defined(HAVE_SETITIMER) || defined(HAVE_GETITIMER) */
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/scmsigs.x"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|