After `emerge` is killed because of out-of-memory (oom) by the kernel, the output is in the form of (e.g. for `sys-kernel/gentoo-sources`) ``` >>> Installing (1 of 1) sys-kernel/gentoo-sources-4.9.16::gentoo >>> Failed to install sys-kernel/gentoo-sources-4.9.16, Log file: >>> '/var/tmp/portage/sys-kernel/gentoo-sources-4.9.16/temp/build.log' * GNU info directory index is up-to-date. * IMPORTANT: 8 news items need reading for repository 'gentoo'. * Use eselect news read to view new items. ``` The referenced log file doesn't contain different information. The user can't figure out why the merging failed easily. Only `dmesg` reveals ``` [15712.020923] Out of memory: Kill process 27569 (emerge) score 570 or sacrifice child [15712.020932] Killed process 27569 (emerge) total-vm:163840kB, anon-rss:148724kB, file-rss:72kB ``` It'd be nice if `emerge` would inform the user that it was killed by OOM if that's possible or if it would otherwise consider the possibility in the failure output.
We can check which signal it was killed by, and SIGKILL usually means the OOM killer did it.
SIGKILL is never received by the application, is it?
The parent process can use WTERMSIG to see if the child process got killed by SIGKILL.