trawick 01/08/30 10:11:04
Modified: shmem/unix shmem.c
Log:
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.
Revision Changes Path
1.33 +4 -0 apr/shmem/unix/shmem.c
Index: shmem.c
===================================================================
RCS file: /home/cvs/apr/shmem/unix/shmem.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- shmem.c 2001/08/30 15:53:06 1.32
+++ shmem.c 2001/08/30 17:11:04 1.33
@@ -192,6 +192,10 @@
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);