On OpenBSD 4.4, <sys/uio.h> is not self-contained: $ cat foo.c #include <sys/uio.h> struct iovec x;
$ gcc -c foo.c In file included from foo.c:1: /usr/include/sys/uio.h:40: error: syntax error before "size_t" In file included from foo.c:1: /usr/include/sys/uio.h:75: error: syntax error before "preadv" /usr/include/sys/uio.h:75: error: syntax error before "off_t" /usr/include/sys/uio.h:76: error: syntax error before "pwritev" /usr/include/sys/uio.h:76: error: syntax error before "off_t" /usr/include/sys/uio.h:78: error: syntax error before "readv" /usr/include/sys/uio.h:79: error: syntax error before "writev" This patch works around it: 2011-04-30 Bruno Haible <[email protected]> sys_uio: Make <sys/uio.h> self-contained. * lib/sys_uio.in.h: Include <sys/types.h> before <sys/uio.h>. * doc/posix-headers/sys_uio.texi: Mention the OpenBSD problem. --- doc/posix-headers/sys_uio.texi.orig Sat Apr 30 13:53:29 2011 +++ doc/posix-headers/sys_uio.texi Sat Apr 30 13:50:50 2011 @@ -10,6 +10,10 @@ @item This header file is missing on some platforms: mingw. +@item +This header file is not self-contained (it requires @code{<sys/types.h>} to be +included first) on some platforms: +OpenBSD 4.4. @end itemize Portability problems not fixed by Gnulib: --- lib/sys_uio.in.h.orig Sat Apr 30 13:53:29 2011 +++ lib/sys_uio.in.h Sat Apr 30 13:49:39 2011 @@ -24,6 +24,9 @@ #if @HAVE_SYS_UIO_H@ +/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */ +# include <sys/types.h> + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@ -- In memoriam Casey Jones <http://en.wikipedia.org/wiki/Casey_Jones>
