MINOR: haproxy: prepare to move limits-related code

This patch is done in order to prepare the move of handlers to compute and to
check process related limits as maxconn, maxsock, maxpipes.

So, these handlers become no longer static due to the future move.

We add the handlers declarations in limits.h in this patch as well, in order to
keep the next patch, dedicated to code replacement, without any additional
modifications.

Such split also assures that this patch can be compiled separately from the
next one, where we moving the handlers. This  is important in case of
git-bisect.
This commit is contained in:
Valentine Krasnobaeva 2024-07-10 12:51:08 +02:00 committed by Willy Tarreau
parent b8dc783eb9
commit 22db643648
2 changed files with 12 additions and 4 deletions

View File

@ -12,6 +12,14 @@
extern unsigned int rlim_fd_cur_at_boot;
extern unsigned int rlim_fd_max_at_boot;
/* handlers to compute internal process limits, if they are not provided via
* cmd line or via configuration file.
*/
int compute_ideal_maxpipes();
int compute_ideal_maxconn();
int compute_ideal_maxsock(int maxconn);
int check_if_maxsock_permitted(int maxsock);
/* handlers to manipulate system resources limits granted by OS to process and
* to tie them up with the internal process limits
*/

View File

@ -1445,7 +1445,7 @@ static void ha_random_boot(char *const *argv)
* Note that a value of zero means there is no need for pipes. -1 is never
* returned if global.maxconn is valid.
*/
static int compute_ideal_maxpipes()
int compute_ideal_maxpipes()
{
struct proxy *cur;
int nbfe = 0, nbbe = 0;
@ -1494,7 +1494,7 @@ static int compute_ideal_maxpipes()
* used to rely on this value as the default one. The system will emit a
* warning indicating how many FDs are missing anyway if needed.
*/
static int compute_ideal_maxconn()
int compute_ideal_maxconn()
{
int ssl_sides = !!global.ssl_used_frontend + !!global.ssl_used_backend;
int engine_fds = global.ssl_used_async_engines * ssl_sides;
@ -1574,7 +1574,7 @@ static int compute_ideal_maxconn()
* temporarily change global.maxconn for the time needed to propagate the
* computations, and will reset it.
*/
static int compute_ideal_maxsock(int maxconn)
int compute_ideal_maxsock(int maxconn)
{
int maxpipes = global.maxpipes;
int maxsock = global.maxsock;
@ -1610,7 +1610,7 @@ static int compute_ideal_maxsock(int maxconn)
* that the setting is possible, so that we defer the error processing to the
* final stage in charge of enforcing this.
*/
static int check_if_maxsock_permitted(int maxsock)
int check_if_maxsock_permitted(int maxsock)
{
struct rlimit orig_limit, test_limit;
int ret;