[Haskell-cafe] setResourceLimit

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Wed May 6 16:25:54 EDT 2009

Hash: SHA1

On May 6, 2009, at 16:18 , brian at lorf.org wrote:
> On Tuesday, 05.05.09 at 22:48, Brandon S. Allbery KF8NH wrote:
>> On May 5, 2009, at 04:52 , brian at lorf.org wrote:
>>> I have a long-lived multithreaded server process that needs to  
>>> execute
>>> programs and interact with them via Handles. The programs could
>>> misbehave, like loop or hang, so I need to limit the real and CPU  
>>> time
>>> they can take.
>> An alternative is to forkProcess and have the child  
>> setResourceLimit and
>> then executeFile.
> The documentation for forkProcess seems to say that Handle-based I/O
> won't work in the child process. I need to communicate with the  
> program
> I'm running via its standard input and output. Does this mean
> forkProcess is out of the question?

No.  What it means is that, if the child will continue to run in the  
same Haskell program after forkProcess-ing, any open Handles won't  
work right.  You could fix this with handleToFd and fdToHandle, I  
suspect, but it's irrelevant because you're going to executeFile  

- --
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

Version: GnuPG v2.0.10 (Darwin)


More information about the Haskell-Cafe mailing list