Ignore addrspace resource limit if system has no RLIMIT_AS.
authorDavin McCall <davmac@davmac.org>
Fri, 5 Jul 2019 11:13:31 +0000 (21:13 +1000)
committerDavin McCall <davmac@davmac.org>
Fri, 5 Jul 2019 11:19:39 +0000 (21:19 +1000)
doc/manpages/dinit-service.5
src/load-service.cc

index 3757d7bf0561d01f047d7221c8e147a1435d7ec2..73466364d8ffb173785a568b0bd564fbb2912199 100644 (file)
@@ -292,7 +292,8 @@ data and heap allocations. Precise meaning may vary between operating systems. S
 .TP
 \fBrlimit-addrspace\fR = \fIresource-limits\fR
 Specifies the maximum size of the address space of the process. See the \fBRESOURCE LIMITS\fR
-section.
+section. Note that some operating systems (notably OpenBSD) do not support this limit; the
+setting will be ignored on such systems.
 .\"
 .SS OPTIONS
 .\"
index 1630d30114fc1434e6accfec87d5422a49d38964..f4b4af27fbf15a9a7607d270de8aefabb98cef07 100644 (file)
@@ -727,9 +727,11 @@ service_record * dirload_service_set::load_service(const char * name)
                 parse_rlimit(line, name, "rlimit-data", nofile_limits);
             }
             else if (setting == "rlimit-addrspace") {
-                string nofile_setting = read_setting_value(i, end, nullptr);
-                service_rlimits &nofile_limits = find_rlimits(rlimits, RLIMIT_AS);
-                parse_rlimit(line, name, "rlimit-addrspace", nofile_limits);
+                #if defined(RLIMIT_AS)
+                    string nofile_setting = read_setting_value(i, end, nullptr);
+                    service_rlimits &nofile_limits = find_rlimits(rlimits, RLIMIT_AS);
+                    parse_rlimit(line, name, "rlimit-addrspace", nofile_limits);
+                #endif
             }
             else {
                 throw service_description_exc(name, "Unknown setting: " + setting);