chiark / gitweb /
Prep v234: Apply missing upstream fixes in src/basic (1/6)
[elogind.git] / src / basic / process-util.c
index 08ec66fb31a5f647747a77ce7c4174c37d1ad5fe..da825a7c3c5f6d2916980430d71f2e6d8bae870e 100644 (file)
@@ -814,7 +814,7 @@ int pid_from_same_root_fs(pid_t pid) {
 
         root = procfs_file_alloca(pid, "root");
 
-        return files_same(root, "/proc/1/root");
+        return files_same(root, "/proc/1/root", 0);
 }
 #endif // 0
 
@@ -914,6 +914,23 @@ int pid_compare_func(const void *a, const void *b) {
         return 0;
 }
 
+int ioprio_parse_priority(const char *s, int *ret) {
+        int i, r;
+
+        assert(s);
+        assert(ret);
+
+        r = safe_atoi(s, &i);
+        if (r < 0)
+                return r;
+
+        if (!ioprio_priority_is_valid(i))
+                return -EINVAL;
+
+        *ret = i;
+        return 0;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",