Skip to content
Snippets Groups Projects
Commit 18d1ed99 authored by pw's avatar pw
Browse files

From Tim Moore; FreeBSD 4.x has new sigcontext code which can be accessed

via the POSIX_SIGS conditional. Change the way SA_SIGINFO gets passed
to sigaction. It is turned off for FreeBSD and Linux.
parent 63f036e0
No related branches found
No related tags found
No related merge requests found
/*
$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
/* $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
......
/*
$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,
......
/* $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);
}
......
/*
* $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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment