summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-03-07 21:02:45 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-03-07 21:02:45 +0000
commitd3490f2756da40a76f005910dcd9d2728eec2949 (patch)
tree7ae65c0dd3518720f37489b5c34ef8ec3ecf182e /cpukit
parent2006-03-07 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-d3490f2756da40a76f005910dcd9d2728eec2949.tar.bz2
2006-03-07 Till Strauman <strauman@slac.stanford.edu>
PR 886/filesystem * libcsupport/src/libio.c: fcntl(fd,F_GETFL) fails to set O_NONBLOCK if the descriptor is in non-blocking mode.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog6
-rw-r--r--cpukit/libcsupport/src/libio.c27
2 files changed, 22 insertions, 11 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 66337501f9..9dc9345db8 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-07 Till Strauman <strauman@slac.stanford.edu>
+
+ PR 886/filesystem
+ * libcsupport/src/libio.c: fcntl(fd,F_GETFL) fails to set O_NONBLOCK if
+ the descriptor is in non-blocking mode.
+
2006-03-07 Joel Sherrill <joel@OARcorp.com>
PR 866/rtems
diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c
index c30c54e2b3..0c42b61854 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 @@ uint32_t 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 ) {