> On Mar 1, 2017, at 3:10 PM, Carl Hoefs <[email protected]> wrote: > > This is a multi-tasking server of sorts that runs different analysis > algorithms on demand depending on what's requested. But much of the > algorithmic code is "hostile" (i.e., student code) so it's unreliable at > best. I can firewall against the accvio's with NS_HANDLER et al, but not the > hangs and infinite loops. I was just fishing for a nicer solution than kill > -9...
The most reliable thing to do is to run the student code as a separate process. You may be able to make use of alarm(3) or setitimer(2). These functions will send SIGALRM to your process after a specified timeout. That will in turn kill your process if you don't have a handler for that signal. Once the alarm is set there is no need for further interaction from your process, so the timeout will be reliably enforced even if the student code is stuck in a hang or a loop. I can't argue with the classification of student code as "hostile" and "malicious". -- Greg Parker [email protected] <mailto:[email protected]> Runtime Wrangler _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
