|
2 | 2 | with Basalt.Strings;
|
3 | 3 | with Gneiss.Config;
|
4 | 4 | with Gneiss.Protocol;
|
| 5 | +with Gneiss.Resource; |
5 | 6 | with Gneiss_Access;
|
6 | 7 | with Gneiss_Log;
|
7 | 8 | with SXML;
|
|
96 | 97 | In_Out => (Policy,
|
97 | 98 | Efd,
|
98 | 99 | Gneiss_Epoll.Linux,
|
99 |
| - Gneiss.Syscall.Linux, |
| 100 | + Gneiss_Syscall.Linux, |
100 | 101 | Main.Component_State,
|
101 | 102 | Load_File_Name,
|
102 | 103 | Gneiss.Linker.Linux));
|
|
112 | 113 | Global => (Input => Document,
|
113 | 114 | In_Out => (Policy,
|
114 | 115 | Efd,
|
115 |
| - Gneiss.Syscall.Linux, |
| 116 | + Gneiss_Syscall.Linux, |
116 | 117 | Main.Component_State,
|
117 | 118 | Gneiss.Linker.Linux,
|
118 | 119 | Gneiss_Epoll.Linux),
|
|
131 | 132 | Load_Message_Name,
|
132 | 133 | Load_Message_Label,
|
133 | 134 | Gneiss_Epoll.Linux,
|
134 |
| - Gneiss.Syscall.Linux, |
| 135 | + Gneiss_Syscall.Linux, |
135 | 136 | Proto.Linux,
|
136 | 137 | Read_Buffer.Ptr));
|
137 | 138 |
|
|
145 | 146 | and then Valid_Read_Buffer,
|
146 | 147 | Global => (Input => (Document,
|
147 | 148 | Policy),
|
148 |
| - In_Out => (Gneiss.Syscall.Linux, |
| 149 | + In_Out => (Gneiss_Syscall.Linux, |
149 | 150 | Proto.Linux,
|
150 | 151 | Read_Buffer.Ptr,
|
151 | 152 | Load_Message_Name,
|
|
170 | 171 | Policy),
|
171 | 172 | In_Out => (Load_Message_Name,
|
172 | 173 | Load_Message_Label,
|
173 |
| - Gneiss.Syscall.Linux, |
| 174 | + Gneiss_Syscall.Linux, |
174 | 175 | Proto.Linux),
|
175 | 176 | Proof_In => Efd);
|
176 | 177 |
|
|
187 | 188 | and then Initialized,
|
188 | 189 | Global => (Input => (Document,
|
189 | 190 | Policy),
|
190 |
| - In_Out => (Gneiss.Syscall.Linux, |
| 191 | + In_Out => (Gneiss_Syscall.Linux, |
191 | 192 | Proto.Linux),
|
192 | 193 | Proof_In => Efd);
|
193 | 194 |
|
|
202 | 203 | and then Initialized,
|
203 | 204 | Global => (Input => (Document,
|
204 | 205 | Policy),
|
205 |
| - In_Out => (Gneiss.Syscall.Linux, |
| 206 | + In_Out => (Gneiss_Syscall.Linux, |
206 | 207 | Proto.Linux),
|
207 | 208 | Proof_In => Efd);
|
208 | 209 |
|
|
218 | 219 | and then Initialized,
|
219 | 220 | Global => (Input => (Document,
|
220 | 221 | Policy),
|
221 |
| - In_Out => (Gneiss.Syscall.Linux, |
| 222 | + In_Out => (Gneiss_Syscall.Linux, |
222 | 223 | Proto.Linux),
|
223 | 224 | Proof_In => Efd);
|
224 | 225 |
|
|
233 | 234 | and then Initialized,
|
234 | 235 | Global => (Input => (Document,
|
235 | 236 | Policy),
|
236 |
| - In_Out => (Gneiss.Syscall.Linux, |
| 237 | + In_Out => (Gneiss_Syscall.Linux, |
237 | 238 | Proto.Linux),
|
238 | 239 | Proof_In => Efd);
|
239 | 240 |
|
|
385 | 386 | exit when SXML.Query.State_Result (State) /= SXML.Result_OK;
|
386 | 387 | SXML.Query.Attribute (State, Document, "name", Result, XML_Buf, Last);
|
387 | 388 | if Result = SXML.Result_OK then
|
388 |
| - Gneiss.Syscall.Socketpair (Policy (Index).Fd, Fd); |
| 389 | + Gneiss_Syscall.Socketpair (Policy (Index).Fd, Fd); |
389 | 390 | if Policy (Index).Fd > -1 then
|
390 | 391 | Gneiss_Epoll.Add (Efd, Policy (Index).Fd, Index, Success);
|
391 |
| - Gneiss.Syscall.Fork (Pid); |
| 392 | + Gneiss_Syscall.Fork (Pid); |
392 | 393 | if Pid < 0 then
|
393 | 394 | Gneiss_Log.Error ("Fork failed");
|
394 | 395 | Policy (Index).Fd := -1;
|
|
397 | 398 | Policy (Index).Pid := Pid;
|
398 | 399 | Policy (Index).Node := State;
|
399 | 400 | pragma Warnings (Off, "unused assignment to ""Fd""");
|
400 |
| - Gneiss.Syscall.Close (Fd); |
| 401 | + Gneiss_Syscall.Close (Fd); |
401 | 402 | pragma Warnings (On, "unused assignment to ""Fd""");
|
402 | 403 | Parent := True;
|
403 | 404 | Gneiss_Log.Info ("Started " & XML_Buf (XML_Buf'First .. Last)
|
|
425 | 426 | Last : Natural;
|
426 | 427 | begin
|
427 | 428 | Ret := 1;
|
428 |
| - Gneiss.Syscall.Close (Integer (Efd)); |
| 429 | + Gneiss_Syscall.Close (Integer (Efd)); |
429 | 430 | for I in Policy'Range loop
|
430 | 431 | pragma Loop_Invariant (Is_Valid);
|
431 | 432 | Policy (I).Node := SXML.Query.Invalid_State;
|
432 |
| - Gneiss.Syscall.Close (Policy (I).Fd); |
| 433 | + Gneiss_Syscall.Close (Policy (I).Fd); |
433 | 434 | end loop;
|
434 | 435 | SXML.Query.Attribute (Comp, Document, "file", Result, Load_File_Name, Last);
|
435 | 436 | if Result /= SXML.Result_OK and then Last not in Load_File_Name'Range then
|
|
460 | 461 | Read_Message (Index);
|
461 | 462 | end if;
|
462 | 463 | if Ev.Epoll_Hup or else Ev.Epoll_Rdhup then
|
463 |
| - Gneiss.Syscall.Waitpid (Policy (Index).Pid, Success); |
| 464 | + Gneiss_Syscall.Waitpid (Policy (Index).Pid, Success); |
464 | 465 | if Result = SXML.Result_OK then
|
465 | 466 | Gneiss_Log.Info ("Component "
|
466 | 467 | & XML_Buf (XML_Buf'First .. Last)
|
|
473 | 474 | & Basalt.Strings.Image (Success));
|
474 | 475 | end if;
|
475 | 476 | Gneiss_Epoll.Remove (Efd, Policy (Index).Fd, Success);
|
476 |
| - Gneiss.Syscall.Close (Policy (Index).Fd); |
| 477 | + Gneiss_Syscall.Close (Policy (Index).Fd); |
477 | 478 | Policy (Index).Node := SXML.Query.Init (Document);
|
478 | 479 | Policy (Index).Pid := -1;
|
479 | 480 | end if;
|
|
488 | 489 | Truncated : Boolean;
|
489 | 490 | Context : RFLX.Session.Packet.Context := RFLX.Session.Packet.Create;
|
490 | 491 | Last : RFLX.Types.Index;
|
| 492 | + Fds : Gneiss_Syscall.Fd_Array (1 .. 1); |
491 | 493 | Fd : Integer;
|
492 | 494 | begin
|
493 |
| - Gneiss.Main.Peek_Message (Policy (Index).Fd, Read_Buffer.Ptr.all, Last, Truncated, Fd); |
494 |
| - Gneiss.Syscall.Drop_Message (Policy (Index).Fd); |
| 495 | + Gneiss.Main.Peek_Message (Policy (Index).Fd, Read_Buffer.Ptr.all, Last, Truncated, Fds); |
| 496 | + Fd := Fds (Fds'First); |
| 497 | + Gneiss_Syscall.Drop_Message (Policy (Index).Fd); |
495 | 498 | if Last < Read_Buffer.Ptr.all'First then
|
496 | 499 | pragma Warnings (Off, "unused assignment to ""Fd""");
|
497 |
| - Gneiss.Syscall.Close (Fd); |
| 500 | + Gneiss_Syscall.Close (Fd); |
498 | 501 | pragma Warnings (On, "unused assignment to ""Fd""");
|
499 | 502 | Gneiss_Log.Warning ("Message too short, dropping");
|
500 | 503 | return;
|
501 | 504 | end if;
|
502 | 505 | if Truncated or else Last > Read_Buffer.Ptr.all'Last then
|
503 | 506 | pragma Warnings (Off, "unused assignment to ""Fd""");
|
504 |
| - Gneiss.Syscall.Close (Fd); |
| 507 | + Gneiss_Syscall.Close (Fd); |
505 | 508 | pragma Warnings (On, "unused assignment to ""Fd""");
|
506 | 509 | Gneiss_Log.Warning ("Message too large, dropping");
|
507 | 510 | return;
|
|
524 | 527 | else
|
525 | 528 | Gneiss_Log.Warning ("Invalid message, dropping");
|
526 | 529 | pragma Warnings (Off, "unused assignment to ""Fd""");
|
527 |
| - Gneiss.Syscall.Close (Fd); |
| 530 | + Gneiss_Syscall.Close (Fd); |
528 | 531 | pragma Warnings (On, "unused assignment to ""Fd""");
|
529 | 532 | end if;
|
530 | 533 | pragma Warnings (Off, "unused assignment to ""Context""");
|
|
740 | 743 | Name : String;
|
741 | 744 | Label : String)
|
742 | 745 | is
|
| 746 | + Fds : Gneiss_Syscall.Fd_Array (1 .. 4); |
743 | 747 | begin
|
| 748 | + Resource.Allocate_Fd (Kind, Fds); |
744 | 749 | Proto.Send_Message (Destination,
|
745 | 750 | Proto.Message'(Length => RFLX.Session.Length_Type (Name'Length + Label'Length),
|
746 | 751 | Action => RFLX.Session.Request,
|
747 | 752 | Kind => Kind,
|
748 | 753 | Name_Length => RFLX.Session.Length_Type (Name'Length),
|
749 |
| - Payload => Convert_Message (Name & Label))); |
| 754 | + Payload => Convert_Message (Name & Label)), |
| 755 | + Resource.Truncate (Kind, Fds)); |
750 | 756 | end Send_Request;
|
751 | 757 |
|
752 | 758 | procedure Send_Confirm (Destination : Integer;
|
|
761 | 767 | Kind => Kind,
|
762 | 768 | Name_Length => 0,
|
763 | 769 | Payload => Convert_Message (Label)),
|
764 |
| - Filedesc); |
| 770 | + Gneiss_Syscall.Fd_Array'(0 => Filedesc)); |
765 | 771 | end Send_Confirm;
|
766 | 772 |
|
767 | 773 | procedure Send_Reject (Destination : Integer;
|
|
0 commit comments