handleToFd without closing of the file descriptor

Simon Marlow marlowsd at gmail.com
Fri Jan 28 11:46:25 CET 2011


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




More information about the Glasgow-haskell-users mailing list