chiark / gitweb /
core,systemctl: add bus API to retrieve processes of a unit
[elogind.git] / src / basic / process-util.c
index ed850824ff4bfe049813ac462709b8aa910e556a..d146638b8e9188159c5e02a74f8d09e6313922f1 100644 (file)
@@ -742,6 +742,18 @@ void valgrind_summary_hack(void) {
 #endif
 }
 
+int pid_compare_func(const void *a, const void *b) {
+        const pid_t *p = a, *q = b;
+
+        /* Suitable for usage in qsort() */
+
+        if (*p < *q)
+                return -1;
+        if (*p > *q)
+                return 1;
+        return 0;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",