From a0ff280a8988dd62c8dc9a3156f6f80a346000e5 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 23 Oct 2021 17:25:58 -0600 Subject: sandbox: Support unmapping a file Add the opposite of mapping, so that we can unmap and avoid running out of address space. Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/sandbox/cpu') diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index b72dafca2ba..873f85ac3be 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -211,6 +211,16 @@ int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep) return 0; } +int os_unmap(void *buf, int size) +{ + if (munmap(buf, size)) { + printf("Can't unmap %p %x\n", buf, size); + return -EIO; + } + + return 0; +} + /* Restore tty state when we exit */ static struct termios orig_term; static bool term_setup; -- cgit v1.2.3