0

I'm using setrlimit(2) to set process' CPU time limit with option RLIMIT_CPU. However, I noticed that idle time do not counts for this option. For example, if you sleep(3) forever, you'll never get SIGKILLed. I need processes calling sleep(3) to get SIGKILLed too. What can I do? (this must be done programmatically)

matheuscscp
  • 827
  • 7
  • 23
  • Why not simply `exit` instead of `sleep` in the first place ? Also, note that `SIGKILL` terminates the process immediately, it is probably better to just `SIGTERM`, cleaning up on exit. – dtouch3d Sep 07 '16 at 21:00
  • Because the processes that may call `sleep(3)` are from untrusted sources... It's hard to control what the program will do. – matheuscscp Sep 07 '16 at 21:04
  • They can also handle `SIGTERM`... They should be `SIGKILL`ed. – matheuscscp Sep 07 '16 at 21:04

0 Answers0