17 switch (cosmos::to_integral(m_limit)) {
18 CASE_ENUM_TO_STR(RLIMIT_AS);
19 CASE_ENUM_TO_STR(RLIMIT_CORE);
20 CASE_ENUM_TO_STR(RLIMIT_CPU);
21 CASE_ENUM_TO_STR(RLIMIT_DATA);
22 CASE_ENUM_TO_STR(RLIMIT_FSIZE);
23 CASE_ENUM_TO_STR(RLIMIT_LOCKS);
24 CASE_ENUM_TO_STR(RLIMIT_MEMLOCK);
25 CASE_ENUM_TO_STR(RLIMIT_MSGQUEUE);
26 CASE_ENUM_TO_STR(RLIMIT_NICE);
27 CASE_ENUM_TO_STR(RLIMIT_NOFILE);
28 CASE_ENUM_TO_STR(RLIMIT_NPROC);
29 CASE_ENUM_TO_STR(RLIMIT_RSS);
30 CASE_ENUM_TO_STR(RLIMIT_RTPRIO);
31 CASE_ENUM_TO_STR(RLIMIT_RTTIME);
32 CASE_ENUM_TO_STR(RLIMIT_SIGPENDING);
33 CASE_ENUM_TO_STR(RLIMIT_STACK);
34 default:
return "unknown";
56 auto update_rlimit = [
this, &proc]<
typename RLIM_T>() {
64 m_limit = cosmos::LimitSpec{};
71 constexpr auto RLIM_T_INFINITY = std::numeric_limits<
decltype(rlim.rlim_cur)>::max();
72 if (rlim.rlim_cur == RLIM_T_INFINITY)
73 m_limit->rlim_cur = RLIM_INFINITY;
75 m_limit->rlim_cur = rlim.rlim_cur;
77 if (rlim.rlim_max == RLIM_T_INFINITY)
78 m_limit->rlim_max = RLIM_INFINITY;
80 m_limit->rlim_max = rlim.rlim_max;
84 update_rlimit.operator()<
struct rlimit32>();
86 update_rlimit.operator()<
struct rlimit64>();