diff mbox series

[v3,7/9] util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD

Message ID 20200703145614.16684-8-peter.maydell@linaro.org
State New
Headers show
Series Build fixes for Haiku | expand

Commit Message

Peter Maydell July 3, 2020, 2:56 p.m. UTC
From: David CARLIER <devnexen@gmail.com>

util/compatfd.c includes <sys/syscall.h> so that the CONFIG_SIGNALFD
code can use SYS_signalfd. Guard the #include with CONFIG_SIGNALFD
to avoid portability issues on hosts like Haiku which do not
provide that header file.

Signed-off-by: David Carlier <devnexen@gmail.com>
[PMM: Expanded commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 util/compatfd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth July 3, 2020, 3:19 p.m. UTC | #1
On 03/07/2020 16.56, Peter Maydell wrote:
> From: David CARLIER <devnexen@gmail.com>
> 
> util/compatfd.c includes <sys/syscall.h> so that the CONFIG_SIGNALFD
> code can use SYS_signalfd. Guard the #include with CONFIG_SIGNALFD
> to avoid portability issues on hosts like Haiku which do not
> provide that header file.
> 
> Signed-off-by: David Carlier <devnexen@gmail.com>
> [PMM: Expanded commit message]
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  util/compatfd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/util/compatfd.c b/util/compatfd.c
> index c296f55d148..ee47dd80897 100644
> --- a/util/compatfd.c
> +++ b/util/compatfd.c
> @@ -16,7 +16,9 @@
>  #include "qemu/osdep.h"
>  #include "qemu/thread.h"
>  
> +#if defined(CONFIG_SIGNALFD)
>  #include <sys/syscall.h>
> +#endif
>  
>  struct sigfd_compat_info
>  {

Reviewed-by: Thomas Huth <thuth@redhat.com>
Philippe Mathieu-Daudé July 3, 2020, 3:29 p.m. UTC | #2
On 7/3/20 4:56 PM, Peter Maydell wrote:
> From: David CARLIER <devnexen@gmail.com>
> 
> util/compatfd.c includes <sys/syscall.h> so that the CONFIG_SIGNALFD
> code can use SYS_signalfd. Guard the #include with CONFIG_SIGNALFD
> to avoid portability issues on hosts like Haiku which do not
> provide that header file.
> 
> Signed-off-by: David Carlier <devnexen@gmail.com>
> [PMM: Expanded commit message]
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  util/compatfd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/util/compatfd.c b/util/compatfd.c
> index c296f55d148..ee47dd80897 100644
> --- a/util/compatfd.c
> +++ b/util/compatfd.c
> @@ -16,7 +16,9 @@
>  #include "qemu/osdep.h"
>  #include "qemu/thread.h"
>  
> +#if defined(CONFIG_SIGNALFD)

Most of the code base guards <sys/syscall.h> with '#ifdef CONFIG_LINUX',
bsd-user/strace.c is the BSD exception.

CONFIG_SIGNALFD guards SYS_signalfd.

>  #include <sys/syscall.h>
> +#endif
>  
>  struct sigfd_compat_info
>  {
>
diff mbox series

Patch

diff --git a/util/compatfd.c b/util/compatfd.c
index c296f55d148..ee47dd80897 100644
--- a/util/compatfd.c
+++ b/util/compatfd.c
@@ -16,7 +16,9 @@ 
 #include "qemu/osdep.h"
 #include "qemu/thread.h"
 
+#if defined(CONFIG_SIGNALFD)
 #include <sys/syscall.h>
+#endif
 
 struct sigfd_compat_info
 {