aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-04-05 16:59:07 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-04-05 16:59:07 +0200
commit43d09e79db91110e7ca09610efd0b62fce453b47 (patch)
tree84e5860ca38d44d1de748271d0e437e8b9ac465e
parentae5ca6fc417161eb514103d3c2b38add18012760 (diff)
downloadbusybox-w32-43d09e79db91110e7ca09610efd0b62fce453b47.tar.gz
busybox-w32-43d09e79db91110e7ca09610efd0b62fce453b47.tar.bz2
busybox-w32-43d09e79db91110e7ca09610efd0b62fce453b47.zip
chrt: fix for SCHED_RESET_ON_FORK bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/chrt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/util-linux/chrt.c b/util-linux/chrt.c
index ede92310f..4dd78dabf 100644
--- a/util-linux/chrt.c
+++ b/util-linux/chrt.c
@@ -135,6 +135,17 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)
135 pol = sched_getscheduler(pid); 135 pol = sched_getscheduler(pid);
136 if (pol < 0) 136 if (pol < 0)
137 bb_perror_msg_and_die("can't %cet pid %u's policy", 'g', (int)pid); 137 bb_perror_msg_and_die("can't %cet pid %u's policy", 'g', (int)pid);
138#ifdef SCHED_RESET_ON_FORK
139 /* "Since Linux 2.6.32, the SCHED_RESET_ON_FORK flag
140 * can be ORed in policy when calling sched_setscheduler().
141 * As a result of including this flag, children created by
142 * fork(2) do not inherit privileged scheduling policies"
143 *
144 * This bit is also returned by sched_getscheduler()!
145 * (TODO: do we want to show it?)
146 */
147 pol &= ~SCHED_RESET_ON_FORK;
148#endif
138 printf("pid %u's %s scheduling policy: SCHED_%s\n", 149 printf("pid %u's %s scheduling policy: SCHED_%s\n",
139 pid, current_new, policy_name(pol) 150 pid, current_new, policy_name(pol)
140 ); 151 );