[pacman-dev,4/5] Fix build error when SIGPOLL is not available

Message ID 20210417034524.204755-5-mark.weiman@markzz.com
State Accepted, archived
Headers show
Series Various fixes for FreeBSD (and perhaps others) | expand

Commit Message

Mark Weiman April 17, 2021, 3:45 a.m. UTC
On Linux, SIGPOLL is a valid signal, but on systems like FreeBSD, it is
not. This patch does a preprocessor check to see if SIGPOLL is available
or not.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
---
This is a modified patch where formatting is addressed and the check for
SIGPOLL is done as a preprocessor macro rather than in meson.

 lib/libalpm/util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Allan McRae April 19, 2021, 7:21 a.m. UTC | #1
On 17/4/21 1:45 pm, Mark Weiman wrote:
> On Linux, SIGPOLL is a valid signal, but on systems like FreeBSD, it is
> not. This patch does a preprocessor check to see if SIGPOLL is available
> or not.
> 
> Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
> ---
> This is a modified patch where formatting is addressed and the check for
> SIGPOLL is done as a preprocessor macro rather than in meson.
> 
>  lib/libalpm/util.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
> index 46c1d0a1..1d9d85dd 100644
> --- a/lib/libalpm/util.c
> +++ b/lib/libalpm/util.c
> @@ -558,8 +558,12 @@ static void _alpm_reset_signals(void)
>  	int *i, signals[] = {
>  		SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL,
>  		SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM, SIGTSTP,
> -		SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
> -		SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ,
> +		SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPROF, SIGSYS, SIGTRAP, SIGURG,
> +		SIGVTALRM, SIGXCPU, SIGXFSZ,
> +#if defined(SIGPOLL)
> +		/* this is needed for FreeBSD et al. */

This comment made me thing SIGPOLL was a BSD specific signal. I changed
the comment to make the issue more clear:

+		/* Not available on FreeBSD et al. */

> +		SIGPOLL,
> +#endif
>  		0
>  	};
>  	struct sigaction def;
>

Patch

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 46c1d0a1..1d9d85dd 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -558,8 +558,12 @@  static void _alpm_reset_signals(void)
 	int *i, signals[] = {
 		SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL,
 		SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM, SIGTSTP,
-		SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
-		SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ,
+		SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPROF, SIGSYS, SIGTRAP, SIGURG,
+		SIGVTALRM, SIGXCPU, SIGXFSZ,
+#if defined(SIGPOLL)
+		/* this is needed for FreeBSD et al. */
+		SIGPOLL,
+#endif
 		0
 	};
 	struct sigaction def;