mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
67f0aff0c6
XPG4.2 defines the siginfo_t type, but not union sigval or its contents (which were added in the 1993 edition of POSIX.1), resulting in namespace violations for sigval, sival_int and sival_ptr for signal.h and sys/wait.h for that standard because those headers incorrectly expose those names in that case. This patch fixes this problem. The public type in this case is union sigval, but various places in the headers use the sigval_t name for it; direct uses of union sigval are already properly guarded or in headers not in XPG4.2. Now, sigval_t, although not a standard name, does seem to be widely used outside glibc. The approach taken by this patch is to make installed headers use the name __sigval_t instead. __sigval_t is then defined to either union sigval or union __sigval (where union __sigval has __-prefixed member names as well), depending on whether there are any namespace issues with the union sigval name and its members. In the case where union __sigval is used, sigval_t is not defined at all, to avoid the problem of sigval_t having a C++ mangled name that depends on feature test macros. sigval_t is still defined by signal.h if __USE_MISC (reflecting the nonstandard nature of that name). Tested for x86_64. [BZ #21944] * signal/bits/types/__sigval_t.h: New file. * signal/Makefile (headers): Add bits/types/__sigval_t.h. * signal/bits/types/sigval_t.h: Include <bits/types/__sigval_t.h> and define sigval_t using __sigval_t. * include/bits/types/__sigval_t.h: New file. * bits/types/sigevent_t.h: Include <bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>. (struct sigevent): Use __sigval_t instead of sigval_t. * bits/types/siginfo_t.h: Include <bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>. (siginfo_t): Use __sigval_t instead of sigval_t. * sysdeps/unix/sysv/linux/bits/types/sigevent_t.h: Include <bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>. (struct sigevent): Use __sigval_t instead of sigval_t. * sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: Include <bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>. (siginfo_t): Use __sigval_t instead of sigval_t. * signal/signal.h [__USE_MISC]: Include <bits/types/sigval_t.h>.
60 lines
2.1 KiB
Makefile
60 lines
2.1 KiB
Makefile
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
|
# This file is part of the GNU C Library.
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
# The GNU C Library 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
|
|
# Lesser General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with the GNU C Library; if not, see
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
# Makefile for signal routines.
|
|
#
|
|
subdir := signal
|
|
|
|
include ../Makeconfig
|
|
|
|
headers := signal.h sys/signal.h \
|
|
bits/signum.h bits/signum-generic.h \
|
|
bits/sigcontext.h bits/sigaction.h \
|
|
bits/sigevent-consts.h bits/siginfo-consts.h \
|
|
bits/sigstack.h bits/sigthread.h bits/ss_flags.h \
|
|
bits/types/__sigset_t.h bits/types/sig_atomic_t.h \
|
|
bits/types/sigevent_t.h bits/types/siginfo_t.h \
|
|
bits/types/sigset_t.h bits/types/sigval_t.h \
|
|
bits/types/stack_t.h bits/types/struct_sigstack.h \
|
|
bits/types/__sigval_t.h
|
|
|
|
routines := signal raise killpg \
|
|
sigaction sigprocmask kill \
|
|
sigpending sigsuspend sigwait \
|
|
sigblock sigsetmask sigpause sigvec \
|
|
sigstack sigaltstack sigintr \
|
|
sigsetops sigempty sigfillset sigaddset sigdelset sigismem \
|
|
sigreturn \
|
|
siggetmask sysv_signal \
|
|
sigisempty sigandset sigorset \
|
|
allocrtsig sigtimedwait sigwaitinfo sigqueue \
|
|
sighold sigrelse sigignore sigset
|
|
|
|
tests := tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2
|
|
|
|
|
|
include ../Rules
|
|
|
|
CFLAGS-sigpause.c = -fexceptions
|
|
CFLAGS-sigsuspend.c = -fexceptions -fasynchronous-unwind-tables
|
|
CFLAGS-sigtimedwait.c = -fexceptions -fasynchronous-unwind-tables
|
|
CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
|
|
CFLAGS-sigwaitinfo.c = -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CFLAGS-sigreturn.c = $(no-stack-protector)
|