summaryrefslogtreecommitdiff
path: root/src/lib/shm_rbuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/shm_rbuff.c')
-rw-r--r--src/lib/shm_rbuff.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c
index d2adc46a..22cff41c 100644
--- a/src/lib/shm_rbuff.c
+++ b/src/lib/shm_rbuff.c
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2022
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* Ring buffer implementations for incoming packets
*
@@ -26,22 +26,22 @@
#include <ouroboros/shm_rbuff.h>
#include <ouroboros/lockfile.h>
-#include <ouroboros/time_utils.h>
#include <ouroboros/errno.h>
#include <ouroboros/fccntl.h>
#include <ouroboros/pthread.h>
+#include <ouroboros/time.h>
-#include <sys/mman.h>
+#include <assert.h>
#include <fcntl.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
-#include <stdint.h>
#include <unistd.h>
-#include <signal.h>
+#include <sys/mman.h>
#include <sys/stat.h>
-#include <assert.h>
-#include <stdbool.h>
#define FN_MAX_CHARS 255
@@ -90,7 +90,7 @@ static struct shm_rbuff * rbuff_create(pid_t pid,
if (fd == -1)
goto fail_open;
- if ((flags & O_CREAT) && ftruncate(fd, SHM_RB_FILE_SIZE - 1) < 0)
+ if ((flags & O_CREAT) && ftruncate(fd, SHM_RB_FILE_SIZE) < 0)
goto fail_truncate;
shm_base = mmap(NULL, SHM_RB_FILE_SIZE, MM_FLAGS, MAP_SHARED, fd, 0);
@@ -172,7 +172,7 @@ struct shm_rbuff * shm_rbuff_create(pid_t pid,
*rb->head = 0;
*rb->tail = 0;
- rb->pid = pid;
+ rb->pid = pid;
rb->flow_id = flow_id;
pthread_mutexattr_destroy(&mattr);