1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- S Y S T E M . M M A P . U N I X -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2007-2021, AdaCore -- 10-- -- 11-- This library is free software; you can redistribute it and/or modify it -- 12-- under terms of the GNU General Public License as published by the Free -- 13-- Software Foundation; either version 3, or (at your option) any later -- 14-- version. This library is distributed in the hope that it will be useful, -- 15-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- 16-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- You should have received a copy of the GNU General Public License and -- 23-- a copy of the GCC Runtime Library Exception along with this program; -- 24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 25-- <http://www.gnu.org/licenses/>. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32-- Declaration of off_t/mmap/munmap. This particular implementation 33-- supposes off_t is long. 34 35with System.OS_Lib; 36with Interfaces.C; 37 38package System.Mmap.Unix is 39 40 type Mmap_Prot is new Interfaces.C.int; 41-- PROT_NONE : constant Mmap_Prot := 16#00#; 42-- PROT_EXEC : constant Mmap_Prot := 16#04#; 43 PROT_READ : constant Mmap_Prot := 16#01#; 44 PROT_WRITE : constant Mmap_Prot := 16#02#; 45 46 type Mmap_Flags is new Interfaces.C.int; 47-- MAP_NONE : constant Mmap_Flags := 16#00#; 48-- MAP_FIXED : constant Mmap_Flags := 16#10#; 49 MAP_SHARED : constant Mmap_Flags := 16#01#; 50 MAP_PRIVATE : constant Mmap_Flags := 16#02#; 51 52 type off_t is new Long_Integer; 53 54 function Mmap (Start : Address := Null_Address; 55 Length : Interfaces.C.size_t; 56 Prot : Mmap_Prot := PROT_READ; 57 Flags : Mmap_Flags := MAP_PRIVATE; 58 Fd : System.OS_Lib.File_Descriptor; 59 Offset : off_t) return Address; 60 pragma Import (C, Mmap, "mmap"); 61 62 function Munmap (Start : Address; 63 Length : Interfaces.C.size_t) return Integer; 64 pragma Import (C, Munmap, "munmap"); 65 66 function Is_Mapping_Available return Boolean is (True); 67 -- Wheter memory mapping is actually available on this system. It is an 68 -- error to use Create_Mapping and Dispose_Mapping if this is False. 69end System.Mmap.Unix; 70