exit(rc);
}
-static void show_rt_info(const char *what, pid_t pid)
+static void show_rt_info(pid_t pid, int isnew)
{
struct sched_param sp;
int policy;
if (policy == -1)
err(EXIT_FAILURE, _("failed to get pid %d's policy"), pid);
- printf(_("pid %d's %s scheduling policy: "), pid, what);
+ if (isnew)
+ printf(_("pid %d's new scheduling policy: "), pid);
+ else
+ printf(_("pid %d's current scheduling policy: "), pid);
+
switch (policy) {
case SCHED_OTHER:
printf("SCHED_OTHER\n");
if (sched_getparam(pid, &sp))
err(EXIT_FAILURE, _("failed to get pid %d's attributes"), pid);
- printf(_("pid %d's %s scheduling priority: %d\n"),
- pid, what, sp.sched_priority);
+ if (isnew)
+ printf(_("pid %d's new scheduling priority: %d\n"),
+ pid, sp.sched_priority);
+ else
+ printf(_("pid %d's current scheduling priority: %d\n"),
+ pid, sp.sched_priority);
}
static void show_min_max(void)
show_usage(EXIT_FAILURE);
if ((pid > -1) && (verbose || argc - optind == 1)) {
- show_rt_info(_("current"), pid);
+ show_rt_info(pid, FALSE);
if (argc - optind == 1)
return EXIT_SUCCESS;
}
err(EXIT_FAILURE, _("failed to set pid %d's policy"), pid);
if (verbose)
- show_rt_info(_("new"), pid);
+ show_rt_info(pid, TRUE);
if (!pid) {
argv += optind + 1;