--nextPart4502527.ulUhznBpoi Content-Type: multipart/mixed; boundary="Boundary-01=_+V/KK7WOwVScEDm" Content-Transfer-Encoding: 7bit --Boundary-01=_+V/KK7WOwVScEDm Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all, I've attached a patch to use the posix_madvise function instead of madvise = in=20 kdelibs. There are currently two places where madvise is used, in=20 kdecore/sycoca/ksycoca.cpp and kdeui/util/kpixmapcache.cpp. This is relate= d=20 to bug 195262 https://bugs.kde.org/show_bug.cgi?id=3D195262 (compilation er= rors=20 on Solaris using madvise). The problem on Solaris is that even for recent OpenSolaris releases the=20 madvise function accepts a char* for the memory address instead of void*. = =20 posix_madvise standardized it to void*, which *is* supported by Solaris. S= o=20 the net effect is to remove some conditional compilation code. I've also had to change the ConfigureChecks.cmake file. I'm using=20 check_symbol_exists instead of the check_function_exists because using=20 posix_madvise requires including sys/mman.h. The void* cast in ksycoca.cpp is still required due to sycoca declaring the= =20 pointer as const void*. Please let me know if there are any objections (especially relating to BSDs= ,=20 since I don't run those). Regards, - Michael Pyne --Boundary-01=_+V/KK7WOwVScEDm Content-Type: text/x-patch; charset="UTF-8"; name="kdelibs-use-posix_madvise.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kdelibs-use-posix_madvise.patch" Index: ConfigureChecks.cmake =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- ConfigureChecks.cmake (revision 978435) +++ ConfigureChecks.cmake (working copy) @@ -99,15 +99,15 @@ check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOL= L) # kioslave check_symbol_exists(S_ISSOCK "sys/stat.h" HAVE_S_ISSO= CK) # config.h check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRI= NTF) # config.h +check_symbol_exists(posix_madvise "sys/mman.h" HAVE_MADVIS= E) # kdecore, kdeui =20 =2D check_function_exists(posix_fadvise HAVE_FADVISE) # ki= oslave check_function_exists(backtrace HAVE_BACKTRACE) # kd= ecore, kio check_function_exists(getpagesize HAVE_GETPAGESIZE) # kh= tml check_function_exists(getpeereid HAVE_GETPEEREID) # kd= esu check_function_exists(fdatasync HAVE_FDATASYNC) # kd= ecore =2Dcheck_function_exists(madvise HAVE_MADVISE) # = kdecore =2Dcheck_function_exists(mmap HAVE_MMAP) # = kdecore, khtml +check_function_exists(mmap HAVE_MMAP) # kd= ecore, khtml + if(NOT WIN32) # we don't have it on windows but need to export it to be backward compa= tible # can be removed when 4.1 is out Index: kdecore/sycoca/ksycoca.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kdecore/sycoca/ksycoca.cpp (revision 978435) +++ kdecore/sycoca/ksycoca.cpp (working copy) @@ -62,14 +62,10 @@ */ #define KSYCOCA_FILENAME "ksycoca4" =20 =2D#ifdef HAVE_SYS_MMAN_H =2D#include +#if HAVE_MADVISE +#include // This #include was checked when looking for posix_= madvise #endif =20 =2D#ifdef Q_OS_SOLARIS =2Dextern "C" int madvise(caddr_t, size_t, int); =2D#endif =2D #ifndef MAP_FAILED #define MAP_FAILED ((void *) -1) #endif @@ -142,7 +138,7 @@ return false; } else { #ifdef HAVE_MADVISE =2D (void) madvise((char*)sycoca_mmap, sycoca_size, MADV_WILLNEED); + (void) posix_madvise((void*)sycoca_mmap, sycoca_size, MADV_WILLNEE= D); #endif // HAVE_MADVISE return true; } Index: kdeui/util/kpixmapcache.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kdeui/util/kpixmapcache.cpp (revision 978435) +++ kdeui/util/kpixmapcache.cpp (working copy) @@ -50,7 +50,7 @@ #include #include =20 =2D#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MADVISE) +#if defined(HAVE_MADVISE) #include #endif =20 @@ -472,7 +472,7 @@ } info->indexHeader =3D reinterpret_cast(inde= xMem); #ifdef HAVE_MADVISE =2D madvise(indexMem, info->size, MADV_WILLNEED); + posix_madvise(indexMem, info->size, MADV_WILLNEED); #endif =20 info->file->close(); --Boundary-01=_+V/KK7WOwVScEDm-- --nextPart4502527.ulUhznBpoi Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (GNU/Linux) iEYEABECAAYFAkor9YIACgkQqjQYp5Omm0poXACgj1OMCH/aQAGtnbNiNnNpRuK2 +m4AoL8Xgys6atd8yq9jLxY65seA+wjd =pWtt -----END PGP SIGNATURE----- --nextPart4502527.ulUhznBpoi--