]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: fd: add a new function to only raise RLIMIT_NOFILE
authorWilly Tarreau <w@1wt.eu>
Thu, 22 Sep 2022 14:08:47 +0000 (16:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 4 Oct 2022 06:38:47 +0000 (08:38 +0200)
commit922a907926d1cb02a8a10c7cdb9917755c934c84
tree9e6d52b97ec60b3de122e711914e321cabd964d4
parent55d2e8577e5ae0e7ac0cdbf5201b4836b5d7ad3c
MINOR: fd: add a new function to only raise RLIMIT_NOFILE

In issue #1866 an issue was reported under docker, by which a user cannot
lower the number of FD needed. It looks like a restriction imposed in this
environment, but it results in an error while it ought not have to in the
case of shrinking.

This patch adds a new function raise_rlim_nofile() that takes the desired
new setting, compares it to the current one, and only calls setrlimit() if
one of the values in the new setting is larger than the older one. As such
it will continue to emit warnings and errors in case of failure to raise
the limit but will never shrink it.

This patch is only preliminary to another one, but will have to be
backported where relevant (likely only 2.6).
include/haproxy/fd.h
src/fd.c