[Haskell-cafe] Genuine Need For Persistent Global State?

Bryan O'Sullivan bos at serpentine.com
Fri Oct 16 16:13:03 EDT 2009


On Fri, Oct 16, 2009 at 11:59 AM, Alan Carter <alangcarter at gmail.com> wrote:

>
> Trouble is, my function is (ultimately) being called from the C kernel
> stuff. It isn't on the bottom of a call graph coming from a Haskell main. A
> driver really needs to know where it's at. So I seem to need some kind of
> global, persistent state, and Control.Monad.State seems to be out because I
> can't pass a State around my call graph.
>

You don't need anything special for this. A Linux kernel "struct device" has
a "void *driver_data" member which is private for your use, and intended for
precisely this purpose. Global persistent state makes no more sense for
kernel drivers than for most other code: how would it work if you had two
mice plugged into your system?

If you want a decent reference on writing Linux driver code, see
http://lwn.net/Kernel/LDD3/

Your friendly kernel and Haskell hacker,
Bryan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091016/a4570d3b/attachment-0001.html


More information about the Haskell-Cafe mailing list