From 0c710141bbb9bd62617d981a3dbaed1b8775fded Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 10 Mar 2015 16:28:38 +0100 Subject: Add simple shared memory facility to IPC (no syscall yet) --- src/kernel/user/pager.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/kernel/user/pager.c') diff --git a/src/kernel/user/pager.c b/src/kernel/user/pager.c index 79f293b..b9233b0 100644 --- a/src/kernel/user/pager.c +++ b/src/kernel/user/pager.c @@ -26,7 +26,7 @@ pager_ops_t swap_pager_ops = { .resize = swap_pager_resize, }; -pager_t *new_swap_pager(size_t size) { +pager_t *new_swap_pager(size_t size, bool allow_resize) { pager_t *p = (pager_t*)malloc(sizeof(pager_t)); if (p == 0) return 0; @@ -38,6 +38,8 @@ pager_t *new_swap_pager(size_t size) { p->lock = MUTEX_UNLOCKED; p->maps = 0; + p->swap_pager.allow_resize = allow_resize; + return p; error: @@ -86,6 +88,8 @@ void swap_page_release(pager_t *p, size_t offset, size_t len) { } bool swap_pager_resize(pager_t *p, size_t new_size) { + if (!p->swap_pager.allow_resize) return false; + // later : remove unused pages in swap file return true; -- cgit v1.2.3