summaryrefslogtreecommitdiff
path: root/shmem
diff options
context:
space:
mode:
authorjim <jim@13f79535-47bb-0310-9956-ffa450edef68>2002-01-15 14:24:51 +0000
committerjim <jim@13f79535-47bb-0310-9956-ffa450edef68>2002-01-15 14:24:51 +0000
commit0cc093aca64787cfe7f42a8d93a5db118a3a61fb (patch)
tree1421b95c8e98972b4b951f44084332fe42906aad /shmem
parent51c5c0b278ae4a7a3c543502f6934ea195c729b3 (diff)
downloadlibapr-0cc093aca64787cfe7f42a8d93a5db118a3a61fb.tar.gz
Mark SysV anon shared memory segments for deletion,
so if we crash, they are removed git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'shmem')
-rw-r--r--shmem/unix/shm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/shmem/unix/shm.c b/shmem/unix/shm.c
index 1ae3cfc3d..5041b30bd 100644
--- a/shmem/unix/shm.c
+++ b/shmem/unix/shm.c
@@ -194,6 +194,11 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
new_m->shmid = shmid;
+ /* Remove the segment once use count hits zero. */
+ if (shmctl(shmid, IPC_RMID, NULL) == -1) {
+ return errno;
+ }
+
*m = new_m;
return APR_SUCCESS;
#endif /* APR_USE_SHMEM_SHMGET_ANON */