diff options
author | Eric Blake <eblake@redhat.com> | 2011-04-08 10:15:54 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-04-08 10:58:36 -0600 |
commit | 70a72e0f50411ccc776379a761725d8c8bec58a3 (patch) | |
tree | 6d9fbc4447cddb8a6081cf4f34302eab06ff7a62 /tests/test-open.h | |
parent | 9cc991025d6139a3a8f3e0f1570bf39a66f3aafa (diff) | |
download | gnulib-70a72e0f50411ccc776379a761725d8c8bec58a3.tar.gz |
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>
Diffstat (limited to 'tests/test-open.h')
-rw-r--r-- | tests/test-open.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test-open.h b/tests/test-open.h index 3e5c5e1726..2ba5d137bf 100644 --- a/tests/test-open.h +++ b/tests/test-open.h @@ -63,6 +63,12 @@ test_open (int (*func) (char const *, int, ...), bool print) ASSERT (write (fd, "c", 1) == 1); ASSERT (close (fd) == 0); + /* Although O_NONBLOCK on regular files can be ignored, it must not + cause a failure. */ + fd = func (BASE "file", O_NONBLOCK | O_RDONLY); + ASSERT (0 <= fd); + ASSERT (close (fd) == 0); + /* Symlink handling, where supported. */ if (symlink (BASE "file", BASE "link") != 0) { |