blob: 57cf42978a622bd331f6673aaff749cf799a944f [file] [log] [blame]
Nico Huberf03ef4f2017-03-04 13:57:09 +01001--
2-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
8--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15package HW.File is
16
Nico Hubera43b1ee2017-07-09 15:40:25 +020017 --
Nico Huberf03ef4f2017-03-04 13:57:09 +010018 -- Map a file's content into our address space
19 --
20 -- If `Map_Copy` is `False`, `Len` bytes from the start of the file
21 -- given by `Path` shall be mapped into the application's address
Nico Hubera43b1ee2017-07-09 15:40:25 +020022 -- space using mmap().
23 --
24 -- If `Map_Copy` is `True`, anonymous memory should be mapped instead
25 -- and be filled with a copy of the file's content using read().
26 --
Nico Huberf03ef4f2017-03-04 13:57:09 +010027 procedure Map
Nico Hubera43b1ee2017-07-09 15:40:25 +020028 (Addr : out Word64;
29 Path : in String;
Nico Huberf03ef4f2017-03-04 13:57:09 +010030 Len : in Natural;
31 Readable : in Boolean := False;
32 Writable : in Boolean := False;
33 Map_Copy : in Boolean := False;
34 Success : out Boolean)
35 with
36 Pre => (Readable or Writable) and
37 (if Map_Copy then Readable and not Writable);
38
39end HW.File;