chiark / gitweb /
core: add new "scope" unit type for making a unit of pre-existing processes
[elogind.git] / src / shared / cgroup-util.c
index 5816b7d4d6fd991a3c4d9cb8ce17ba978a8ab502..0e5da23ecd50f3eeaab48727505514a87fa924f6 100644 (file)
@@ -1679,6 +1679,23 @@ int cg_attach_with_mask(CGroupControllerMask mask, const char *path, pid_t pid)
         return r;
 }
 
+int cg_attach_many_with_mask(CGroupControllerMask mask, const char *path, Set* pids) {
+        Iterator i;
+        void *pidp;
+        int r = 0;
+
+        SET_FOREACH(pidp, pids, i) {
+                pid_t pid = PTR_TO_LONG(pidp);
+                int k;
+
+                k = cg_attach_with_mask(mask, path, pid);
+                if (k < 0)
+                        r = k;
+        }
+
+        return r;
+}
+
 int cg_migrate_with_mask(CGroupControllerMask mask, const char *from, const char *to) {
         CGroupControllerMask bit = 1;
         const char *n;