raw
cryostat_genesis.kv     1 ------------------------------------------------------------------------------
cryostat_genesis.kv 2 ------------------------------------------------------------------------------
cryostat_genesis.kv 3 -- This file is part of 'Cryostat', an Ada library for persistent storage. --
cryostat_genesis.kv 4 -- --
cryostat_genesis.kv 5 -- (C) 2020 Stanislav Datskovskiy ( www.loper-os.org ) --
cryostat_genesis.kv 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
cryostat_genesis.kv 7 -- --
cryostat_genesis.kv 8 -- You do not have, nor can you ever acquire the right to use, copy or --
cryostat_genesis.kv 9 -- distribute this software ; Should you use this software for any purpose, --
cryostat_genesis.kv 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
cryostat_genesis.kv 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
cryostat_genesis.kv 12 -- continue doing so for the indefinite future. In any case, please --
cryostat_genesis.kv 13 -- always : read and understand any software ; verify any PGP signatures --
cryostat_genesis.kv 14 -- that you use - for any purpose. --
cryostat_genesis.kv 15 ------------------------------------------------------------------------------
cryostat_genesis.kv 16 ------------------------------------------------------------------------------
cryostat_genesis.kv 17
cryostat_genesis.kv 18 ------------------------------------------------------------------------------
cryostat_genesis.kv 19 -- WARNING : MIPS32/64 currently unsupported! --
cryostat_genesis.kv 20 -- See also: http://logs.nosuchlabs.com/log/trilema/2018-10-24#1865524 --
cryostat_genesis.kv 21 ------------------------------------------------------------------------------
cryostat_genesis.kv 22
cryostat_genesis.kv 23 with Interfaces; use Interfaces;
cryostat_genesis.kv 24 with Interfaces.C;
cryostat_genesis.kv 25 with System; use System;
cryostat_genesis.kv 26
cryostat_genesis.kv 27
cryostat_genesis.kv 28 package Unix is
cryostat_genesis.kv 29
cryostat_genesis.kv 30 pragma Preelaborate;
cryostat_genesis.kv 31
cryostat_genesis.kv 32 -- Machine Word
cryostat_genesis.kv 33 type Word is mod 2**Standard'Address_Size;
cryostat_genesis.kv 34
cryostat_genesis.kv 35 -- Byte
cryostat_genesis.kv 36 type Byte is mod 2**8;
cryostat_genesis.kv 37
cryostat_genesis.kv 38 -- Unit int
cryostat_genesis.kv 39 type Unix_Int is mod 2**Interfaces.C.int'Size;
cryostat_genesis.kv 40
cryostat_genesis.kv 41 -- File descriptors
cryostat_genesis.kv 42 type FD is new Unix_Int;
cryostat_genesis.kv 43
cryostat_genesis.kv 44 type MM_Prot is new Unix_Int;
cryostat_genesis.kv 45 PROT_READ : constant MM_Prot := 1;
cryostat_genesis.kv 46 PROT_WRITE : constant MM_Prot := 2;
cryostat_genesis.kv 47
cryostat_genesis.kv 48 type MM_Flags is new Unix_Int;
cryostat_genesis.kv 49 MAP_NONE : constant MM_Flags := 16#00#;
cryostat_genesis.kv 50 MAP_FIXED : constant MM_Flags := 16#10#;
cryostat_genesis.kv 51 MAP_SHARED : constant MM_Flags := 16#01#;
cryostat_genesis.kv 52 MAP_PRIVATE : constant MM_Flags := 16#02#;
cryostat_genesis.kv 53 -- TODO: MAP_HUGETLB
cryostat_genesis.kv 54
cryostat_genesis.kv 55 -- Null Pointer
cryostat_genesis.kv 56 NullPtr : constant Address := System'To_Address(0);
cryostat_genesis.kv 57
cryostat_genesis.kv 58 function MMap
cryostat_genesis.kv 59 (Start : Address := NullPtr;
cryostat_genesis.kv 60 Length : Word;
cryostat_genesis.kv 61 Prot : MM_Prot;
cryostat_genesis.kv 62 Flags : MM_Flags;
cryostat_genesis.kv 63 Handle : FD;
cryostat_genesis.kv 64 Off_T : Word := 0)
cryostat_genesis.kv 65 return Address;
cryostat_genesis.kv 66 pragma Import(C, MMap, "mmap");
cryostat_genesis.kv 67
cryostat_genesis.kv 68 -- Eggog code '-1' (posix uses instead of null here)
cryostat_genesis.kv 69 MAP_FAILED : constant Address := System'To_Address(Word'Last);
cryostat_genesis.kv 70
cryostat_genesis.kv 71 function MUnmap
cryostat_genesis.kv 72 (Start : Address;
cryostat_genesis.kv 73 Length : Word)
cryostat_genesis.kv 74 return Unix_Int;
cryostat_genesis.kv 75 pragma Import(C, MUnmap, "munmap");
cryostat_genesis.kv 76
cryostat_genesis.kv 77 type O_Flags is new Unix_Int;
cryostat_genesis.kv 78 O_RDONLY : constant O_Flags := 8#00#;
cryostat_genesis.kv 79 O_WRONLY : constant O_Flags := 8#01#;
cryostat_genesis.kv 80 O_RDWR : constant O_Flags := 8#02#;
cryostat_genesis.kv 81 O_CREAT : constant O_Flags := 8#0100#;
cryostat_genesis.kv 82
cryostat_genesis.kv 83 type M_Flags is new Unix_Int;
cryostat_genesis.kv 84 MS_ASYNC : constant M_Flags := 1;
cryostat_genesis.kv 85 MS_INVALIDATE : constant M_Flags := 2;
cryostat_genesis.kv 86 MS_SYNC : constant M_Flags := 4;
cryostat_genesis.kv 87
cryostat_genesis.kv 88 function MSync
cryostat_genesis.kv 89 (Addr : Address;
cryostat_genesis.kv 90 Length : Word;
cryostat_genesis.kv 91 Flags : M_Flags)
cryostat_genesis.kv 92 return Unix_Int;
cryostat_genesis.kv 93 pragma Import(C, MSync, "msync");
cryostat_genesis.kv 94
cryostat_genesis.kv 95 function Open
cryostat_genesis.kv 96 (Name : System.Address;
cryostat_genesis.kv 97 Flags : O_Flags;
cryostat_genesis.kv 98 Mode : Unix_Int := 8#666#) -- TODO
cryostat_genesis.kv 99 return FD;
cryostat_genesis.kv 100 pragma Import(C, Open, "open");
cryostat_genesis.kv 101
cryostat_genesis.kv 102 -- '-1'
cryostat_genesis.kv 103 FD_EGGOG : constant FD := FD'Last;
cryostat_genesis.kv 104
cryostat_genesis.kv 105 function Close(Handle : FD) return Unix_Int;
cryostat_genesis.kv 106 pragma Import(C, Close, "close");
cryostat_genesis.kv 107
cryostat_genesis.kv 108 function FTruncate(Handle : FD; Length : Word) return Unix_Int;
cryostat_genesis.kv 109 pragma Import(C, FTruncate, "ftruncate");
cryostat_genesis.kv 110
cryostat_genesis.kv 111 end Unix;