glibc/sysdeps/unix/sysv/linux/bits
Joseph Myers 67f0aff0c6 Fix sigval namespace (bug 21944).
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>.
2017-08-16 20:33:59 +00:00
..
types Fix sigval namespace (bug 21944). 2017-08-16 20:33:59 +00:00
a.out.h Update. 2003-07-25 09:06:04 +00:00
dirent.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
epoll.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
errno.h Remove __need macros from errno.h (__need_Emath, __need_error_t). 2017-06-14 08:14:34 -04:00
eventfd.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
fcntl-linux.h Remove __need_IOV_MAX and __need_FOPEN_MAX. 2017-06-14 07:51:30 -04:00
fcntl.h Update. 2000-09-01 07:14:30 +00:00
in.h Add more IPV6_* macros to sysdeps/unix/sysv/linux/bits/in.h. 2017-03-13 16:45:23 +00:00
initspin.h Update. 2000-10-15 06:50:42 +00:00
inotify.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ioctl-types.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ioctls.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ipc.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
local_lim.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
mqueue.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
msq.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
param.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
poll.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
posix_opt.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
resource.h Define struct rusage in sys/wait.h when required (bug 21575). 2017-06-19 11:59:19 +00:00
sched.h Remove __need_schedparam and __cpu_set_t_defined. 2017-06-12 17:11:36 -04:00
sem.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
shm.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigaction.h Fix XPG4.2 bits/sigaction.h namespace (bug 21899). 2017-08-07 23:41:32 +00:00
sigcontext.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigevent-consts.h Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
siginfo-arch.h Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
siginfo-consts-arch.h Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
siginfo-consts.h Fix a bug in 'Remove __need macros from signal.h' (a992f506) 2017-05-22 22:32:09 -04:00
signalfd.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
signum.h Factor out shared definitions from bits/signum.h. 2017-06-20 20:32:50 -04:00
sigstack.h Split up bits/sigstack.h. 2017-05-19 20:35:07 +00:00
socket_type.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
socket.h Add PF_SMC, AF_SMC from Linux 4.11 to bits/socket.h. 2017-05-01 15:11:33 +00:00
ss_flags.h Split up bits/sigstack.h. 2017-05-19 20:35:07 +00:00
stat.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
statfs.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
statvfs.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sys_errlist.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sysctl.h Add sysctl.mk and bits/sysctl.h 2012-05-22 13:46:29 -07:00
termios.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
time.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
timerfd.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
timex.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
uio_lim.h Remove __need_IOV_MAX and __need_FOPEN_MAX. 2017-06-14 07:51:30 -04:00
uio-ext.h posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738) 2017-07-11 11:06:44 -03:00
utsname.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
waitflags.h Fix waitid namespace (bug 21561). 2017-06-09 16:28:07 +00:00