mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
MFC r206397:
Enhance r199804 by marking the daemonised child as immune to OOM instead of short-living parent. Only mark the master process that accepts connections, do not protect connection handlers spawned from inetd.
This commit is contained in:
parent
b754ab83bc
commit
eada7f55a8
1 changed files with 4 additions and 4 deletions
|
|
@ -1293,10 +1293,6 @@ main(int ac, char **av)
|
|||
/* Initialize configuration options to their default values. */
|
||||
initialize_server_options(&options);
|
||||
|
||||
/* Avoid killing the process in high-pressure swapping environments. */
|
||||
if (madvise(NULL, 0, MADV_PROTECT) != 0)
|
||||
debug("madvise(): %.200s", strerror(errno));
|
||||
|
||||
/* Parse command-line arguments. */
|
||||
while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:C:dDeiqrtQRT46")) != -1) {
|
||||
switch (opt) {
|
||||
|
|
@ -1663,6 +1659,10 @@ main(int ac, char **av)
|
|||
/* Reinitialize the log (because of the fork above). */
|
||||
log_init(__progname, options.log_level, options.log_facility, log_stderr);
|
||||
|
||||
/* Avoid killing the process in high-pressure swapping environments. */
|
||||
if (!inetd_flag && madvise(NULL, 0, MADV_PROTECT) != 0)
|
||||
debug("madvise(): %.200s", strerror(errno));
|
||||
|
||||
/* Initialize the random number generator. */
|
||||
arc4random_stir();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue