patch/bootstrap.conf
Paul Eggert 448ff9bc72 Defer signals by hand with sigatomic_t
Refactor by using a sig_atomic_t variable instead of a sigprocmask
call to defer signals.  This should be good enough for a
single-thread app where we write all the code that needs critical
sections, and where the signal handler merely cleans up and exits.
The resulting code should have the same behavior (including
signal-handling races!) as the original.
* bootstrap.conf (gnulib_modules): Remove sigaction, sigprocmask.
Instead, use sigaction only if it’s supported natively,
as the Gnulib emulation of sigaction drags in code we no longer need.
* configure.ac: Check for sigaction, sigfillset.
* src/patch.c (fatal_cleanup): New async-signal-safe function,
which does the cleanup that the old fatal_exit (SIG) did when SIG
was nonzero.
(fatal_exit): Do what the old fatal_exit (SIG) did when SIG was zero.
Omit SIG arg.  All callers changed.  This function is no longer
called from signal handlers, and so no longer needs to be
async-signal-safe under some circumstances.  However, it now
defers signals.
* src/util.c (signal_received): New static var.
(signal_deferring_level): Now sig_atomic_t.
(fatal_cleanup_and_terminate, handle_signal): New functions.
(defer_signals, undefer_signals): Reimplement by
using sigatomic_t volatile vars, not by using sigprocmask.
(init_signals): Don’t assume SIGPIPE since we don’t use the
Gnulib sigpipe module.  Use simple sigfillset signal mask
so that we needn’t use sigprocmask to inquire about the
current signal mask.  Have a fallback for old platforms
that lack sigaction and sigfillset, since we no longer use
Gnulib’s sigaction module.
(exit_with_signal): Remove; no longer needed.
2024-09-15 22:50:38 -07:00

109 lines
1.7 KiB
Bash

# Bootstrap configuration. -*- sh -*-
# Copyright 2006-2024 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# gnulib modules used by this package.
gnulib_modules="
argmatch
assert-h
attribute
backupfile
basename-lgpl
c-ctype
clock-time
closeout
diffseq
dup2
errno
exitfail
extensions
faccessat
fchownat
fchmodat
fcntl-h
filename
fseeko
fstatat
ftello
futimens
getopt-gnu
gettime
gitlog-to-changelog
git-version-gen
gnupload
hash
idx
ignore-value
intprops
inttypes
largefile
linked-list
maintainer-makefile
malloc-gnu
manywarnings
memchr
mempcpy
minmax
mkdirat
nstrftime
nullptr
openat
parse-datetime
progname
quotearg
raise
readlinkat
realloc-gnu
renameat
setenv
signal-h
ssize_t
stat-time
stdbool
stdc_bit_ceil
stdckdint
stdlib
stpcpy
symlinkat
sys_stat
tempname
time
unistd
unlinkat
update-copyright
utimensat
verror
xalloc
xlist
xstdopen
year2038-recommended
"
# Build prerequisites
buildreq="\
autoconf 2.59
automake 1.9.6
git 1.5.5
tar -
"
bootstrap_post_import_hook ()
{
# Automake requires that ChangeLog exist.
touch ChangeLog || exit 1
}