]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: limits: prepare to keep limits in one place
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 10 Jul 2024 10:15:45 +0000 (12:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 10 Jul 2024 16:05:48 +0000 (18:05 +0200)
The code which gets, sets and checks initial and current fd limits and process
related limits (maxconn, maxsock, ulimit-n, fd-hard-limit) is spread around
different functions in haproxy.c and in fd.c. Let's group it together in
dedicated limits.c and limits.h.

This patch is done in order to prepare the moving of limits-related functions
from different places to the new 'limits' compilation unit. It helps to keep
clean the next patch, which will do only the move without any additional
modifications.

Such detailed split is needed in order to be sure not to break accidentally
limits logic and in order to be able to compile each commit separately in case
of git-bisect.

Makefile
include/haproxy/limits.h [new file with mode: 0644]
src/extcheck.c
src/haproxy.c
src/limits.c [new file with mode: 0644]

index ab3f3b1d375c73b6b4a1b56740485e83d16d018e..1178229eb78fc936028e2bf2d1fa5c12705f1e2a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -982,7 +982,8 @@ OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/stream.o               \
         src/hpack-tbl.o src/ebsttree.o src/ebistree.o src/auth.o       \
         src/hpack-huff.o src/freq_ctr.o src/dict.o src/wdt.o           \
         src/pipe.o src/init.o src/http_acl.o src/hpack-enc.o           \
-        src/ebtree.o src/dgram.o src/hash.o src/version.o
+        src/ebtree.o src/dgram.o src/hash.o src/version.o              \
+        src/limits.o
 
 ifneq ($(TRACE),)
   OBJS += src/calltrace.o
diff --git a/include/haproxy/limits.h b/include/haproxy/limits.h
new file mode 100644 (file)
index 0000000..2a76e2c
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Handlers for process resources limits.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later.
+ *
+ */
+
+#ifndef _HAPROXY_LIMITS_H
+#define _HAPROXY_LIMITS_H
+#include <sys/resource.h>
+
+#endif /* _HAPROXY_LIMITS_H */
index c667b1635cc0feb7e1392b872707895f0d282e2b..05c53ff9f6f2d36a44c17d095ccd86c16b7fdd7c 100644 (file)
@@ -32,6 +32,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/global.h>
 #include <haproxy/list.h>
+#include <haproxy/limits.h>
 #include <haproxy/proxy.h>
 #include <haproxy/server.h>
 #include <haproxy/signal.h>
index 8fdc4b86037bcfb49c6f46cb4a91f9963b8376fd..cf23dba529bbdf68dd1ed140b0386937a1e796d1 100644 (file)
@@ -92,6 +92,7 @@
 #include <haproxy/global.h>
 #include <haproxy/hlua.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/limits.h>
 #if defined(USE_LINUX_CAP)
 #include <haproxy/linuxcap.h>
 #endif
diff --git a/src/limits.c b/src/limits.c
new file mode 100644 (file)
index 0000000..a80a2ac
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Handlers for process resources limits.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later.
+ *
+ */
+
+#include <haproxy/compat.h>
+#include <haproxy/global.h>
+#include <haproxy/limits.h>
+#include <haproxy/proxy.h>
+
+