hare

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

commit 0c57fdcc61e5ee89a385d4c5b55235e6e61699d3
parent 0900dbb51f946b46630a740ef701727c9fdee7e2
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 15 May 2021 11:22:53 -1000

linux::uring: add uring::finish

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

Diffstat:
Mlinux/uring/setup.ha | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/linux/uring/setup.ha b/linux/uring/setup.ha @@ -79,3 +79,13 @@ export fn setup(entries: u32, params: *params) (io_uring | error) = { return uring; }; + +// Frees state associated with an [[io_uring]]. +export fn finish(ring: *io_uring) void = { + let sq = &ring.sq, cq = &ring.cq; + rt::munmap(sq.ring_ptr, sq.ring_sz): void; + if (cq.ring_ptr != null: *void && cq.ring_ptr != sq.ring_ptr) { + rt::munmap(cq.ring_ptr, cq.ring_sz): void; + }; + rt::close(ring.fd): void; +};