chrt: non-Linux fix
Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
e51c9822a9
commit
a96932103e
|
@ -214,6 +214,7 @@ fallback:
|
||||||
static void show_sched_info(struct chrt_ctl *ctl)
|
static void show_sched_info(struct chrt_ctl *ctl)
|
||||||
{
|
{
|
||||||
if (ctl->all_tasks) {
|
if (ctl->all_tasks) {
|
||||||
|
#ifdef __linux__
|
||||||
pid_t tid;
|
pid_t tid;
|
||||||
struct proc_tasks *ts = proc_open_tasks(ctl->pid);
|
struct proc_tasks *ts = proc_open_tasks(ctl->pid);
|
||||||
|
|
||||||
|
@ -224,6 +225,9 @@ static void show_sched_info(struct chrt_ctl *ctl)
|
||||||
show_sched_pid_info(ctl, tid);
|
show_sched_pid_info(ctl, tid);
|
||||||
|
|
||||||
proc_close_tasks(ts);
|
proc_close_tasks(ts);
|
||||||
|
#else
|
||||||
|
err(EXIT_FAILURE, _("cannot obtain the list of tasks"));
|
||||||
|
#endif
|
||||||
} else
|
} else
|
||||||
show_sched_pid_info(ctl, ctl->pid);
|
show_sched_pid_info(ctl, ctl->pid);
|
||||||
}
|
}
|
||||||
|
@ -320,6 +324,7 @@ static int set_sched_one(struct chrt_ctl *ctl, pid_t pid)
|
||||||
static void set_sched(struct chrt_ctl *ctl)
|
static void set_sched(struct chrt_ctl *ctl)
|
||||||
{
|
{
|
||||||
if (ctl->all_tasks) {
|
if (ctl->all_tasks) {
|
||||||
|
#ifdef __linux__
|
||||||
pid_t tid;
|
pid_t tid;
|
||||||
struct proc_tasks *ts = proc_open_tasks(ctl->pid);
|
struct proc_tasks *ts = proc_open_tasks(ctl->pid);
|
||||||
|
|
||||||
|
@ -331,7 +336,9 @@ static void set_sched(struct chrt_ctl *ctl)
|
||||||
err(EXIT_FAILURE, _("failed to set tid %d's policy"), tid);
|
err(EXIT_FAILURE, _("failed to set tid %d's policy"), tid);
|
||||||
|
|
||||||
proc_close_tasks(ts);
|
proc_close_tasks(ts);
|
||||||
|
#else
|
||||||
|
err(EXIT_FAILURE, _("cannot obtain the list of tasks"));
|
||||||
|
#endif
|
||||||
} else if (set_sched_one(ctl, ctl->pid) == -1)
|
} else if (set_sched_one(ctl, ctl->pid) == -1)
|
||||||
err(EXIT_FAILURE, _("failed to set pid %d's policy"), ctl->pid);
|
err(EXIT_FAILURE, _("failed to set pid %d's policy"), ctl->pid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue