]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: haproxy: prepare to move limits-related code
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 10 Jul 2024 10:51:08 +0000 (12:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 10 Jul 2024 16:05:48 +0000 (18:05 +0200)
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.

include/haproxy/limits.h
src/haproxy.c

index f9ff625f3beed29eae3aa12369a5b0e8d79c4c9a..50937a32aae992baf8a6e999fae77ce215c54c6c 100644 (file)
 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
  */
index 4c63c22f6dc166b78a6ca6d852b558871eeb7d1f..ea53f9130e9ca845eeafe8fa248617047658c3ce 100644 (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;