The flag works (= kernel accepts it) for all scheduling policies
and sched_getattr() returns the flag for all policies.
There is no reason for userspace to be more smart than kernel or hide
the flag when it prints sched_getattr()/sched_getscheduler() results.
# chrt -v --reset-on-fork --batch 0 /bin/true
pid 1315019's new scheduling policy: SCHED_BATCH|SCHED_RESET_ON_FORK
# chrt -v --reset-on-fork --fifo 1 /bin/true
pid 1315055's new scheduling policy: SCHED_FIFO|SCHED_RESET_ON_FORK
# chrt -v --reset-on-fork --deadline --sched-period 10000 0 /bin/true
pid 1315182's new scheduling policy: SCHED_DEADLINE|SCHED_RESET_ON_FORK
# chrt -v --reset-on-fork --idle 0 /bin/true
pid 1315247's new scheduling policy: SCHED_IDLE|SCHED_RESET_ON_FORK
# chrt -v --reset-on-fork --rr 1 /bin/true
pid 1315275's new scheduling policy: SCHED_RR|SCHED_RESET_ON_FORK
# chrt -v --reset-on-fork --other 0 /bin/true
pid 1315311's new scheduling policy: SCHED_OTHER|SCHED_RESET_ON_FORK
Signed-off-by: Karel Zak <kzak@redhat.com>
Reviewed by many people, used for years (but probably nobody uses
SCHED_DEADLINE with reset-on-fork), but we all missed:
- sched_setscheduler() uses SCHED_RESET_ON_FORK (0x40000000)
- sched_setattr() uses SCHED_FLAG_RESET_ON_FORK (0x01)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1883013
Signed-off-by: Karel Zak <kzak@redhat.com>
mandoc: ./schedutils/chrt.1:37:2: WARNING: skipping paragraph macro: PP after SH
mandoc: ./schedutils/ionice.1:120:2: WARNING: skipping paragraph macro: PP empty
mandoc: ./schedutils/taskset.1:36:2: WARNING: skipping paragraph macro: PP after SH
####
There is no change in the ouput from "nroff" and "groff".
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Earlier, I patched various pages to consistently use EXAMPLE as a
section heading, rather than EXAMPLES. (At that time, both headings
occurred in util-linux, with roughly equal frequency.)
Since then, I've observed that EXAMPLES is the more common usage
across a large corpus of manual pages. So, in Linux the man-pages
project, I switched to using EXAMPLES also. This patch makes the same
change for util-linux.
Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.
In this patch, we ensure that the NOTES, HISTORY, BUGS, and EXAMPLE
sections are always placed near the end of the page, just above
AUTHORS, COPYRIGHT, SEE ALSO, and AVAILABILITY.
One page is not fixed by this patch: term-utils/agetty.8. This page
is a mess of unusual section names, and probably requires an individual
edit.
Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
[Apply patch]
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
$ diff a b
$ echo $?
0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.
In this patch, we ensure that the AUTHORS, COPYRIGHT, SEE ALSO, and
AVAILABILITY sections are always placed at the end of the page.
Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
[Apply patch]
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
$ diff a b
$ echo $?
0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
There is quite some value (in terms of readability and user
expectations) if consistent names are used for the sections
within manual pages. This patch is one of a series to bring
about this consistency.
Currently we have EXAMPLE (10) or EXAMPLES (23).
Let's standardize on the EXAMPLE (which is also what is
suggested in man-pages(7)) and used consistently across
a large number of pages in the Linux man-pages project.
(I realize the choice to go EXAMPLE, rather than EXAMPLES,
may be debatable. If necessary, I'd write a patch that instead
goes the other way, but I'd prefer to follow man-pages(7).)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
There is quite some value (in terms of readability and user
expectations) if consistent names are used for the sections
within manual pages. This patch is one of a series to bring
about this consistency.
In the Linux man-pages project, I long ago did away with the
AUTHOR(S) section, but I realize some projects like to keep this.
But, let's make sure that the section is consistently titled
across pages. Currently we have AUTHOR (47) or AUTHORS (41).
Let's standardize on the latter (which is also what is
suggested in man-pages(7)).
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Using double quotes in .SH lines containing multiple words is unneeded,
and in any case is not consistently done in the util-linux manual pages,
where double quotes are used in only around half of the cases.
(This usage was long ago elminated in the man-pages project, with
no ill effects reported to date.)
Remove these quotes, so that .SH lines are more uniform, in preparation
for some (more easily) scripted doiscovery of consistency problems in
(and possibly global fixes to) the manual pages.
Other than stripping the double quotes, this patch makes no changes to
the content of the manual pages.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of
1) a name of an option
2) a negative number to be printed.
See man-pages(7) [Debian package "manpages"].
The output from "nroff" is unchanged.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Use the correct macro (I, B) for the font change of one argument, not
those that are used for alternating two fonts, like "BR", "IR", "RB",
or "RI".
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Consolidate --help and --version descriptions. We are
now able to align them to the other options.
We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
We are using better/shorter error messages and somtimes
also errtryhelp().
Here we fix all cases where the usage function took
an int argument for exit_code.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
The pid 0 is technically correct, but very confusing for end users. Use
getpid() in the messages.
Addresses: https://github.com/karelzak/util-linux/issues/413
Signed-off-by: Karel Zak <kzak@redhat.com>
This fixes a regression introduced in:
commit 7a4ea5664e
"chrt: add control struct"
Previously (and as documented in the manpage) the default policy
was SCHED_RR. Now it's implicitly SCHED_OTHER (0) as the value
is not initialized explicitly anymore.
Test-command: chrt 90 echo hello
Reported-by: Patrick Pelissier <patrick.pelissier@gmail.com>
Addresses: http://bugs.debian.org/846572
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Some time back, I moved the discussion of scheduling from
sched_setscheduler(2) to a new sched(7) page. Adjust the cross
reference in the taskset(1) page accordingly.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This patch does only the following:
* Order SEE ALSO entries first by section name, then alphabetically
within section
* Adds one or two missing commas in SEE ALSO lists
* Removes one or two periods that were (inconsistently) used
at the end of SEE ALSO lists.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Broken since 6f27e449. We could not enter the fallback
if HAVE_SCHED_SETATTR is not defined.
Two gcc warnings made this issue visible:
schedutils/chrt.c:247:1: warning: label 'fallback' defined but not used [-Wunused-label]
schedutils/chrt.c:266:9: warning: 'policy' may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* do not reset 'nice' setting by sched_setattr(), if 'nice' setting
is not zero then chrt ends with EPERM for non-root users:
$ renice -n 5 -p $$; chrt -v -b 0 date
12475 (process ID) old priority 0, new priority 5
chrt: failed to set pid 0's policy: Operation not permitted
* it seems more elegant to always use old sched_setscheduler() API for
non-deadline policies; in this case we do not need getpriority()
to keep 'nice' unchanged.
Addresses: https://github.com/karelzak/util-linux/issues/359
Signed-off-by: Karel Zak <kzak@redhat.com>
The man page confusingly says that the mask is "typically"
hexadecimal, when in fact it is always hexadecimal. Fix the
language, and provide an additional example with no leading "0x".
Also, provide an example using the --cpu-list option.
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
We have fallback for compilation with/without proper glibc and kernel
headers, but it's not enough, because people can switch between
kernels with and without the syscalls. (For example RT kernels for
RHEL/CentOS).
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1353340
Signed-off-by: Karel Zak <kzak@redhat.com>
Before this patch, it wasn't clear whether '0' or '7' should be used to
specify "highest priority". (The answer could have been inferred from
the 'Examples' section of the man page.)
Signed-off-by: Daniel Shahaf <danielsh@apache.org>
Earlier message:
$ chrt -i 1 ls
chrt: failed to set pid 0's policy: Invalid argument
basically told 'something failed', while the new one tries to be more
helpful.
$ chrt -i 1 ls
chrt: unsupported priority value for the policy: 1: see --max for valid range
Addresses: https://bugs.debian.org/791707
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Commit 42f15e9848 introduced a certain
inaccuracy in -c option description; it is not _the option with an argument_,
but it is the flag that changes interpretation of `mask` parameter.
The difference is almost not noticeable, but there are one corner case where it is:
taskset -c 1 -p $$
fails (but it would work if 42f15e was correct). Instead,
taskset -c -p 1 $$
works (but it should not have if 42f15e was correct).
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch introduces
-d, --deadline
-T, --sched-runtime
-D, --sched-deadline
-P, --sched-period
command line options. The functionality is available only for Linux with
sched_setattr() [kernel >=3.14]
Signed-off-by: Karel Zak <kzak@redhat.com>