mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 12:56:00 +01:00
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>
This commit is contained in:
parent
15156c95e9
commit
a0ff280a89
@ -211,6 +211,16 @@ int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep)
|
|||||||
return 0;
|
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 */
|
/* Restore tty state when we exit */
|
||||||
static struct termios orig_term;
|
static struct termios orig_term;
|
||||||
static bool term_setup;
|
static bool term_setup;
|
||||||
|
@ -419,6 +419,15 @@ int os_read_file(const char *name, void **bufp, int *sizep);
|
|||||||
*/
|
*/
|
||||||
int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep);
|
int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_unmap() - Unmap a file previously mapped
|
||||||
|
*
|
||||||
|
* @buf: Mapped address
|
||||||
|
* @size: Size in bytes
|
||||||
|
* Return: 0 if OK, -ve on error
|
||||||
|
*/
|
||||||
|
int os_unmap(void *buf, int size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* os_find_text_base() - Find the text section in this running process
|
* os_find_text_base() - Find the text section in this running process
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user