fix self-defense with SIGSTOP

This commit is contained in:
Alexey Avramov 2019-02-05 21:33:28 +09:00
parent 7367d4f2d2
commit 11336d707c

3
nohang
View File

@ -73,6 +73,7 @@ def stop():
oom_score_r = int( oom_score_r = int(
rline1('/proc/' + pid + '/oom_score') rline1('/proc/' + pid + '/oom_score')
) )
print('PID: {}, State: {}, oom_score {}'.format(pid, pid_to_state(pid), oom_score_r))
if uid_r != '0' and oom_score_r > 10: if uid_r != '0' and oom_score_r > 10:
stopped_list.append(pid) stopped_list.append(pid)
print('Send SIGSTOP to {}, {}, {}...'.format( print('Send SIGSTOP to {}, {}, {}...'.format(
@ -84,6 +85,8 @@ def stop():
except ProcessLookupError: except ProcessLookupError:
continue continue
print('Stop time:', t2 - t1) print('Stop time:', t2 - t1)
stdout.flush()
return stopped_list return stopped_list
def cont(stopped_list): def cont(stopped_list):