[Ada] Sockets.Poll implementation
authorDmitriy Anisimkov <anisimko@adacore.com>
Sat, 8 Aug 2020 12:49:27 +0000 (18:49 +0600)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 23 Oct 2020 08:25:07 +0000 (04:25 -0400)
commitd08d481912b9a2dc3388f8e1183cea0bf3ffae9f
tree22e513c76801fa433fcc0445892f3b47d4c7a0bf
parent66e97274cef35ed40584c7a09096fffa061fddf0
[Ada] Sockets.Poll implementation

gcc/ada/

* Makefile.rtl (GNATRTL_SOCKETS_OBJS): New object
g-socpol$(objext) New source files noted: g-socpol.adb,
g-socpol.ads, g-socpol__dummy.adb, g-socpol__dummy.ads,
g-sopowa.adb, g-sopowa__posix.adb, g-sopowa__mingw.adb,
g-spogwa.adb, g-spogwa.ads.
* impunit.adb (Non_Imp_File_Names_95): New base filename
g-socpol in "GNAT Library Units" section for GNAT.Sockets.Poll
unit.
* libgnat/g-socket.ads, libgnat/g-socket.adb:
(Raise_Socket_Error): Moved from body to private part of
specification to use in GNAT.Sockets.Poll.
* libgnat/g-socpol.ads, libgnat/g-socpol.adb: Main unit of the
implementation.
* libgnat/g-socpol__dummy.ads, libgnat/g-socpol__dummy.adb:
Empty unit for the systems without sockets support.
* libgnat/g-spogwa.ads, libgnat/g-spogwa.adb: Generic unit
implementing sockets poll on top of select system call.
* libgnat/g-sopowa.adb (Wait): Separate implementation for
operation systems with poll system call support.
* libgnat/g-sopowa__posix.adb (Wait): Separate implementation
for POSIX select system call.
* libgnat/g-sopowa__mingw.adb (Wait): Separate implementation
for Windows select system call.
* gsocket.h (_WIN32_WINNT): Increase to 0x0600 for winsock2.h to
allow WSAPoll related definitions.
* s-oscons-tmplt.c: Fix comment next to #endif for
#if defined (__linux__) || defined (__ANDROID__) line.  Include
<poll.h> for all except VxWorks and Windows.
(SIZEOF_nfds_t): New definition.
(SIZEOF_fd_type): New definition.
(SIZEOF_pollfd_events): New definition.
(POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL): New
definitions for VxWorks to be able to emulate poll on top of
select in it.  Define POLLPRI as zero on Windows as it is not
supported there.
(Poll_Linkname): New definition, because the poll system call
has different name in Windows and POSIX.
15 files changed:
gcc/ada/Makefile.rtl
gcc/ada/gsocket.h
gcc/ada/impunit.adb
gcc/ada/libgnat/g-socket.adb
gcc/ada/libgnat/g-socket.ads
gcc/ada/libgnat/g-socpol.adb [new file with mode: 0644]
gcc/ada/libgnat/g-socpol.ads [new file with mode: 0644]
gcc/ada/libgnat/g-socpol__dummy.adb [new file with mode: 0644]
gcc/ada/libgnat/g-socpol__dummy.ads [new file with mode: 0644]
gcc/ada/libgnat/g-sopowa.adb [new file with mode: 0644]
gcc/ada/libgnat/g-sopowa__mingw.adb [new file with mode: 0644]
gcc/ada/libgnat/g-sopowa__posix.adb [new file with mode: 0644]
gcc/ada/libgnat/g-spogwa.adb [new file with mode: 0644]
gcc/ada/libgnat/g-spogwa.ads [new file with mode: 0644]
gcc/ada/s-oscons-tmplt.c