summaryrefslogtreecommitdiff
path: root/gcc/ada/g-socthi-vxworks.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/g-socthi-vxworks.adb')
-rw-r--r--gcc/ada/g-socthi-vxworks.adb34
1 files changed, 14 insertions, 20 deletions
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index 3a1d1fe9a5f..81a8d96eeed 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -44,8 +44,7 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
- Non_Blocking_Sockets : constant Fd_Set_Access :=
- New_Socket_Set (No_Fd_Set_Access);
+ Non_Blocking_Sockets : aliased Fd_Set;
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
@@ -84,7 +83,7 @@ package body GNAT.Sockets.Thin is
function Syscall_Ioctl
(S : C.int;
Req : C.int;
- Arg : Int_Access) return C.int;
+ Arg : access C.int) return C.int;
pragma Import (C, Syscall_Ioctl, "ioctl");
function Syscall_Recv
@@ -125,7 +124,7 @@ package body GNAT.Sockets.Thin is
Protocol : C.int) return C.int;
pragma Import (C, Syscall_Socket, "socket");
- function Non_Blocking_Socket (S : C.int) return Boolean;
+ function Non_Blocking_Socket (S : C.int) return Boolean;
procedure Set_Non_Blocking_Socket (S : C.int; V : Boolean);
--------------
@@ -161,7 +160,7 @@ package body GNAT.Sockets.Thin is
-- tracks sockets set in non-blocking mode by user.
Set_Non_Blocking_Socket (R, Non_Blocking_Socket (S));
- Res := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
+ Res := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Access);
-- Is it OK to ignore result ???
end if;
@@ -191,33 +190,28 @@ package body GNAT.Sockets.Thin is
end if;
declare
- WSet : Fd_Set_Access;
+ WSet : aliased Fd_Set;
Now : aliased Timeval;
-
begin
- WSet := New_Socket_Set (No_Fd_Set_Access);
-
+ Reset_Socket_Set (WSet'Access);
loop
- Insert_Socket_In_Set (WSet, S);
+ Insert_Socket_In_Set (WSet'Access, S);
Now := Immediat;
Res := C_Select
(S + 1,
No_Fd_Set_Access,
- WSet,
+ WSet'Access,
No_Fd_Set_Access,
Now'Unchecked_Access);
exit when Res > 0;
if Res = Failure then
- Free_Socket_Set (WSet);
return Res;
end if;
delay Quantum;
end loop;
-
- Free_Socket_Set (WSet);
end;
Res := Syscall_Connect (S, Name, Namelen);
@@ -238,7 +232,7 @@ package body GNAT.Sockets.Thin is
function C_Ioctl
(S : C.int;
Req : C.int;
- Arg : Int_Access) return C.int
+ Arg : access C.int) return C.int
is
begin
if not SOSC.Thread_Blocking_IO
@@ -380,7 +374,7 @@ package body GNAT.Sockets.Thin is
-- Do not use C_Ioctl as this subprogram tracks sockets set
-- in non-blocking mode by user.
- Res := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Unchecked_Access);
+ Res := Syscall_Ioctl (R, SOSC.FIONBIO, Val'Access);
-- Is it OK to ignore result ???
Set_Non_Blocking_Socket (R, False);
end if;
@@ -409,7 +403,7 @@ package body GNAT.Sockets.Thin is
procedure Initialize is
begin
- null;
+ Reset_Socket_Set (Non_Blocking_Sockets'Access);
end Initialize;
-------------------------
@@ -420,7 +414,7 @@ package body GNAT.Sockets.Thin is
R : Boolean;
begin
Task_Lock.Lock;
- R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0);
+ R := (Is_Socket_In_Set (Non_Blocking_Sockets'Access, S) /= 0);
Task_Lock.Unlock;
return R;
end Non_Blocking_Socket;
@@ -433,9 +427,9 @@ package body GNAT.Sockets.Thin is
begin
Task_Lock.Lock;
if V then
- Insert_Socket_In_Set (Non_Blocking_Sockets, S);
+ Insert_Socket_In_Set (Non_Blocking_Sockets'Access, S);
else
- Remove_Socket_From_Set (Non_Blocking_Sockets, S);
+ Remove_Socket_From_Set (Non_Blocking_Sockets'Access, S);
end if;
Task_Lock.Unlock;