nonblocking: provide O_NONBLOCK for mingw
authorEric Blake <eblake@redhat.com>
Fri, 8 Apr 2011 16:15:54 +0000 (10:15 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 8 Apr 2011 16:58:36 +0000 (10:58 -0600)
commit70a72e0f50411ccc776379a761725d8c8bec58a3
tree6d9fbc4447cddb8a6081cf4f34302eab06ff7a62
parent9cc991025d6139a3a8f3e0f1570bf39a66f3aafa
nonblocking: provide O_NONBLOCK for mingw

Mingw is the only known platform that lacks O_NONBLOCK (possibly
via the alternate spelling O_NDELAY).  But mingw also lacks any
files where open() needs to enforce non-blocking behavior, and
lacks openat(), so it is relatively simple to provide a non-zero
flag.  A future patches will make use of O_NONBLOCK for pipe2.

* modules/nonblocking (Depends-on): Add open.
(configure.ac): Set new witness macro.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Provide default for it.
* modules/fcntl-h (Makefile.am): Substitute it.
* lib/fcntl.in.h (O_NONBLOCK): Guarantee non-zero definition when
nonblocking module is in use.
* lib/nonblocking.c: Adjust portability test.
* lib/open.c (open): Don't let native open see gnulib flag.
* tests/test-fcntl-h.c (main): Enhance test.
* tests/test-open.h (test_open): Likewise.
* doc/posix-headers/fcntl.texi (fcntl.h): Document the replacement.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/posix-headers/fcntl.texi
lib/fcntl.in.h
lib/nonblocking.c
lib/open.c
m4/fcntl_h.m4
modules/fcntl-h
modules/nonblocking
tests/test-fcntl-h.c
tests/test-open.h