Support non-blocking pipe I/O in read() on native Windows.
authorBruno Haible <bruno@clisp.org>
Thu, 14 Apr 2011 23:02:13 +0000 (01:02 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 14 Apr 2011 23:02:13 +0000 (01:02 +0200)
commitacc203f3da092e2ee94eff8f9c85e1fdc61315cf
tree56da48288771130ff5dff688df67b2241b3a45f9
parent73899ad375e2b795e1caaac9a75b99bc87cd9aea
Support non-blocking pipe I/O in read() on native Windows.

* lib/unistd.in.h: Include <sys/types.h> also for 'read'.
(read): New declaration.
* lib/read.c: New file.
* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_SCANF,
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM): New macros.
(fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf,
vscanf): New declarations.
* lib/stdio-read.c: New file.
* m4/read.m4: New file.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_READ,
REPLACE_READ.
* m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FGETC, GNULIB_FGETS,
GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS,
GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF. In non-blocking I/O is
desired and needs workarounds, set REPLACE_STDIO_READ_FUNCS.
(gl_STDIO_H_DEFAULTS): Initialize GNULIB_FGETC, GNULIB_FGETS,
GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS,
GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS.
* modules/read: New file.
* modules/nonblocking (Files): Add lib/stdio-read.c.
* modules/unistd (Makefile.am): Substitute GNULIB_READ, REPLACE_READ.
* modules/stdio (Makefile.am): Substitute GNULIB_FGETC, GNULIB_FGETS,
GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS,
GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS.
* modules/pread (Depends-on): Add read.
* modules/safe-read (Depends-on): Likewise.
* tests/test-stdio-c++.cc (fgetc, fgets, fread, fscanf, getc, getchar,
gets, scanf, vfscanf, vscanf): Verify signatures.
* doc/posix-functions/read.texi: Mention 'nonblocking' module and
problem with non-blocking pipes.
* doc/posix-functions/fgetc.texi: Likewise.
* doc/posix-functions/fgets.texi: Likewise.
* doc/posix-functions/fread.texi: Likewise.
* doc/posix-functions/fscanf.texi: Likewise.
* doc/posix-functions/getc.texi: Likewise.
* doc/posix-functions/getchar.texi: Likewise.
* doc/posix-functions/gets.texi: Likewise.
* doc/posix-functions/scanf.texi: Likewise.
* doc/posix-functions/vfscanf.texi: Likewise.
* doc/posix-functions/vscanf.texi: Likewise.
26 files changed:
ChangeLog
doc/posix-functions/fgetc.texi
doc/posix-functions/fgets.texi
doc/posix-functions/fread.texi
doc/posix-functions/fscanf.texi
doc/posix-functions/getc.texi
doc/posix-functions/getchar.texi
doc/posix-functions/gets.texi
doc/posix-functions/read.texi
doc/posix-functions/scanf.texi
doc/posix-functions/vfscanf.texi
doc/posix-functions/vscanf.texi
lib/read.c [new file with mode: 0644]
lib/stdio-read.c [new file with mode: 0644]
lib/stdio.in.h
lib/unistd.in.h
m4/read.m4 [new file with mode: 0644]
m4/stdio_h.m4
m4/unistd_h.m4
modules/nonblocking
modules/pread
modules/read [new file with mode: 0644]
modules/safe-read
modules/stdio
modules/unistd
tests/test-stdio-c++.cc