From: Valentine Krasnobaeva Date: Wed, 10 Jul 2024 10:41:26 +0000 (+0200) Subject: REORG: global: move rlim_fd_*_at_boot in limits X-Git-Tag: v3.1-dev4~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8dc783eb966b124abbc337dc5a19fd4b071781e;p=thirdparty%2Fhaproxy.git REORG: global: move rlim_fd_*_at_boot in limits Let's move in 'limits' compilation unit global variables to keep the initial process fd limits. --- diff --git a/include/haproxy/global.h b/include/haproxy/global.h index 5553468786..561802a837 100644 --- a/include/haproxy/global.h +++ b/include/haproxy/global.h @@ -45,8 +45,6 @@ extern char *localpeer; extern unsigned int warned; /* bitfield of a few warnings to emit just once */ extern struct list proc_list; /* list of process in mworker mode */ extern int master; /* 1 if in master, 0 otherwise */ -extern unsigned int rlim_fd_cur_at_boot; -extern unsigned int rlim_fd_max_at_boot; extern int atexit_flag; extern unsigned char boot_seed[20]; // per-boot random seed (160 bits initially) extern THREAD_LOCAL struct buffer trash; diff --git a/include/haproxy/limits.h b/include/haproxy/limits.h index 4db6989b33..f9ff625f3b 100644 --- a/include/haproxy/limits.h +++ b/include/haproxy/limits.h @@ -9,6 +9,9 @@ #define _HAPROXY_LIMITS_H #include +extern unsigned int rlim_fd_cur_at_boot; +extern unsigned int rlim_fd_max_at_boot; + /* handlers to manipulate system resources limits granted by OS to process and * to tie them up with the internal process limits */ diff --git a/src/haproxy.c b/src/haproxy.c index cf23dba529..4c63c22f6d 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -255,8 +255,6 @@ static char **old_argv = NULL; /* previous argv but cleaned up */ struct list proc_list = LIST_HEAD_INIT(proc_list); int master = 0; /* 1 if in master, 0 if in child */ -unsigned int rlim_fd_cur_at_boot = 0; -unsigned int rlim_fd_max_at_boot = 0; /* per-boot randomness */ unsigned char boot_seed[20]; /* per-boot random seed (160 bits initially) */ diff --git a/src/limits.c b/src/limits.c index 8d0bf7b463..badeeb0895 100644 --- a/src/limits.c +++ b/src/limits.c @@ -11,6 +11,9 @@ #include +unsigned int rlim_fd_cur_at_boot = 0; +unsigned int rlim_fd_max_at_boot = 0; + /* Sets the RLIMIT_NOFILE setting to and returns the previous one * in if the pointer is not NULL, even if set_rlimit() fails. The * two pointers may point to the same variable as the copy happens after