Bug 140143 - Source/WTF/wtf/OSAllocatorPosix.cpp fails to build on OS X Leopard due to madvise() extensions not being available
Summary: Source/WTF/wtf/OSAllocatorPosix.cpp fails to build on OS X Leopard due to mad...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-06 13:27 PST by Jeremy Huddleston Sequoia
Modified: 2015-01-08 12:55 PST (History)
3 users (show)

See Also:


Attachments
Fix Platform.h for Leopard (532 bytes, patch)
2015-01-08 12:54 PST, Jeremy Huddleston Sequoia
no flags Details | Formatted Diff | Diff
Fix malloc struct for Leopard (864 bytes, patch)
2015-01-08 12:55 PST, Jeremy Huddleston Sequoia
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Huddleston Sequoia 2015-01-06 13:27:03 PST
Compilation of webkit-gtk-2.4.7 fails on OS X Leopard:

:info:build Source/WTF/wtf/OSAllocatorPosix.cpp:54:35: error: use of undeclared identifier 'MADV_FREE_REUSABLE'
:info:build     while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
:info:build                                   ^
:info:build Source/WTF/wtf/OSAllocatorPosix.cpp:139:36: error: use of undeclared identifier 'MADV_FREE_REUSE'
:info:build     while (madvise(address, bytes, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
:info:build                                    ^
:info:build Source/WTF/wtf/OSAllocatorPosix.cpp:156:36: error: use of undeclared identifier 'MADV_FREE_REUSABLE'
:info:build     while (madvise(address, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
:info:build                                    ^
:info:build 3 errors generated.
:info:build GNUmakefile:52455: recipe for target 'Source/WTF/wtf/libWTF_la-OSAllocatorPosix.lo' failed
:info:build gmake: *** [Source/WTF/wtf/libWTF_la-OSAllocatorPosix.lo] Error 1

This happens because Leopard does not support:

#define MADV_ZERO_WIRED_PAGES   6       /* zero the wired pages that have not been unwired before the entry is deleted */
#define MADV_FREE_REUSABLE      7       /* pages can be reused (by anyone) */
#define MADV_FREE_REUSE         8       /* caller wants to reuse those pages */
#define MADV_CAN_REUSE          9
Comment 1 Jeremy Huddleston Sequoia 2015-01-06 13:29:57 PST
It looks like the code is guarded:

#elif HAVE(MADV_FREE_REUSE)
    while (madvise(address, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }

so the issue is that HAVE(MADV_FREE_REUSE) is not working right.
Comment 2 Jeremy Huddleston Sequoia 2015-01-06 13:44:36 PST
I'm testing a patch of Platform.h for Leopard now.
Comment 3 Jeremy Huddleston Sequoia 2015-01-08 12:54:34 PST
Created attachment 244284 [details]
Fix Platform.h for Leopard
Comment 4 Jeremy Huddleston Sequoia 2015-01-08 12:55:03 PST
Created attachment 244285 [details]
Fix malloc struct for Leopard
Comment 5 Jeremy Huddleston Sequoia 2015-01-08 12:55:23 PST
With these two patches, webkit-gtk builds correctly against the Leopard SDK.