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/include/ipc.h | 4 ++++ src/kernel/include/pager.h | 5 ++++- src/kernel/include/vfs.h | 10 +++++----- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/kernel/include') diff --git a/src/kernel/include/ipc.h b/src/kernel/include/ipc.h index 05d14a8..4f8573c 100644 --- a/src/kernel/include/ipc.h +++ b/src/kernel/include/ipc.h @@ -14,6 +14,10 @@ typedef struct { fs_handle_pair_t make_channel(bool blocking); +// ---- shared memory regions + +fs_handle_t* make_shm(size_t size); + // ---- Tokens for sharing file descriptors between processes #define TOKEN_LIFETIME 1500000 // in usecs diff --git a/src/kernel/include/pager.h b/src/kernel/include/pager.h index 03e5da4..a53c7d3 100644 --- a/src/kernel/include/pager.h +++ b/src/kernel/include/pager.h @@ -32,6 +32,9 @@ typedef struct pager { pager_ops_t *ops; union { + struct { + bool allow_resize; + } swap_pager; struct { fs_node_t* node; vfs_pager_ops_t *ops; @@ -49,7 +52,7 @@ typedef struct pager { user_region_t *maps; } pager_t; -pager_t* new_swap_pager(size_t size); +pager_t* new_swap_pager(size_t size, bool allow_resize); pager_t* new_vfs_pager(size_t size, fs_node_t* vfs_node, vfs_pager_ops_t *vfs_ops); pager_t* new_device_pager(size_t size, void* phys_offset); diff --git a/src/kernel/include/vfs.h b/src/kernel/include/vfs.h index c22ec9a..888c0bc 100644 --- a/src/kernel/include/vfs.h +++ b/src/kernel/include/vfs.h @@ -81,11 +81,11 @@ typedef struct fs_handle { typedef struct fs_node_ops { bool (*open)(fs_node_ptr n, int mode); - size_t (*read)(fs_handle_t *f, size_t offset, size_t len, char* buf); - size_t (*write)(fs_handle_t *f, size_t offset, size_t len, const char* buf); - bool (*readdir)(fs_handle_t *f, size_t ent_no, dirent_t *d); - int (*poll)(fs_handle_t *f, void** out_wait_obj); - void (*close)(fs_handle_t *f); + size_t (*read)(fs_handle_t *h, size_t offset, size_t len, char* buf); + size_t (*write)(fs_handle_t *h, size_t offset, size_t len, const char* buf); + bool (*readdir)(fs_handle_t *h, size_t ent_no, dirent_t *d); + int (*poll)(fs_handle_t *h, void** out_wait_obj); + void (*close)(fs_handle_t *h); bool (*stat)(fs_node_ptr n, stat_t *st); int (*ioctl)(fs_node_ptr n, int command, void* data); -- cgit v1.2.3