hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit c9c76d9a3540d454b1a331d0550e92c0408886ce
parent 88644f79ebf937c2b15477b0228480707aa8afc8
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon,  8 Nov 2021 13:30:57 +0100

io: add munmap

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mio/+freebsd/mmap.ha | 10++++++++++
Mio/+linux/mmap.ha | 10++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/io/+freebsd/mmap.ha b/io/+freebsd/mmap.ha @@ -45,3 +45,13 @@ export fn mmap( return errors::errno(err); }; }; + +// Unmaps memory previously mapped with [[mmap]]. +export fn munmap(addr: *void, length: size) (void | errors::error) = { + match (rt::munmap(addr, length)) { + case void => + return; + case err: rt::errno => + return errors::errno(err); + }; +}; diff --git a/io/+linux/mmap.ha b/io/+linux/mmap.ha @@ -65,3 +65,13 @@ export fn mmap( return errors::errno(err); }; }; + +// Unmaps memory previously mapped with [[mmap]]. +export fn munmap(addr: *void, length: size) (void | errors::error) = { + match (rt::munmap(addr, length)) { + case void => + return; + case err: rt::errno => + return errors::errno(err); + }; +};