diff options
Diffstat (limited to 'gcc/ada/3vsocthi.adb')
| -rw-r--r-- | gcc/ada/3vsocthi.adb | 88 |
1 files changed, 31 insertions, 57 deletions
diff --git a/gcc/ada/3vsocthi.adb b/gcc/ada/3vsocthi.adb index 94bfccb..41b32d1 100644 --- a/gcc/ada/3vsocthi.adb +++ b/gcc/ada/3vsocthi.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- -- @@ -58,33 +58,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 @@ -93,8 +92,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; pragma Import (C, Syscall_Recvfrom, "recvfrom"); function Syscall_Send @@ -116,8 +114,7 @@ package body GNAT.Sockets.Thin is pragma Import (C, Syscall_Sendto, "sendto"); function Syscall_Socket - (Domain, Typ, Protocol : C.int) - return C.int; + (Domain, Typ, Protocol : C.int) return C.int; pragma Import (C, Syscall_Socket, "socket"); function Non_Blocking_Socket (S : C.int) return Boolean; @@ -130,8 +127,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; @@ -170,8 +166,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; @@ -231,10 +226,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 @@ -256,8 +250,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; @@ -284,8 +277,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; @@ -310,8 +302,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; @@ -338,8 +329,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; @@ -363,8 +353,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; @@ -412,7 +401,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); @@ -424,10 +412,7 @@ package body GNAT.Sockets.Thin is -- Set_Address -- ----------------- - procedure Set_Address - (Sin : Sockaddr_In_Access; - Address : In_Addr) - is + procedure Set_Address (Sin : Sockaddr_In_Access; Address : In_Addr) is begin Sin.Sin_Addr := Address; end Set_Address; @@ -436,10 +421,7 @@ package body GNAT.Sockets.Thin is -- Set_Family -- ---------------- - procedure Set_Family - (Sin : Sockaddr_In_Access; - Family : C.int) - is + procedure Set_Family (Sin : Sockaddr_In_Access; Family : C.int) is begin Sin.Sin_Family := C.unsigned_short (Family); end Set_Family; @@ -448,13 +430,9 @@ package body GNAT.Sockets.Thin is -- Set_Length -- ---------------- - procedure Set_Length - (Sin : Sockaddr_In_Access; - Len : C.int) - is + procedure Set_Length (Sin : Sockaddr_In_Access; Len : C.int) is pragma Unreferenced (Sin); pragma Unreferenced (Len); - begin null; end Set_Length; @@ -480,10 +458,7 @@ package body GNAT.Sockets.Thin is -- Set_Port -- -------------- - procedure Set_Port - (Sin : Sockaddr_In_Access; - Port : C.unsigned_short) - is + procedure Set_Port (Sin : Sockaddr_In_Access; Port : C.unsigned_short) is begin Sin.Sin_Port := Port; end Set_Port; @@ -492,7 +467,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; @@ -501,10 +478,9 @@ 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; @@ -515,8 +491,7 @@ package body GNAT.Sockets.Thin is function C_Readv (Fd : C.int; Iov : System.Address; - Iovcnt : C.int) - return C.int + Iovcnt : C.int) return C.int is Res : C.int; Count : C.int := 0; @@ -548,8 +523,7 @@ package body GNAT.Sockets.Thin is function C_Writev (Fd : C.int; Iov : System.Address; - Iovcnt : C.int) - return C.int + Iovcnt : C.int) return C.int is Res : C.int; Count : C.int := 0; |
