OSDN Git Service

2005-06-14 Jose Ruiz <ruiz@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-inmaop-posix.adb
index 8fe6b3a..987fb71 100644 (file)
@@ -1,13 +1,14 @@
 ------------------------------------------------------------------------------
 --                                                                          --
---                 GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS              --
+--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
 --                                                                          --
---                   SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS                 --
+--          S Y S T E M . I N T E R R U P T _ M A N A G E M E N T .         --
+--                            O P E R A T I O N S                           --
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
 --             Copyright (C) 1991-1994, Florida State University            --
---             Copyright (C) 1995-2003, Ada Core Technologies               --
+--                     Copyright (C) 1995-2005, AdaCore                     --
 --                                                                          --
 -- 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- --
@@ -78,7 +79,6 @@ package body System.Interrupt_Management.Operations is
    is
       Result : Interfaces.C.int;
       Mask   : aliased sigset_t;
-
    begin
       Result := sigemptyset (Mask'Access);
       pragma Assert (Result = 0);
@@ -97,7 +97,6 @@ package body System.Interrupt_Management.Operations is
    is
       Mask   : aliased sigset_t;
       Result : Interfaces.C.int;
-
    begin
       Result := sigemptyset (Mask'Access);
       pragma Assert (Result = 0);
@@ -113,7 +112,6 @@ package body System.Interrupt_Management.Operations is
 
    procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask) is
       Result   : Interfaces.C.int;
-
    begin
       Result := pthread_sigmask
         (SIG_SETMASK, +Interrupt_Mask_Ptr (Mask), null);
@@ -125,7 +123,6 @@ package body System.Interrupt_Management.Operations is
       OMask : access Interrupt_Mask)
    is
       Result  : Interfaces.C.int;
-
    begin
       Result := pthread_sigmask
         (SIG_SETMASK, +Interrupt_Mask_Ptr (Mask), +Interrupt_Mask_Ptr (OMask));
@@ -138,7 +135,6 @@ package body System.Interrupt_Management.Operations is
 
    procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask) is
       Result : Interfaces.C.int;
-
    begin
       Result := pthread_sigmask
         (SIG_SETMASK, null, +Interrupt_Mask_Ptr (Mask));
@@ -155,7 +151,6 @@ package body System.Interrupt_Management.Operations is
    is
       Result : Interfaces.C.int;
       Sig    : aliased Signal;
-
    begin
       Result := sigwait (Mask, Sig'Access);
 
@@ -172,7 +167,6 @@ package body System.Interrupt_Management.Operations is
 
    procedure Install_Default_Action (Interrupt : Interrupt_ID) is
       Result : Interfaces.C.int;
-
    begin
       Result := sigaction
         (Signal (Interrupt),
@@ -186,7 +180,6 @@ package body System.Interrupt_Management.Operations is
 
    procedure Install_Ignore_Action (Interrupt : Interrupt_ID) is
       Result : Interfaces.C.int;
-
    begin
       Result := sigaction (Signal (Interrupt), Ignore_Action'Access, null);
       pragma Assert (Result = 0);
@@ -198,7 +191,6 @@ package body System.Interrupt_Management.Operations is
 
    procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask) is
       Result : Interfaces.C.int;
-
    begin
       Result := sigfillset (Mask);
       pragma Assert (Result = 0);
@@ -210,7 +202,6 @@ package body System.Interrupt_Management.Operations is
 
    procedure Empty_Interrupt_Mask (Mask : access Interrupt_Mask) is
       Result : Interfaces.C.int;
-
    begin
       Result := sigemptyset (Mask);
       pragma Assert (Result = 0);
@@ -225,7 +216,6 @@ package body System.Interrupt_Management.Operations is
       Interrupt : Interrupt_ID)
    is
       Result : Interfaces.C.int;
-
    begin
       Result := sigaddset (Mask, Signal (Interrupt));
       pragma Assert (Result = 0);
@@ -240,7 +230,6 @@ package body System.Interrupt_Management.Operations is
       Interrupt : Interrupt_ID)
    is
       Result : Interfaces.C.int;
-
    begin
       Result := sigdelset (Mask, Signal (Interrupt));
       pragma Assert (Result = 0);
@@ -255,7 +244,6 @@ package body System.Interrupt_Management.Operations is
       Interrupt : Interrupt_ID) return Boolean
    is
       Result : Interfaces.C.int;
-
    begin
       Result := sigismember (Mask, Signal (Interrupt));
       pragma Assert (Result = 0 or else Result = 1);
@@ -268,8 +256,7 @@ package body System.Interrupt_Management.Operations is
 
    procedure Copy_Interrupt_Mask
      (X : out Interrupt_Mask;
-      Y : Interrupt_Mask)
-   is
+      Y : Interrupt_Mask) is
    begin
       X := Y;
    end Copy_Interrupt_Mask;
@@ -280,12 +267,24 @@ package body System.Interrupt_Management.Operations is
 
    procedure Interrupt_Self_Process (Interrupt : Interrupt_ID) is
       Result : Interfaces.C.int;
-
    begin
       Result := kill (getpid, Signal (Interrupt));
       pragma Assert (Result = 0);
    end Interrupt_Self_Process;
 
+   --------------------------
+   -- Setup_Interrupt_Mask --
+   --------------------------
+
+   procedure Setup_Interrupt_Mask is
+   begin
+      --  Mask task for all signals. The original mask of the Environment task
+      --  will be recovered by Interrupt_Manager task during the elaboration
+      --  of s-interr.adb.
+
+      Set_Interrupt_Mask (All_Tasks_Mask'Access);
+   end Setup_Interrupt_Mask;
+
 begin
 
    declare