Commit Graph

183 Commits

Author SHA1 Message Date
Bjarni Ingi Gislason 75ba1d8c28 doc: schedutils/*: Fix some warnings from "mandoc -T lint"
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>
2020-06-15 11:28:01 +02:00
Michael Kerrisk (man-pages) 3bc92f313a Manual pages: rename EXAMPLE section to EXAMPLES
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>
2020-05-28 14:51:54 +02:00
Michael Kerrisk (man-pages) 67e63c1263 Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
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>
2020-05-22 10:25:50 +02:00
Michael Kerrisk (man-pages) ade04bb89c Manual pages: order AUTHORS / COPYRIGHT / SEE ALSO / AVAILABILITY consistently
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>
2020-05-22 10:25:49 +02:00
Michael Kerrisk (man-pages) bc281b0991 Manual pages: Standardize on EXAMPLE as section title
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>
2020-05-20 12:56:12 +02:00
Michael Kerrisk (man-pages) a8d0d330cf Manual pages: Standardize on AUTHORS as section title
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>
2020-05-20 12:56:12 +02:00
Michael Kerrisk (man-pages) 5a82980632 docs: (man) remove double quotes (") in .SH lines
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>
2020-05-19 12:15:34 +02:00
jonnyh64 fcc3078754 chrt: Use sched_setscheduler system call directly
musl libc does not support the sched_setscheduler library function
because the underlying Linux system call does not confirm to Posix;
this patch makes chrt use the system call directly

[kzak@redhat.com:
    - note that musl libc implements sched_setscheduler()
      but returns -ENOSYS all time...
    - add ifdefs to the patch
    - make sure we include syscall.h]

References: http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2
Addresses: https://github.com/karelzak/util-linux/issues/943
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-30 10:45:32 +01:00
Bjarni Ingi Gislason 1c4c602427 man pages: Change a HYPHEN-MINUS (-) to a minus (\-) for options and numbers
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>
2019-12-17 12:32:43 +01:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Karel Zak c313ee737b tastset: (man) add :N stride for CPU lists
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-29 13:00:42 +01:00
Bjarni Ingi Gislason 0bb7e904d7 man: Use the correct macro for a font change of one argument
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>
2018-05-23 10:43:27 +02:00
Karel Zak 685f544918 chrt: fix compiler warning [-Wmaybe-uninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-20 10:43:32 +01:00
Karel Zak 61b6222269 schedutils: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:40:59 +01:00
Ruediger Meier f45f3ec34a misc: consolidate macro style USAGE_HELP_OPTIONS
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>
2017-06-29 16:54:33 +02:00
Ruediger Meier b305445495 misc: consolidate all --help option descriptions
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>
2017-06-27 12:28:36 +02:00
Ruediger Meier b1a294c448 misc: introduce print_usage_help_options()
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>
2017-06-27 12:26:19 +02:00
Ruediger Meier 6e1eda6f22 misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier 5118d1be2a misc: never use usage(ERROR)
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>
2017-06-26 14:38:24 +02:00
Sami Kerola 2ba641e5f3 misc: add static keyword to where needed [smatch scan]
text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Karel Zak 6433fcad71 taskset: don't use zero PID in messages
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>
2017-02-10 11:46:37 +01:00
Karel Zak 677ec86cef Use --help suggestion on invalid option
The current default is to print all usage() output. This is overkill
in many case.

Addresses: https://github.com/karelzak/util-linux/issues/338
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 13:13:34 +01:00
Sébastien Helleu d673b74e9d docs: replace FTP by HTTPS in kernel.org URLs
The links to ftp://ftp.kernel.org/ are replaced by
https://www.kernel.org/.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 11:22:26 +01:00
Michael Kerrisk 82b3c4c291 docs: ionice(1): SEE ALSO: add ioprio_set(2)
ioprio_set(2) is the system call that underlies this command.

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
2016-12-09 13:45:09 +01:00
Michael Kerrisk cef04ac8da docs: taskset(1): Wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-09 13:45:09 +01:00
Andreas Henriksson c7adc2f204 chrt: default to SCHED_RR policy
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>
2016-12-05 13:07:50 +01:00
Michael Kerrisk (man-pages) 154aede1fb Fix reference for scheduling discussion
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>
2016-11-29 10:44:19 +01:00
Michael Kerrisk (man-pages) f053ff1e3a Place SEE ALSO entries in order
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>
2016-11-29 10:44:19 +01:00
Ruediger Meier fded05ac81 chrt: fix HAVE_SCHED_SETATTR fallback case
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>
2016-10-27 11:03:21 +02:00
Karel Zak 88b60f0bde chrt: follow nice setting, prefer sched_setscheduler()
* 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>
2016-10-03 11:02:35 +02:00
Chris Metcalf 47bd898e91 taskset: clarify that masks are always hex in man page
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>
2016-08-09 11:31:41 +02:00
Karel Zak 6f27e449a9 chrt: add fallback to be usable on kernels without sched_{get,set}attr
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>
2016-07-11 15:33:46 +02:00
Karel Zak 078720a76f tests: add chrt test
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-07-11 10:25:13 +02:00
Daniel Shahaf fe5a9bcfcd ionice: clarify description of --classdata
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>
2016-06-07 12:49:21 +02:00
Sami Kerola 2e31d1c3a5 chrt: validate priority before trying to use it
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>
2016-04-13 12:29:16 +02:00
Sami Kerola b3a5067148 chrt: make --sched-* short options to require an argument
These options are expecting an argument, and the long options struct already
required them.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-04-04 10:26:03 +02:00
Benno Schulenberg 8722fc38b1 chrt: remove duplicate words and tweak some phrasings in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-17 12:18:52 +01:00
Yuriy M. Kaminskiy 59e2fea119 taskset: fix description of `-c` option in the man page
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>
2016-03-07 15:11:06 +01:00
Ruediger Meier a03eac5294 chrt: restore removed ifdef SCHED_RESET_ON_FORK
They got lost in acde3a05.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-24 12:46:20 +01:00
Ruediger Meier 59e4a3827b chrt: fix case SCHED_RR
Looks like the logic was mistakenly changed in acde3a05.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-24 12:46:20 +01:00
Karel Zak acde3a05a9 chrt: use sched_getattr() 2016-01-20 15:32:30 +01:00
Karel Zak 5b033bfd85 chrt: make man page more structured
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-20 14:30:52 +01:00
Karel Zak 1a7e63950b chrt: add support for SCHED_DEADLINE
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>
2016-01-20 14:04:32 +01:00
Karel Zak 15167589fb chrt: use sched_setattr() if available
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-20 12:44:27 +01:00
Karel Zak a6fec53788 chrt: make usage more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-19 14:52:51 +01:00
Karel Zak 4820a7373a chrt: set function refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-19 14:46:30 +01:00
Karel Zak a30cf65076 chrt: output function refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-19 14:38:18 +01:00
Karel Zak 7a4ea5664e chrt: add control struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-19 14:24:53 +01:00
Benno Schulenberg 9acbe2aa47 chrt: slice up the usage text and normalize its layout
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-15 15:06:36 +02:00
Benno Schulenberg 4e4bc0c801 chrt: make the usage synopsis clearer
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-06-15 15:06:35 +02:00