From c0d30332957c6f0cab8c0a3670f2903546fc0ad8 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Fri, 26 Aug 2005 19:13:02 +0000 Subject: [PATCH] 0.9.4.2: * run with disabled interrupts until the initial thread is started --- NEWS | 2 ++ src/code/target-signal.lisp | 1 + src/runtime/interrupt.c | 14 ++++++-------- src/runtime/interrupt.h | 2 ++ src/runtime/runtime.c | 8 +++----- version.lisp-expr | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 38cd37c..3b44037 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; -*- changes in sbcl-0.9.5 relative to sbcl-0.9.4: + * bug fix: interrupts are disabled until startup is complete; no + more sigsegvs when receiving a signal to soon * threads ** bug fix: parent thread now can be gc'ed even with a live child thread diff --git a/src/code/target-signal.lisp b/src/code/target-signal.lisp index 2bffede..97bc95e 100644 --- a/src/code/target-signal.lisp +++ b/src/code/target-signal.lisp @@ -144,6 +144,7 @@ (enable-interrupt sigsys #'sigsys-handler) (enable-interrupt sigpipe #'sigpipe-handler) (enable-interrupt sigalrm #'sigalrm-handler) + (sb!unix::reset-signal-mask) (values)) ;;;; etc. diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index ecf0464..79275ef 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -605,8 +605,7 @@ maybe_now_maybe_later(int signal, siginfo_t *info, void *void_context) #ifdef LISP_FEATURE_LINUX os_restore_fp_control(context); #endif - if(maybe_defer_handler(interrupt_handle_now,data, - signal,info,context)) + if(maybe_defer_handler(interrupt_handle_now,data,signal,info,context)) return; interrupt_handle_now(signal, info, context); #ifdef LISP_FEATURE_DARWIN @@ -620,8 +619,7 @@ low_level_interrupt_handle_now(int signal, siginfo_t *info, void *void_context) { os_context_t *context = (os_context_t*)void_context; struct thread *thread=arch_os_get_current_thread(); - struct interrupt_data *data= - thread ? thread->interrupt_data : global_interrupt_data; + struct interrupt_data *data=thread->interrupt_data; #ifdef LISP_FEATURE_LINUX os_restore_fp_control(context); @@ -641,8 +639,7 @@ low_level_maybe_now_maybe_later(int signal, siginfo_t *info, void *void_context) { os_context_t *context = arch_os_get_context(&void_context); struct thread *thread=arch_os_get_current_thread(); - struct interrupt_data *data= - thread ? thread->interrupt_data : global_interrupt_data; + struct interrupt_data *data=thread->interrupt_data; #ifdef LISP_FEATURE_LINUX os_restore_fp_control(context); #endif @@ -966,8 +963,7 @@ interrupt_maybe_gc(int signal, siginfo_t *info, void *void_context) { os_context_t *context=(os_context_t *) void_context; struct thread *th=arch_os_get_current_thread(); - struct interrupt_data *data= - th ? th->interrupt_data : global_interrupt_data; + struct interrupt_data *data=th->interrupt_data; if(!foreign_function_call_active && gc_trigger_hit(signal, info, context)){ struct thread *thread=arch_os_get_current_thread(); @@ -1056,6 +1052,7 @@ undoably_install_low_level_interrupt_handler (int signal, { struct sigaction sa; struct thread *th=arch_os_get_current_thread(); + /* It may be before the initial thread is started. */ struct interrupt_data *data= th ? th->interrupt_data : global_interrupt_data; @@ -1093,6 +1090,7 @@ install_handler(int signal, void handler(int, siginfo_t*, void*)) sigset_t old, new; union interrupt_handler oldhandler; struct thread *th=arch_os_get_current_thread(); + /* It may be before the initial thread is started. */ struct interrupt_data *data= th ? th->interrupt_data : global_interrupt_data; diff --git a/src/runtime/interrupt.h b/src/runtime/interrupt.h index ae72020..0b6fb7b 100644 --- a/src/runtime/interrupt.h +++ b/src/runtime/interrupt.h @@ -96,6 +96,8 @@ void sigaddset_deferrable(sigset_t *s); /* Set all blockable signals into *s. */ void sigaddset_blockable(sigset_t *s); +extern void block_blockable_signals(); + /* The void* casting here avoids having to mess with the various types * of function argument lists possible for signal handlers: * SA_SIGACTION handlers have one signature, and the default old-style diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 8a44604..8dbc76c 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -191,6 +191,9 @@ main(int argc, char *argv[], char *envp[]) lispobj initial_function; + interrupt_init(); + block_blockable_signals(); + setlocale(LC_ALL, ""); /* KLUDGE: os_vm_page_size is set by os_init(), and on some @@ -328,7 +331,6 @@ main(int argc, char *argv[], char *envp[]) gc_initialize_pointers(); - interrupt_init(); arch_install_interrupt_handlers(); os_install_interrupt_handlers(); @@ -337,10 +339,6 @@ main(int argc, char *argv[], char *envp[]) SetSymbolValue(POSIX_ARGV, alloc_base_string_list(sbcl_argv),0); free(sbcl_argv); - /* Install a handler to pick off SIGINT until the Lisp system gets - * far enough along to install its own handler. */ - sigint_init(); - FSHOW((stderr, "/funcalling initial_function=0x%lx\n", initial_function)); create_initial_thread(initial_function); lose("CATS. CATS ARE NICE."); diff --git a/version.lisp-expr b/version.lisp-expr index d3316d4..4d0c64c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.4.1" +"0.9.4.2" -- 1.7.10.4