[PATCH] meson: fix cpuset_getaffinity() detection

Roman Bogorodskiy posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211123115756.12264-1-bogorodskiy@gmail.com
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH] meson: fix cpuset_getaffinity() detection

Posted by Roman Bogorodskiy 1 week, 5 days ago
The cpuset_getaffinity() function is checked in sys/cpuset.h to see if
BSD CPU affinity APIs are available. This check requires including
sys/param.h to work properly, otherwise the test program fails with
unrelated errors like:

/usr/include/sys/cpuset.h:155:1: error: unknown type name
'__BEGIN_DECLS'
__BEGIN_DECLS
^
/usr/include/sys/cpuset.h:156:12: error: unknown type name 'cpusetid_t';
did you mean 'cpuset_t'?
int     cpuset(cpusetid_t *);

and so forth.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index e4f36e8574..ad0cd44aca 100644
--- a/meson.build
+++ b/meson.build
@@ -709,7 +709,7 @@ if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD', prefix: brd_required_h
 endif
 
 # Check for BSD CPU affinity availability
-if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity')
+if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity', prefix: '#include <sys/param.h>')
   conf.set('WITH_BSD_CPU_AFFINITY', 1)
 endif
 
-- 
2.33.1

Re: [PATCH] meson: fix cpuset_getaffinity() detection

Posted by Michal Prívozník 1 week, 5 days ago
On 11/23/21 12:57, Roman Bogorodskiy wrote:
> The cpuset_getaffinity() function is checked in sys/cpuset.h to see if
> BSD CPU affinity APIs are available. This check requires including
> sys/param.h to work properly, otherwise the test program fails with
> unrelated errors like:
> 
> /usr/include/sys/cpuset.h:155:1: error: unknown type name
> '__BEGIN_DECLS'
> __BEGIN_DECLS
> ^
> /usr/include/sys/cpuset.h:156:12: error: unknown type name 'cpusetid_t';
> did you mean 'cpuset_t'?
> int     cpuset(cpusetid_t *);
> 
> and so forth.
> 
> Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

Re: [PATCH] meson: fix cpuset_getaffinity() detection

Posted by Martin Kletzander 1 week, 5 days ago
On Tue, Nov 23, 2021 at 03:57:56PM +0400, Roman Bogorodskiy wrote:
>The cpuset_getaffinity() function is checked in sys/cpuset.h to see if
>BSD CPU affinity APIs are available. This check requires including
>sys/param.h to work properly, otherwise the test program fails with
>unrelated errors like:
>
>/usr/include/sys/cpuset.h:155:1: error: unknown type name
>'__BEGIN_DECLS'
>__BEGIN_DECLS
>^
>/usr/include/sys/cpuset.h:156:12: error: unknown type name 'cpusetid_t';
>did you mean 'cpuset_t'?
>int     cpuset(cpusetid_t *);
>
>and so forth.
>
>Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

>---
> meson.build | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/meson.build b/meson.build
>index e4f36e8574..ad0cd44aca 100644
>--- a/meson.build
>+++ b/meson.build
>@@ -709,7 +709,7 @@ if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD', prefix: brd_required_h
> endif
>
> # Check for BSD CPU affinity availability
>-if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity')
>+if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity', prefix: '#include <sys/param.h>')
>   conf.set('WITH_BSD_CPU_AFFINITY', 1)
> endif
>
>-- 
>2.33.1
>