1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . R P C --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
34 with Unchecked_Deallocation
;
37 with System
.RPC
.Net_Trace
;
38 with System
.RPC
.Garlic
;
39 with System
.RPC
.Streams
;
40 pragma Elaborate
(System
.RPC
.Garlic
);
42 package body System
.RPC
is
44 -- ??? general note: the debugging calls are very heavy, especially
45 -- those that create exception handlers in every procedure. Do we
46 -- really still need all this stuff?
48 use type Ada
.Streams
.Stream_Element_Count
;
49 use type Ada
.Streams
.Stream_Element_Offset
;
51 use type Garlic
.Protocol_Access
;
52 use type Garlic
.Lock_Method
;
54 Max_Of_Message_Id
: constant := 127;
56 subtype Message_Id_Type
is
57 Integer range -Max_Of_Message_Id
.. Max_Of_Message_Id
;
58 -- A message id is either a request id or reply id. A message id is
59 -- provided with a message to a receiving stub which uses the opposite
60 -- as a reply id. A message id helps to retrieve to which task is
61 -- addressed a reply. When the environment task receives a message, the
62 -- message id is extracted : a positive message id stands for a call, a
63 -- negative message id stands for a reply. A null message id stands for
64 -- an asynchronous request.
66 subtype Request_Id_Type
is Message_Id_Type
range 1 .. Max_Of_Message_Id
;
67 -- When a message id is positive, it is a request
69 type Message_Length_Per_Request
is array (Request_Id_Type
)
70 of Ada
.Streams
.Stream_Element_Count
;
72 Header_Size
: Ada
.Streams
.Stream_Element_Count
:=
73 Streams
.Get_Integer_Initial_Size
+
74 Streams
.Get_SEC_Initial_Size
;
75 -- Initial size needed for frequently used header streams
77 Stream_Error
: exception;
78 -- Occurs when a read procedure is executed on an empty stream
79 -- or when a write procedure is executed on a full stream
81 Partition_RPC_Receiver
: RPC_Receiver
;
82 -- Cache the RPC_Receiver passed by Establish_RPC_Receiver
84 type Anonymous_Task_Node
;
86 type Anonymous_Task_Node_Access
is access Anonymous_Task_Node
;
87 -- Types we need to construct a singly linked list of anonymous tasks
88 -- This pool is maintained to avoid a task creation each time a RPC
89 -- occurs - to be cont'd
91 task type Anonymous_Task_Type
(Self
: Anonymous_Task_Node_Access
) is
94 (Message_Id
: Message_Id_Type
;
95 Partition
: Partition_ID
;
96 Params_Size
: Ada
.Streams
.Stream_Element_Count
;
97 Result_Size
: Ada
.Streams
.Stream_Element_Count
;
98 Protocol
: Garlic
.Protocol_Access
);
99 -- This entry provides an anonymous task a remote call to perform.
100 -- This task calls for a Request id is provided to construct the
101 -- reply id by using -Request. Partition is used to send the reply
102 -- message. Params_Size is the size of the calling stub Params stream.
103 -- Then Protocol (used by the environment task previously) allows
104 -- extraction of the message following the header (The header is
105 -- extracted by the environment task)
106 -- Note: grammar in above is obscure??? needs cleanup
108 end Anonymous_Task_Type
;
110 type Anonymous_Task_Access
is access Anonymous_Task_Type
;
112 type Anonymous_Task_List
is record
113 Head
: Anonymous_Task_Node_Access
;
114 Tail
: Anonymous_Task_Node_Access
;
117 type Anonymous_Task_Node
is record
118 Element
: Anonymous_Task_Access
;
119 Next
: Anonymous_Task_Node_Access
;
121 -- Types we need to construct a singly linked list of anonymous tasks.
122 -- This pool is maintained to avoid a task creation each time a RPC occurs.
124 protected Garbage_Collector
is
127 (Item
: out Anonymous_Task_Node_Access
);
128 -- Anonymous task pool management : if there is an anonymous task
129 -- left, use it. Otherwise, allocate a new one
132 (Item
: in out Anonymous_Task_Node_Access
);
133 -- Anonymous task pool management : queue this task in the pool
134 -- of inactive anonymous tasks.
138 Anonymous_List
: Anonymous_Task_Node_Access
;
139 -- The list root of inactive anonymous tasks
141 end Garbage_Collector
;
145 entry New_Request
(Request
: out Request_Id_Type
);
146 -- To get a new request
148 entry Wait_On
(Request_Id_Type
)
149 (Length
: out Ada
.Streams
.Stream_Element_Count
);
150 -- To block the calling stub when it waits for a reply
151 -- When it is resumed, we provide the size of the reply
154 (Request
: Request_Id_Type
;
155 Length
: Ada
.Streams
.Stream_Element_Count
);
156 -- To wake up the calling stub when the environment task has
157 -- received a reply for this request
161 task Environnement
is
164 -- Receive no message until Partition_Receiver is set
165 -- Establish_RPC_Receiver decides when the environment task
166 -- is allowed to start
170 protected Partition_Receiver
is
173 -- Blocks if the Partition_RPC_Receiver has not been set
176 -- Done by Establish_RPC_Receiver when Partition_RPC_Receiver
181 Was_Set
: Boolean := False;
182 -- True when Partition_RPC_Receiver has been set
184 end Partition_Receiver
;
185 -- Anonymous tasks have to wait for the Partition_RPC_Receiver
189 (D_Elaborate
, -- About the elaboration of this package
190 D_Communication
, -- About calls to Send and Receive
192 D_Exception
); -- Exception handler
195 package Debugging
is new System
.RPC
.Net_Trace
(Debug_Level
, "RPC : ");
199 (Flag
: Debug_Level
; Info
: String) renames Debugging
.Debug
;
202 ------------------------
203 -- Partition_Receiver --
204 ------------------------
206 protected body Partition_Receiver
is
208 -------------------------------
209 -- Partition_Receiver.Is_Set --
210 -------------------------------
212 entry Is_Set
when Was_Set
is
217 ----------------------------
218 -- Partition_Receiver.Set --
219 ----------------------------
226 end Partition_Receiver
;
233 (Index
: out Packet_Node_Access
;
234 Stream
: Params_Stream_Type
)
237 Index
:= Stream
.Extra
.Head
;
241 D
(D_Exception
, "exception in Head_Node");
250 (Index
: out Packet_Node_Access
;
251 Stream
: Params_Stream_Type
)
254 Index
:= Stream
.Extra
.Tail
;
258 D
(D_Exception
, "exception in Tail_Node");
266 function Null_Node
(Index
: Packet_Node_Access
) return Boolean is
272 D
(D_Exception
, "exception in Null_Node");
276 ----------------------
277 -- Delete_Head_Node --
278 ----------------------
280 procedure Delete_Head_Node
(Stream
: in out Params_Stream_Type
) is
283 new Unchecked_Deallocation
284 (Packet_Node
, Packet_Node_Access
);
286 Next_Node
: Packet_Node_Access
:= Stream
.Extra
.Head
.Next
;
289 -- Delete head node and free memory usage
291 Free
(Stream
.Extra
.Head
);
292 Stream
.Extra
.Head
:= Next_Node
;
294 -- If the extra storage is empty, update tail as well
296 if Stream
.Extra
.Head
= null then
297 Stream
.Extra
.Tail
:= null;
302 D
(D_Exception
, "exception in Delete_Head_Node");
304 end Delete_Head_Node
;
310 procedure Next_Node
(Node
: in out Packet_Node_Access
) is
312 -- Node is set to the next node
313 -- If not possible, Stream_Error is raised
323 D
(D_Exception
, "exception in Next_Node");
327 ---------------------
328 -- Append_New_Node --
329 ---------------------
331 procedure Append_New_Node
(Stream
: in out Params_Stream_Type
) is
332 Index
: Packet_Node_Access
;
335 -- Set Index to the end of the linked list
337 Tail_Node
(Index
, Stream
);
339 if Null_Node
(Index
) then
341 -- The list is empty : set head as well
343 Stream
.Extra
.Head
:= new Packet_Node
;
344 Stream
.Extra
.Tail
:= Stream
.Extra
.Head
;
347 -- The list is not empty : link new node with tail
349 Stream
.Extra
.Tail
.Next
:= new Packet_Node
;
350 Stream
.Extra
.Tail
:= Stream
.Extra
.Tail
.Next
;
356 D
(D_Exception
, "exception in Append_New_Node");
365 (Stream
: in out Params_Stream_Type
;
366 Item
: out Ada
.Streams
.Stream_Element_Array
;
367 Last
: out Ada
.Streams
.Stream_Element_Offset
)
368 renames System
.RPC
.Streams
.Read
;
375 (Stream
: in out Params_Stream_Type
;
376 Item
: Ada
.Streams
.Stream_Element_Array
)
377 renames System
.RPC
.Streams
.Write
;
379 -----------------------
380 -- Garbage_Collector --
381 -----------------------
383 protected body Garbage_Collector
is
385 --------------------------------
386 -- Garbage_Collector.Allocate --
387 --------------------------------
389 procedure Allocate
(Item
: out Anonymous_Task_Node_Access
) is
390 New_Anonymous_Task_Node
: Anonymous_Task_Node_Access
;
391 Anonymous_Task
: Anonymous_Task_Access
;
394 -- If the list is empty, allocate a new anonymous task
395 -- Otherwise, reuse the first queued anonymous task
397 if Anonymous_List
= null then
399 -- Create a new anonymous task
400 -- Provide this new task with its id to allow it
401 -- to enqueue itself into the free anonymous task list
402 -- with the function Deallocate
404 New_Anonymous_Task_Node
:= new Anonymous_Task_Node
;
406 new Anonymous_Task_Type
(New_Anonymous_Task_Node
);
407 New_Anonymous_Task_Node
.all := (Anonymous_Task
, null);
410 -- Extract one task from the list
411 -- Set the Next field to null to avoid possible bugs
413 New_Anonymous_Task_Node
:= Anonymous_List
;
414 Anonymous_List
:= Anonymous_List
.Next
;
415 New_Anonymous_Task_Node
.Next
:= null;
419 -- Item is an out parameter
421 Item
:= New_Anonymous_Task_Node
;
425 D
(D_Exception
, "exception in Allocate (Anonymous Task)");
429 ----------------------------------
430 -- Garbage_Collector.Deallocate --
431 ----------------------------------
433 procedure Deallocate
(Item
: in out Anonymous_Task_Node_Access
) is
435 -- Enqueue the task in the free list
437 Item
.Next
:= Anonymous_List
;
438 Anonymous_List
:= Item
;
442 D
(D_Exception
, "exception in Deallocate (Anonymous Task)");
446 end Garbage_Collector
;
453 (Partition
: Partition_ID
;
454 Params
: access Params_Stream_Type
;
455 Result
: access Params_Stream_Type
)
457 Protocol
: Protocol_Access
;
458 Request
: Request_Id_Type
;
459 Header
: aliased Params_Stream_Type
(Header_Size
);
460 R_Length
: Ada
.Streams
.Stream_Element_Count
;
463 -- Parameters order :
464 -- Opcode (provided and used by garlic)
465 -- (1) Size (provided by s-rpc and used by garlic)
466 -- (size of (2)+(3)+(4)+(5))
467 -- (2) Request (provided by calling stub (resp receiving stub) and
468 -- used by anonymous task (resp Do_RPC))
469 -- *** ZERO IF APC ***
470 -- (3) Res.len. (provided by calling stubs and used by anonymous task)
471 -- *** ZERO IF APC ***
472 -- (4) Receiver (provided by calling stubs and used by anonymous task)
473 -- (5) Params (provided by calling stubs and used by anonymous task)
475 -- The call is a remote call or a local call. A local call occurs
476 -- when the pragma All_Calls_Remote has been specified. Do_RPC is
477 -- called and the execution has to be performed in the PCS
479 if Partition
/= Garlic
.Get_My_Partition_ID
then
481 -- Get a request id to be resumed when the reply arrives
483 Dispatcher
.New_Request
(Request
);
485 -- Build header = request (2) + result.initial_size (3)
487 D
(D_Debug
, "Do_RPC - Build header");
488 Streams
.Allocate
(Header
);
489 Streams
.Integer_Write_Attribute
-- (2)
490 (Header
'Access, Request
);
491 System
.RPC
.Streams
.SEC_Write_Attribute
-- (3)
492 (Header
'Access, Result
.Initial_Size
);
494 -- Get a protocol method to communicate with the remote partition
495 -- and give the message size
498 "Do_RPC - Lookup for protocol to talk to partition" &
499 Partition_ID
'Image (Partition
));
502 Streams
.Get_Stream_Size
(Header
'Access) +
503 Streams
.Get_Stream_Size
(Params
), -- (1)
507 -- Send the header by using the protocol method
509 D
(D_Communication
, "Do_RPC - Send Header to partition" &
510 Partition_ID
'Image (Partition
));
514 Header
'Access); -- (2) + (3)
516 -- The header is deallocated
518 Streams
.Deallocate
(Header
);
520 -- Send Params from Do_RPC
522 D
(D_Communication
, "Do_RPC - Send Params to partition" &
523 Partition_ID
'Image (Partition
));
527 Params
); -- (4) + (5)
529 -- Let Garlic know we have nothing else to send
534 D
(D_Debug
, "Do_RPC - Suspend");
536 -- Wait for a reply and get the reply message length
538 Dispatcher
.Wait_On
(Request
) (R_Length
);
539 D
(D_Debug
, "Do_RPC - Resume");
542 New_Result
: aliased Params_Stream_Type
(R_Length
);
544 -- Adjust the Result stream size right now to be able to load
545 -- the stream in one receive call. Create a temporary result
546 -- that will be substituted to Do_RPC one
548 Streams
.Allocate
(New_Result
);
550 -- Receive the reply message from receiving stub
552 D
(D_Communication
, "Do_RPC - Receive Result from partition" &
553 Partition_ID
'Image (Partition
));
559 -- Let Garlic know we have nothing else to receive
561 Garlic
.Complete_Receive
565 -- Update calling stub Result stream
567 D
(D_Debug
, "Do_RPC - Reconstruct Result");
568 Streams
.Deallocate
(Result
.all);
569 Result
.Initial
:= New_Result
.Initial
;
570 Streams
.Dump
("|||", Result
.all);
575 -- Do RPC locally and first wait for Partition_RPC_Receiver to be
578 Partition_Receiver
.Is_Set
;
579 D
(D_Debug
, "Do_RPC - Locally");
580 Partition_RPC_Receiver
.all (Params
, Result
);
586 D
(D_Exception
, "exception in Do_RPC");
595 (Partition
: Partition_ID
;
596 Params
: access Params_Stream_Type
)
598 Message_Id
: Message_Id_Type
:= 0;
599 Protocol
: Protocol_Access
;
600 Header
: aliased Params_Stream_Type
(Header_Size
);
603 -- For more information, see above
604 -- Request = 0 as we are not waiting for a reply message
605 -- Result length = 0 as we don't expect a result at all
607 if Partition
/= Garlic
.Get_My_Partition_ID
then
609 -- Build header = request (2) + result.initial_size (3)
610 -- As we have an APC, the request id is null to indicate
611 -- to the receiving stub that we do not expect a reply
612 -- This comes from 0 = -0
614 D
(D_Debug
, "Do_APC - Build Header");
615 Streams
.Allocate
(Header
);
616 Streams
.Integer_Write_Attribute
617 (Header
'Access, Integer (Message_Id
));
618 Streams
.SEC_Write_Attribute
621 -- Get a protocol method to communicate with the remote partition
622 -- and give the message size
625 "Do_APC - Lookup for protocol to talk to partition" &
626 Partition_ID
'Image (Partition
));
629 Streams
.Get_Stream_Size
(Header
'Access) +
630 Streams
.Get_Stream_Size
(Params
),
634 -- Send the header by using the protocol method
636 D
(D_Communication
, "Do_APC - Send Header to partition" &
637 Partition_ID
'Image (Partition
));
643 -- The header is deallocated
645 Streams
.Deallocate
(Header
);
647 -- Send Params from Do_APC
649 D
(D_Communication
, "Do_APC - Send Params to partition" &
650 Partition_ID
'Image (Partition
));
656 -- Let Garlic know we have nothing else to send
664 Result
: aliased Params_Stream_Type
(0);
666 -- Result is here a dummy parameter
667 -- No reason to deallocate as it is not allocated at all
669 Partition_Receiver
.Is_Set
;
670 D
(D_Debug
, "Do_APC - Locally");
671 Partition_RPC_Receiver
.all (Params
, Result
'Access);
679 D
(D_Exception
, "exception in Do_APC");
683 ----------------------------
684 -- Establish_RPC_Receiver --
685 ----------------------------
687 procedure Establish_RPC_Receiver
688 (Partition
: Partition_ID
;
689 Receiver
: RPC_Receiver
)
692 -- Set Partition_RPC_Receiver and allow RPC mechanism
694 Partition_RPC_Receiver
:= Receiver
;
695 Partition_Receiver
.Set
;
696 D
(D_Elaborate
, "Partition_Receiver is set");
700 D
(D_Exception
, "exception in Establish_RPC_Receiver");
702 end Establish_RPC_Receiver
;
708 task body Dispatcher
is
709 Last_Request
: Request_Id_Type
:= Request_Id_Type
'First;
710 Current_Rqst
: Request_Id_Type
:= Request_Id_Type
'First;
711 Current_Size
: Ada
.Streams
.Stream_Element_Count
;
717 -- New_Request to get an entry in Dispatcher table
719 -- Wait_On for Do_RPC calls
721 -- Wake_Up called by environment task when a Do_RPC receives
722 -- the result of its remote call
725 accept New_Request
(Request
: out Request_Id_Type
) do
726 Request
:= Last_Request
;
729 -- ??? Availability check
731 if Last_Request
= Request_Id_Type
'Last then
732 Last_Request
:= Request_Id_Type
'First;
734 Last_Request
:= Last_Request
+ 1;
741 (Request
: Request_Id_Type
;
742 Length
: Ada
.Streams
.Stream_Element_Count
)
744 -- The environment reads the header and has been notified
745 -- of the reply id and the size of the result message
747 Current_Rqst
:= Request
;
748 Current_Size
:= Length
;
753 -- ??? Must be select with delay for aborted tasks
757 accept Wait_On
(Current_Rqst
)
758 (Length
: out Ada
.Streams
.Stream_Element_Count
)
760 Length
:= Current_Size
;
764 -- To free the Dispatcher when a task is aborted
778 D
(D_Exception
, "exception in Dispatcher body");
782 -------------------------
783 -- Anonymous_Task_Type --
784 -------------------------
786 task body Anonymous_Task_Type
is
787 Whoami
: Anonymous_Task_Node_Access
:= Self
;
788 C_Message_Id
: Message_Id_Type
; -- Current Message Id
789 C_Partition
: Partition_ID
; -- Current Partition
790 Params_S
: Ada
.Streams
.Stream_Element_Count
; -- Params message size
791 Result_S
: Ada
.Streams
.Stream_Element_Count
; -- Result message size
792 C_Protocol
: Protocol_Access
; -- Current Protocol
796 -- Get a new RPC to execute
800 (Message_Id
: Message_Id_Type
;
801 Partition
: Partition_ID
;
802 Params_Size
: Ada
.Streams
.Stream_Element_Count
;
803 Result_Size
: Ada
.Streams
.Stream_Element_Count
;
804 Protocol
: Protocol_Access
)
806 C_Message_Id
:= Message_Id
;
807 C_Partition
:= Partition
;
808 Params_S
:= Params_Size
;
809 Result_S
:= Result_Size
;
810 C_Protocol
:= Protocol
;
817 Params
: aliased Params_Stream_Type
(Params_S
);
818 Result
: aliased Params_Stream_Type
(Result_S
);
819 Header
: aliased Params_Stream_Type
(Header_Size
);
822 -- We reconstruct all the client context : Params and Result
823 -- with the SAME size, then we receive Params from calling stub
826 "Anonymous Task - Receive Params from partition" &
827 Partition_ID
'Image (C_Partition
));
833 -- Let Garlic know we don't receive anymore
835 Garlic
.Complete_Receive
839 -- Check that Partition_RPC_Receiver has been set
841 Partition_Receiver
.Is_Set
;
846 "Anonymous Task - Perform Partition_RPC_Receiver for request" &
847 Message_Id_Type
'Image (C_Message_Id
));
848 Partition_RPC_Receiver
(Params
'Access, Result
'Access);
850 -- If this was a RPC we send the result back
851 -- Otherwise, do nothing else than deallocation
853 if C_Message_Id
/= 0 then
855 -- Build Header = -C_Message_Id + Result Size
856 -- Provide the request id to the env task of the calling
857 -- stub partition We get the real result stream size : the
858 -- calling stub (in Do_RPC) updates its size to this one
860 D
(D_Debug
, "Anonymous Task - Build Header");
861 Streams
.Allocate
(Header
);
862 Streams
.Integer_Write_Attribute
863 (Header
'Access, Integer (-C_Message_Id
));
864 Streams
.SEC_Write_Attribute
866 Streams
.Get_Stream_Size
(Result
'Access));
868 -- Get a protocol method to communicate with the remote
869 -- partition and give the message size
872 "Anonymous Task - Lookup for protocol talk to partition" &
873 Partition_ID
'Image (C_Partition
));
876 Streams
.Get_Stream_Size
(Header
'Access) +
877 Streams
.Get_Stream_Size
(Result
'Access),
881 -- Send the header by using the protocol method
884 "Anonymous Task - Send Header to partition" &
885 Partition_ID
'Image (C_Partition
));
891 -- Send Result toDo_RPC
894 "Anonymous Task - Send Result to partition" &
895 Partition_ID
'Image (C_Partition
));
901 -- Let Garlic know we don't send anymore
906 Streams
.Deallocate
(Header
);
909 Streams
.Deallocate
(Params
);
910 Streams
.Deallocate
(Result
);
913 -- Enqueue into the anonymous task free list : become inactive
915 Garbage_Collector
.Deallocate
(Whoami
);
921 D
(D_Exception
, "exception in Anonymous_Task_Type body");
923 end Anonymous_Task_Type
;
929 task body Environnement
is
930 Partition
: Partition_ID
;
931 Message_Size
: Ada
.Streams
.Stream_Element_Count
;
932 Result_Size
: Ada
.Streams
.Stream_Element_Count
;
933 Message_Id
: Message_Id_Type
;
934 Header
: aliased Params_Stream_Type
(Header_Size
);
935 Protocol
: Protocol_Access
;
936 Anonymous
: Anonymous_Task_Node_Access
;
939 -- Wait the Partition_RPC_Receiver to be set
942 D
(D_Elaborate
, "Environment task elaborated");
945 -- We receive first a fixed size message : the header
946 -- Header = Message Id + Message Size
948 Streams
.Allocate
(Header
);
950 -- Garlic provides the size of the received message and the
951 -- protocol to use to communicate with the calling partition
953 Garlic
.Initiate_Receive
959 "Environment task - Receive protocol to talk to active partition" &
960 Partition_ID
'Image (Partition
));
962 -- Extract the header to route the message either to
963 -- an anonymous task (Message Id > 0 <=> Request Id)
964 -- or to a waiting task (Message Id < 0 <=> Reply Id)
967 "Environment task - Receive Header from partition" &
968 Partition_ID
'Image (Partition
));
974 -- Evaluate the remaining size of the message
976 Message_Size
:= Message_Size
-
977 Streams
.Get_Stream_Size
(Header
'Access);
979 -- Extract from header : message id and message size
981 Streams
.Integer_Read_Attribute
(Header
'Access, Message_Id
);
982 Streams
.SEC_Read_Attribute
(Header
'Access, Result_Size
);
984 if Streams
.Get_Stream_Size
(Header
'Access) /= 0 then
986 -- If there are stream elements left in the header ???
988 D
(D_Exception
, "Header is not empty");
993 if Message_Id
< 0 then
995 -- The message was sent by a receiving stub : wake up the
996 -- calling task - We have a reply there
998 D
(D_Debug
, "Environment Task - Receive Reply from partition" &
999 Partition_ID
'Image (Partition
));
1000 Dispatcher
.Wake_Up
(-Message_Id
, Result_Size
);
1003 -- The message was send by a calling stub : get an anonymous
1004 -- task to perform the job
1006 D
(D_Debug
, "Environment Task - Receive Request from partition" &
1007 Partition_ID
'Image (Partition
));
1008 Garbage_Collector
.Allocate
(Anonymous
);
1010 -- We subtracted the size of the header from the size of the
1011 -- global message in order to provide immediately Params size
1013 Anonymous
.Element
.Start
1022 -- Deallocate header : unnecessary - WARNING
1024 Streams
.Deallocate
(Header
);
1030 D
(D_Exception
, "exception in Environment");
1035 -- Set debugging information
1037 Debugging
.Set_Environment_Variable
("RPC");
1038 Debugging
.Set_Debugging_Name
("D", D_Debug
);
1039 Debugging
.Set_Debugging_Name
("E", D_Exception
);
1040 Debugging
.Set_Debugging_Name
("C", D_Communication
);
1041 Debugging
.Set_Debugging_Name
("Z", D_Elaborate
);
1042 D
(D_Elaborate
, "To be elaborated");
1044 -- When this body is elaborated we should ensure that RCI name server
1045 -- has been already elaborated : this means that Establish_RPC_Receiver
1046 -- has already been called and that Partition_RPC_Receiver is set
1048 Environnement
.Start
;
1049 D
(D_Elaborate
, "ELABORATED");