summaryrefslogtreecommitdiff
path: root/shmem
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2001-08-30 17:11:04 +0000
committerJeff Trawick <trawick@apache.org>2001-08-30 17:11:04 +0000
commit2b796fa99b8d0149b8d7a9bd89b71050d8da3094 (patch)
treea4c017b4fda148bc87f450ecc64cd355b03fbdb2 /shmem
parent4e003efa2903539f8174f8d42345eca8aebc99cc (diff)
downloadapr-2b796fa99b8d0149b8d7a9bd89b71050d8da3094.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: https://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);