Przemyslaw,
there is no MMAP api on OS/2. Long ago I write an emulation layer which is
still around to help porting miniSQL to OS/2. It worked ok, but it was an hack
with several limitations (in particular for mmapping shared regions).
In my opinion dlmalloc should not be used on OS/2 if it does not work without
mmap().
Best regards.
Maurilio.
Przemysław Czerpak wrote:
> On Mon, 23 Nov 2009, David Arturo Macias Corona wrote:
>
> Hi,
>
>>> * harbour/src/vm/dlmalloc.c
>>> * modifications for non MS-Windows WATCOM builds
>>> TOFIX: now it compiles in Linux and OS2 builds but it still does
>>> not work
>> Do you need some tests on OS/2 ?
>
> Yes but first we will have to add support for OS2 MMAP emulation
> just like in MS-Windows builds where VirtualAlloc() is used to
> emulate mmap().
>
> This code is used for WIN32 builds:
>
> /* Win32 MMAP via VirtualAlloc */
> static void* win32mmap(size_t size) {
> void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT,
> PAGE_READWRITE);
> return (ptr != 0)? ptr: MFAIL;
> }
>
> /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
> static void* win32direct_mmap(size_t size) {
> void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
> PAGE_READWRITE);
> return (ptr != 0)? ptr: MFAIL;
> }
>
> /* This function supports releasing coalesed segments */
> static int win32munmap(void* ptr, size_t size) {
> MEMORY_BASIC_INFORMATION minfo;
> char* cptr = (char*)ptr; /* NOTE: Harbour fix for MSVC C++ mode compile
> error. Also fixed in dlmalloc 2.8.4b. [vszakats] */
> while (size) {
> if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
> return -1;
> if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
> minfo.State != MEM_COMMIT || minfo.RegionSize > size)
> return -1;
> if (VirtualFree(cptr, 0, MEM_RELEASE) == 0)
> return -1;
> cptr += minfo.RegionSize;
> size -= minfo.RegionSize;
> }
> return 0;
> }
>
> #define CALL_MMAP(s) win32mmap(s)
> #define CALL_MUNMAP(a, s) win32munmap((a), (s))
> #define DIRECT_MMAP(s) win32direct_mmap(s)
>
> and we have to translate it to OS2 API. Probably it's sth trivial for OS2
> users but I will have to look in the internet for OS2 API documentation
> to find corresponding functions giving similar functionality. If no one
> will help then I'll try to make it myself and I'll ask you to make some
> tests.
>
> best regards,
> Przemek
> _______________________________________________
> Harbour mailing list (attachment size limit: 40KB)
> [email protected]
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
--
__________
| | | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour