summaryrefslogtreecommitdiffstats
path: root/sys-utils/chmem.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chmem: add initilizer [clang]Sami Kerola2019-01-021-1/+1
| | | | | | warning: use of GNU empty initializer extension [-Wgnu-empty-initializer] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ipcs,chmem: fix access() usageRuediger Meier2018-06-251-1/+1
| | | | | | | | | | | Some mistakes happened lately when switching from path_exist() to ul_path_access(). See f09a98de and 8ca31279. This caused ipcs test failures when running i386 binaries on x86_64 hosts, because the syscall fallback was always used. That's why I reviewed all similar changes and found another one in chmem. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* chmem: use new ul_path_* APIKarel Zak2018-06-211-16/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chmem: cleanup includesKarel Zak2017-10-231-8/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chmem: cleanup usage()Karel Zak2017-10-201-15/+11Star
| | | | | | Just to be compatible with another u-l tools. Signed-off-by: Karel Zak <kzak@redhat.com>
* lsmem/chmem: add memory zone awarenessGerald Schaefer2017-10-201-8/+128
| | | | | | | | | | | | | | | | With this patch, valid memory zones can be shown with lsmem, and chmem can set memory online/offline in a specific memory zone, if allowed by the kernel. The valid memory zones are read from the "valid_zones" sysfs attribute, and setting memory online to a specific zone is done by echoing "online_kernel" or "online_movable" to the "state" sysfs attribute, in addition to the previous "online". This patch also changes the default behavior of chmem, when setting memory online without specifying a memory zone. If valid, memory will be set online to the zone Movable. This zone is preferable for memory hotplug, as it makes memory offline much more likely to succeed. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.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: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | 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>
* chmem: don't use scanf format for printfRuediger Meier2017-04-101-1/+1
| | | | | | | | | | | The compiler had not complained here because both macros are probably the same. But gettext issued a funny warning: sys-utils/chmem.c:67: warning: Although being used in a format string position, the msgid is not a valid C format string. Reason: The string ends in the middle of a directive. CC: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-0/+2
| | | | | | | | 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>
* lsmem: add CopyrightKarel Zak2016-11-091-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chmem: new toolHeiko Carstens2016-11-091-0/+325
Move the s390 specific chmem tool to util-linux. The chmem tool was originally written in perl and is part of the s390-tools package which can be found here: https://www.ibm.com/developerworks/linux/linux390/s390-tools.html Given that the tool is architecture independent, there is no reason to keep it in an s390 specific repository. It seems to be useful for other architectures as well. This patch converts the tool to C and adds it to util-linux, while the command line options stay compatible. The only exception is the option "-v" which used to be the short form of "--version". That got changed to "-V" so it behaves like most other tools contained within util-linux. The chmem tool can be used to set memory online or offline. This can be achieved by specifying a memory range: Memory Block 19 (0x0000000130000000-0x000000013fffffff) disabled or by specifying a size where chmem will automatically select memory blocks: Memory Block 21 (0x0000000150000000-0x000000015fffffff) disable failed Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled or by specifying memory block numbers instead of address ranges: Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled This is based on a patch from Clemens von Mann. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>