diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-13 11:17:10 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-13 11:17:10 +0200 |
commit | 223eab977a61c48f62cb0cbb9c009afefa6f6cbc (patch) | |
tree | 1857f720afceceaca3d3c5a224ab66303e3e682d /gcc/ada | |
parent | fdd7e7bb1d01de50a07ba1b7f9bf6235b7e89da3 (diff) | |
download | gcc-223eab977a61c48f62cb0cbb9c009afefa6f6cbc.zip gcc-223eab977a61c48f62cb0cbb9c009afefa6f6cbc.tar.gz gcc-223eab977a61c48f62cb0cbb9c009afefa6f6cbc.tar.bz2 |
[multiple changes]
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.
From-SVN: r149559
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/ada/adaint.c | 18 | ||||
-rw-r--r-- | gcc/ada/g-socthi-vxworks.adb | 21 |
3 files changed, 45 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 63f9380..7fe05126 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +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. + 2009-07-13 Emmanuel Briot <briot@adacore.com> * 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<name_len; k++) + if (wname[k] == _T('\\') || wname[k] == _T('/')) + dirsep_count++; + /* Only a drive letter followed by ':', we must add a directory separator for the stat routine to work properly. */ - if (name_len == 2 && wname[1] == _T(':')) + if ((name_len == 2 && wname[1] == _T(':')) + || (name_len > 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) |