diff --git a/lisp/FreeBSD-os.h b/lisp/FreeBSD-os.h index 3370713a7c2200e73d4241e8892b190061d3a4ff..353bea60a27e8d9541cb218146c53bcef499cef3 100644 --- a/lisp/FreeBSD-os.h +++ b/lisp/FreeBSD-os.h @@ -1,12 +1,13 @@ /* - $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.h,v 1.2 1997/11/30 12:08:52 dtc Exp $ + $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.h,v 1.3 2000/04/12 17:31:19 pw Exp $ This code was written as part of the CMU Common Lisp project at Carnegie Mellon University, and has been placed in the public domain. */ +#include <osreldate.h> #include <sys/types.h> #include <sys/mman.h> #include <sys/signal.h> @@ -25,8 +26,20 @@ typedef int os_vm_prot_t; #define OS_VM_DEFAULT_PAGESIZE 4096 +/* I *think* this is when things became incompatible with old + signals. +*/ +#if __FreeBSD_version > 400010 +#define POSIX_SIGS int +/* If we used SA_SIGINFO in sigaction() the third argument to signal + handlers would be a struct ucontext_t. (The manpage for + sigaction(2) is wrong!) Sigcontext and ucontext_t are + "compatible", but access to registers in a ucontext_t goes through + the uc_mcontext field, so we just won't bother. +*/ +#define USE_SA_SIGINFO 0 +#define uc_sigmask sc_mask sc_reg(struct sigcontext*,int); -void -os_save_context(); -#define SAVE_CONTEXT os_save_context +#endif + diff --git a/lisp/Linux-os.h b/lisp/Linux-os.h index a2a1117f95ac848b46aa8070ec7df5e0084af657..7426580236bae0557b364f312714b07ba9291e51 100644 --- a/lisp/Linux-os.h +++ b/lisp/Linux-os.h @@ -1,4 +1,4 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.h,v 1.11 1999/09/22 14:42:08 dtc Exp $ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.h,v 1.12 2000/04/12 17:31:19 pw Exp $ This code was written as part of the CMU Common Lisp project at Carnegie Mellon University, and has been placed in the public domain. @@ -58,6 +58,11 @@ typedef struct sigcontext_struct sigcontext; #define POSIX_SIGS +/* Don't want the SIGINFO flag on linux as it causes the creation + of real-time interrupt frames. +*/ +#define USE_SA_SIGINFO 0 + /* Alpha uses OSF/1 signals which are the defaults in os.h, so there is no need to define the following for Alpha Linux diff --git a/lisp/breakpoint.c b/lisp/breakpoint.c index dd0f752050523ab0e94a88d17d065b5860a5877e..75812cfc08344da61ab22f3e7d6718a7f96485da 100644 --- a/lisp/breakpoint.c +++ b/lisp/breakpoint.c @@ -1,6 +1,6 @@ /* - $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/breakpoint.c,v 1.9 1998/01/25 05:58:55 dtc Exp $ + $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/breakpoint.c,v 1.10 2000/04/12 17:31:19 pw Exp $ This code was written as part of the CMU Common Lisp project at Carnegie Mellon University, and has been placed in the public domain. @@ -144,8 +144,11 @@ void handle_breakpoint(int signal, int subcode, struct sigcontext *scp) /* Don't disallow recursive breakpoint traps. Otherwise, we can't */ /* use debugger breakpoints anywhere in here. */ +#if defined POSIX_SIGS + sigprocmask(SIG_SETMASK,&scp->sc_mask,NULL); +#else sigsetmask(scp->sc_mask); - +#endif funcall3(SymbolFunction(HANDLE_BREAKPOINT), compute_offset(scp, code), code, @@ -194,8 +197,11 @@ void *handle_function_end_breakpoint(int signal, int subcode, /* Don't disallow recursive breakpoint traps. Otherwise, we can't * use debugger breakpoints anywhere in here. */ +#if defined POSIX_SIGS + sigprocmask(SIG_SETMASK,&scp->sc_mask,NULL); +#else sigsetmask(scp->sc_mask); - +#endif funcall3(SymbolFunction(HANDLE_BREAKPOINT), compute_offset(scp, code), code, diff --git a/lisp/interrupt.c b/lisp/interrupt.c index 7edc5ff8c5c99c000ecd9778bb7b0d621200187f..0194308f55d975e722b2dc28e5255f1945763e64 100644 --- a/lisp/interrupt.c +++ b/lisp/interrupt.c @@ -1,4 +1,4 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.21 1999/11/11 16:14:16 dtc Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.22 2000/04/12 17:31:19 pw Exp $ */ /* Interrupt handing magic. */ @@ -508,46 +508,16 @@ void interrupt_install_low_level_handler sa.sa_sigaction = handler; sigemptyset(&sa.sa_mask); FILLBLOCKSET(&sa.sa_mask); -#if defined(__linux__) - /* - * Don't want the SIGINFO flag on linux as it causes the creation - * of real-time interrupt frames. - */ - sa.sa_flags = SA_RESTART; -#else - sa.sa_flags = SA_RESTART | SA_SIGINFO; -#endif + sa.sa_flags = SA_RESTART | USE_SA_SIGINFO; sigaction(signal, &sa, NULL); -#else -#if defined __FreeBSD__ && 0 /* hack in progress */ -/* sort of like POSIX -- maybe fixed in new release */ -#define FILLBLOCKSET(s) (sigaddset(s, SIGHUP), sigaddset(s, SIGINT), \ - sigaddset(s, SIGQUIT), sigaddset(s, SIGPIPE), \ - sigaddset(s, SIGALRM), sigaddset(s, SIGURG), \ - sigaddset(s, SIGTSTP), sigaddset(s, SIGCHLD), \ - sigaddset(s, SIGIO), sigaddset(s, SIGXCPU), \ - sigaddset(s, SIGXFSZ), sigaddset(s, SIGVTALRM), \ - sigaddset(s, SIGPROF), sigaddset(s, SIGWINCH), \ - sigaddset(s, SIGUSR1), sigaddset(s,S IGUSR2)) - - struct sigaction sa; - sa.sa_handler = handler; - sigemptyset(&sa.sa_mask); - FILLBLOCKSET(&sa.sa_mask); - sa.sa_flags = SA_RESTART | SA_SIGINFO; - sa.sa_flags |= SA_ONSTACK; #else struct sigvec sv; sv.sv_handler = handler; sv.sv_mask = BLOCKABLE; sv.sv_flags = 0; -#if defined USE_SIG_STACK - sv.sv_flags |= SV_ONSTACK; /* use separate stack */ -#endif sigvec(signal, &sv, NULL); -#endif #endif interrupt_low_level_handlers[signal] = (handler == (void (*)(HANDLER_ARGS)) SIG_DFL) ? 0 : handler; @@ -579,15 +549,7 @@ unsigned long install_handler(int signal, sigemptyset(&sa.sa_mask); FILLBLOCKSET(&sa.sa_mask); -#if defined(__linux__) - /* - * Don't want the SIGINFO flag on linux as it causes the - * creation of real-time interrupt frames. - */ - sa.sa_flags = SA_RESTART; -#else - sa.sa_flags = SA_SIGINFO | SA_RESTART; -#endif + sa.sa_flags = USE_SA_SIGINFO | SA_RESTART; sigaction(signal, &sa, NULL); } @@ -618,9 +580,6 @@ unsigned long install_handler(int signal, sv.sv_mask = BLOCKABLE; sv.sv_flags = 0; -#if defined USE_SIG_STACK - sv.sv_flags = SV_ONSTACK; -#endif sigvec(signal, &sv, NULL); } diff --git a/lisp/os.h b/lisp/os.h index 84c120f1230fc34212112beae8c3e0572fda009c..849aa034201a6ddc3806520df0e3bb04a7ac5c18 100644 --- a/lisp/os.h +++ b/lisp/os.h @@ -1,5 +1,5 @@ /* - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.6 1997/01/21 00:28:13 ram Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.7 2000/04/12 17:31:20 pw Exp $ * * Common interface for os-dependent functions. * @@ -52,6 +52,14 @@ #define SAVE_CONTEXT() do {} while(0) #endif +/* Some OSes have their reasons not to use SA_SIGINFO. */ + +#ifdef POSIX_SIGS +#if !defined(USE_SA_SIGINFO) +#define USE_SA_SIGINFO SA_SIGINFO +#endif +#endif + #define OS_VM_PROT_ALL (OS_VM_PROT_READ|OS_VM_PROT_WRITE|OS_VM_PROT_EXECUTE) extern os_vm_size_t os_vm_page_size;