diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-07 10:41:04 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-07 10:41:04 +0000 |
commit | 4bd9fc6c00ed86d7859878617a195cf96c8b46f7 (patch) | |
tree | dc0dcca7bc87813da8b91fba55d1fd2901e94b59 /gcc/ada/g-socthi-vms.adb | |
parent | a4870f3d8b4debc5e0f3080c3c9052e20b3a7cec (diff) | |
download | gcc-4bd9fc6c00ed86d7859878617a195cf96c8b46f7.tar.gz |
2011-09-07 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 178630 using svnmerge.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@178632 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi-vms.adb')
-rw-r--r-- | gcc/ada/g-socthi-vms.adb | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb index c075ae542e2..51c28fb601a 100644 --- a/gcc/ada/g-socthi-vms.adb +++ b/gcc/ada/g-socthi-vms.adb @@ -42,7 +42,15 @@ package body GNAT.Sockets.Thin is pragma Pack (VMS_Msghdr); -- On VMS 8.x (unlike other platforms), struct msghdr is packed, so a -- specific derived type is required. This structure was not packed on - -- VMS 7.3, so sendmsg and recvmsg fail on earlier VMS versions. + -- VMS 7.3. + + function Is_VMS_V7 return Integer; + pragma Import (C, Is_VMS_V7, "__gnat_is_vms_v7"); + -- Helper (defined in init.c) that returns a non-zero value if the VMS + -- version is 7.x. + + VMS_V7 : constant Boolean := Is_VMS_V7 /= 0; + -- True if VMS version is 7.x. Non_Blocking_Sockets : aliased Fd_Set; -- When this package is initialized with Process_Blocking_IO set to True, @@ -295,15 +303,24 @@ package body GNAT.Sockets.Thin is is Res : C.int; + Msg_Addr : System.Address; + GNAT_Msg : Msghdr; for GNAT_Msg'Address use Msg; pragma Import (Ada, GNAT_Msg); - VMS_Msg : aliased VMS_Msghdr := VMS_Msghdr (GNAT_Msg); + VMS_Msg : aliased VMS_Msghdr; begin + if VMS_V7 then + Msg_Addr := Msg; + else + VMS_Msg := VMS_Msghdr (GNAT_Msg); + Msg_Addr := VMS_Msg'Address; + end if; + loop - Res := Syscall_Recvmsg (S, VMS_Msg'Address, Flags); + Res := Syscall_Recvmsg (S, Msg_Addr, Flags); exit when SOSC.Thread_Blocking_IO or else Res /= Failure or else Non_Blocking_Socket (S) @@ -311,7 +328,9 @@ package body GNAT.Sockets.Thin is delay Quantum; end loop; - GNAT_Msg := Msghdr (VMS_Msg); + if not VMS_V7 then + GNAT_Msg := Msghdr (VMS_Msg); + end if; return System.CRTL.ssize_t (Res); end C_Recvmsg; @@ -327,15 +346,24 @@ package body GNAT.Sockets.Thin is is Res : C.int; + Msg_Addr : System.Address; + GNAT_Msg : Msghdr; for GNAT_Msg'Address use Msg; pragma Import (Ada, GNAT_Msg); - VMS_Msg : aliased VMS_Msghdr := VMS_Msghdr (GNAT_Msg); + VMS_Msg : aliased VMS_Msghdr; begin + if VMS_V7 then + Msg_Addr := Msg; + else + VMS_Msg := VMS_Msghdr (GNAT_Msg); + Msg_Addr := VMS_Msg'Address; + end if; + loop - Res := Syscall_Sendmsg (S, VMS_Msg'Address, Flags); + Res := Syscall_Sendmsg (S, Msg_Addr, Flags); exit when SOSC.Thread_Blocking_IO or else Res /= Failure or else Non_Blocking_Socket (S) @@ -343,7 +371,9 @@ package body GNAT.Sockets.Thin is delay Quantum; end loop; - GNAT_Msg := Msghdr (VMS_Msg); + if not VMS_V7 then + GNAT_Msg := Msghdr (VMS_Msg); + end if; return System.CRTL.ssize_t (Res); end C_Sendmsg; |