summaryrefslogtreecommitdiff
path: root/include/ouroboros/shm_ap_rbuff.h
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-06-30 23:14:14 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-02 19:11:12 +0200
commit79475a4742bc28e1737044f2300bcb601e6e10bf (patch)
treecd79dba391c0ded80125836069d8187a22f7e5f5 /include/ouroboros/shm_ap_rbuff.h
parentd85f211d53a0cb35a756d0c44a2b28807eff4e5d (diff)
downloadouroboros-79475a4742bc28e1737044f2300bcb601e6e10bf.tar.gz
ouroboros-79475a4742bc28e1737044f2300bcb601e6e10bf.zip
lib: robust locking in shared memory and crash recovery
This PR enhances the shared memory providing recovery if a process crashes. It adds a SHM_DU_TIMEOUT_MICROS variable, setting an expiration time for SDU's when shared memory is full. If an application doesn't read a blocking SDU within this time, the shared memory will be cleansed of all SDU's for this application and the application's rbuff will be cleared. Some refactoring of the API's. Fixed wrong pthread checks in IRMd. Fixes #13 Fixes #14
Diffstat (limited to 'include/ouroboros/shm_ap_rbuff.h')
-rw-r--r--include/ouroboros/shm_ap_rbuff.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/include/ouroboros/shm_ap_rbuff.h b/include/ouroboros/shm_ap_rbuff.h
index 053709bb..78926869 100644
--- a/include/ouroboros/shm_ap_rbuff.h
+++ b/include/ouroboros/shm_ap_rbuff.h
@@ -24,15 +24,8 @@
#ifndef OUROBOROS_SHM_AP_RBUFF_H
#define OUROBOROS_SHM_AP_RBUFF_H
-#ifndef SHM_AP_RBUFF
-#define SHM_AP_RBUFF_PREFIX "ouroboros_rb_"
-#endif
-
-#ifndef SHM_RBUFF_SIZE
-#define SHM_RBUFF_SIZE (1 << 14)
-#endif
-
#include <sys/types.h>
+#include <stdbool.h>
struct shm_ap_rbuff;
@@ -42,7 +35,7 @@ struct rb_entry {
};
struct shm_ap_rbuff * shm_ap_rbuff_create();
-struct shm_ap_rbuff * shm_ap_rbuff_open();
+struct shm_ap_rbuff * shm_ap_rbuff_open(pid_t api);
void shm_ap_rbuff_close(struct shm_ap_rbuff * rb);
void shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb);
int shm_ap_rbuff_write(struct shm_ap_rbuff * rb,
@@ -50,5 +43,6 @@ int shm_ap_rbuff_write(struct shm_ap_rbuff * rb,
struct rb_entry * shm_ap_rbuff_read(struct shm_ap_rbuff * rb);
ssize_t shm_ap_rbuff_read_port(struct shm_ap_rbuff * rb,
int port_id);
-
+pid_t shm_ap_rbuff_get_api(struct shm_ap_rbuff * rb);
+void shm_ap_rbuff_reset(struct shm_ap_rbuff * rb);
#endif /* OUROBOROS_SHM_AP_RBUFF_H */