[PATCH] Use posix_madvise instead of madvise in kdelibs

Michael Pyne mpyne at purinchu.net
Sun Jun 7 18:14:37 BST 2009


Hi all,

I've attached a patch to use the posix_madvise function instead of madvise in 
kdelibs.  There are currently two places where madvise is used, in 
kdecore/sycoca/ksycoca.cpp and kdeui/util/kpixmapcache.cpp.  This is related 
to bug 195262 https://bugs.kde.org/show_bug.cgi?id=195262 (compilation errors 
on Solaris using madvise).

The problem on Solaris is that even for recent OpenSolaris releases the 
madvise function accepts a char* for the memory address instead of void*.  
posix_madvise standardized it to void*, which *is* supported by Solaris.  So 
the net effect is to remove some conditional compilation code.

I've also had to change the ConfigureChecks.cmake file.  I'm using 
check_symbol_exists instead of the check_function_exists because using 
posix_madvise requires including sys/mman.h.

The void* cast in ksycoca.cpp is still required due to sycoca declaring the 
pointer as const void*.

Please let me know if there are any objections (especially relating to BSDs, 
since I don't run those).

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-use-posix_madvise.patch
Type: text/x-patch
Size: 2876 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090607/47e6f150/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090607/47e6f150/attachment.sig>


More information about the kde-core-devel mailing list