-- POSIX_Poll_Poorly - Provide a rather simple binding specifically for the dumb poll functionality. -- Copyright (C) 2023 Prince Trippy . -- This program is free software: you can redistribute it and/or modify it under the terms of the -- GNU Affero General Public License version 3 as published by the Free Software Foundation. -- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without -- even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- See the GNU Affero General Public License for more details. -- You should have received a copy of the GNU Affero General Public License along with this program. -- If not, see . with Interfaces.C, System; use Interfaces.C; package body POSIX_Poll_Poorly is function C_Poll (File_Descriptors : in System.Address; Count : in Long; Timeout : in Int) return Int; pragma Import(Convention => C, Entity => C_Poll, External_Name => "poll"); procedure Poll (File_Descriptors : in out Fds; Milliseconds_Timeout : in Int; Count : out Int) is I : Int := C_Poll(File_Descriptors'Address, File_Descriptors'Length, Milliseconds_Timeout); begin if I = -1 then raise Poll_Error; else Count := I; end if; end Poll; end POSIX_Poll_Poorly; .