From 09ff713743bbe69fc68e4875085c162d0bf1f9fb Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 20 Apr 2018 12:37:17 -0700 Subject: [PATCH] ircd::info: Query the RLIMIT_NOFILE; minor fixes. --- include/ircd/info.h | 7 ++++--- ircd/info.cc | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/ircd/info.h b/include/ircd/info.h index 0c1388956..b63cce1bc 100644 --- a/include/ircd/info.h +++ b/include/ircd/info.h @@ -44,9 +44,10 @@ namespace ircd::info extern const size_t hardware_concurrency; extern const size_t destructive_interference; extern const size_t constructive_interference; - extern const uint64_t rlimit_as; - extern const uint64_t rlimit_data; - extern const uint64_t rlimit_rss; + extern const size_t rlimit_as; + extern const size_t rlimit_data; + extern const size_t rlimit_rss; + extern const size_t rlimit_nofile; #ifdef HAVE_SYS_UTSNAME_H extern const ::utsname utsname; #endif diff --git a/ircd/info.cc b/ircd/info.cc index bc84ba31d..1534d861a 100644 --- a/ircd/info.cc +++ b/ircd/info.cc @@ -66,6 +66,16 @@ ircd::info::init() destructive_interference, constructive_interference }; + + // This message flashes posix information about the resource limits + log::debug + { + "AS=%lu DATA=%lu RSS=%lu NOFILE=%zu", + rlimit_as, + rlimit_data, + rlimit_rss, + rlimit_nofile + }; } extern "C" const char *const @@ -182,7 +192,7 @@ static uint64_t _get_rlimit(const int &resource) { rlimit rlim; - ircd::syscall(getrlimit, RLIMIT_AS, &rlim); + ircd::syscall(getrlimit, resource, &rlim); return rlim.rlim_cur; } #else @@ -211,6 +221,12 @@ ircd::info::rlimit_rss _get_rlimit(RLIMIT_RSS) }; +decltype(ircd::info::rlimit_nofile) +ircd::info::rlimit_nofile +{ + _get_rlimit(RLIMIT_NOFILE) +}; + decltype(ircd::info::max_align) ircd::info::max_align {