ksh/ksh93-vm.dif
2014-07-08 14:22:03 +00:00

48 lines
1.3 KiB
Plaintext

--- src/lib/libast/vmalloc/vmmaddress.c
+++ src/lib/libast/vmalloc/vmmaddress.c 2014-02-18 14:19:22.978507488 +0000
@@ -37,6 +37,10 @@
#endif /*MAP_ANON*/
#endif /*_mem_mmap_anon*/
+#if defined(__linux__) && !defined(_lib_getpagesize)
+#define _lib_getpagesize 1
+#endif
+
/* Heuristic to suggest an address usable for mapping shared memory
**
** Written by Kiem-Phong Vo, phongvo@gmail.com, 07/07/2012
--- src/lib/libast/vmalloc/vmdcshare.c
+++ src/lib/libast/vmalloc/vmdcshare.c 2014-04-14 16:28:26.406992119 +0200
@@ -53,8 +53,10 @@
/* magic word signaling file/segment is ready */
#define MM_MAGIC ((unsigned int)(('P'<<24) | ('&'<<16) | ('N'<<8) | ('8')) ) /* 1344687672 */
+#ifndef __linux__
/* default mimimum region size */
#define MM_MINSIZE (64*_Vmpagesize)
+#endif
/* flags for actions on region closing */
#define MM_DETACH 01 /* detach all attached memory */
@@ -174,10 +176,19 @@
if(mmdc->mmvm) /* already done this */
return 0;
-
+#ifdef MM_MINSIZE
/* fixed size region so make it reasonably large */
if((size = mmdc->size) < MM_MINSIZE )
size = MM_MINSIZE;
+#else
+# if __WORDSIZE == 64
+ extent = 4*1024*1024*sizeof(long);
+# else
+ extent = 512*1024;
+# endif
+ if((size = mmdc->size) < extent)
+ size = extent;
+#endif
size += MMHEAD(mmdc->name) + ALIGN;
size = ROUND(size, _Vmpagesize);