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.
This commit is contained in:
jb 1997-04-01 22:49:58 +00:00
parent 1e950f70a0
commit bc406c9764

View File

@ -29,6 +29,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*
*/
#include <errno.h>
#include <fcntl.h>
@ -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: */