From: FRIGN Date: Mon, 22 Aug 2016 23:45:46 +0000 (+0200) Subject: Refactor dontkillme() X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=137f0076c2986306109d637599b885bdaf92cd58;hp=137f0076c2986306109d637599b885bdaf92cd58;p=slock.git Refactor dontkillme() - Use file pointers instead of raw I/O, inspired by Kernel code. - Use OOM_SCORE_ADJ_MIN from linux/oom.h instead of working with magic values. - Stricter error checking and descriptive error messages. The reasoning for using the constant rather than magic values lies in the fact that this ensures people get the message. With "-1000", a code reviewer would question if that is really the lowest possible number or just an arbitrary value. The kernel ABI probably won't change, but even in the case, we wouldn't have to modify the code. The OOM killer only is guaranteed to not kill you if you have OOM_SCORE_ADJ_MIN. ---