From 2e64472d16b00389134ca38b6c81efe5d7be469a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 7 Aug 2022 16:55:07 +0200 Subject: [PATCH] BUILD: cfgparse: always defined _GNU_SOURCE for sched.h and crypt.h _GNU_SOURCE used to be defined only when USE_LIBCRYPT was set. It's also needed for sched_setaffinity() to be exported. As a side effect, when USE_LIBCRYPT is not set, a warning is emitted, as Ilya found and reported in issue #1815. Let's just define _GNU_SOURCE regardless of USE_LIBCRYPT, and also explicitly add sched.h, as right now it appears to be inherited from one of the other includes. This should be backported to 2.4. --- src/cfgparse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index 52979390b..fc447d6eb 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -10,10 +10,10 @@ * */ -#ifdef USE_LIBCRYPT -/* This is to have crypt() defined on Linux */ +/* This is to have crypt() and sched_setaffinity() defined on Linux */ #define _GNU_SOURCE +#ifdef USE_LIBCRYPT #ifdef USE_CRYPT_H /* some platforms such as Solaris need this */ #include @@ -29,6 +29,9 @@ #include #include #include +#ifdef USE_CPU_AFFINITY +#include +#endif #include #include #include