summaryrefslogtreecommitdiffstats
path: root/sys-utils/chcpu.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu: fix memory leakKarel Zak2019-04-161-4/+5
| | | | | | The CPU set has been allocated more than once. Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu: use new ul_path_* APIKarel Zak2018-06-211-43/+55
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu: Fix maximal number of CPUsStanislav Brabec2018-05-101-8/+8
| | | | | | | | | | chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit mask). It effectively limits number of CPUs to 1/8 of the supported amount. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Cc: Michael Matz <matz@suse.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
* lscpu, chcpu: Avoid use of the old CPU macrosStanislav Brabec2018-05-101-3/+3
| | | | | | | | The old CPU macros are limited to 1024 cores. As a result, lscpu cannot count sockets on large systems. Use new scalable macros. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Cc: Michael Matz <matz@suse.de>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-1/+1
| | | | | | | | | 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-10/+12
| | | | | | | | 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: 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>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-9/+9
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: Fix word repetitionsYuri Chornoivan2017-02-131-1/+1
|
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | 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>
* sys-utils/disk-utils/lib: fix printf format types [cppcheck]Boris Egorov2015-06-251-19/+19
| | | | | | Fix 'invalidPrintfArgType' cppcheck warnings Signed-off-by: Boris Egorov <egorov@linux.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | 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 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>
* chcpu: cleanup stdout/stderr usageKarel Zak2014-03-051-10/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu: cleanup return codesKarel Zak2014-03-051-22/+60
| | | | | | | | The code currently always return EXIT_SUCCESS, that's strange. It seems better to return 0 on success, 1 on complete failure and 64 on partial success. Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu: clean up error messagesKarel Zak2013-05-141-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: rename functions to be more explicitKarel Zak2012-11-231-11/+11
| | | | | | ... and to have names compatible with lib/sysfs.c Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu: use err_exclusive_options()Karel Zak2012-07-261-15/+9Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix typos found by misspellingsBernhard Voelker2012-07-091-2/+2
| | | | | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * Documentation/releases/v2.18-ReleaseNotes: Fix typo in news entry. * NEWS: Likewise. * config/texinfo.tex: Fix typo in comments. * libmount/src/context.c: Fix typo in comment. * libmount/src/fs.c: Likewise. * login-utils/login.c: Likewise. * login-utils.su.1: Fix typo in man page. * sys-utils/chcpu.c: Fix typo in error message. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* chcpu: use exclusive_option()Sami Kerola2012-06-171-4/+18
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sys-utils: 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>
* chcpu: use appropriate variable type [cppcheck]Sami Kerola2012-02-081-2/+2
| | | | | | [sys-utils/chcpu.c:251]: (style) Checking if unsigned variable 'maxcpus' is less than zero. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chcpu: check get_max_number_of_cpus() result properlyKarel Zak2012-02-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use %m in format string instead of %s and strerror(errno)Petr Uzel2011-09-271-8/+4Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* chcpu: provide better user feedbackHeiko Carstens2011-09-271-11/+40
| | | | | | | | | | Instead of printing error messages like "I/O resource busy" which are supplied by strerror, give better feedback if the reason of failure is known. E.g. taking the last cpu offline cannot succeed, therefore print a message that gives this "hint". Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* chcpu: convert to use lib/path.cHeiko Carstens2011-09-271-57/+16Star
| | | | | | | Use the common path access functions. In order to simplify chcpu also implement and use path_writestr() which writes a string to the path specified. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* chcpu,cpuset: reduce code duplication for cpu list parsingHeiko Carstens2011-09-101-12/+16
| | | | | | | Reduce code duplication and print better error message if an unsupported cpu number was passed. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* chcpu: new toolHeiko Carstens2011-08-221-0/+337
chcpu can modify the logical state of CPUs. It can enable and disable CPUs, scan for new CPUs, change the CPU dispatching mode of the underlying hypervisor and request (configure) or give logical CPUs back (deconfigure) to the the underlying hypervisor. This is quite useful if you work a lot with virtual servers, since doing all the configuration stuff directly via sysfs becomes a pain. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>