From 745a12fc30cfd41506c8b3a7b16b27bf9cab94ed Mon Sep 17 00:00:00 2001 From: John Birrell Date: Tue, 1 Apr 1997 22:49:58 +0000 Subject: [PATCH] Make error checking less zealous to handle devices like /dev/null which don't provide a non-blocking interface. This is a short term "fix" which changes a half-lose to a half-win. The thread that accesses a device that does not provide a non-blocking interface will block for its time slice. A medium term solution would be to use rfork. A long-term solution would be some sort of kernel thread/SMP implementation. --- lib/libc_r/uthread/uthread_fd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libc_r/uthread/uthread_fd.c b/lib/libc_r/uthread/uthread_fd.c index 4c74080e30aa..1e61bb760cae 100644 --- a/lib/libc_r/uthread/uthread_fd.c +++ b/lib/libc_r/uthread/uthread_fd.c @@ -29,6 +29,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $Id$ + * */ #include #include @@ -102,8 +104,14 @@ _thread_fd_table_init(int fd) /* Make the file descriptor non-blocking: */ if (_thread_sys_fcntl(fd, F_SETFL, - _thread_fd_table[fd]->flags | O_NONBLOCK) == -1) - ret = errno; + _thread_fd_table[fd]->flags | O_NONBLOCK) == -1) { + /* + * Some devices don't support + * non-blocking calls (sigh): + */ + if (errno != ENODEV) + ret = errno; + } } /* Check if one of the fcntl calls failed: */