annotate gcc/ada/libgnat/g-socthi__vxworks.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- G N A T . S O C K E T S . T H I N --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 2002-2018, AdaCore --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package provides a target dependent thin interface to the sockets
kono
parents:
diff changeset
33 -- layer for use by the GNAT.Sockets package (g-socket.ads). This package
kono
parents:
diff changeset
34 -- should not be directly with'ed by an applications program.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- This is the version for VxWorks
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 with Interfaces.C;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 with GNAT.OS_Lib;
kono
parents:
diff changeset
41 with GNAT.Sockets.Thin_Common;
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 with System;
kono
parents:
diff changeset
44 with System.CRTL;
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 package GNAT.Sockets.Thin is
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 use Thin_Common;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 package C renames Interfaces.C;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
kono
parents:
diff changeset
53 -- Returns last socket error number
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 procedure Set_Socket_Errno (Errno : Integer) renames GNAT.OS_Lib.Set_Errno;
kono
parents:
diff changeset
56 -- Set last socket error number
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 function Socket_Error_Message (Errno : Integer) return String;
kono
parents:
diff changeset
59 -- Returns the error message string for the error number Errno. If Errno is
kono
parents:
diff changeset
60 -- not known, returns "Unknown system error".
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 function Host_Errno return Integer;
kono
parents:
diff changeset
63 pragma Import (C, Host_Errno, "__gnat_get_h_errno");
kono
parents:
diff changeset
64 -- Returns last host error number
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 package Host_Error_Messages is
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 function Host_Error_Message (H_Errno : Integer) return String;
kono
parents:
diff changeset
69 -- Returns the error message string for the host error number H_Errno.
kono
parents:
diff changeset
70 -- If H_Errno is not known, returns "Unknown system error".
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 end Host_Error_Messages;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 --------------------------------
kono
parents:
diff changeset
75 -- Standard library functions --
kono
parents:
diff changeset
76 --------------------------------
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 function C_Accept
kono
parents:
diff changeset
79 (S : C.int;
kono
parents:
diff changeset
80 Addr : System.Address;
kono
parents:
diff changeset
81 Addrlen : not null access C.int) return C.int;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 function C_Bind
kono
parents:
diff changeset
84 (S : C.int;
kono
parents:
diff changeset
85 Name : System.Address;
kono
parents:
diff changeset
86 Namelen : C.int) return C.int;
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 function C_Close
kono
parents:
diff changeset
89 (Fd : C.int) return C.int;
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 function C_Connect
kono
parents:
diff changeset
92 (S : C.int;
kono
parents:
diff changeset
93 Name : System.Address;
kono
parents:
diff changeset
94 Namelen : C.int) return C.int;
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 function C_Gethostname
kono
parents:
diff changeset
97 (Name : System.Address;
kono
parents:
diff changeset
98 Namelen : C.int) return C.int;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 function C_Getpeername
kono
parents:
diff changeset
101 (S : C.int;
kono
parents:
diff changeset
102 Name : System.Address;
kono
parents:
diff changeset
103 Namelen : not null access C.int) return C.int;
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 function C_Getsockname
kono
parents:
diff changeset
106 (S : C.int;
kono
parents:
diff changeset
107 Name : System.Address;
kono
parents:
diff changeset
108 Namelen : not null access C.int) return C.int;
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 function C_Getsockopt
kono
parents:
diff changeset
111 (S : C.int;
kono
parents:
diff changeset
112 Level : C.int;
kono
parents:
diff changeset
113 Optname : C.int;
kono
parents:
diff changeset
114 Optval : System.Address;
kono
parents:
diff changeset
115 Optlen : not null access C.int) return C.int;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 function Socket_Ioctl
kono
parents:
diff changeset
118 (S : C.int;
kono
parents:
diff changeset
119 Req : SOSC.IOCTL_Req_T;
kono
parents:
diff changeset
120 Arg : access C.int) return C.int;
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 function C_Listen
kono
parents:
diff changeset
123 (S : C.int;
kono
parents:
diff changeset
124 Backlog : C.int) return C.int;
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 function C_Recv
kono
parents:
diff changeset
127 (S : C.int;
kono
parents:
diff changeset
128 Msg : System.Address;
kono
parents:
diff changeset
129 Len : C.int;
kono
parents:
diff changeset
130 Flags : C.int) return C.int;
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 function C_Recvfrom
kono
parents:
diff changeset
133 (S : C.int;
kono
parents:
diff changeset
134 Msg : System.Address;
kono
parents:
diff changeset
135 Len : C.int;
kono
parents:
diff changeset
136 Flags : C.int;
kono
parents:
diff changeset
137 From : System.Address;
kono
parents:
diff changeset
138 Fromlen : not null access C.int) return C.int;
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 function C_Recvmsg
kono
parents:
diff changeset
141 (S : C.int;
kono
parents:
diff changeset
142 Msg : System.Address;
kono
parents:
diff changeset
143 Flags : C.int) return System.CRTL.ssize_t;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 function C_Select
kono
parents:
diff changeset
146 (Nfds : C.int;
kono
parents:
diff changeset
147 Readfds : access Fd_Set;
kono
parents:
diff changeset
148 Writefds : access Fd_Set;
kono
parents:
diff changeset
149 Exceptfds : access Fd_Set;
kono
parents:
diff changeset
150 Timeout : Timeval_Access) return C.int;
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 function C_Sendmsg
kono
parents:
diff changeset
153 (S : C.int;
kono
parents:
diff changeset
154 Msg : System.Address;
kono
parents:
diff changeset
155 Flags : C.int) return System.CRTL.ssize_t;
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 function C_Sendto
kono
parents:
diff changeset
158 (S : C.int;
kono
parents:
diff changeset
159 Msg : System.Address;
kono
parents:
diff changeset
160 Len : C.int;
kono
parents:
diff changeset
161 Flags : C.int;
kono
parents:
diff changeset
162 To : System.Address;
kono
parents:
diff changeset
163 Tolen : C.int) return C.int;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 function C_Setsockopt
kono
parents:
diff changeset
166 (S : C.int;
kono
parents:
diff changeset
167 Level : C.int;
kono
parents:
diff changeset
168 Optname : C.int;
kono
parents:
diff changeset
169 Optval : System.Address;
kono
parents:
diff changeset
170 Optlen : C.int) return C.int;
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 function C_Shutdown
kono
parents:
diff changeset
173 (S : C.int;
kono
parents:
diff changeset
174 How : C.int) return C.int;
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 function C_Socket
kono
parents:
diff changeset
177 (Domain : C.int;
kono
parents:
diff changeset
178 Typ : C.int;
kono
parents:
diff changeset
179 Protocol : C.int) return C.int;
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 function C_System
kono
parents:
diff changeset
182 (Command : System.Address) return C.int;
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 -------------------------------------------------------
kono
parents:
diff changeset
185 -- Signalling file descriptors for selector abortion --
kono
parents:
diff changeset
186 -------------------------------------------------------
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 package Signalling_Fds is
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 function Create (Fds : not null access Fd_Pair) return C.int;
kono
parents:
diff changeset
191 pragma Convention (C, Create);
kono
parents:
diff changeset
192 -- Create a pair of connected descriptors suitable for use with C_Select
kono
parents:
diff changeset
193 -- (used for signalling in Selector objects).
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 function Read (Rsig : C.int) return C.int;
kono
parents:
diff changeset
196 pragma Convention (C, Read);
kono
parents:
diff changeset
197 -- Read one byte of data from rsig, the read end of a pair of signalling
kono
parents:
diff changeset
198 -- fds created by Create_Signalling_Fds.
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 function Write (Wsig : C.int) return C.int;
kono
parents:
diff changeset
201 pragma Convention (C, Write);
kono
parents:
diff changeset
202 -- Write one byte of data to wsig, the write end of a pair of signalling
kono
parents:
diff changeset
203 -- fds created by Create_Signalling_Fds.
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 procedure Close (Sig : C.int);
kono
parents:
diff changeset
206 pragma Convention (C, Close);
kono
parents:
diff changeset
207 -- Close one end of a pair of signalling fds (ignoring any error)
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 end Signalling_Fds;
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 procedure Initialize;
kono
parents:
diff changeset
212 procedure Finalize;
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 private
kono
parents:
diff changeset
215 pragma Import (C, C_Bind, "bind");
kono
parents:
diff changeset
216 pragma Import (C, C_Close, "close");
kono
parents:
diff changeset
217 pragma Import (C, C_Gethostname, "gethostname");
kono
parents:
diff changeset
218 pragma Import (C, C_Getpeername, "getpeername");
kono
parents:
diff changeset
219 pragma Import (C, C_Getsockname, "getsockname");
kono
parents:
diff changeset
220 pragma Import (C, C_Getsockopt, "getsockopt");
kono
parents:
diff changeset
221 pragma Import (C, C_Listen, "listen");
kono
parents:
diff changeset
222 pragma Import (C, C_Select, "select");
kono
parents:
diff changeset
223 pragma Import (C, C_Setsockopt, "setsockopt");
kono
parents:
diff changeset
224 pragma Import (C, C_Shutdown, "shutdown");
kono
parents:
diff changeset
225 pragma Import (C, C_System, "system");
kono
parents:
diff changeset
226 end GNAT.Sockets.Thin;