Skip to content

threadWaitRead/registerFd unusable

The following program:

module Main where

import System.Posix.IO
import GHC.Event

main = do
  Just mgr <- getSystemEventManager
  fd <- openFd "/tmp/bleh" ReadOnly Nothing defaultFileFlags { nonBlock = True }
  key <- registerFd mgr (\_ _ -> putStrLn "hello") fd evtRead MultiShot
  return ()

fails with:

*** Exception: modifyFdOnce: permission denied (Operation not permitted)

Since threadWaitRead and family are implemented in terms of registerFd, they also fail with the same error.

Perhaps I am misunderstanding how to use this function, but in this case the conditions that must hold true regarding file descriptors should be documented somewhere.

Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information