summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-01-18 14:35:50 +0100
committerSander Vrijders <sander@ouroboros.rocks>2026-01-19 08:31:30 +0100
commitc51611c27f766bb4f413485bf8a12bca02e98669 (patch)
tree61fe6a862d550aa1cbd6c9d7c964f171ebe84afa /include
parent60b04305d70614580b4f883c0a147507edef3779 (diff)
downloadouroboros-c51611c27f766bb4f413485bf8a12bca02e98669.tar.gz
ouroboros-c51611c27f766bb4f413485bf8a12bca02e98669.zip
lib: Call mlock() on the shared memory buffers
This prevents them from swapping to disk and killing performance. It also enhances security a little bit by reducing the risk of sensitive (even encrypted) data being paged out and captured. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/shm_rbuff.h2
-rw-r--r--include/ouroboros/shm_rdrbuff.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h
index 423a40a0..a1d2816a 100644
--- a/include/ouroboros/shm_rbuff.h
+++ b/include/ouroboros/shm_rbuff.h
@@ -52,6 +52,8 @@ uint32_t shm_rbuff_get_acl(struct shm_rbuff * rb);
void shm_rbuff_fini(struct shm_rbuff * rb);
+int shm_rbuff_mlock(struct shm_rbuff * rb);
+
int shm_rbuff_write(struct shm_rbuff * rb,
size_t idx);
diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h
index 4f9a215a..30dc3ff7 100644
--- a/include/ouroboros/shm_rdrbuff.h
+++ b/include/ouroboros/shm_rdrbuff.h
@@ -42,6 +42,8 @@ void shm_rdrbuff_destroy(struct shm_rdrbuff * rdrb);
void shm_rdrbuff_purge(void);
+int shm_rdrbuff_mlock(struct shm_rdrbuff * rdrb);
+
/* Returns block index, a ptr and du_buff. */
ssize_t shm_rdrbuff_alloc(struct shm_rdrbuff * rdrb,
size_t count,