From d3490f2756da40a76f005910dcd9d2728eec2949 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 7 Mar 2006 21:02:45 +0000 Subject: 2006-03-07 Till Strauman PR 886/filesystem * libcsupport/src/libio.c: fcntl(fd,F_GETFL) fails to set O_NONBLOCK if the descriptor is in non-blocking mode. --- cpukit/ChangeLog | 6 ++++++ cpukit/libcsupport/src/libio.c | 27 ++++++++++++++++----------- 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 + + 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 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 #include -#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 #include /* 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 ) { -- cgit v1.2.3