diff --git a/schedutils/uclampset.c b/schedutils/uclampset.c index e09d6a7f9..0de806abc 100644 --- a/schedutils/uclampset.c +++ b/schedutils/uclampset.c @@ -27,7 +27,7 @@ #include "closestream.h" #include "path.h" #include "pathnames.h" -#include "procutils.h" +#include "procfs.h" #include "sched_attr.h" #include "strutils.h" @@ -94,7 +94,7 @@ static void show_uclamp_pid_info(pid_t pid, char *cmd) if (cmd) comm = cmd; else - comm = proc_get_command_name(pid); + comm = pid_get_cmdname(pid); printf(_("%s (%d) util_clamp: min: %d max: %d\n"), comm ? : "unknown", pid, sa.sched_util_min, sa.sched_util_max); @@ -134,16 +134,17 @@ static void show_uclamp_info(struct uclampset *ctl) if (ctl->system) { show_uclamp_system_info(); } else if (ctl->all_tasks) { + DIR *sub = NULL; pid_t tid; - struct proc_tasks *ts = proc_open_tasks(ctl->pid); + struct path_cxt *pc = ul_new_procfs_path(ctl->pid, NULL); - if (!ts) + if (!pc) err(EXIT_FAILURE, _("cannot obtain the list of tasks")); - while (!proc_next_tid(ts, &tid)) + while (procfs_process_next_tid(pc, &sub, &tid) == 0) show_uclamp_pid_info(tid, NULL); - proc_close_tasks(ts); + ul_unref_path(pc); } else { show_uclamp_pid_info(ctl->pid, ctl->cmd); } @@ -175,17 +176,18 @@ static int set_uclamp_one(struct uclampset *ctl, pid_t pid) static void set_uclamp_pid(struct uclampset *ctl) { if (ctl->all_tasks) { + DIR *sub = NULL; pid_t tid; - struct proc_tasks *ts = proc_open_tasks(ctl->pid); + struct path_cxt *pc = ul_new_procfs_path(ctl->pid, NULL); - if (!ts) + if (!pc) err(EXIT_FAILURE, _("cannot obtain the list of tasks")); - while (!proc_next_tid(ts, &tid)) + while (procfs_process_next_tid(pc, &sub, &tid) == 0) { if (set_uclamp_one(ctl, tid) == -1) err(EXIT_FAILURE, _("failed to set tid %d's uclamp values"), tid); - - proc_close_tasks(ts); + } + ul_unref_path(pc); } else if (set_uclamp_one(ctl, ctl->pid) == -1) { err(EXIT_FAILURE, _("failed to set pid %d's uclamp values"), ctl->pid);