bjh 01/12/29 02:00:41
Modified: shmem/os2 shmem.c
Log:
Fix handling of named shared memory
Allocate some extra space for heap structures so that a block of the same
size as the reqsize can be allocated later with apr_shm_malloc().
Revision Changes Path
1.12 +6 -1 apr/shmem/os2/shmem.c
Index: shmem.c
===================================================================
RCS file: /home/cvs/apr/shmem/os2/shmem.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- shmem.c 10 Aug 2001 21:04:48 -0000 1.11
+++ shmem.c 29 Dec 2001 10:00:41 -0000 1.12
@@ -72,11 +72,16 @@
int rc;
struct shmem_t *newm = (struct shmem_t *)apr_palloc(cont, sizeof(struct
shmem_t));
char *name = NULL;
+ ULONG flags = PAG_COMMIT|PAG_READ|PAG_WRITE;
if (file)
name = apr_pstrcat(cont, "\\SHAREMEM\\", file, NULL);
- rc = DosAllocSharedMem(&(newm->memblock), name, reqsize,
PAG_COMMIT|OBJ_GETTABLE|PAG_READ|PAG_WRITE);
+ if (name == NULL)
+ flags |= OBJ_GETTABLE;
+
+ reqsize += 1024; /* Allow some overhead for heap structures */
+ rc = DosAllocSharedMem(&(newm->memblock), name, reqsize, flags);
if (rc)
return APR_OS2_STATUS(rc);