How to get the file descriptor of a handle?
Jeremy Shaw
jeremy at n-heptane.com
Sat Feb 13 19:58:43 EST 2010
Hello,
In GHC 6.12 there is no guarantee that a Handle is backed up by a file
descriptor. That said, check out the handleToFd defined on line 141
here:
http://patch-tag.com/r/mae/sendfile/snapshot/current/content/pretty/src/Network/Socket/SendFile/Internal.hs
A better type might be:
handleToFd :: Handle -> IO (Maybe Fd)
instead of raising an exception. Having a Handle not backed by a Fd is
not really an 'exceptional' condition after all.
- jeremy
On Feb 13, 2010, at 6:23 AM, Volker Wysk wrote:
> Hello
>
> I'd like to know how you get the file descriptor, which is
> incapsulated in a handle. The libraries GHC.IO.Handle/
> GHC.IO.Handle.FD only provide for the other direction.
>
> The function haFD, which I've used before I've updated to the
> current version of GHC (6.12), appears to be in use two times in the
> libraries. But there isn't a definition anywhere.
>
>
> Any help would be appreciated.
>
> Cheers,
> Volker
>
>
> --
> Volker Wysk <pf3 at volker-wysk.de>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list