chiark / gitweb /
basic: include only what we use
[elogind.git] / src / shared / bus-util.c
index 8b79883727e07a144f4976d52fa5da9968d503ab..4b0337b34a44f0e5f504642b36b6c454b3b65c56 100644 (file)
@@ -1454,14 +1454,14 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
 
                 return 0;
 
-        } else if (streq(field, "RandomSec")) {
+        } else if (streq(field, "RandomizedDelaySec")) {
                 usec_t t;
 
                 r = parse_sec(eq, &t);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to parse RandomSec= parameter: %s", eq);
+                        return log_error_errno(r, "Failed to parse RandomizedDelaySec= parameter: %s", eq);
 
-                r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, "RandomUSec");
+                r = sd_bus_message_append_basic(m, SD_BUS_TYPE_STRING, "RandomizedDelayUSec");
                 if (r < 0)
                         return bus_log_create_error(r);
 
@@ -2380,23 +2380,28 @@ int bus_property_get_rlimit(
         struct rlimit *rl;
         uint64_t u;
         rlim_t x;
+        const char *is_soft;
 
         assert(bus);
         assert(reply);
         assert(userdata);
 
+        is_soft = endswith(property, "Soft");
         rl = *(struct rlimit**) userdata;
         if (rl)
-                x = rl->rlim_max;
+                x = is_soft ? rl->rlim_cur : rl->rlim_max;
         else {
                 struct rlimit buf = {};
                 int z;
+                const char *s;
+
+                s = is_soft ? strndupa(property, is_soft - property) : property;
 
-                z = rlimit_from_string(strstr(property, "Limit"));
+                z = rlimit_from_string(strstr(s, "Limit"));
                 assert(z >= 0);
 
                 getrlimit(z, &buf);
-                x = buf.rlim_max;
+                x = is_soft ? buf.rlim_cur : buf.rlim_max;
         }
 
         /* rlim_t might have different sizes, let's map