diff options
Diffstat (limited to 'source/compiler/aslmain.c')
-rw-r--r-- | source/compiler/aslmain.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index a282b0c4926b..10251fb2a80f 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -207,6 +207,9 @@ main ( int ReturnStatus = 0; + signal (SIGINT, AslSignalHandler); + signal (SIGSEGV, AslSignalHandler); + /* * Big-endian machines are not currently supported. ACPI tables must * be little-endian, and support for big-endian machines needs to @@ -224,7 +227,6 @@ main ( /* Initialize preprocessor and compiler before command line processing */ - signal (SIGINT, AslSignalHandler); AcpiGbl_ExternalFileList = NULL; AcpiDbgLevel = 0; PrInitializePreprocessor (); @@ -254,6 +256,7 @@ main ( } } + /* Process each pathname/filename in the list, with possible wildcards */ while (argv[Index2]) @@ -301,8 +304,10 @@ CleanupAndExit: * * RETURN: None * - * DESCRIPTION: Control-C handler. Delete any intermediate files and any - * output files that may be left in an indeterminate state. + * DESCRIPTION: Signal interrupt handler. Delete any intermediate files and + * any output files that may be left in an indeterminate state. + * Currently handles SIGINT (control-c) and SIGSEGV (segmentation + * fault). * *****************************************************************************/ @@ -314,11 +319,34 @@ AslSignalHandler ( signal (Sig, SIG_IGN); - printf ("Aborting\n\n"); + fflush (stdout); + fflush (stderr); + + switch (Sig) + { + case SIGINT: + + printf ("\n" ASL_PREFIX "<Control-C>\n"); + break; - /* Close all open files */ + case SIGSEGV: - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */ + /* Even on a seg fault, we will try to delete any partial files */ + + printf (ASL_PREFIX "Segmentation Fault\n"); + break; + + default: + + printf (ASL_PREFIX "Unknown interrupt signal (%u), ignoring\n", Sig); + return; + } + + /* + * Close all open files + * Note: the .pre file is the same as the input source file + */ + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { @@ -332,6 +360,7 @@ AslSignalHandler ( FlDeleteFile (i); } + printf (ASL_PREFIX "Terminating\n"); exit (0); } |