From 223eab977a61c48f62cb0cbb9c009afefa6f6cbc Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 13 Jul 2009 11:17:10 +0200 Subject: [multiple changes] 2009-07-13 Thomas Quinot * 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 * adaint.c: Fix __gnat_stat() with Win32 UNC paths. From-SVN: r149559 --- gcc/ada/ChangeLog | 10 ++++++++++ gcc/ada/adaint.c | 18 +++++++++++++++--- gcc/ada/g-socthi-vxworks.adb | 21 ++++++++++++++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 63f9380..7fe0512 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2009-07-13 Thomas Quinot + + * 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 + + * adaint.c: Fix __gnat_stat() with Win32 UNC paths. + 2009-07-13 Emmanuel Briot * prj-proc.adb, prj-proc.ads, prj.ads, prj-nmsc.adb, prj-nmsc.ads, diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index fd7b1b3..f8ef6b1 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -1655,10 +1655,14 @@ __gnat_stat (char *name, STRUCT_STAT *statbuf) { #ifdef __MINGW32__ /* Under Windows the directory name for the stat function must not be - terminated by a directory separator except if just after a drive name. */ + terminated by a directory separator except if just after a drive name + or with UNC path without directory (only the name of the shared + resource), for example: \\computer\share\ */ + TCHAR wname [GNAT_MAX_PATH_LEN + 2]; - int name_len; + int name_len, k; TCHAR last_char; + int dirsep_count = 0; S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2); name_len = _tcslen (wname); @@ -1675,9 +1679,17 @@ __gnat_stat (char *name, STRUCT_STAT *statbuf) last_char = wname[name_len - 1]; } + /* Count back-slashes. */ + + for (k=0; k 3 && wname[0] == _T('\\') && wname[1] == _T('\\') + && dirsep_count == 3)) _tcscat (wname, _T("\\")); return _tstat (wname, (struct _stat *)statbuf); diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb index 67e6c25..8a90056 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) -- cgit v1.1