diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-07-06 19:30:47 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-07-06 19:30:47 +0200 |
commit | 1ddc75c877f00a05669d1854d6196409428ea223 (patch) | |
tree | ee3d038867decb18a0f21fea18c004f8d48dc662 /src/lib/shm_du_map.c | |
parent | dbed235ff41b9ae72b188e57888bacc984a43d75 (diff) | |
download | ouroboros-1ddc75c877f00a05669d1854d6196409428ea223.tar.gz ouroboros-1ddc75c877f00a05669d1854d6196409428ea223.zip |
lib: shm_du_map: Don't open rbuff when process exits
clean_sdus now has a boolean flag to let it know the process has
exited.
Diffstat (limited to 'src/lib/shm_du_map.c')
-rw-r--r-- | src/lib/shm_du_map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 68452158..1c9155a0 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -102,7 +102,7 @@ static void garbage_collect(struct shm_du_map * dum) #endif } -static void clean_sdus(struct shm_du_map * dum, pid_t api) +static void clean_sdus(struct shm_du_map * dum, pid_t api, bool exit) { size_t idx = *dum->ptr_tail; struct shm_du_buff * buf; @@ -120,7 +120,7 @@ static void clean_sdus(struct shm_du_map * dum, pid_t api) garbage_collect(dum); - if (kill(api, 0) == 0) { + if (!exit && kill(api, 0) == 0) { struct shm_ap_rbuff * rb; rb = shm_ap_rbuff_open(api); if (rb != NULL) { @@ -319,7 +319,7 @@ void * shm_du_map_sanitize(void * o) if (kill(api, 0)) { LOG_DBGF("Dead process %d left stale sdu.", api); - clean_sdus(dum, api); + clean_sdus(dum, api, false); continue; } @@ -339,7 +339,7 @@ void * shm_du_map_sanitize(void * o) if (ret == ETIMEDOUT) { LOG_DBGF("SDU timed out."); - clean_sdus(dum, api); + clean_sdus(dum, api, false); } } } @@ -356,7 +356,7 @@ void shm_du_map_close_on_exit(struct shm_du_map * dum) return; } - clean_sdus(dum, getpid()); + clean_sdus(dum, getpid(), true); if (close(dum->fd) < 0) LOG_DBGF("Couldn't close shared memory."); |