summaryrefslogtreecommitdiff
path: root/gcc/ada/g-socthi-vxworks.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-13 09:17:10 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-13 09:17:10 +0000
commit8234fccd5db937e45fb31ff3f3161744e776a6ab (patch)
tree1857f720afceceaca3d3c5a224ab66303e3e682d /gcc/ada/g-socthi-vxworks.adb
parent4eafea4c70890f237b2331faf5fa43dbb27bfbdd (diff)
downloadgcc-8234fccd5db937e45fb31ff3f3161744e776a6ab.tar.gz
2009-07-13 Thomas Quinot <quinot@adacore.com>
* g-socthi-vxworks.adb (C_Sendto): VxWorks does not support the standard sendto(2) interface for connected sockets (passing a null destination address). Use send(2) instead for that case. 2009-07-13 Pascal Obry <obry@adacore.com> * adaint.c: Fix __gnat_stat() with Win32 UNC paths. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149559 138bc75d-0d04-0410-961f-82ee72b054a4
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)