wrowe 02/01/11 00:30:55
Modified: shmem/win32 shm.c
Log:
Simple solutions? No, but document some observations.
Revision Changes Path
1.5 +22 -2 apr/shmem/win32/shm.c
Index: shm.c
===================================================================
RCS file: /home/cvs/apr/shmem/win32/shm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- shm.c 10 Jan 2002 00:09:17 -0000 1.4
+++ shm.c 11 Jan 2002 08:30:55 -0000 1.5
@@ -83,6 +83,9 @@
if (CloseHandle(m->hMap)) {
return (rv != APR_SUCCESS) ? rv : apr_get_os_error();
}
+ /* ### Do we want to make a point of unlinking m->file here?
+ * Need to add the fname to the apr_shm_t, in that case.
+ */
return rv;
}
@@ -140,6 +143,20 @@
psec = NULL;
}
+ /* XXX: I had nothing but utter failure on WinNT attempting to specify
+ * the size of the CreateFileMapping() calls below (given in DWORDs
+ * as hi-DWORD, lo-DWORD where you see the 0, 0 args.) Consistently,
+ * Win2K reported insufficient disk space, when that is obviously not
+ * the case. I'm suspecting size should have been in pages (???) but
+ * there was no docs in the PSDK that made that implication.
+ *
+ * The XXX above is due to the fact that anon allocation dies right now,
+ * since we can't create a filemapping with size zero, when we don't
+ * back it with a file. Since I clearly don't understand what Win32
+ * has done with this size arg, I'm loath to make the obvious fix.
+ * Let it fail until I, or someone with time on their hands, wants to
+ * research, experiment and fix this for good.
+ */
#if APR_HAS_UNICODE_FS
if (apr_os_level >= APR_WIN_NT)
{
@@ -151,7 +168,11 @@
hMap = CreateFileMappingA(hFile, psec, PAGE_READWRITE, 0, 0, mapkey);
}
err = apr_get_os_error();
- apr_file_close(f);
+
+ if (file) {
+ apr_file_close(f);
+ }
+
if (hMap && err == ERROR_ALREADY_EXISTS) {
CloseHandle(hMap);
return APR_EEXIST;
@@ -163,7 +184,6 @@
base = MapViewOfFile(hMap, FILE_MAP_READ | FILE_MAP_WRITE,
0, 0, size);
if (!base) {
- apr_file_close(f);
CloseHandle(hMap);
return apr_get_os_error();
}