Solaris mmap fixes - Hacky

Robert Lunnon bobl at optushome.com.au
Sat Oct 22 16:57:11 CDT 2005


Changelog:
libs/wine/mmap.c

Robert Lunnon <bobl at optusnet.com.au>
Make mmaping work under Solaris


Notes about patch:
This patch is essential to run Wine under Solaris

This patch is unfinished, submitted for completeness for Wine 0.9 . Some kind 
soul might like to "productise it". 

The default method of mapping out memory above 80000000h doesn't work reliably 
under solaris. After the first dozen of so mmaps, vfork fails with "out of 
resources". .However, later the allocator maps out other memory on first 
access since the allocator will refuse to allocate anonymous mmap memory over 
0x8000000 anyway. Normally this allocator will compact adjacent blocks into 
larger chunks which unfortunately fails because Solaris places two pages 
between each mmapped block. This results in the mapped out memory being very 
fragmented and the heap can't then be allocated successfully from this pool

This patch modifies the code to preallocate 64MB for the heap at 0x80000000 
using the vfork method, then leaves the rest to the allocator. (Plus a minor 
change to iterate mmap errors.)

Hacky bits: 
Use of #ifdef sun rather than a more specific test
Old code remains in comments to remind me of what went before (subject to 
change once a suitable fix went in)
Legacies of a few debugging sessions (Braces added etc)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmap.c.diff
Type: text/x-diff
Size: 2755 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20051023/ea1ae2dc/mmap.c.diff


More information about the wine-patches mailing list