summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-04-19 10:38:30 +0200
committerBruno Haible <bruno@clisp.org>2011-04-19 10:38:30 +0200
commit12856373f8fd28a9d4453d6df97b2fdd17ced398 (patch)
tree7db287a79567ebffbc8bf225499d8dac7e742308
parent05414bd22e5c18afd876aa481fb6648458bad6b5 (diff)
downloadgnulib-12856373f8fd28a9d4453d6df97b2fdd17ced398.tar.gz
Move the support of O_NONBLOCK in open() to the 'open' module.
* modules/nonblocking (Depends-on): Remove 'open'. * m4/nonblocking.m4 (gl_NONBLOCKING_IO_BODY): Set gl_cv_have_open_O_NONBLOCK. * m4/open.m4 (gl_FUNC_OPEN): Replace open() also when required for O_NONBLOCK support. * doc/posix-functions/open.texi: Document support for O_NONBLOCK.
-rw-r--r--ChangeLog10
-rw-r--r--doc/posix-functions/open.texi4
-rw-r--r--m4/nonblocking.m48
-rw-r--r--m4/open.m411
-rw-r--r--modules/nonblocking1
5 files changed, 31 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c5e07aa078..48a12610ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-04-19 Bruno Haible <bruno@clisp.org>
+
+ Move the support of O_NONBLOCK in open() to the 'open' module.
+ * modules/nonblocking (Depends-on): Remove 'open'.
+ * m4/nonblocking.m4 (gl_NONBLOCKING_IO_BODY): Set
+ gl_cv_have_open_O_NONBLOCK.
+ * m4/open.m4 (gl_FUNC_OPEN): Replace open() also when required for
+ O_NONBLOCK support.
+ * doc/posix-functions/open.texi: Document support for O_NONBLOCK.
+
2011-04-17 Bruno Haible <bruno@clisp.org>
pipe2: Simplify code.
diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi
index 223126f61e..7ccb4861e4 100644
--- a/doc/posix-functions/open.texi
+++ b/doc/posix-functions/open.texi
@@ -14,6 +14,10 @@ and (without the slash) names a nonexistent file or a file that is not a
directory, on some platforms:
FreeBSD 7.2, AIX 7.1, HP-UX 11.00, Solaris 9, Irix 5.3.
@item
+This function does not support the @code{O_NONBLOCK} flag when it is defined
+by the gnulib module @code{nonblock} on some platforms:
+mingw.
+@item
On Windows platforms (excluding Cygwin), this function does usually not
recognize the @file{/dev/null} filename.
@end itemize
diff --git a/m4/nonblocking.m4 b/m4/nonblocking.m4
index 8224626bef..fd6faeea63 100644
--- a/m4/nonblocking.m4
+++ b/m4/nonblocking.m4
@@ -1,4 +1,4 @@
-# nonblocking.m4 serial 1
+# nonblocking.m4 serial 2
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,
@@ -6,6 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Tests whether non-blocking I/O is natively supported by read(), write().
dnl Sets gl_cv_have_nonblocking.
+dnl Also tests whether open() supports O_NONBLOCK.
+dnl Sets gl_cv_have_open_O_NONBLOCK.
AC_DEFUN([gl_NONBLOCKING_IO],
[
dnl Use AC_REQUIRE here, so that the default behavior below is expanded
@@ -20,4 +22,8 @@ AC_DEFUN([gl_NONBLOCKING_IO_BODY],
mingw*) gl_cv_have_nonblocking=no ;;
*) gl_cv_have_nonblocking=yes ;;
esac
+ case "$host_os" in
+ mingw*) gl_cv_have_open_O_NONBLOCK=no ;;
+ *) gl_cv_have_open_O_NONBLOCK=yes ;;
+ esac
])
diff --git a/m4/open.m4 b/m4/open.m4
index bfebdab7b6..690cc648d0 100644
--- a/m4/open.m4
+++ b/m4/open.m4
@@ -1,4 +1,4 @@
-# open.m4 serial 11
+# open.m4 serial 12
dnl Copyright (C) 2007-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,
@@ -62,6 +62,15 @@ changequote([,])dnl
esac
;;
esac
+ dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
+ m4_ifdef([gl_NONBLOCKING_IO], [
+ if test $REPLACE_OPEN = 0; then
+ gl_NONBLOCKING_IO
+ if test $gl_cv_have_open_O_NONBLOCK != yes; then
+ gl_REPLACE_OPEN
+ fi
+ fi
+ ])
])
AC_DEFUN([gl_REPLACE_OPEN],
diff --git a/modules/nonblocking b/modules/nonblocking
index cce41db972..2d469ebaa4 100644
--- a/modules/nonblocking
+++ b/modules/nonblocking
@@ -12,7 +12,6 @@ m4/asm-underscore.m4
Depends-on:
fcntl-h
ioctl
-open
stdbool
stdio
sys_socket