Commit Graph

170 Commits

Author SHA1 Message Date
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
Karel Zak 3fabc3637c chrt: fix --help inconsistency
Reported-by: Martin Steigerwald <ms@teamix.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-09 11:16:45 +02:00
Karel Zak 505edf1c5f chrt: add note about zero priority for IDLE and BATCH
Reported-by: dE <de.techno@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-26 12:53:21 +01:00
Karel Zak 3d0b57d62c Merge branch 'opts' of https://github.com/jwpi/util-linux 2015-01-26 11:31:05 +01:00
Benno Schulenberg 6b93474df7 ionice: drop the duplicate docstring
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:22:12 +01:00
J William Piggott b06c1ca6f8 docs: restore minus symbols in long opts
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-20 18:15:30 -05:00
Benno Schulenberg 3a60b1c26b docs: remove obsolete and unneeded comments from man-page files
Transform some of them into copyright lines.
Also fix three header lines and snip some trailing whitespace.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-12 11:03:26 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Sami Kerola f627750083 textual: use version printing macro everywhere
Only mount, umount, and blkid remains not using the macro because they
are print also library references.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:23 +02:00
Benno Schulenberg 42f15e9848 docs: bring the chrt and taskset man pages closer to standard formatting
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-20 10:47:10 +02:00
Benno Schulenberg a7560c0655 textual: make the license of chrt and taskset slightly more explicit
This makes it match the license of the man pages.
While there, also tweak some other comment lines.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-20 10:47:09 +02:00
Benno Schulenberg 5aab9a1aee docs: make the man-page licenses of chrt and taskset match their intent
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-20 10:47:08 +02:00
Karel Zak d6ace0b8dd build-sys: add BUILD_CHRT
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21 13:35:01 +02:00