Merge pull request #6200 from poettering/ioprio-transient
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 27 Jun 2017 01:19:33 +0000 (21:19 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 27 Jun 2017 01:30:36 +0000 (21:30 -0400)
1  2 
src/core/dbus-execute.c
src/shared/bus-unit-util.c

@@@ -166,15 -165,46 +165,45 @@@ static int property_get_ioprio
          assert(reply);
          assert(c);
  
-         if (c->ioprio_set)
-                 n = c->ioprio;
-         else {
-                 n = ioprio_get(IOPRIO_WHO_PROCESS, 0);
-                 if (n < 0)
-                         n = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 4);
-         }
+         return sd_bus_message_append(reply, "i", exec_context_get_effective_ioprio(c));
+ }
  
-         return sd_bus_message_append(reply, "i", n);
+ static int property_get_ioprio_class(
+                 sd_bus *bus,
+                 const char *path,
+                 const char *interface,
+                 const char *property,
+                 sd_bus_message *reply,
+                 void *userdata,
+                 sd_bus_error *error) {
+         ExecContext *c = userdata;
+         assert(bus);
+         assert(reply);
+         assert(c);
+         return sd_bus_message_append(reply, "i", IOPRIO_PRIO_CLASS(exec_context_get_effective_ioprio(c)));
+ }
 -
+ static int property_get_ioprio_priority(
+                 sd_bus *bus,
+                 const char *path,
+                 const char *interface,
+                 const char *property,
+                 sd_bus_message *reply,
+                 void *userdata,
+                 sd_bus_error *error) {
+         ExecContext *c = userdata;
+         assert(bus);
+         assert(reply);
+         assert(c);
+         return sd_bus_message_append(reply, "i", IOPRIO_PRIO_DATA(exec_context_get_effective_ioprio(c)));
  }
  
  static int property_get_cpu_sched_policy(
@@@ -390,15 -389,24 +390,33 @@@ int bus_append_unit_property_assignment
  
                  r = sd_bus_message_append(m, "v", "i", (int32_t) n);
  
 +        } else if (streq(field, "FileDescriptorStoreMax")) {
 +                unsigned u;
 +
 +                r = safe_atou(eq, &u);
 +                if (r < 0)
 +                        return log_error_errno(r, "Failed to parse file descriptor store limit: %s", eq);
 +
 +                r = sd_bus_message_append(m, "v", "u", (uint32_t) u);
 +
+         } else if (streq(field, "IOSchedulingClass")) {
+                 int c;
+                 c = ioprio_class_from_string(eq);
+                 if (c < 0)
+                         return log_error_errno(r, "Failed to parse IO scheduling class: %s", eq);
+                 r = sd_bus_message_append(m, "v", "i", (int32_t) c);
+         } else if (streq(field, "IOSchedulingPriority")) {
+                 int q;
+                 r = ioprio_parse_priority(eq, &q);
+                 if (r < 0)
+                         return log_error_errno(r, "Failed to parse IO scheduling priority: %s", eq);
+                 r = sd_bus_message_append(m, "v", "i", (int32_t) q);
          } else if (STR_IN_SET(field, "Environment", "PassEnvironment")) {
                  const char *p;