diff options
author | Simon Glass <sjg@chromium.org> | 2021-10-24 02:25:58 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-11-29 02:51:51 +0300 |
commit | a0ff280a8988dd62c8dc9a3156f6f80a346000e5 (patch) | |
tree | 9645997be3a755337f658716b01c5b875cac3c4a /arch/sandbox | |
parent | 15156c95e9710447cc66f4b18009220bc4098d4e (diff) | |
download | u-boot-a0ff280a8988dd62c8dc9a3156f6f80a346000e5.tar.xz |
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 <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/os.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index b72dafca2b..873f85ac3b 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; |