summaryrefslogtreecommitdiffstats
path: root/schedutils/taskset.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* schedutils: use errexec()Karel Zak2018-02-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | 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>
* misc: consolidate all --help option descriptionsRuediger Meier2017-06-271-2/+3
| | | | | | | | 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>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-1/+0Star
| | | | | | | | | | | | 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>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-5/+8
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* taskset: don't use zero PID in messagesKarel Zak2017-02-101-7/+14
| | | | | | | | 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>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-2/+1Star
| | | | | | | | 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>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | 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>
* textual: use manual tail usage() macroSami Kerola2014-10-011-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: use version printing macro everywhereSami Kerola2014-10-011-2/+1Star
| | | | | | | 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>
* textual: make the license of chrt and taskset slightly more explicitBenno Schulenberg2014-08-201-3/+2Star
| | | | | | | 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>
* schedutils: don't apply -a without -pDaniel Stodden2013-03-261-1/+1
| | | | | | | | 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>
* translation: unify exec error messagesSami Kerola2013-02-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: gettextize several overlooked messagesBenno Schulenberg2013-01-251-1/+1
| | | | | | Also improve the clarity of some of them. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: tag two bug messages as "internal error"Benno Schulenberg2013-01-251-2/+1Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* schedutils: cleanup strtoxx_or_err()Karel Zak2012-05-151-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* schedutils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: corrections to FSF license files, and postal addressSami Kerola2012-02-241-3/+3
| | | | | | | | | | | | | | 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>
* taskset: use appropriate variable type [cppcheck]Sami Kerola2012-02-081-1/+1
| | | | | | [schedutils/taskset.c:182]: (style) Checking if unsigned variable 'ncpus' is less than zero. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cpuset: add option to allow cpulist_parse() to failHeiko Carstens2011-08-151-1/+1
| | | | | | | | | | | | | 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>
* misc: use unsigned int for bit-filedsKarel Zak2011-07-291-1/+1
| | | | | Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: coding style fixesSami Kerola2011-07-211-17/+17
| | | | | | | 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>
* taskset: include-what-you-use header checkSami Kerola2011-07-211-0/+3
| | | | | | | | | 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>
* taskset: make threads awareDavidlohr Bueso2011-05-111-47/+100
| | | | | | | | | | | | | | | | | | | | | | | 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>
* taskset: use xalloc libDavidlohr Bueso2011-05-111-3/+2Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* move struct option to .rodataKarel Zak2011-03-031-1/+1
| | | | | | | It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-2/+1Star
| | | | | | | | 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>
* schedutils: remove unneeded header filesDavidlohr Bueso2011-02-081-3/+0Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-2/+2
| | | | | | | | | | | | | 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>
* taskset: proper numbers parsingKarel Zak2010-09-301-1/+3
| | | | | Reported-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: move NR_CPUS determination to lib/cpuset.cKarel Zak2010-06-011-36/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: add NLS support, use err.h, cleanupKarel Zak2010-06-011-101/+78Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: use libc based cpu_set_tKarel Zak2010-06-011-35/+47
| | | | | | | The glibc already supports dynamically allocated CPU sets. We don't have to maintains our private non-compatible implementation. Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: move bitmap routines to lib/cpuset.cKarel Zak2010-06-011-237/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove hardcoded _GNU_SOURCEKarel Zak2007-09-201-2/+0Star
| | | | | | We have AC_GNU_SOURCE, so we needn't any extra hardcoded _GNU_SOURCE. Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: independent of hardcoded NR_CPUS max.Cliff Wickman2007-06-191-33/+168
| | | | | | | | | | | | | | | | | | | | This patch makes the taskset command independent of the system's maximum number of cpus (CONFIG_NR_CPUS). The maximum for CONFIG_NR_CPUS is a moving target. With this patch the size of the systems's cpumask_t is gotten from sched_getaffinity(2). This patch uses variable length bitmasks borrowed from Paul Jackson's variable size bitmask routines (hence I kept his copyright notice). This replaces the use of the glibc CPU_SETSIZE, CPU_SET, CPU_ZERO and CPU_ISSET macros which depend on a hardcoded size for cpu_set_t. (also fixes one little nit: the -V option is "-v" in the built-in help, so changed the built-in help) Signed-off-by: Cliff Wickman <cpw@sgi.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.13-pre2 tarball.Karel Zak2006-12-071-2/+2
|
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-071-0/+334