glibc/include
Joseph Myers 9fe3c80c7c Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426).
sys/socket.h includes sys/uio.h to get the definition of the iovec
structure.

POSIX allows sys/socket.h to make all sys/uio.h symbols visible.
However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this
results in conformtest failures (for sys/socket.h and other headers
that include it):

    Namespace violation: "UIO_MAXIOV"
    Namespace violation: "readv"
    Namespace violation: "writev"

Now, there is some ambiguity in POSIX about what namespace
reservations apply in this case - see
http://austingroupbugs.net/view.php?id=1127 - but glibc convention
would still avoid declaring readv and writev, for example, for feature
test macros that don't include them (if only headers from the relevant
standard are included), even if such declarations are permitted, so
there is a bug here according to glibc conventions.

This patch moves the struct iovec definition to a new
bits/types/struct_iovec.h header and includes that from sys/socket.h
instead of including the whole of sys/uio.h.  This fixes the namespace
issue; however, three files in glibc that were relying on the implicit
inclusion needed to be updated to include sys/uio.h explicitly.  So
there is a question of whether sys/socket.h should continue to include
sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or
__USE_XOPEN || __USE_MISC, for greater compatibility with code that
(wrongly) expects this optional inclusion to be present there.  (I
think the three affected files in glibc should still have explicit
sys/uio.h inclusions added in any case, however.)

Tested for x86_64.

	[BZ #21426]
	* misc/bits/types/struct_iovec.h: New file.
	* misc/Makefile (headers): Add bits/types/struct_iovec.h.
	* include/bits/types/struct_iovec.h: New file.
	* bits/uio.h (struct iovec): Replace by inclusion of
	<bits/types/struct_iovec.h>.
	* sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise.
	* socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead
	of <sys/uio.h>.
	* nptl/tst-cancel4.c: Include <sys/uio.h>
	* posix/test-errno.c: Likewise.
	* support/resolv_test.c: Likewise.
	* conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform):
	Remove.
	(test-xfail-POSIX2008/netdb.h/conform): Likewise.
	(test-xfail-POSIX2008/netinet/in.h/conform): Likewise.
	(test-xfail-POSIX2008/sys/socket.h/conform): Likewise.
2017-04-25 17:52:47 +00:00
..
arpa nss_dns: Replace local declarations with declarations from a header file 2017-04-04 20:56:23 +02:00
bits Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426). 2017-04-25 17:52:47 +00:00
gnu Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
net Fix resolver if_* namespace (bug 17717). 2014-12-16 18:18:49 +00:00
netinet Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
programs Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
protocols
rpc sunrpc: Always obtain AF_INET addresses from NSS [BZ #20964] 2016-12-27 16:44:15 +01:00
rpcsvc Deprecate libnsl by default (only shared library will be 2017-03-21 15:14:27 +01:00
sys Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
aio.h
aliases.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
alloca.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
argp.h
argz.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
assert.h
atomic.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
byteswap.h
caller.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
complex.h
cpio.h
crypt.h Add include/crypt.h. 2016-10-28 22:40:16 -04:00
ctype.h Rename bits/libc-tsd.h to libc-tsd.h (bug 14912). 2015-09-03 20:33:46 +00:00
des.h
dirent.h Mark internal dirent functions hidden 2015-10-15 14:15:41 -07:00
dlfcn.h Mark _dl_catch_error hidden 2015-10-15 14:13:50 -07:00
elf.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
endian.h
envz.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
err.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
errno.h
error.h
execinfo.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
fcntl.h Assume that O_CLOEXEC is always defined and works 2017-04-18 14:56:51 +02:00
features.h Clean up conditionals for declaration of gets. 2017-02-25 09:47:51 -05:00
fenv.h Mark fegetround pure (bug 16296). 2015-09-15 20:36:50 +00:00
fmtmsg.h
fnmatch.h
fpu_control.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
ftw.h
gconv.h
getopt.h getopt: remove USE_NONOPTION_FLAGS 2017-04-07 07:45:53 -04:00
getopt_int.h
glob.h
gmp.h
gnu-versions.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
grp-merge.h NSS: Implement group merging support. 2016-04-29 22:18:21 -04:00
grp.h
gshadow.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
iconv.h
ifaddrs.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
ifunc-impl-list.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
inline-hashtab.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
langinfo.h
libc-diag.h Split DIAG_* macros to new header libc-diag.h. 2017-02-25 09:59:46 -05:00
libc-internal.h Narrowing the visibility of libc-internal.h even further. 2017-03-01 20:33:46 -05:00
libc-pointer-arith.h Narrowing the visibility of libc-internal.h even further. 2017-03-01 20:33:46 -05:00
libc-symbols.h getopt: merge _GL_UNUSED annotations from gnulib 2017-04-07 07:52:29 -04:00
libgen.h
libintl.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
libio.h Rename bits/stdio-lock.h to stdio-lock.h (bug 14912). 2015-09-04 16:21:14 +00:00
limits.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
link.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
list.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
locale.h
malloc.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
math.h Add roundeven, roundevenf, roundevenl. 2016-12-21 01:48:27 +00:00
mcheck.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
memory.h
mntent.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
monetary.h
mqueue.h Fix mq_receive, mq_send mq_timed* namespace (bug 18545). 2015-06-17 20:19:04 +00:00
netdb.h Fix h_errno namespace (bug 18520). 2015-06-12 10:10:18 +00:00
netgroup.h
nl_types.h
nss.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
nsswitch.h
obstack.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
poll.h
printf.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
pthread.h Fix mq_notify pthread_barrier_* namespace (bug 18544). 2015-06-17 20:16:56 +00:00
pty.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
pwd.h Harden putpwent, putgrent, putspent, putspent against injection [BZ #18724] 2015-10-02 11:34:13 +02:00
regex.h
resolv.h resolv: Reduce EDNS payload size to 1200 bytes [BZ #21361] 2017-04-13 13:09:38 +02:00
rounding-mode.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sched.h posix: New Linux posix_spawn{p} implementation 2016-03-07 11:53:47 +07:00
scratch_buffer.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
search.h Fix sem_* tdelete, tfind, tsearch, twalk namespace (bug 18536). 2015-06-17 20:11:58 +00:00
set-hooks.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
setjmp.h Mark internal setjmp functions hidden 2015-10-15 14:22:25 -07:00
sgtty.h
shadow.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
shlib-compat.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
signal.h Mark ld.so internel sigaction functions hidden 2015-10-15 14:23:31 -07:00
spawn.h
stab.h
stackinfo.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
stap-probe.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
stdc-predef.h Bug 20313: Update to Unicode 9.0.0 2017-02-21 06:30:38 -05:00
stdio.h getopt: clean up error reporting 2017-04-07 07:48:57 -04:00
stdio_ext.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
stdlib.h Remove the str(n)dup inlines from string/bits/string2.h. Although inlining 2017-03-13 18:45:42 +00:00
string.h Clean up redundancies between string.h and strings.h. 2017-02-16 17:02:50 -05:00
strings.h
stropts.h
stubs-prologue.h
syscall.h
sysexits.h
syslog.h
tar.h
termios.h
tgmath.h
time.h timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576] 2017-03-07 17:45:38 +01:00
ttyent.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
uchar.h
ucontext.h
ulimit.h
unistd.h Assume that dup3 is available 2017-04-18 14:42:19 +02:00
utime.h
utmp.h Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
values.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
wchar.h Use __typeof instead of typeof 2016-06-04 09:19:09 +02:00
wctype.h Fix regex wctype namespace (bug 18495). 2015-06-05 20:04:47 +00:00
wordexp.h
xlocale.h