BUILD: pools: fix backport of no-memory-trimming on non-linux OS
authorWilly Tarreau <w@1wt.eu>
Tue, 8 Mar 2022 14:10:05 +0000 (15:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 8 Mar 2022 14:10:05 +0000 (15:10 +0100)
Commit 4bcff9ba4 in 2.5 ("MINOR: pools: add a new global option
"no-memory-trimming"") was missing some extra ifdefs for the cases
where the allocator doesn't have malloc_trim() and fails to build
on windows.

This must be backported to 2.4.

src/pool.c

index d34e6d5..e9778e5 100644 (file)
@@ -728,6 +728,7 @@ static int mem_parse_global_fail_alloc(char **args, int section_type, struct pro
 }
 #endif
 
+#if defined(HA_HAVE_MALLOC_TRIM)
 /* config parser for global "no-memory-trimming" */
 static int mem_parse_global_no_mem_trim(char **args, int section_type, struct proxy *curpx,
                                        const struct proxy *defpx, const char *file, int line,
@@ -738,13 +739,16 @@ static int mem_parse_global_no_mem_trim(char **args, int section_type, struct pr
        disable_trim = 1;
        return 0;
 }
+#endif
 
 /* register global config keywords */
 static struct cfg_kw_list mem_cfg_kws = {ILH, {
 #ifdef DEBUG_FAIL_ALLOC
        { CFG_GLOBAL, "tune.fail-alloc", mem_parse_global_fail_alloc },
 #endif
+#if defined(HA_HAVE_MALLOC_TRIM)
        { CFG_GLOBAL, "no-memory-trimming", mem_parse_global_no_mem_trim },
+#endif
        { 0, NULL, NULL }
 }};