diff options
author | Sander Vrijders <[email protected]> | 2016-07-06 19:48:32 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-07-06 19:48:32 +0200 |
commit | f797b763dd9fa95d5294f60232babb017b2b495f (patch) | |
tree | ee3d038867decb18a0f21fea18c004f8d48dc662 /src | |
parent | ff09baf0cf9ec501ec54d2666e386238bc7e6389 (diff) | |
parent | 1ddc75c877f00a05669d1854d6196409428ea223 (diff) | |
download | ouroboros-f797b763dd9fa95d5294f60232babb017b2b495f.tar.gz ouroboros-f797b763dd9fa95d5294f60232babb017b2b495f.zip |
Merged in dstaesse/ouroboros/be-clean-exit (pull request #162)
lib: shm_du_map: Don't open rbuff when process exits
Diffstat (limited to 'src')
-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."); |