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.adb21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index 67e6c25eeb8..8a90056312b 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -108,6 +108,13 @@ package body GNAT.Sockets.Thin is
Flags : C.int) return C.int;
pragma Import (C, Syscall_Sendmsg, "sendmsg");
+ function Syscall_Send
+ (S : C.int;
+ Msg : System.Address;
+ Len : C.int;
+ Flags : C.int) return C.int;
+ pragma Import (C, Syscall_Send, "send");
+
function Syscall_Sendto
(S : C.int;
Msg : System.Address;
@@ -355,11 +362,23 @@ package body GNAT.Sockets.Thin is
To : System.Address;
Tolen : C.int) return C.int
is
+ use System;
+
Res : C.int;
begin
loop
- Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
+ if To = Null_Address then
+ -- In violation of the standard sockets API, VxWorks does not
+ -- support sendto(2) calls on connected sockets with a null
+ -- destination address, so use send(2) instead in that case.
+
+ Res := Syscall_Send (S, Msg, Len, Flags);
+
+ else
+ Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
+ end if;
+
exit when SOSC.Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)