OSDN Git Service

gcc/ChangeLog:
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-intman-solaris.adb
index 05f1e04..170cd82 100644 (file)
@@ -6,45 +6,36 @@
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---          Copyright (C) 1992-2005 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNARL is free software; you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNARL; see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- GNARL was developed by the GNARL team at Florida State University.       --
 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This is a Solaris version of this package.
-
---  Make a careful study of all signals available under the OS,
---  to see which need to be reserved, kept always unmasked,
---  or kept always unmasked.
+--  This is a Solaris version of this package
 
---  Be on the lookout for special signals that
---  may be used by the thread library.
+--  Make a careful study of all signals available under the OS, to see which
+--  need to be reserved, kept always unmasked, or kept always unmasked.
 
-with Interfaces.C;
---  used for int
-
-with System.OS_Interface;
---  used for various Constants, Signal and types
+--  Be on the lookout for special signals that may be used by the thread
+--  library.
 
 package body System.Interrupt_Management is
 
@@ -79,10 +70,10 @@ package body System.Interrupt_Management is
    -- Notify_Exception --
    ----------------------
 
-   --  This function identifies the Ada exception to be raised using
-   --  the information when the system received a synchronous signal.
-   --  Since this function is machine and OS dependent, different code
-   --  has to be provided for different target.
+   --  This function identifies the Ada exception to be raised using the
+   --  information when the system received a synchronous signal. Since this
+   --  function is machine and OS dependent, different code has to be provided
+   --  for different target.
 
    procedure Notify_Exception
      (signo   : Signal;
@@ -98,36 +89,27 @@ package body System.Interrupt_Management is
       info    : access siginfo_t;
       context : access ucontext_t)
    is
-      pragma Unreferenced (context);
+      pragma Unreferenced (info);
+
    begin
-      --  Check that treatment of exception propagation here
-      --  is consistent with treatment of the abort signal in
-      --  System.Task_Primitives.Operations.
+      --  Perform the necessary context adjustments prior to a raise
+      --  from a signal handler.
+
+      Adjust_Context_For_Raise (signo, context.all'Address);
+
+      --  Check that treatment of exception propagation here is consistent with
+      --  treatment of the abort signal in System.Task_Primitives.Operations.
 
       case signo is
          when SIGFPE =>
-            case info.si_code is
-               when  FPE_INTDIV |
-                     FPE_INTOVF |
-                     FPE_FLTDIV |
-                     FPE_FLTOVF |
-                     FPE_FLTUND |
-                     FPE_FLTRES |
-                     FPE_FLTINV |
-                     FPE_FLTSUB =>
-
-                  raise Constraint_Error;
-
-               when others =>
-                  pragma Assert (False);
-                  null;
-            end case;
-
-         when SIGILL | SIGSEGV | SIGBUS  =>
+            raise Constraint_Error;
+         when SIGILL =>
+            raise Program_Error;
+         when SIGSEGV =>
+            raise Storage_Error;
+         when SIGBUS =>
             raise Storage_Error;
-
          when others =>
-            pragma Assert (False);
             null;
       end case;
    end Notify_Exception;
@@ -177,9 +159,8 @@ package body System.Interrupt_Management is
       Result := sigemptyset (mask'Access);
       pragma Assert (Result = 0);
 
-      --  ??? For the same reason explained above, we can't mask these
-      --  signals because otherwise we won't be able to catch more than
-      --  one signal.
+      --  ??? For the same reason explained above, we can't mask these signals
+      --  because otherwise we won't be able to catch more than one signal.
 
       act.sa_mask := mask;
 
@@ -245,10 +226,10 @@ package body System.Interrupt_Management is
          Reserve (SIGINT) := False;
       end if;
 
-      --  We do not have Signal 0 in reality. We just use this value
-      --  to identify not existing signals (see s-intnam.ads). Therefore,
-      --  Signal 0 should not be used in all signal related operations hence
-      --  mark it as reserved.
+      --  We do not have Signal 0 in reality. We just use this value to
+      --  identify not existing signals (see s-intnam.ads). Therefore, Signal 0
+      --  should not be used in all signal related operations hence mark it as
+      --  reserved.
 
       Reserve (0) := True;
    end Initialize;