summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-03-07 21:02:00 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-03-07 21:02:00 +0000
commit5b78cd6bc981eff94840301fa87f134f1abbcb77 (patch)
treea95e17a7f4c0606d763544dd27fce2b5a18f9459
parent2006-03-07 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-5b78cd6bc981eff94840301fa87f134f1abbcb77.tar.bz2
2006-03-07 Till Strauman <strauman@slac.stanford.edu>
PR 886/filesystem * src/libio.c: fcntl(fd,F_GETFL) fails to set O_NONBLOCK if the descriptor is in non-blocking mode.
-rw-r--r--cpukit/libcsupport/ChangeLog6
-rw-r--r--cpukit/libcsupport/src/libio.c27
2 files changed, 22 insertions, 11 deletions
diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog
index 7b75feb111..92bd4689f7 100644
--- a/cpukit/libcsupport/ChangeLog
+++ b/cpukit/libcsupport/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-07 Till Strauman <strauman@slac.stanford.edu>
+
+ PR 886/filesystem
+ * src/libio.c: fcntl(fd,F_GETFL) fails to set O_NONBLOCK if the
+ descriptor is in non-blocking mode.
+
2005-08-31 Ralf Corsepius <ralf.corsepius@rtems.org>
PR 819/filesystem
diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c
index bc868dd51a..d7c7cf1f55 100644
--- a/cpukit/libcsupport/src/libio.c
+++ b/cpukit/libcsupport/src/libio.c
@@ -26,16 +26,19 @@
#include <assert.h>
#include <errno.h>
-#if ! defined(O_NDELAY)
-# if defined(solaris2)
-# define O_NDELAY O_NONBLOCK
-# elif defined(__CYGWIN__)
-# define O_NDELAY _FNBIO
-# elif defined(RTEMS_NEWLIB)
-# define O_NDELAY _FNBIO
-# endif
-#endif
-
+/* define this to alias O_NDELAY to O_NONBLOCK, i.e.,
+ * O_NDELAY is accepted on input but fcntl(F_GETFL) returns
+ * O_NONBLOCK. This is because rtems has no distinction
+ * between the two (but some systems have).
+ * Note that accepting this alias creates a problem:
+ * an application trying to clear the non-blocking flag
+ * using a
+ *
+ * fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NDELAY);
+ *
+ * does (silently) ignore the operation.
+ */
+#undef ACCEPT_O_NDELAY_ALIAS
#include <errno.h>
#include <string.h> /* strcmp */
@@ -114,7 +117,9 @@ rtems_assoc_t access_modes_assoc[] = {
};
rtems_assoc_t status_flags_assoc[] = {
+#ifdef ACCEPT_O_NDELAY_ALIAS
{ "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY },
+#endif
{ "NONBLOCK", LIBIO_FLAGS_NO_DELAY, O_NONBLOCK },
{ "APPEND", LIBIO_FLAGS_APPEND, O_APPEND },
{ "CREATE", LIBIO_FLAGS_CREATE, O_CREAT },
@@ -166,7 +171,7 @@ unsigned32 rtems_libio_to_fcntl_flags(
}
if ( (flags & LIBIO_FLAGS_NO_DELAY) == LIBIO_FLAGS_NO_DELAY ) {
- fcntl_flags |= O_NDELAY;
+ fcntl_flags |= O_NONBLOCK;
}
if ( (flags & LIBIO_FLAGS_APPEND) == LIBIO_FLAGS_APPEND ) {