:: Re: [DNG] help with C - error: impl…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Rainer Weikusat
Fecha:  
A: dng
Asunto: Re: [DNG] help with C - error: implicit declaration of function
Lorenz via Dng <dng@???> writes:
> Hello,
> I'm an amateur and self-taught "programmer" and I need help from
> someone that knows better than me in C.
>
> Runit currently fails to build from source with gcc-14, with
> sig_pause.c:14:3: error: implicit declaration of function ‘sigpause’
> see
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075484
>
> looked at the error, did a quick search about 'sigpause'
>
> https://man7.org/linux/man-pages/man3/sigpause.3.html
> https://www.ibm.com/docs/fi/zos/2.4.0?topic=functions-sigpause-unblock-signal-wait-signal
>
> and come up with the following patch
>
> --- a/runit-2.1.2/src/sig_pause.c
> +++ b/runit-2.1.2/src/sig_pause.c
> @@ -11,6 +11,7 @@
>    sigemptyset(&ss);
>    sigsuspend(&ss);
>  #else
> +  int sigpause(int);
>    sigpause(0);
>  #endif
>  }

>
> tested, it builds and seems to work fine, so everything ok.
> Actually, no.


The real problem is that detecting availability of sigprocmask doesn't
work. The code in the #else-branch should never be compiled on
Linux. I've tried this on Debian 12 and Devuan 4 but couldn't reproduce
the problem. The detection code can be executed by running

make hassgprm.h

in the runit source directory. This should create a file hassgprm.h with
the following content:

/* Public domain. */

/* sysdep: +sigprocmask */
#define HASSIGPROCMASK 1

The patch cannot help because by default, glibc uses the SysV version of
sigpause which unblocks the single signal passed as argument and then
suspends the process. What it's supposed to do is to clear the current
signal mask, ie, unblock all signals, and suspend the process. The BSD
sigpause would do that with an argument of 0. But working why
sigprocmask isn't being detected and fixing that is the 'proper' way to
handle this.