Module: kamailio Branch: master Commit: 4a335848f1b2b1e685891258803d1acd5540710d URL: https://github.com/kamailio/kamailio/commit/4a335848f1b2b1e685891258803d1acd...
Author: Xenofon Karamanos xk@gilawa.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-01-29T08:17:17+01:00
main: Print open file limits
---
Modified: src/main.c
---
Diff: https://github.com/kamailio/kamailio/commit/4a335848f1b2b1e685891258803d1acd... Patch: https://github.com/kamailio/kamailio/commit/4a335848f1b2b1e685891258803d1acd...
---
diff --git a/src/main.c b/src/main.c index 9e315285998..a29857757bc 100644 --- a/src/main.c +++ b/src/main.c @@ -59,6 +59,7 @@ #include <sys/utsname.h> #include <sys/stat.h> #include <sys/mman.h> +#include <sys/resource.h> /* getrlimit */ #include <fcntl.h> #include <sys/time.h> #include <sys/wait.h> @@ -2209,6 +2210,7 @@ int main(int argc, char **argv) char *tbuf_tmp; struct stat st = {0}; long l1 = 0; + struct rlimit lim;
int option_index = 0;
@@ -3310,7 +3312,16 @@ int main(int argc, char **argv) fprintf(stderr, "ERROR: error could not increase file limits\n"); goto error; } + } else { + if(getrlimit(RLIMIT_NOFILE, &lim) < 0) { + LM_CRIT("cannot get the maximum number of file descriptors: %s\n", + strerror(errno)); + goto error; + } + LM_INFO("current open file limits [soft/hard]: [%lu/%lu]\n", + (unsigned long)lim.rlim_cur, (unsigned long)lim.rlim_max); } + if(mlock_pages) mem_lock_pages();