diff options
author | vkalintiris <vasilis@netdata.cloud> | 2022-05-02 14:18:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 14:18:07 +0300 |
commit | 78e9a97b5d292646c71a3c689567ac9acb4667de (patch) | |
tree | c08d79caa53af1fa99a79886105cd3491612718b /libnetdata | |
parent | ee2d762f81d478557c2fcf879bbaaa86686522fb (diff) |
Don't use MADV_DONTDUMP on non-linux builds (#12795)
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/libnetdata.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index 0ee2e26813..36787042ef 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -951,6 +951,7 @@ static inline int madvise_sequential(void *mem, size_t len) { if (ret != 0 && logger-- > 0) error("madvise(MADV_SEQUENTIAL) failed."); return ret; } + static inline int madvise_dontfork(void *mem, size_t len) { static int logger = 1; int ret = madvise(mem, len, MADV_DONTFORK); @@ -958,6 +959,7 @@ static inline int madvise_dontfork(void *mem, size_t len) { if (ret != 0 && logger-- > 0) error("madvise(MADV_DONTFORK) failed."); return ret; } + static inline int madvise_willneed(void *mem, size_t len) { static int logger = 1; int ret = madvise(mem, len, MADV_WILLNEED); @@ -965,6 +967,8 @@ static inline int madvise_willneed(void *mem, size_t len) { if (ret != 0 && logger-- > 0) error("madvise(MADV_WILLNEED) failed."); return ret; } + +#if __linux__ static inline int madvise_dontdump(void *mem, size_t len) { static int logger = 1; int ret = madvise(mem, len, MADV_DONTDUMP); @@ -972,6 +976,15 @@ static inline int madvise_dontdump(void *mem, size_t len) { if (ret != 0 && logger-- > 0) error("madvise(MADV_DONTDUMP) failed."); return ret; } +#else +static inline int madvise_dontdump(void *mem, size_t len) { + UNUSED(mem); + UNUSED(len); + + return 0; +} +#endif + static inline int madvise_mergeable(void *mem, size_t len) { #ifdef MADV_MERGEABLE static int logger = 1; |