[PATCH] D119695: [Support] Fix build on illumos
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 15 07:32:45 PST 2022
ro added a comment.
In D119695#3322927 <https://reviews.llvm.org/D119695#3322927>, @joerg wrote:
> Wouldn't the correct solution for Illumos be to use `posix_madvise` instead? Possibly with `__EXTENSIONS__`. Declaring prototypes like this is just begging for problems long term...
This should work indeed: all of Solaris 11.3, 11.4, and Illumos have it. One could simply use
#ifdef POSIX_MADV_DONTNEED
::posix_madvise(Mapping, Size, POSIX_MADV_DONTNEED);
#else
::madvise(Mapping, Size, MADV_DONTNEED);
#endif
Something similar could be done in `compiler-rt/lib/sanitizer_common/sanitizer_solaris.cpp` (`internal_madvise`): according to `<sys/mman.h>`, the `MADV_*` and `POSIX_MADV_*` constants are kept in sync.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119695/new/
https://reviews.llvm.org/D119695
More information about the llvm-commits
mailing list