summaryrefslogtreecommitdiff
path: root/src/lib/shm_ap_rbuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/shm_ap_rbuff.c')
-rw-r--r--src/lib/shm_ap_rbuff.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c
index 4eb91136..618c4c19 100644
--- a/src/lib/shm_ap_rbuff.c
+++ b/src/lib/shm_ap_rbuff.c
@@ -21,12 +21,13 @@
*/
#include <ouroboros/config.h>
+#include <ouroboros/errno.h>
#define OUROBOROS_PREFIX "shm_ap_rbuff"
#include <ouroboros/logs.h>
#include <ouroboros/shm_ap_rbuff.h>
-#include <ouroboros/shm_du_map.h>
+#include <ouroboros/lockfile.h>
#include <pthread.h>
#include <sys/mman.h>
@@ -35,7 +36,6 @@
#include <string.h>
#include <stdint.h>
#include <unistd.h>
-#include <errno.h>
#include <signal.h>
#include <sys/stat.h>
@@ -215,7 +215,7 @@ void shm_ap_rbuff_close(struct shm_ap_rbuff * rb)
void shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb)
{
char fn[25];
- struct shm_du_map * dum = NULL;
+ struct lockfile * lf = NULL;
if (rb == NULL) {
LOG_DBGF("Bogus input. Bugging out.");
@@ -223,15 +223,17 @@ void shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb)
}
if (rb->api != getpid()) {
- dum = shm_du_map_open();
- if (shm_du_map_owner(dum) == getpid()) {
+ lf = lockfile_open();
+ if (lf == NULL)
+ return;
+ if (lockfile_owner(lf) == getpid()) {
LOG_DBGF("Ringbuffer %d destroyed by IRMd %d.",
rb->api, getpid());
- shm_du_map_close(dum);
+ lockfile_close(lf);
} else {
LOG_ERR("AP-I %d tried to destroy rbuff owned by %d.",
getpid(), rb->api);
- shm_du_map_close(dum);
+ lockfile_close(lf);
return;
}
}