return cg_path_get_unit(cgroup, ret_unit);
}
+int cg_pidref_get_unit(const PidRef *pidref, char **ret) {
+ _cleanup_free_ char *unit = NULL;
+ int r;
+
+ assert(ret);
+
+ if (!pidref_is_set(pidref))
+ return -ESRCH;
+
+ r = cg_pid_get_unit(pidref->pid, &unit);
+ if (r < 0)
+ return r;
+
+ r = pidref_verify(pidref);
+ if (r < 0)
+ return r;
+
+ *ret = TAKE_PTR(unit);
+ return 0;
+}
+
/**
* Skip session-*.scope, but require it to be there.
*/
int cg_pid_get_session(pid_t pid, char **ret_session);
int cg_pid_get_owner_uid(pid_t pid, uid_t *ret_uid);
int cg_pid_get_unit(pid_t pid, char **ret_unit);
+int cg_pidref_get_unit(const PidRef *pidref, char **ret);
int cg_pid_get_user_unit(pid_t pid, char **ret_unit);
int cg_pid_get_machine_name(pid_t pid, char **ret_machine);
int cg_pid_get_slice(pid_t pid, char **ret_slice);