mirror of
https://github.com/sheumann/hush.git
synced 2025-01-27 06:34:03 +00:00
chrt: correct opt_complementary. Closes bug 2977
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
b2fa0b6219
commit
96c8a6b5ea
@ -54,7 +54,7 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
int policy = SCHED_RR;
|
int policy = SCHED_RR;
|
||||||
|
|
||||||
/* at least 1 arg; only one policy accepted */
|
/* at least 1 arg; only one policy accepted */
|
||||||
opt_complementary = "-1:r--fo:f--ro:r--fo";
|
opt_complementary = "-1:r--fo:f--ro:o--rf";
|
||||||
opt = getopt32(argv, "+mprfo");
|
opt = getopt32(argv, "+mprfo");
|
||||||
if (opt & OPT_r)
|
if (opt & OPT_r)
|
||||||
policy = SCHED_RR;
|
policy = SCHED_RR;
|
||||||
@ -90,13 +90,13 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
print_rt_info:
|
print_rt_info:
|
||||||
pol = sched_getscheduler(pid);
|
pol = sched_getscheduler(pid);
|
||||||
if (pol < 0)
|
if (pol < 0)
|
||||||
bb_perror_msg_and_die("can't %cet pid %d's policy", 'g', pid);
|
bb_perror_msg_and_die("can't %cet pid %d's policy", 'g', (int)pid);
|
||||||
printf("pid %d's %s scheduling policy: %s\n",
|
printf("pid %d's %s scheduling policy: %s\n",
|
||||||
pid, current_new, policies[pol].name);
|
pid, current_new, policies[pol].name);
|
||||||
if (sched_getparam(pid, &sp))
|
if (sched_getparam(pid, &sp))
|
||||||
bb_perror_msg_and_die("can't get pid %d's attributes", pid);
|
bb_perror_msg_and_die("can't get pid %d's attributes", (int)pid);
|
||||||
printf("pid %d's %s scheduling priority: %d\n",
|
printf("pid %d's %s scheduling priority: %d\n",
|
||||||
pid, current_new, sp.sched_priority);
|
(int)pid, current_new, sp.sched_priority);
|
||||||
if (!*argv) {
|
if (!*argv) {
|
||||||
/* Either it was just "-p <pid>",
|
/* Either it was just "-p <pid>",
|
||||||
* or it was "-p <priority> <pid>" and we came here
|
* or it was "-p <priority> <pid>" and we came here
|
||||||
@ -115,7 +115,7 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
sp.sched_priority = xstrtou_range(priority, 0, policy != SCHED_OTHER ? 1 : 0, 99);
|
sp.sched_priority = xstrtou_range(priority, 0, policy != SCHED_OTHER ? 1 : 0, 99);
|
||||||
|
|
||||||
if (sched_setscheduler(pid, policy, &sp) < 0)
|
if (sched_setscheduler(pid, policy, &sp) < 0)
|
||||||
bb_perror_msg_and_die("can't %cet pid %d's policy", 's', pid);
|
bb_perror_msg_and_die("can't %cet pid %d's policy", 's', (int)pid);
|
||||||
|
|
||||||
if (!argv[0]) /* "-p <priority> <pid> [...]" */
|
if (!argv[0]) /* "-p <priority> <pid> [...]" */
|
||||||
goto print_rt_info;
|
goto print_rt_info;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user