]> git.armaanb.net Git - slock.git/commit
Refactor dontkillme()
authorFRIGN <dev@frign.de>
Mon, 22 Aug 2016 23:45:46 +0000 (01:45 +0200)
committerMarkus Teich <markus.teich@stusta.mhn.de>
Tue, 30 Aug 2016 23:06:44 +0000 (01:06 +0200)
commit137f0076c2986306109d637599b885bdaf92cd58
tree151b5b2148151e90bbe520de11358a8d43a391b9
parenta9eddbd94fb03a36186ef2b1e784468dfcddbc19
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.
slock.c