Commit 0ea9ecaf authored by simonmar's avatar simonmar
Browse files

[project @ 2001-09-26 10:35:41 by simonmar]

A failure while trying to set O_NONBLOCK on a file descriptor should
be a non-fatal error.  It turns out that on FreeBSD it is an error
(ENODEV) to try to set O_NONBLOCK on /dev/null.

parent 2c910672
{-# OPTIONS -fno-implicit-prelude #-}
-- ---------------------------------------------------------------------------
-- $Id: PrelPosix.hsc,v 1.13 2001/08/23 10:36:50 sewardj Exp $
-- $Id: PrelPosix.hsc,v 1.14 2001/09/26 10:35:41 simonmar Exp $
-- POSIX support layer for the standard libraries
......@@ -212,9 +212,11 @@ getEcho fd = return False
setNonBlockingFD fd = do
flags <- throwErrnoIfMinus1Retry "setNonBlockingFD"
(fcntl_read (fromIntegral fd) (#const F_GETFL))
throwErrnoIfMinus1Retry "setNonBlockingFD"
(fcntl_write (fromIntegral fd)
(#const F_SETFL) (flags .|. #const O_NONBLOCK))
-- An error when setting O_NONBLOCK isn't fatal: on some systems
-- there are certain file handles on which this will fail (eg. /dev/null
-- on FreeBSD) so we throw away the return code from fcntl_write.
fcntl_write (fromIntegral fd)
(#const F_SETFL) (flags .|. #const O_NONBLOCK)
-- bogus defns for win32
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment