Commit Graph

207 Commits

Author SHA1 Message Date
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
Benno Schulenberg 2d745ee6e6 textual: slice up and standardize the usage text of ionice
Done for ease of translation and maintenance.  Also improve the
clarity of some of the descriptions, and of one error message.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-05-06 11:09:33 +02:00
Benno Schulenberg b6973e5d23 ionice: add a missing error message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-05-06 11:09:30 +02:00
Masatake YAMATO bd2ff3d2d9 ionice: add the way to specify the target processes with pgid and uid
ioprio_get and ioprio_set system call accept not only process ID but
also process group ID(pgid) and user ID(uid) to specify the target
process(es).  However, ionice command accepts only process ID.  With
this patch a user can specify the target processes with pgid(-P
option) and uid(-u option).

[kzak@redhat.com: - tiny cleanup in usage()]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 11:44:12 +01:00
Michael Bunk b422f5fe87 ionice: Fix output for case ioclass==0
output "none" instead of "unknown"
2014-01-15 17:38:37 +01:00
Rik van Riel ab0e0fa7a4 taskset: fix PERMISSIONS section of taskset man page
A user is always allowed to change the CPU affinity of his or her
own processes. CAP_SYS_NICE is only required to change the affinity
of another user's process.

Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Joe Mario <jmario@redhat.com>
2013-12-10 11:33:54 +01:00
Benno Schulenberg b4362b6f84 docs: standardize the phrases for --help and --version in all man pages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-15 10:28:30 +02:00
Benno Schulenberg 4ce393f4d8 textual: fix several typos and angular brackets in messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 12:11:14 +02:00
Sami Kerola fdf8fb1cc0 chrt: make command syntax easier to understand in usage()
And mention in manual that the default is referring to the internal
default of this command, not the Linux system default.  Manual page
example also tries to be a little more complete how to use the command.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 13:56:17 +02:00
Daniel Stodden d9b22d179a schedutils: don't apply -a without -p
The unsuspecting user might use taskset -a mask command. Behavior then
is to exec with no affinity applied at all. Better handled by ignoring
all_tasks if no pid was given.

Signed-off-by: Daniel Stodden <daniel.stodden@gmail.com>
2013-03-26 12:37:55 +01:00
Karel Zak 65f25186d5 ionice: keep output backwardly compatible
...bug introduced by 8c219bf463

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-04 12:58:12 +01:00
Sami Kerola 07ff972eb6 translation: unify exec error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:17 +01:00
Benno Schulenberg 8c219bf463 textual: gettextize several overlooked messages
Also improve the clarity of some of them.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:29 +01:00
Benno Schulenberg c602fe5a8e textual: tag two bug messages as "internal error"
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:28 +01:00
Yuri Chornoivan bbac757b1e textual: fix typos in messages 2012-09-04 17:26:31 +02:00
Karel Zak dcdb349be7 build-sys: always use default $(LDADD)
The global variable $(LDADD) is always used if program_LDADD is
not specified. Let's use $LDADD everywhere to avoid exceptions for
people who need to specify global $LDADD.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-09 16:23:51 +02:00
Karel Zak f38e5ff355 build-sys: cleanup .gitignore files
- move all binaries to top-level .gitignore
 - remove unnecessary */.gitignore files

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:54 +02:00
Karel Zak d77ab74af7 build-sys: convert lib/ to libcommon.la
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Karel Zak 5ed5df5d6e build-sys: convert schedutils/ to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 17:25:24 +02:00
Karel Zak 630ed89d5a schedutils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:05 +02:00
Sami Kerola ed8ec2a65d schedutils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:51:32 +02:00
Sami Kerola f06b43285d build-sys: enhance readability of the autotools files
Several horizontal lists are turned to vertical, and sorted to
alphabetical order. Additionally spaces are converted to tabs where
ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-28 13:29:35 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Sami Kerola 2f5a248420 taskset: use appropriate variable type [cppcheck]
[schedutils/taskset.c:182]: (style) Checking if unsigned variable 'ncpus' is less than zero.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-08 14:13:34 +01:00
Karel Zak 337b8eade0 chrt: add comment to keep static analysers happy 2012-01-31 21:16:28 +01:00
Karel Zak 17d5e11bf8 build-sys: cleanup BUILD_SCHEDUTILS
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-03 12:32:50 +01:00
Karel Zak b82c15bd19 Merge branch 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux
* 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux:
  chcpu: new tool
  cpuset: add option to allow cpulist_parse() to fail
2011-08-31 11:49:27 +02:00
Benno Schulenberg 530395f2d5 ionice: adjust synopsis and wording and formatting on the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-29 11:24:45 +02:00
Benno Schulenberg 232dc924c4 docs: uniformize the header and footer lines in man pages
Use dates without the day, use the full month name, put "util-linux" in
the lower left corner, and "User Commands" or "System Administration"
at the top center.

Also improve here and there the one-line program description.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-22 10:39:21 +02:00
Heiko Carstens b16f615afb cpuset: add option to allow cpulist_parse() to fail
This is a preparation patch for chcpu. If a cpu should be added to
a cpu_set where the cpu doesn't fit into the cpu_set this got silently
ignored.
Since the cpu-list is user space provided it should be checked if cpus
are specified that are completely out of range of the system.
In order to do that add a parameter which specifies if cpulist_parse()
should fail if it parses a cpu-list with "impossible" cpus.
The current callers have been converted so they behave like before.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-15 07:52:44 +02:00
Benno Schulenberg a92eea152b ionice: slightly improve grammar, spacing and consistency of man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-08 11:58:51 +02:00
Benno Schulenberg 64109bbaf5 taskset: adjust style of man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-08 11:58:50 +02:00
Benno Schulenberg 397a511458 chrt: adjust style of man page, alphabetize option -p
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-08 11:58:48 +02:00
Karel Zak c150589fce chrt: silently ignore -R if unsupported
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-02 14:29:03 +02:00
Karel Zak cee12fc60c ionice: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 13:17:54 +02:00
Karel Zak 9feec79cc5 misc: use unsigned int for bit-fileds
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-29 10:51:06 +02:00
Karel Zak cbc1dc969b ionice: make -t more tolerant
* replace errx() with warnx() for unknown -c class

  The right place to check I/O scheduler features is in kernel. We should
  not try to be more smart than kernel.

* make the code ready (robust) for unknown sched.classes

* fix -t behavior

	old version:
	  $ ionice -c 4 -t bash
	  ionice: bad prio class 4

	new version:
	  $ ionice -c 4 -t bash

Reported-by: Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-22 12:55:01 +02:00
Karel Zak fe040397f9 ionice: allow to use names for -c <class>
for example:

   $ ionice -c best-effort bash

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-22 11:39:06 +02:00
Karel Zak fcc2b2da4c ionice: improve command line interpretation
ionice                       : print the current I/O prio.
 ionice COMMAND               : exec command with default (best-effort) class
 ionice -p PID [...]          : return info about the PID(s)
 ionice -c CLASS COMMAND      : exec command with the class
 ionice -c CLASS -p PID [...] : modify PID(s) class

This should be backwardly compatible and also compatible with nice(1)
from coreutils.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-22 11:24:05 +02:00
Sami Kerola 8a44fb011d chrt: add strings to use NLS
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 17:32:28 +02:00
Sami Kerola 02ad010012 taskset: coding style fixes
Reindentation and deletion of few empty lines etc. There is no
actual code changes in this patch.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 17:30:24 +02:00
Sami Kerola 6f45c0e9ff taskset: include-what-you-use header check
taskset.c should add these lines:
 #include <sched.h>   for sched_getaffinity, etc
 #include <stddef.h>  for size_t
 #include <string.h>  for memset

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 17:29:38 +02:00
Sami Kerola 4033fbe3e6 docs: mention long options in ionice.1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 17:28:32 +02:00
Sami Kerola a5e9b75fac ionice: coding style fixes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 17:09:28 +02:00
Sami Kerola abd57eb3e3 ionice: fix -V output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 17:04:36 +02:00
Karel Zak 7ab08ba3e5 ionice: fix -p
$ ionice 123
 none: prio 4
 none: prio 4

It calls ioprio_get(0x1, 0) and ioprio_get(0x1, 123), because the
code does not check it the "-p" options was specified.

The proper command line syntax is:

  $ ionice -p 123

and the ioprio_get() should be called only once.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 17:02:52 +02:00
Karel Zak 560cdabbfa ionice: IOPRIO_PRIO_* macros
* make the code more robust
 * follow kernel conventions for variable names
   (data = classdata, ioprio = classdata | class)

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 16:33:20 +02:00
Sami Kerola 976b7580e0 ionice: add long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 16:03:35 +02:00
Sami Kerola 110d680af8 chrt: coding style fix
Make horizontal list vertical and few other enhancements to
readability.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 15:53:44 +02:00
Sami Kerola 90b7d261b9 chrt: data type compiler warning fixed
chrt.c:158:16: warning: comparison of integers of different
	signs: 'int' and 'unsigned long' [-Wsign-compare]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 15:52:25 +02:00
Karel Zak 58a111bdb2 build-sys: move BUILD_SCHEDUTILS to top-level Makefile
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-20 13:51:26 +02:00
Davidlohr Bueso 1b9b57ace5 chrt: clarify use of -a option
With this option we can operate on all the thread group of a process not just
for changes, but also when obtaining information via sched_getscheduler().

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-05-17 16:29:59 +02:00
Davidlohr Bueso 42708f12f0 taskset: make threads aware
Add a new '-a' option to view/modify the CPU affinity for an entire
group of threads belonging to a given PID.  We create two new
functions, print_affinity() and do_taskset() for code simplification.

Example:

zeus@jilguero:~/src/util-linux/schedutils$ ./taskset -a -p 01 3142
pid 3142's current affinity mask: 2
pid 3142's new affinity mask: 1
pid 3164's current affinity mask: 2
pid 3164's new affinity mask: 1
pid 854's current affinity mask: 2
pid 854's new affinity mask: 1

[kzak@redhat.com: - clean up
                  - move variables to struct taskset]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Tested-by: Jonathan Gonzalez <zeus@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-11 16:17:56 +02:00
Davidlohr Bueso dd29a76293 taskset: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-05-11 10:06:58 +02:00
Davidlohr Bueso f82ce2aab1 chrt.1: fix grammar
Corrent the English grammar for the new -a option.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-05-10 14:21:33 +02:00
Karel Zak 503cbbe1d4 chrt: allow to use --all-tasks when retrieve info
master thread:
 $ chrt --pid $(pidof firefox)

all threads:
 $ chrt --all-tasks --pid $(pidof firefox)

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-05 14:23:38 +02:00
Davidlohr Bueso 78904e7647 chrt: make threads aware
Currently this program works only with the master thread. Add a '-t'
option to propagate changes to the entire group of threads.

Example:

root@offworld:~/projects/util-linux/schedutils# ls /proc/2111/task/
2111  2112  2119  2121  2138  2139  2159  2160
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2111
pid 2111's current scheduling policy: SCHED_RR
pid 2111's current scheduling priority: 3
root@offworld:~/projects/util-linux/schedutils# ./chrt -t -p 2 2111
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2112
pid 2112's current scheduling policy: SCHED_RR
pid 2112's current scheduling priority: 2
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2111
pid 2111's current scheduling policy: SCHED_RR
pid 2111's current scheduling priority: 2

[kzak@redhat.com: - rename -t/--thread to -a/--all-tasks]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-05 14:02:34 +02:00
Karel Zak 6c7d5ae9a2 move struct option to .rodata
It does not make sense to have writable large arrays of "struct
option" on the stack.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-03 15:00:30 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Davidlohr Bueso f2f0dcaf11 schedutils: remove unneeded header files
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-02-08 16:23:28 +01:00
Davidlohr Bueso cdc1ae5fb2 schedutils: fix typos
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-01-17 15:26:35 +01:00
Karel Zak 601d12fb10 rename util-linux-ng back to util-linux
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-30 11:41:59 +01:00
Davidlohr Bueso 8abcf29002 lib: [strutils] general purpose string handling functions
This patch replaces a few functions used throughout the source:
* Renames getnum (from schedutils) to strtol_or_err
* Moves strtosize (from lib/strtosize.c)
* Moves xstrncpy (from include/xstrncpy.h)
* Adds strnlen, strnchr and strndup if not available (remove it from libmount utils)

A few Makefile.am files were modified to compile accordingly along with trivial renaming
in schedutils source code.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-23 21:06:49 +01:00
Marek Polacek 98da1298ca chrt: Add noreturn attribute to show_usage() function
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
2010-10-29 13:26:25 +02:00