From: Eric Blake Date: Thu, 21 Apr 2011 14:51:12 +0000 (-0600) Subject: sys_uio: new module X-Git-Tag: v0.1~2927 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=753425d56eedab92c361cae9d6baa701d893fbc9;p=gnulib.git sys_uio: new module For now, just provide the types used by sys/socket. We could add readv() and writev() later, if desired. * modules/sys_uio: New module. * modules/sys_uio-tests: Likewise. * lib/sys_uio.in.h: New file. * m4/sys_uio_h.m4: Likewise. * tests/test-sys_uio.c: Likewise. * doc/posix-headers/sys_uio.texi (sys/uio.h): Document it. * MODULES.html.sh (systems lacking POSIX:2008): Likewise. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 5081b4594..4f8321a1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-04-21 Eric Blake + + sys_uio: new module + * modules/sys_uio: New module. + * modules/sys_uio-tests: Likewise. + * lib/sys_uio.in.h: New file. + * m4/sys_uio_h.m4: Likewise. + * tests/test-sys_uio.c: Likewise. + * doc/posix-headers/sys_uio.texi (sys/uio.h): Document it. + * MODULES.html.sh (systems lacking POSIX:2008): Likewise. + 2011-04-20 Jim Meyering useless-if-before-free: avoid false-positive diff --git a/MODULES.html.sh b/MODULES.html.sh index 708f3cccf..8d32a2125 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2464,6 +2464,7 @@ func_all_modules () func_module sys_stat func_module sys_time func_module sys_times + func_module sys_uio func_module sys_utsname func_module sys_wait func_module tsearch diff --git a/doc/posix-headers/sys_uio.texi b/doc/posix-headers/sys_uio.texi index 44282f22f..bc4825400 100644 --- a/doc/posix-headers/sys_uio.texi +++ b/doc/posix-headers/sys_uio.texi @@ -3,15 +3,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html} -Gnulib module: --- +Gnulib module: sys_uio Portability problems fixed by Gnulib: @itemize +@item +This header file is missing on some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This header file is missing on some platforms: -mingw. @end itemize diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h new file mode 100644 index 000000000..175ee0fb6 --- /dev/null +++ b/lib/sys_uio.in.h @@ -0,0 +1,49 @@ +/* Substitute for . + Copyright (C) 2011 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +# if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +# endif +@PRAGMA_COLUMNS@ + +#ifndef _GL_SYS_UIO_H + +#if @HAVE_SYS_UIO_H@ + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@ + +#endif + +#ifndef _GL_SYS_UIO_H +#define _GL_SYS_UIO_H + +#if !@HAVE_SYS_UIO_H@ +/* A platform that lacks . */ +/* Get 'ssize_t'. */ +# include + +/* All known platforms that lack also lack any declaration + of struct iovec in any other header. */ +struct iovec { + void *iov_base; + size_t iov_len; +}; +#endif + +#endif /* _GL_SYS_UIO_H */ +#endif /* _GL_SYS_UIO_H */ diff --git a/m4/sys_uio_h.m4 b/m4/sys_uio_h.m4 new file mode 100644 index 000000000..bafa0ac45 --- /dev/null +++ b/m4/sys_uio_h.m4 @@ -0,0 +1,31 @@ +# sys_uio_h.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_HEADER_SYS_UIO], +[ + AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) + dnl is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/uio.h]) + if test $ac_cv_header_sys_uio_h = yes; then + HAVE_SYS_UIO_H=1 + else + HAVE_SYS_UIO_H=0 + fi + AC_SUBST([HAVE_SYS_UIO_H]) +]) + +AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_UIO_H_DEFAULTS], +[ +]) diff --git a/modules/sys_uio b/modules/sys_uio new file mode 100644 index 000000000..2152718cc --- /dev/null +++ b/modules/sys_uio @@ -0,0 +1,42 @@ +Description: +A POSIX-like . + +Files: +lib/sys_uio.in.h +m4/sys_uio_h.m4 + +Depends-on: +include_next + +configure.ac: +gl_HEADER_SYS_UIO +AC_PROG_MKDIR_P + +Makefile.am: +BUILT_SOURCES += sys/uio.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +sys/uio.h: sys_uio.in.h $(top_builddir)/config.status + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \ + -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \ + < $(srcdir)/sys_uio.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t +MOSTLYCLEANDIRS += sys + +Include: + + +License: +LGPLv2+ + +Maintainer: +Eric Blake diff --git a/modules/sys_uio-tests b/modules/sys_uio-tests new file mode 100644 index 000000000..025857953 --- /dev/null +++ b/modules/sys_uio-tests @@ -0,0 +1,10 @@ +Files: +tests/test-sys_uio.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-sys_uio +check_PROGRAMS += test-sys_uio diff --git a/tests/test-sys_uio.c b/tests/test-sys_uio.c new file mode 100644 index 000000000..7855a6bc4 --- /dev/null +++ b/tests/test-sys_uio.c @@ -0,0 +1,32 @@ +/* Test of substitute. + Copyright (C) 2011 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 . */ + +/* Written by Eric Blake , 2011. */ + +#include + +#include + +/* Check that necessary types are defined. */ +size_t a; +ssize_t b; +struct iovec c; + +int +main (void) +{ + return a + b + !!c.iov_base + c.iov_len; +}