Mercurial > hg > octave-lyh > gnulib-hg
changeset 13923:ec0a7deeb2de
pipe-posix: new module
* modules/pipe-posix: New file.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set default.
(gl_UNISTD_H): Check for declaration.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (pipe): Provide it for mingw.
* doc/posix-functions/pipe.texi (pipe): Update documentation.
* MODULES.html.sh (File descriptor based Input/Output): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Fri, 10 Dec 2010 15:18:38 -0700 |
parents | 120aa31e498d |
children | 5be0c314f2f8 |
files | ChangeLog MODULES.html.sh doc/posix-functions/pipe.texi lib/unistd.in.h m4/unistd_h.m4 modules/pipe-posix modules/unistd |
diffstat | 7 files changed, 64 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-12-10 Eric Blake <eblake@redhat.com> + + pipe-posix: new module + * modules/pipe-posix: New file. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set default. + (gl_UNISTD_H): Check for declaration. + * modules/unistd (Makefile.am): Substitute it. + * lib/unistd.in.h (pipe): Provide it for mingw. + * doc/posix-functions/pipe.texi (pipe): Update documentation. + * MODULES.html.sh (File descriptor based Input/Output): Likewise. + 2010-12-07 Bruno Haible <bruno@clisp.org> unistr/u8-strcmp: Avoid collision with libc function on Solaris 11.
--- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2649,6 +2649,7 @@ func_module full-write func_module binary-io func_module isapipe + func_module pipe-posix func_module pipe2 func_module pipe2-safer func_end_table
--- a/doc/posix-functions/pipe.texi +++ b/doc/posix-functions/pipe.texi @@ -4,15 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/pipe.html} -Gnulib module: --- +Gnulib module: pipe-posix Portability problems fixed by Gnulib: @itemize -@end itemize - -Portability problems not fixed by Gnulib: -@itemize @item This function is missing on some platforms: mingw. @end itemize + +Portability problems not fixed by Gnulib: +@itemize +@end itemize
--- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -82,10 +82,14 @@ # include <stdlib.h> #endif -/* mingw declares getcwd in <io.h>, not in <unistd.h>. */ -#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ +/* mingw declares getcwd in <io.h>, not in <unistd.h>. It also provides + _pipe in <io.h>, but that requires _O_BINARY from <fcntl.h>. */ +#if ((@GNULIB_GETCWD@ || @GNULIB_PIPE@ || defined GNULIB_POSIXCHECK) \ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) # include <io.h> +# if @GNULIB_PIPE@ +# include <fcntl.h> +# endif #endif /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. */ @@ -972,6 +976,22 @@ #endif +#if @GNULIB_PIPE@ +/* Create a pipe, defaulting to O_BINARY mode. + Store the read-end as fd[0] and the write-end as fd[1]. + Return 0 upon success, or -1 with errno set upon failure. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define pipe(fd) _pipe (fd, 4096, _O_BINARY) +# endif +#elif defined GNULIB_POSIXCHECK +# undef pipe +# if HAVE_RAW_DECL_PIPE +_GL_WARN_ON_USE (pipe, "pipe is unportable - " + "use gnulib module pipe for portability"); +# endif +#endif + + #if @GNULIB_PIPE2@ /* Create a pipe, applying the given flags when opening the read-end of the pipe and the write-end of the pipe.
--- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -38,7 +38,7 @@ ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell - endusershell lchown link linkat lseek pipe2 pread pwrite readlink + endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep]) ]) @@ -78,6 +78,7 @@ GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
new file mode 100644 --- /dev/null +++ b/modules/pipe-posix @@ -0,0 +1,22 @@ +Description: +Creation of a pipe. + +Files: + +Depends-on: +unistd + +configure.ac: +AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) +gl_UNISTD_MODULE_INDICATOR([pipe]) + +Makefile.am: + +Include: +<unistd.h> + +License: +LGPLv2+ + +Maintainer: +Eric Blake
--- a/modules/unistd +++ b/modules/unistd @@ -52,6 +52,7 @@ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ + -e 's|@''GNULIB_PIPE''@|$(GNULIB_PIPE)|g' \ -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \