diff options
Diffstat (limited to 'src/lib/shm_rbuff.c')
-rw-r--r-- | src/lib/shm_rbuff.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c index 361d5bb0..d491c69a 100644 --- a/src/lib/shm_rbuff.c +++ b/src/lib/shm_rbuff.c @@ -69,20 +69,11 @@ struct shm_rbuff { int flow_id; /* flow_id of the flow */ }; -void shm_rbuff_close(struct shm_rbuff * rb) -{ - assert(rb); - - munmap(rb->shm_base, SHM_RB_FILE_SIZE); - - free(rb); -} - #define MM_FLAGS (PROT_READ | PROT_WRITE) -struct shm_rbuff * rbuff_create(pid_t pid, - int flow_id, - int flags) +static struct shm_rbuff * rbuff_create(pid_t pid, + int flow_id, + int flags) { struct shm_rbuff * rb; int fd; @@ -130,6 +121,13 @@ struct shm_rbuff * rbuff_create(pid_t pid, return NULL; } +static void rbuff_destroy(struct shm_rbuff * rb) +{ + munmap(rb->shm_base, SHM_RB_FILE_SIZE); + + free(rb); +} + struct shm_rbuff * shm_rbuff_create(pid_t pid, int flow_id) { @@ -202,6 +200,13 @@ struct shm_rbuff * shm_rbuff_open(pid_t pid, return rbuff_create(pid, flow_id, O_RDWR); } +void shm_rbuff_close(struct shm_rbuff * rb) +{ + assert(rb); + + rbuff_destroy(rb); +} + #if (defined(SHM_RBUFF_LOCKLESS) && \ (defined(__GNUC__) || defined (__clang__))) #include "shm_rbuff_ll.c" |