Lines Matching defs:cgroup
731 * get_self_cgroup - get the current thread cgroup path
733 * Parse /proc/$$/cgroup file to get the thread's cgroup. As an example of line to parse:
746 snprintf(path, MAX_PATH, "/proc/%d/cgroup", getpid());
796 * open_cgroup_procs - Open the cgroup.procs file for the given cgroup
798 * If cgroup argument is not NULL, the cgroup.procs file for that cgroup
799 * will be opened. Otherwise, the cgroup of the calling, i.e., rtla, thread
802 * Supports cgroup v2.
806 static int open_cgroup_procs(const char *cgroup)
808 char cgroup_path[MAX_PATH - strlen("/cgroup.procs")];
819 if (!cgroup) {
823 err_msg("Did not find self cgroup\n");
828 sizeof(cgroup_path) - strlen(cgroup_path), "%s/", cgroup);
831 snprintf(cgroup_procs, MAX_PATH, "%s/cgroup.procs", cgroup_path);
833 debug_msg("Using cgroup path at: %s\n", cgroup_procs);
843 * set_pid_cgroup - Set cgroup to pid_t pid
845 * If cgroup argument is not NULL, the threads will move to the given cgroup.
846 * Otherwise, the cgroup of the calling, i.e., rtla, thread will be used.
848 * Supports cgroup v2.
852 int set_pid_cgroup(pid_t pid, const char *cgroup)
858 cg_fd = open_cgroup_procs(cgroup);
866 err_msg("Error setting cgroup attributes for pid:%s - %s\n",
869 debug_msg("Set cgroup attributes for pid:%s\n", pid_str);
877 * set_comm_cgroup - Set cgroup to threads starting with char *comm_prefix
879 * If cgroup argument is not NULL, the threads will move to the given cgroup.
880 * Otherwise, the cgroup of the calling, i.e., rtla, thread will be used.
882 * Supports cgroup v2.
886 int set_comm_cgroup(const char *comm_prefix, const char *cgroup)
899 cg_fd = open_cgroup_procs(cgroup);
917 err_msg("Error setting cgroup attributes for pid:%s - %s\n",
922 debug_msg("Set cgroup attributes for pid:%s\n", proc_entry->d_name);