handleToFd without closing of the file descriptor

Hello I need to get the file descriptor, which is encapsulated inside a handle. handleToFd gets it, but the fd is closed. Is it possible to extract the fd from the handle, without modifying the handle? Greetings, Volker

On 27/01/2011 20:04, Volker Wysk wrote:
I need to get the file descriptor, which is encapsulated inside a handle. handleToFd gets it, but the fd is closed. Is it possible to extract the fd from the handle, without modifying the handle?
I think you mean the *Handle* is closed, not the FD, right? There's no stable/public API for extracting the FD, but you can use the internal APIs. Basically you want to copy the code for handleToFD but omit the parts to do with closing the Handle. The code is in http://darcs.haskell.org/packages/unix/System/Posix/IO.hsc Cheers, Simon
participants (2)
-
Simon Marlow
-
Volker Wysk