From 00bfde3b0bbcfb41627fbaa4ca2df9f4fbdf2a79 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Wed, 1 Aug 2007 20:01:03 +0000 Subject: [PATCH] log fd limits on startup --- src/main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main.c b/src/main.c index 7221cc2..ea7f710 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,8 @@ #include "bouncer.h" +#include + #include #include @@ -396,6 +398,18 @@ static void write_pidfile(void) atexit(remove_pidfile); } +/* just print out max files, in the future may warn if something is off */ +static void check_limits(void) +{ + struct rlimit lim; + int err = getrlimit(RLIMIT_NOFILE, &lim); + if (err < 0) + log_error("could not get RLIMIT_NOFILE: %s", strerror(errno)); + else + log_info("File descriptors limits: S:%d H:%d", + (int)lim.rlim_cur, (int)lim.rlim_max); +} + static void daemon_setup(void) { if (!cf_reboot) @@ -444,6 +458,9 @@ int main(int argc, char *argv[]) cf_config_file = argv[optind]; load_config(false); + /* need to do that after loading config */ + check_limits(); + /* init random */ srandom(time(NULL) ^ getpid()); -- 2.40.0