Hi Paul, I wrote: > > - The declaration in sigsegv.h needs to stay, at least for the next > > couple of years, because it is necessary for programs that use SIGSTKSZ > > (such as GNU m4 and GNU clisp) to compile fine. > > Why is it needed for GNU m4 and GNU clisp? I just looked at the latest > development source code for these programs, and neither mentions > SIGSTKSZ. GNU Emacs doesn't either (except in a configure.ac test that > does not assume SIGSTKSZ is a constant). > ... > And I propose the second attached patch to remove sigsegv.h's guarantee > that SIGSTKSZ is a constant, as glibc has gone a different way and it's > better if Gnulib tracks glibc.
sigsegv.h is the public interface of GNU libsigsegv too. Apparently my memory was wrong regarding GNU m4 and GNU clisp. So, let me look at all relevant programs, how they allocate their alternate stacks. $ apt-cache rdepends libsigsegv2 libsigsegv2 Reverse Depends: libsigsegv-dev scheme2c maude libgst7 clisp asymptote m4 gawk scheme2c -------- Referenced in scheme2c-2012.10.14/scrt/cio.c. The program is single-threaded. The alternate stack is statically allocated, of size 16 KB. maude ----- Referenced in maude-3.1/src/Mixfix/interact.cc. The program is single-threaded. The alternate stack is statically allocated, of size SIGSTKSZ. GNU smalltalk ------------- Uses only a SIGSEGV handler, no stack overflow handler. GNU clisp --------- Referenced in clisp/src/spvw_sigsegv.d. The program is single-threaded. The alternate stack is allocated on the stack of the main thread, using alloca(), of size 16 KB. asymptote --------- Referenced in asymptote-2.70/main.cc. The program is multi-threaded. An alternate stack is allocated only for the main thread, on the stack of the main thread, as a local variable that goes out-of-scope (weird, but OK), of size 16 KB. GNU m4 ------ Referenced in m4/src/m4.c. The program is single-threaded. The alternate stack (in c-stack.c) is statically allocated, of size 64 KB. GNU gawk -------- Referenced in gawk/main.c. The program is single-threaded. The alternate stack is allocated through malloc(), of size 16 KB. So, there are indeed few users of SIGSTKSZ among the users of GNU libsigsegv, namely only 'maude'. And since 'maude' does not use Gnulib, it is possible to move forward with the API of sigsegv.h faster in Gnulib than it is possible in libsigsegv. But please hold off from doing this patch for now. First, I need to document things properly, both in the Gnulib documentation and in the libsigsegv documentation. In particular: * API differences between gnulib's sigsegv.h and libsigsegv's sigsegv.h need to be documented. * It needs to be documented from where the alternate stack should be allocated, and with which size (since 16 KB is too small on some platforms, and 16 MB is too large for multithreaded apps). Bruno