diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-07 11:53:17 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-07 11:53:17 +0000 |
commit | c789d03839a7a90a88e0ca6758788263fc8524cb (patch) | |
tree | ba0a466bb52ca32720ca9abc6b47333977f626e2 /gcc/ada/g-socthi-vms.adb | |
parent | d87dd2579cf376a08bfa49a61f805ef153721aee (diff) | |
download | gcc-c789d03839a7a90a88e0ca6758788263fc8524cb.tar.gz |
2009-05-07 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r147228
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@147231 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi-vms.adb')
-rw-r--r-- | gcc/ada/g-socthi-vms.adb | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb index 14576805602..6384598f07a 100644 --- a/gcc/ada/g-socthi-vms.adb +++ b/gcc/ada/g-socthi-vms.adb @@ -40,13 +40,18 @@ with Interfaces.C; use Interfaces.C; package body GNAT.Sockets.Thin is + type VMS_Msghdr is new Msghdr; + pragma Pack (VMS_Msghdr); + -- On VMS (unlike other platforms), struct msghdr is packed, so a specific + -- derived type is required. + 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 operation. But the user can -- also set a socket in non-blocking mode by purpose. In order to make a -- difference between these two situations, we track the origin of - -- non-blocking mode in Non_Blocking_Sockets. If S is in + -- non-blocking mode in Non_Blocking_Sockets. Note that if S is in -- Non_Blocking_Sockets, it has been set in non-blocking mode by the user. Quantum : constant Duration := 0.2; @@ -87,7 +92,7 @@ package body GNAT.Sockets.Thin is Msg : System.Address; Len : C.int; Flags : C.int; - From : Sockaddr_In_Access; + From : System.Address; Fromlen : not null access C.int) return C.int; pragma Import (C, Syscall_Recvfrom, "recvfrom"); @@ -108,7 +113,7 @@ package body GNAT.Sockets.Thin is Msg : System.Address; Len : C.int; Flags : C.int; - To : Sockaddr_In_Access; + To : System.Address; Tolen : C.int) return C.int; pragma Import (C, Syscall_Sendto, "sendto"); @@ -210,7 +215,6 @@ package body GNAT.Sockets.Thin is if Res = Failure and then Errno = SOSC.EISCONN then return Thin_Common.Success; - else return Res; end if; @@ -271,7 +275,7 @@ package body GNAT.Sockets.Thin is Msg : System.Address; Len : C.int; Flags : C.int; - From : Sockaddr_In_Access; + From : System.Address; Fromlen : not null access C.int) return C.int is Res : C.int; @@ -300,9 +304,15 @@ package body GNAT.Sockets.Thin is is Res : C.int; + GNAT_Msg : Msghdr; + for GNAT_Msg'Address use Msg; + pragma Import (Ada, GNAT_Msg); + + VMS_Msg : aliased VMS_Msghdr := VMS_Msghdr (GNAT_Msg); + begin loop - Res := Syscall_Recvmsg (S, Msg, Flags); + Res := Syscall_Recvmsg (S, VMS_Msg'Address, Flags); exit when SOSC.Thread_Blocking_IO or else Res /= Failure or else Non_Blocking_Socket (S) @@ -310,6 +320,8 @@ package body GNAT.Sockets.Thin is delay Quantum; end loop; + GNAT_Msg := Msghdr (VMS_Msg); + return ssize_t (Res); end C_Recvmsg; @@ -324,9 +336,15 @@ package body GNAT.Sockets.Thin is is Res : C.int; + GNAT_Msg : Msghdr; + for GNAT_Msg'Address use Msg; + pragma Import (Ada, GNAT_Msg); + + VMS_Msg : aliased VMS_Msghdr := VMS_Msghdr (GNAT_Msg); + begin loop - Res := Syscall_Sendmsg (S, Msg, Flags); + Res := Syscall_Sendmsg (S, VMS_Msg'Address, Flags); exit when SOSC.Thread_Blocking_IO or else Res /= Failure or else Non_Blocking_Socket (S) @@ -334,6 +352,8 @@ package body GNAT.Sockets.Thin is delay Quantum; end loop; + GNAT_Msg := Msghdr (VMS_Msg); + return ssize_t (Res); end C_Sendmsg; @@ -346,7 +366,7 @@ package body GNAT.Sockets.Thin is Msg : System.Address; Len : C.int; Flags : C.int; - To : Sockaddr_In_Access; + To : System.Address; Tolen : C.int) return C.int is Res : C.int; |