summaryrefslogtreecommitdiff
path: root/gcc/ada/g-socthi.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-12 11:45:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-12 11:45:26 +0000
commitb5ff3ed8b1db3c73947d1ec66fc199192bc37c11 (patch)
tree9a40f2549e1bdb5877d519b870509751de706702 /gcc/ada/g-socthi.adb
parent7c63d70b926a0383da6f17734537f62420900c17 (diff)
downloadgcc-b5ff3ed8b1db3c73947d1ec66fc199192bc37c11.tar.gz
2004-01-12 Laurent Pautet <pautet@act-europe.fr>
* 3vsocthi.adb, 3vsocthi.ads, 3wsocthi.adb, 3wsocthi.ads, 3zsocthi.adb, 3zsocthi.ads, g-socthi.adb, g-socthi.ads (Socket_Error_Message): Return C.Strings.chars_ptr instead of String. * g-socket.adb (Raise_Socket_Error): Use new Socket_Error_Message signature. 2004-01-12 Javier Miranda <miranda@gnat.com> * cstand.adb, exp_aggr.adb, exp_ch3.adb, exp_ch9.adb, exp_dist.adb, exp_imgv.adb, exp_pakd.adb, exp_util.adb, par-ch3.adb, sem.adb, sem_ch3.adb, sem_dist.adb, sem_prag.adb, sem_res.adb, sem_util.adb, sinfo.adb, sinfo.ads, sprint.adb: Addition of Component_Definition node. 2004-01-12 Ed Falis <falis@gnat.com> * impunit.adb: Add GNAT.Secondary_Stack_Info as user-visible unit 2004-01-12 Thomas Quinot <quinot@act-europe.fr> * link.c: Change default libgnat kind to STATIC for FreeBSD. 2004-01-12 Ed Schonberg <schonberg@gnat.com> * lib-xref.adb (Get_Type_Reference): If the type is the subtype entity generated to rename a generic actual, go to the actual itself, the subtype is not a user-visible entity. * sem_ch7.adb (Uninstall_Declarations): If an entity in the visible part is a private subtype, reset the visibility of its full view, if any, to be consistent. 2004-01-12 Robert Dewar <dewar@gnat.com> * trans.c (Eliminate_Error_Msg): New procedure called to generate msg * usage.adb: Remove mention of obsolete -gnatwb switch Noticed during code reading 2004-01-12 Jerome Guitton <guitton@act-europe.fr> * 1ssecsta.adb: Minor changes for -gnatwa warnings 2004-01-12 GNAT Script <nobody@gnat.com> * Make-lang.in: Makefile automatically updated git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75714 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi.adb')
-rw-r--r--gcc/ada/g-socthi.adb74
1 files changed, 32 insertions, 42 deletions
diff --git a/gcc/ada/g-socthi.adb b/gcc/ada/g-socthi.adb
index 2c337e00ea2..49f3c8d244b 100644
--- a/gcc/ada/g-socthi.adb
+++ b/gcc/ada/g-socthi.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2004 Ada Core Technologies, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -44,8 +44,8 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
- Non_Blocking_Sockets : constant Fd_Set_Access
- := New_Socket_Set (No_Socket_Set);
+ Non_Blocking_Sockets : constant Fd_Set_Access :=
+ New_Socket_Set (No_Socket_Set);
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
@@ -62,33 +62,32 @@ package body GNAT.Sockets.Thin is
Thread_Blocking_IO : Boolean := True;
+ Unknown_System_Error : constant C.Strings.chars_ptr :=
+ C.Strings.New_String ("Unknown system error");
+
function Syscall_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
pragma Import (C, Syscall_Accept, "accept");
function Syscall_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
pragma Import (C, Syscall_Connect, "connect");
function Syscall_Ioctl
(S : C.int;
Req : C.int;
- Arg : Int_Access)
- return C.int;
+ Arg : Int_Access) return C.int;
pragma Import (C, Syscall_Ioctl, "ioctl");
function Syscall_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
pragma Import (C, Syscall_Recv, "recv");
function Syscall_Recvfrom
@@ -97,16 +96,14 @@ package body GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
pragma Import (C, Syscall_Recvfrom, "recvfrom");
function Syscall_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
pragma Import (C, Syscall_Send, "send");
function Syscall_Sendto
@@ -115,13 +112,13 @@ package body GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
pragma Import (C, Syscall_Sendto, "sendto");
function Syscall_Socket
- (Domain, Typ, Protocol : C.int)
- return C.int;
+ (Domain : C.int;
+ Typ : C.int;
+ Protocol : C.int) return C.int;
pragma Import (C, Syscall_Socket, "socket");
function Non_Blocking_Socket (S : C.int) return Boolean;
@@ -134,8 +131,7 @@ package body GNAT.Sockets.Thin is
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int
+ Addrlen : access C.int) return C.int
is
R : C.int;
Val : aliased C.int := 1;
@@ -174,8 +170,7 @@ package body GNAT.Sockets.Thin is
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int
+ Namelen : C.int) return C.int
is
Res : C.int;
@@ -235,10 +230,9 @@ package body GNAT.Sockets.Thin is
-------------
function C_Ioctl
- (S : C.int;
- Req : C.int;
- Arg : Int_Access)
- return C.int
+ (S : C.int;
+ Req : C.int;
+ Arg : Int_Access) return C.int
is
begin
if not Thread_Blocking_IO
@@ -260,8 +254,7 @@ package body GNAT.Sockets.Thin is
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int
+ Flags : C.int) return C.int
is
Res : C.int;
@@ -288,8 +281,7 @@ package body GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int
+ Fromlen : access C.int) return C.int
is
Res : C.int;
@@ -314,8 +306,7 @@ package body GNAT.Sockets.Thin is
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int
+ Flags : C.int) return C.int
is
Res : C.int;
@@ -342,8 +333,7 @@ package body GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int
+ Tolen : C.int) return C.int
is
Res : C.int;
@@ -367,8 +357,7 @@ package body GNAT.Sockets.Thin is
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int
+ Protocol : C.int) return C.int
is
R : C.int;
Val : aliased C.int := 1;
@@ -416,7 +405,6 @@ package body GNAT.Sockets.Thin is
function Non_Blocking_Socket (S : C.int) return Boolean is
R : Boolean;
-
begin
Task_Lock.Lock;
R := Is_Socket_In_Set (Non_Blocking_Sockets, S);
@@ -433,7 +421,7 @@ package body GNAT.Sockets.Thin is
Address : In_Addr)
is
begin
- Sin.Sin_Addr := Address;
+ Sin.Sin_Addr := Address;
end Set_Address;
----------------
@@ -496,7 +484,9 @@ package body GNAT.Sockets.Thin is
-- Socket_Error_Message --
--------------------------
- function Socket_Error_Message (Errno : Integer) return String is
+ function Socket_Error_Message
+ (Errno : Integer) return C.Strings.chars_ptr
+ is
use type Interfaces.C.Strings.chars_ptr;
C_Msg : C.Strings.chars_ptr;
@@ -505,10 +495,10 @@ package body GNAT.Sockets.Thin is
C_Msg := C_Strerror (C.int (Errno));
if C_Msg = C.Strings.Null_Ptr then
- return "Unknown system error";
+ return Unknown_System_Error;
else
- return C.Strings.Value (C_Msg);
+ return C_Msg;
end if;
end Socket_Error_Message;