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 SIGKILL
ed. I need processes calling sleep(3)
to get SIGKILL
ed too. What can I do? (this must be done programmatically)
Asked
Active
Viewed 977 times
0

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