aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user/pager.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-10 16:28:38 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-10 16:28:38 +0100
commit0c710141bbb9bd62617d981a3dbaed1b8775fded (patch)
tree0094294fc5b6182bada5db8e5a64cd3a52e872e2 /src/kernel/user/pager.c
parent48c1c4dcc449d05e9950a861e165f456e0d583a1 (diff)
downloadkogata-0c710141bbb9bd62617d981a3dbaed1b8775fded.tar.gz
kogata-0c710141bbb9bd62617d981a3dbaed1b8775fded.zip
Add simple shared memory facility to IPC (no syscall yet)
Diffstat (limited to 'src/kernel/user/pager.c')
-rw-r--r--src/kernel/user/pager.c6
1 files changed, 5 insertions, 1 deletions
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;