From: Taylor R Campbell Date: Wed, 6 Apr 2011 02:55:11 +0000 (+0000) Subject: Work around brain damage in Linux's madvise. X-Git-Tag: 20110426-Gtk~2^2~16 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=65c8a4abcbc3176b2cf85d49b4400fa80ee432d2;p=mit-scheme.git Work around brain damage in Linux's madvise. --- diff --git a/src/microcode/uxtop.c b/src/microcode/uxtop.c index 7cb446c00..26b8c38a2 100644 --- a/src/microcode/uxtop.c +++ b/src/microcode/uxtop.c @@ -633,6 +633,21 @@ OS_expect_normal_access (void *start, void *end) #endif } +/* Brain-damaged Linux uses MADV_DONTNEED to mean the destructive + operation that everyone else means by MADV_FREE. Everywhere else, + (POSIX_)MADV_DONTNEED is a nondestructive operation which is useless + here. Fortunately, if Linux ever changes its meaning of + MADV_DONTNEED to match the rest of the world, the consequences here + are harmless, and if Linux additionally defines MADV_FREE like + everyone else in the world, then everything here will be + hunky-dory. */ + +#if ((defined (__linux__)) && (defined (HAVE_MADVISE))) +# if ((! (defined (MADV_FREE))) && (defined (MADV_DONTNEED))) +# define MADV_FREE MADV_DONTNEED +# endif +#endif + void OS_free_pages (void *start, void *end) {