summaryrefslogtreecommitdiff
path: root/shmem
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2001-08-30 17:11:04 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2001-08-30 17:11:04 +0000
commitb9b6c16bd82200ff6ca797655677e2cc9be3072b (patch)
treea4c017b4fda148bc87f450ecc64cd355b03fbdb2 /shmem
parent8d3006d0b4f32f68e96c6f10dd8c1164c38f5456 (diff)
downloadlibapr-b9b6c16bd82200ff6ca797655677e2cc9be3072b.tar.gz
when creating a shared memory segment using SysV, be sure
to specify that the segment will go away when the last user detaches This fixes a problem with Apache leaving behind a shared memory segments at termination. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62256 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'shmem')
-rw-r--r--shmem/unix/shmem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/shmem/unix/shmem.c b/shmem/unix/shmem.c
index e0fdb568f..7cda42332 100644
--- a/shmem/unix/shmem.c
+++ b/shmem/unix/shmem.c
@@ -192,6 +192,10 @@ APR_DECLARE(apr_status_t) apr_shm_init(apr_shmem_t **m, apr_size_t reqsize,
if (shmctl(new_m->file, IPC_SET, &shmbuf) == -1)
return errno;
+ /* remove in future (once use count hits zero) */
+ if (shmctl(new_m->file, IPC_RMID, NULL) == -1)
+ return errno;
+
#elif APR_USE_SHMEM_BEOS
new_m->area_id = create_area("mm", (void*)&mem, B_ANY_ADDRESS, reqsize,
B_LAZY_LOCK, B_READ_AREA|B_WRITE_AREA);