aboutsummaryrefslogtreecommitdiffstats
path: root/sys-utils
AgeCommit message (Collapse)AuthorFilesLines
5 dayslscpu: Add a few missing Arm CPU identifiersJonathan Thackray1-0/+5
6 dayseject: fix const qualifier warning in read_speedKarel Zak1-1/+1
Fix const qualifier discarded warning in read_speed(). This warning is reported by gcc 15 which defaults to the C23 standard. The strrchr() function returns a pointer into a const string, so the receiving variable must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
6 daysdmesg: fix const qualifier warnings in parse_calleridKarel Zak1-2/+1
Fix const qualifier discarded warnings in parse_callerid(). These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strstr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
6 dayslsns: fix const qualifier warnings for C23Karel Zak1-3/+3
Fix const qualifier discarded warnings in read_persistent_namespaces() and is_path_included() functions. These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strstr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
6 dayslib, lscpu: fix const qualifier discarded warnings in bsearchKarel Zak1-1/+2
Fix compilation warnings from newer compilers with stricter const-correctness checks. When bsearch() searches in const arrays, the result pointer must also be const to avoid discarding the const qualifier. Fixed in: - lib/color-names.c: searching in static const basic_schemes[] - sys-utils/lscpu-cputype.c: searching in const pattern arrays The warnings were: lib/color-names.c:62:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] Signed-off-by: Karel Zak <kzak@redhat.com>
9 daystunelp: remove extraneous -T optionChristian Goeschel Ndjomouo1-1/+0
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
9 daysmount: document --ro option on the man pageChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
9 daysmount: add missing --ro option info in usage messageChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysflock: fix incomplete -n option info in usage messageChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
13 daysmountpoint: use single libmount cache for all path resolutionsKarel Zak1-14/+22
Move libmount cache initialization to main() and pass it through the control structure. This allows the cache to be reused across all mnt_resolve_path() calls, reducing allocations. Also add cleanup section in main() with goto labels for proper resource deallocation in a single location. Signed-off-by: Karel Zak <kzak@redhat.com>
13 daysmountpoint: add --show option to print mountpoint pathKarel Zak2-3/+27
Add a new --show option that prints the actual mountpoint path for a given directory or file. This is useful for: - Resolving any path to its containing mountpoint - Finding the canonical mountpoint path when symlinks are involved - Determining the mountpoint from paths within filesystems The option requires kernel support for statmount(2) (Linux 6.8+). On older kernels without statmount support, the option fails with an error message, as the /proc/self/mountinfo fallback cannot resolve arbitrary paths to their containing mountpoint. Example usage: $ mountpoint --show / / $ mountpoint --show /home/user/file.txt /home The --show option always returns EXIT_SUCCESS (0) when it successfully finds the mountpoint, regardless of whether the given path itself is a mountpoint or not. Addresses: https://github.com/util-linux/util-linux/issues/3806 Signed-off-by: Karel Zak <kzak@redhat.com>
13 daysmountpoint: use statmount() syscall on modern kernelsKarel Zak2-12/+98
Improve mountpoint(1) to use the modern statmount() system call (available since Linux 6.8) instead of parsing /proc/self/mountinfo. - Works without /proc mounted on modern kernels - More efficient than parsing /proc/self/mountinfo - Better detection of bind mounts via statmount() - Graceful fallback maintains compatibility Addresses: https://github.com/util-linux/util-linux/issues/3806 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-17Fix typos when "set up" is used as a verbLouis Sautier2-2/+2
The noun is "setup" while the verb is "set up".
2025-11-12chmem: improve messagesKarel Zak1-4/+4
Suggested-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-12Merge branch 'PR/chmem-dynamic-configuration' of ↵Karel Zak4-49/+551
https://github.com/karelzak/util-linux-work * 'PR/chmem-dynamic-configuration' of https://github.com/karelzak/util-linux-work: tests: update lsmem outputs lsmem: use xstrncpy() lsmem,chmem: add configure/deconfigure bash completion options lsmem: add doc for dynamic (de)configuration and memmap-on-memory support chmem: add chmem documentation for dynamic (de)configuration of memory chmem: add support for dynamic (de)configuration of hotplug memory lsmem: add support to display dynamic (de)configuration of memory lsmem: display global memmap on memory parameter
2025-11-10Merge branch 'hwclock-rtc-fix-typo' of https://github.com/jgilles/util-linuxKarel Zak1-1/+1
* 'hwclock-rtc-fix-typo' of https://github.com/jgilles/util-linux: hwclock-rtc: fix verbose output when --param-set value is unchanged
2025-11-08fallocate: require posix_fallocate() from libcThomas Weißschuh1-12/+0
Recent libcs implement posix_fallocate() properly. The fallback logic should never be used. Furthermore unconditional support for posix_fallocate() will enable some further cleanup and fixes. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-08fallocate: drop syscall() fallback for fallocate()Thomas Weißschuh1-8/+1
The ABI of the fallocate() syscall is complicated and not properly handled by the open-coded fallback logic. As all recent libcs implement fallocate() properly, drop the open-coded systemcall fallback and depend on the libc implementation. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-07hwclock-rtc: fix verbose output when --param-set value is unchangedJesse Gilles1-1/+1
RTC_PARAM_SET operation is skipped rather than GET
2025-11-07lsmem: use xstrncpy()Karel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07lsmem: add doc for dynamic (de)configuration and memmap-on-memory supportSumanth Korikkar1-3/+41
lsmem --output-all now displays two new columns: CONFIGURED : yes/no indicating if a memory block has been explicitly configured. MEMMAP-ON-MEMORY : yes/no indicating whether the block uses memmap-on-memory. lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes Add documentation for new fields. Reviewed-by: Maria Eisenhaendler <maria1@de.ibm.com> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07chmem: add chmem documentation for dynamic (de)configuration of memorySumanth Korikkar1-5/+42
Describe chmem configure, deconfigure and memmap-on-memory options: ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory") s390 kernel no longer pre-adds all standby memory at boot. Instead, users must explicitly configure a block before it can be used for online/offline actions. At configuration time, users can dynamically decide whether to use optional memmap-on-memory for each memory block, where value of 1 allocates metadata (such as struct pages array) from the hotplug memory itself, enabling hot-add operations even under memory pressure. A value of 0 stores metadata in regular system memory, which may require additional free memory, but enables continuous physical memory across memory blocks. Add documentation to reflect the following options: * chmem --configure 128M --memmap-on-memory 1 * chmem --deconfigure 128M * chmem --enable 128M # implicitly configure memory if supported by architecture and online it * chmem --disable 128M # offline memory and implicitly deconfigure if supported by the architecture. Just like online and offline actions, memory configuration and deconfiguration can be controlled through similar options. Also, memmap-on-memory setting can be changed, only when the memory block is in deconfigured state. This means, it is usable only via --configure option. Reviewed-by: Maria Eisenhaendler <maria1@de.ibm.com> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07chmem: add support for dynamic (de)configuration of hotplug memorySumanth Korikkar1-29/+342
Extend chmem to use the new s390 kernel interface for configuring and deconfiguring hotpluggable memory blocks, with memmap-on-memory support. Background: On s390, memmap-on-memory was introduced to ensure that the struct page array (metadata) for hotpluggable standby memory is allocated from the memory block itself. This allowed hot-add operations even under memory pressure, particularly in cases with a strong imbalance between boot-time online memory and standby memory. The original design, however, had few limitations: * All hotpluggable standby memory was added at boot. * The use of memmap-on-memory was global and static, decided at boot time. Either all standby blocks used it, or none of them did. * memmap-on-memory choice could not be changed at runtime, limiting flexibility. For example, when continuous physical memory was required later across memory blocks. The s390 kernel ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory") no longer pre-adds all standby memory at boot. Instead, users must explicitly configure a block before it can be used for online/offline actions. At configuration time, users can dynamically decide whether to use optional memmap-on-memory for each memory block, where value of 1 allocates metadata (such as struct pages array) from the hotplug memory itself, enabling hot-add operations even under memory pressure. A value of 0 stores metadata in regular system memory and enables continuous physical memory across memory blocks. s390 kernel sysfs interface to configure/deconfigure memory with memmap-on-memory support looks as shown below: 1. Configure memory echo 1 > /sys/firmware/memory/memoryX/config   2. Deconfigure memory echo 0 > /sys/firmware/memory/memoryX/config 3. Enable memmap-on-memory echo 1 > /sys/firmware/memory/memoryX/memmap_on_memory 4. Disable memmap-on-memory echo 0 > /sys/firmware/memory/memoryX/memmap_on_memory * Initial memory layout: lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes * Configure memory with memmap-on-memory. chmem -c 128M -m 1 lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0x87ffffff 128M offline 16 yes yes 0x88000000-0xffffffff 1.9G offline 17-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes * Deconfigure memory chmem -g 128M lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes * Online memory. If the memory is in deconfigured state, configure and online it. chmem -e 128M -v Memory Block 16 (0x0000000080000000-0x0000000087ffffff) configured Memory Block 16 (0x0000000080000000-0x0000000087ffffff) enabled lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0x87ffffff 128M online 16 yes yes 0x88000000-0xffffffff 1.9G offline 17-31 no yes Memory block size: 128M Total online memory: 2.1G Total offline memory: 1.9G Memmap on memory parameter: yes * Offline memory If the memory is in online state, then offline it and deconfigure it. chmem -d 128M -v Memory Block 16 (0x0000000080000000-0x0000000087ffffff) disabled Memory Block 16 (0x0000000080000000-0x0000000087ffffff) deconfigured lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes Just like online and offline actions, memory configuration and deconfiguration can be controlled through similar options. Also, memmap-on-memory setting can be changed, only when the memory block is in deconfigured state. This means, it is usable only via --configure option. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07lsmem: add support to display dynamic (de)configuration of memorySumanth Korikkar1-12/+95
Extend lsmem to display (de)configured blocks and memmap_on_memory state. With the new s390 kernel interface (linux-next) ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory"), standby memory blocks are no longer pre-added at boot, but must be explicitly configured before being eligible for online/offline operations. At configuration time, users can also decide whether to use memmap-on-memory per block. Add CONFIGURED column : indicate if a memory block has been explicitly configured. Add MEMMAP-ON-MEMORY column : indicate if a memory block uses memmap-on-memory. memmap-on-memory reference: https://docs.kernel.org/admin-guide/mm/memory-hotplug.html Users can now inspect memory configuration state and retrieve memmap-on-memory state per block. lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07lsmem: display global memmap on memory parameterSumanth Korikkar2-0/+31
Display the output of global memmap-on-memory parameter for memory hotplug. Retrieve the details via /sys/module/memory_hotplug/parameters/memmap_on_memory. lsmem RANGE SIZE STATE REMOVABLE BLOCK 0x0000000000000000-0x00000001ffffffff 8G online yes 0-63 Memory block size: 128M Total online memory: 8G Total offline memory: 0B Memmap on memory parameter: yes Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-03losetup: (man) put the synopses in a better order, the name-giver firstBenno Schulenberg1-15/+11
Also, condense the synopsis for setting up a loop device to just the essentials -- it had become so long that it was incomprehensible. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-11-03losetup: remove the --verbose flag, as it doesn't actually do anythingBenno Schulenberg2-7/+0
Fourteen years ago, commit c7e0925def rewrote the `losetup` tool, removing all references to the 'verbose' variable. Three years later, commit 60cb2c3720 removed the line 'verbose = 1' because the compiler complained that the variable was set but never used. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-11-03losetup: sort 'O' correctly for the mutual-exclusive check to workBenno Schulenberg1-1/+1
The options need to be in strict ascending order. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-11-03wdctl: remove -d option leftoverMunehisa Kamata1-1/+1
-d option was removed in commit f56338b43973 ("wdctl: allow to specify more than one device"), but the optstring wasn't updated at that time and wdctl can still accept the option halfway as below: $ wdctl -d wdctl: option requires an argument -- 'd' whereas it should say: wdctl: invalid option -- 'd' So update the optstring. Fixes: f56338b43973 ("wdctl: allow to specify more than one device") Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
2025-10-30hwclock: skip RTC_PARAM_SET for --param-set with unchanged valueBastian Krause1-1/+14
Parameters set with `hwclock --param-set` tend to be persisted in the RTC's EEPROM. Writing the same value over and over again can wear out the EEPROM (e.g. on each boot). So read the current value first. Only if the parameter is changed, actually write the new value. This allows for easier integrations, especially since there is no machine-readable way of retrieving the current value via hwclock. Signed-off-by: Bastian Krause <bst@pengutronix.de>
2025-10-29Merge branch 'my-master-2' of https://github.com/Leefancy/util-linuxKarel Zak1-0/+1
* 'my-master-2' of https://github.com/Leefancy/util-linux: Fix memory leak issue in read_Subid_range()
2025-10-23Fix memory leak issue in read_Subid_range()fortunate-lee1-0/+1
2025-10-22swapon: (man page) use "defaults" (plural)Chris Hofstaedtler1-1/+1
A lot of documentation on the Internet seems to assume "defaults" is the /correct/ default value when no other options are intended. Documentation/example.files/fstab does not have an entry for swap, but it shows "defaults" for other file systems. It seems prudent to align on a single variant, at least in the documentation, even if both are accepted by swapon. Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2025-10-22Merge branch 'PR/losetup-remove' of https://github.com/karelzak/util-linux-workKarel Zak2-38/+50
* 'PR/losetup-remove' of https://github.com/karelzak/util-linux-work: losetup: improve command line option processing lostup: report EACCES on loop-control losetup: improve --remove documentation losetup: make --remove a long-only option with mutual exclusivity lib/loopdev: introduce loopcxt_get_device_nr() helper losetup: add error feedback for --remove command
2025-10-22mount: add note about systemd and --all historical contextKarel Zak1-1/+3
Add information that mount -a was originally designed for init scripts but many modern systemd-based distributions use systemd units instead for mounting filesystems on boot in a more sophisticated way. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-22mount: improve --all documentation regarding swap areasKarel Zak1-0/+2
The --all option description did not mention that swap entries in fstab are silently ignored. Add a note clarifying this behavior and pointing users to swapon --all for enabling swap devices and files. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: improve command line option processingKarel Zak1-23/+22
The options --detach, --remove, and --set-capacity are mutually exclusive. We can assume the device name follows the options, which is better than assuming the device name is specified as an option's argument. This also allows the use of the existing mutually-exclusive check. # losetup --remove --detach loop0 losetup: /dev/--detach: remove failed: Success losetup: /dev/loop0: remove failed: Device or resource busy is ugly. Reported-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: improve --remove documentationKarel Zak1-4/+14
Rewrite the --remove option description to clearly explain the difference between --detach and --remove. Add a new LOOP DEVICE LIFECYCLE section that describes the three stages: creation, detachment, and removal, with corresponding ioctl names. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: make --remove a long-only option with mutual exclusivityKarel Zak2-10/+11
Change --remove from '-R, --remove' to a long-only option '--remove'. This makes it consistent with other administrative options and adds mutual exclusivity with other major actions like -d, -D, -a, -c, -f, -j, -l, and -O. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: add error feedback for --remove commandKarel Zak1-3/+5
The remove_loop() function was silently failing without providing any feedback to the user. This also fixes incorrect indentation (spaces instead of tabs). Signed-off-by: Karel Zak <kzak@redhat.com> Reported-by: Benno Schulenberg <bensberg@telfort.nl>
2025-10-15treewide: use is_dotdir_dirent() helperKarel Zak2-2/+4
This simplifies the code by using the is_dotdir_dirent() helper function instead of manual strcmp() checks for "." and ".." directory entries across multiple utilities. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14Merge branch 'fix/umount_no_verbose_for_non_root' of ↵Karel Zak1-1/+2
https://github.com/cgoesche/util-linux-fork * 'fix/umount_no_verbose_for_non_root' of https://github.com/cgoesche/util-linux-fork: umount: consider helper return status for success message
2025-10-13umount: consider helper return status for success messageChristian Goeschel Ndjomouo1-1/+2
If a helper function was executed to unmount, we simply return without any user feedback. That can unintentionally surpress verbose messages (`--verbose`) for non-root users who use udisks2 to mount filesystems, and unmount via the unmount.udisks2 helper. It would be better to check the helper return status as well for completeness and a more reliable way to test the success of the unmount operation. mnt_context_get_helper_status() is only called if the helper was executed, i.e. mnt_context_helper_executed == 1, anything else wouldnt make sense anyways. Addresses: #3790 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-11treewide: consolidate --list-columns option in usage() to ↵Christian Goeschel Ndjomouo2-2/+2
USAGE_LIST_COLUMNS_OPTION() This consolidates the --list-columns description in the usage() of ls-like tools to the USAGE_LIST_COLUMNS_OPTION() macro. It makes it simplier and ensures a consistent definition. Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-07hwclock: use snprintf() instead of sprintf()Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-07dmesg: use snprintf() instead of sprintf()Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-07lsipc: use snprintf() instead of sprintf()Karel Zak1-6/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-06Merge branch 'fix/rename_annotation_opt_to_annotate' of ↵Karel Zak2-25/+25
https://github.com/cgoesche/util-linux-fork * 'fix/rename_annotation_opt_to_annotate' of https://github.com/cgoesche/util-linux-fork: man-common: rename annotation.adoc to annotate.adoc swapon: use ANNOTATE_OPTION as enum name for --annotate swapon: rename the new --annotation option to --annotate swapon: (usage) make the help text fit within 80 columns again
2025-10-05man-common: rename annotation.adoc to annotate.adocChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-05swapon: use ANNOTATE_OPTION as enum name for --annotateChristian Goeschel Ndjomouo1-9/+9
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-05swapon: rename the new --annotation option to --annotateBenno Schulenberg1-2/+2
The form --annotation gave the impression that after the subsequent "=" comes the text that each column name should be annotated with. Furthermore, the other two options with optional arguments (--show and --discard) are in the imperative, so follow that style and use --annotate instead. (In the bargain, this allows aligning the descriptions in the help text perfectly again.) Also, improve the description of --annotate in the man page somewhat. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-10-05swapon: (usage) make the help text fit within 80 columns againBenno Schulenberg1-15/+15
Recent commit 72829b08fe added four extra spaces to each description in the usage text, causing some lines to be wider than 80 characters. Undo that addition, to make the help text fit again in 80 columns. Also, put the equals sign for the new --annotation option inside the square brackets instead of mistakenly before them. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-10-03lsns: don't abort if /proc/self/ns/user is absent; probe other ns entriesMasatake YAMATO1-3/+17
In 7d5036fdafe0 ("lsns: show namespaces only kept alive by open file descriptors"), I added code that calls stat(2) on /proc/self/ns/user and made lsns exit after reporting an error if the call failed. I assumed /proc/self/ns/user would be available on all platforms. As Axel Karjalainen reported (link below), that assumption was wrong: on some platforms, the file is absent. Exiting for this reason is undesirable. The stat(2) call is used to obtain the dev_t of the backing device of nsfs. However, /proc/self/ns/user is not the only source; calling stat(2) on other namespace files under /proc/self/ns yields the same dev_t. This change iterates over entries under /proc/self/ns and uses the first one whose stat(2) succeeds. Reported-by: Axel Karjalainen <axel@axka.fi> Link: https://github.com/util-linux/util-linux/pull/2902#issuecomment-3348630885 Fixes: 7d5036fdafe0 ("lsns: show namespaces only kept alive by open file descriptors") Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2025-10-01Merge branch 'feat/swapon_translate_col_names' of ↵Karel Zak2-42/+59
https://github.com/cgoesche/util-linux-fork * 'feat/swapon_translate_col_names' of https://github.com/cgoesche/util-linux-fork: bash-completion: (swapon) add --annotation option swapon: document --annotation option on the man page swapon: control column header tooltips with --annotation swapon: annotate column header names with OSC8 hyperlinks lib/strutils: add helper function for --annotation option libsmartcols: new scols_column_{refer,get}_annotation routines
2025-10-01fallocate: allow O_CREATE if mode is FALLOC_FL_WRITE_ZEROESLukas Herbolt1-1/+1
With the new flag we can create the ZEROED allcoated files directly and not in the two steps. Removing FALLOC_FL_WRITE_ZEROES from the flags of not using O_CREATE on open(). Signed-off-by: Lukas Herbolt <lukas@herbolt.com>
2025-09-24swapon: document --annotation option on the man pageChristian Goeschel Ndjomouo1-0/+2
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-24swapon: control column header tooltips with --annotationChristian Goeschel Ndjomouo1-15/+27
Whether column header names should be annotated can be specified with the --annotation option which takes the following three arguments: 'auto', 'never' and 'always', where the former is the default and makes it so that annotations are only added when the output device is a terminal. If the option is omitted the 'auto' behavior should be expected. Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-24swapon: annotate column header names with OSC8 hyperlinksChristian Goeschel Ndjomouo1-28/+31
Column header names are annotated with OSC8 hyperlinks to provide tooltips with a description of the column. This is mainly motivated by the fact that column headers are currently not translated, so as an alternative we will provide a column description translated according to the environment locale setting. Addresses: #1291 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-24Merge branch 'PR/Benno-23Sep' of https://github.com/karelzak/util-linux-workKarel Zak2-16/+15
* 'PR/Benno-23Sep' of https://github.com/karelzak/util-linux-work: fallocate: (man,usage) correct the alphabetical sorting of the options fallocate: (man) slightly improve the grammar of two sentences fallocate: redo four tweaks that were accidentally undone column: (usage) wrap two descriptions, to make them fit within 80 columns column: (usage) correct the description of --wrap-separator getopt: (usage) make the description of -U fit within 80 columns
2025-09-24losetup: Add the --remove/-R parameter to remove loop deviceswguanghao2-1/+40
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
2025-09-24losetup: rename function *_delete_* to *_detach_*wguanghao1-13/+14
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
2025-09-23fallocate: (man,usage) correct the alphabetical sorting of the optionsBenno Schulenberg2-9/+9
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-09-23fallocate: (man) slightly improve the grammar of two sentencesBenno Schulenberg1-2/+2
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-09-23fallocate: redo four tweaks that were accidentally undoneBenno Schulenberg1-6/+5
Recent commit c407a13fc1 undid some changes that were made by commits 762f295a02 and 325a269995. Redo these changes. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-09-13nsenter,unshare: (man) add the NS-related commands to SEE ALSOMasatake YAMATO2-0/+6
The NS-related commands in util-linux complement each other. Users should know them. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2025-09-10lscpu: New Arm C1 partsJeremy Linton1-0/+4
Arm has announced the C1-Nano with a TRM here: https://developer.arm.com/documentation/107753/latest The C1-Pro with a TRM here: https://developer.arm.com/documentation/107771/latest The C1-Ultra with a TRM here: https://developer.arm.com/documentation/108014/latest The C1-Premium with a TRM here: https://developer.arm.com/documentation/109416/latest Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
2025-09-08Merge branch 'fix/doc_list_columns_lscpu_man' of ↵Karel Zak1-3/+8
https://github.com/cgoesche/util-linux-fork * 'fix/doc_list_columns_lscpu_man' of https://github.com/cgoesche/util-linux-fork: lscpu: (man) add description of the --list-columns option
2025-09-08Merge branch 'master' of https://github.com/mariobl/util-linuxKarel Zak1-1/+1
* 'master' of https://github.com/mariobl/util-linux: Fix another issue in login.1.adoc sfdisk.8.adoc: Replace --help and --version with external entity Fix markup in pam_lastlog2.8.adoc Fix markup in column.1.adoc Fix markup in mount.8.adoc Fix typo and markup in getopt.1.adoc Fix markup in lsfd.1.adoc Fix markup, grammar and spelling in scols-filter.5.adoc Fix login.1.adoc
2025-09-08lscpu: Add NVIDIA Olympus arm64 coreMatthew R. Ochs1-0/+1
Add an entry for NVIDIA Olympus arm64 core. Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
2025-09-04lscpu: (man) add description of the --list-columns optionChristian Goeschel Ndjomouo1-3/+8
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-03Fix markup in mount.8.adocMario Blättermann1-1/+1
2025-09-03Merge branch 'feat/lscpu_add_microcode_column' of ↵Karel Zak1-0/+6
https://github.com/cgoesche/util-linux-fork * 'feat/lscpu_add_microcode_column' of https://github.com/cgoesche/util-linux-fork: bash-completion: add MICROCODE to $OPTS_ALL lscpu: add MICROCODE output column
2025-09-03Merge branch 'fix/fix_lsns_list_columns_opt' of ↵Karel Zak1-6/+8
https://github.com/cgoesche/util-linux-fork * 'fix/fix_lsns_list_columns_opt' of https://github.com/cgoesche/util-linux-fork: bash-completion: (lsns) add -H/--list-columns options lsns: fix --list-columns option Signed-off-by: Karel Zak <kzak@redhat.com>
2025-09-03Merge branch 'feat/allow_killing_with_pidfd' of ↵Karel Zak1-2/+2
https://github.com/cgoesche/util-linux-fork * 'feat/allow_killing_with_pidfd' of https://github.com/cgoesche/util-linux-fork: textual: rename list_colunms() to list_columns() and remove trailing whitespaces include/strutils: add missing header guard comment lib: fix bad indentation in meson.build kill: add support for race-free process kills using pidfd inodes
2025-09-03Merge branch 'feat/add_columns_env_ls_cmds' of ↵Karel Zak4-11/+59
https://github.com/cgoesche/util-linux-fork * 'feat/add_columns_env_ls_cmds' of https://github.com/cgoesche/util-linux-fork: lscpu: (man) document the LSCPU_{CACHES_}COLUMNS environment variables bash-completion: (lscpu) add -H/--list-columns options lscpu: add --list-columns option and declutter --help output lscpu: add support for LSCPU_{CACHES_}COLUMNS environment variables lsclocks: add support for LSCLOCKS_COLUMNS environmental variable tests: (lsmem) update expected/lscpu/* with 'ZONES' column lsmem: add support for LSMEM_COLUMNS environmental variable
2025-09-03Merge branch 'PR/libmount-canonicalize-cleanup' of ↵Karel Zak3-5/+5
https://github.com/karelzak/util-linux-work * 'PR/libmount-canonicalize-cleanup' of https://github.com/karelzak/util-linux-work: lib/canonicalize: use ul_ prefix lib/canonicalize: introduce generic drop-permission caller meson: cleanup tests to use libcommon.la autotools: cleanup tests to use libcommon.la tests: add canonicalize test lib/canonicalize: refactor canonicalize_path() lib/canonicalize: rename to ul_absolute_path()
2025-09-02textual: rename list_colunms() to list_columns() and remove trailing whitespacesChristian Goeschel Ndjomouo1-2/+2
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-02lscpu: add MICROCODE output columnChristian Goeschel Ndjomouo1-0/+6
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-02lsns: fix --list-columns optionChristian Goeschel Ndjomouo1-6/+8
This patch makes it so that we continue parsing all CLI options even when we find -H/--list-columns. Therefore we don't miss any format specifying options, namely --json and --raw, and print the columns in the desired form. Closes: #3725 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-02lscpu: (man) document the LSCPU_{CACHES_}COLUMNS environment variablesChristian Goeschel Ndjomouo1-1/+13
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-02lscpu: add --list-columns option and declutter --help outputChristian Goeschel Ndjomouo1-10/+34
This moves the list of available columns from the --help output to the '--list-columns' option and makes the usage information more readable. Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-02lscpu: add support for LSCPU_{CACHES_}COLUMNS environment variablesChristian Goeschel Ndjomouo1-0/+5
This provides alternate ways of specifying output columns similar to the '--parse', '--extended' and '--caches' options. Addresses: #2816 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-02lsmem: add support for LSMEM_COLUMNS environmental variableChristian Goeschel Ndjomouo2-0/+7
This provides an alternate way to specify output columns similar to the --output option. Addresses: #2816 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-09-01fallocate: update FALLOC_FL_WRITE_ZEROESKarel Zak2-9/+10
Update to Zhang Yi's latest version of the patch. Unfortunately, I missed that he was still working on it (it was sent to the kernel mailing lists rather than the util-linux mailing list). Signed-off-by: Karel Zak <kzak@redhat.com>
2025-09-01lib/canonicalize: use ul_ prefixKarel Zak3-5/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-09-01Merge branch 'master' of https://github.com/mariobl/util-linuxKarel Zak6-10/+10
* 'master' of https://github.com/mariobl/util-linux: Fix markup in pam_lastlog2.8.adoc Fix markup in ll2_import_lastlog.3.adoc Fix markup in more.1.adoc Fix markup in column.1.adoc Fix markup in mesg.1.adoc Fix markup in unshare.1.adoc Fix markup in swapon.8.adoc Fix typos and markup in setpriv.1.adoc Fix markup in lsirq.1.adoc Fix markup in flock.1.adoc Fix markup in chmem.8.adoc Fix markup in lastlog2.8.adoc Fix markup in findmnt.8.adoc Fix markup in su.1.adoc Fix markup in login.1.adoc Fix markup in scols-filter.5.adoc
2025-09-01Merge branch 'zramctl-max_comp_streams_fix' of ↵Karel Zak1-1/+2
https://github.com/mentha/util-linux * 'zramctl-max_comp_streams_fix' of https://github.com/mentha/util-linux: zramctl: ignore ENOENT when setting max_comp_streams
2025-08-31Fix markup in unshare.1.adocMario Blättermann1-2/+2
2025-08-31Fix markup in swapon.8.adocMario Blättermann1-1/+1
2025-08-31Fix typos and markup in setpriv.1.adocMario Blättermann1-3/+3
2025-08-31Fix markup in lsirq.1.adocMario Blättermann1-2/+2
2025-08-31Fix markup in flock.1.adocMario Blättermann1-1/+1
2025-08-31Fix markup in chmem.8.adocMario Blättermann1-1/+1
2025-08-30zramctl: ignore ENOENT when setting max_comp_streamsJiang XueQian1-1/+2
The `max_comp_streams` attribute of zram devices has been deprecated and all writes were silently ignored by the kernel since 2016. It was finally removed in 6.15, causing zramctl to fail on ENOENT, when it should just ignore the error. Signed-off-by: Jiang XueQian <jiangxueqian@gmail.com>
2025-08-29man: Fixed incorrect ipcrm optionsPrasanna Paithankar1-3/+3
Signed-off-by: Prasanna Paithankar <paithankarprasanna@gmail.com>
2025-08-26Merge branch 'feat/add_microcode_to_lscpu_summary' of ↵Karel Zak4-3/+15
https://github.com/cgoesche/util-linux-fork * 'feat/add_microcode_to_lscpu_summary' of https://github.com/cgoesche/util-linux-fork: lscpu: add 'microcode' information to the CPU summary
2025-08-26Merge branch 'fix/fstrim_use_f_type_equal_macro' of ↵Karel Zak1-1/+1
https://github.com/cgoesche/util-linux-fork * 'fix/fstrim_use_f_type_equal_macro' of https://github.com/cgoesche/util-linux-fork: fstrim: use F_TYPE_EQUAL() macro for statfs.f_type comparison
2025-08-26Merge branch 'master' of https://github.com/ticpu/util-linuxKarel Zak1-1/+1
* 'master' of https://github.com/ticpu/util-linux: zramctl: fix MEM-USED column description
2025-08-26Merge branch 'PR/lscpu-extend-dmi' of ↵Karel Zak2-4/+18
https://github.com/karelzak/util-linux-work * 'PR/lscpu-extend-dmi' of https://github.com/karelzak/util-linux-work: lscpu: use maximum CPU speed from DMI, avoid duplicate version string
2025-08-26chmem: Remove commit - chmem print warnings about failures alwaysSumanth Korikkar1-4/+4
Users do not care which blocks are set offline, when using size option Consistently printing warnings/errors in this case may confuse them and create the false impression that the enable/disable operation itself has failed. If size option succeeds, chmem should not print errors/warnings. Hence, revert commit 48675a744 ("chmem: print warnings about failures always (not only with --verbose)") Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-08-25lscpu: add 'microcode' information to the CPU summarycgoesche4-3/+15
The procfs provides microcode revision information on supported platforms (probably only x86 for now). It can be useful to show this in the output of lscpu for various use cases, e.g. applications that wish to make sure that a specific microcode version has been loaded. Addresses: #3050 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-08-22fstrim: use F_TYPE_EQUAL() macro for statfs.f_type comparisoncgoesche1-1/+1
Addresses: #2332 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-08-22zramctl: fix MEM-USED column descriptionJérôme Poulin1-1/+1
The MEM-USED column was incorrectly documented as showing current memory consumption. This is due to confusing naming in the kernel's zram implementation: - Kernel field "mem_used_total" (3rd in mm_stat) = current memory usage - Kernel field "mem_used_max" (5th in mm_stat) = peak memory usage zramctl maps these as: - TOTAL column <= mem_used_total (current usage) - MEM-USED column <= mem_used_max (peak usage) The misleading "MEM-USED" name suggests current usage, but it actually shows the peak memory usage (high water mark) since device creation or last reset. This is tracked by the kernel's max_used_pages which only increases when current usage exceeds the stored maximum. Fixed description from: "memory zram have been consumed to store compressed data" to "peak memory usage to store compressed data". Mise à jour de la traduction française.
2025-08-21lscpu: use maximum CPU speed from DMI, avoid duplicate version stringKarel Zak2-4/+18
* Read maximum CPU speed from DMI * Don't use max speed if nonsensical * Avoid appending "CPU @ speed" to the version string if it's already included. (This is a code robustness improvement as DMI is currently read for ARMs only, and the issue was detected on Intel.) Fixes: https://github.com/util-linux/util-linux/commit/a772d7c493afcec32f0123fc947013f74db6e45d Signed-off-by: Karel Zak <kzak@redhat.com>
2025-08-20Merge branch 'PR/fallocate-write-zeroes' of ↵Karel Zak2-6/+25
https://github.com/karelzak/util-linux-work * 'PR/fallocate-write-zeroes' of https://github.com/karelzak/util-linux-work: fallocate: add FALLOC_FL_WRITE_ZEROES support
2025-08-14Merge branch 'PR/swapon-fstab' of https://github.com/karelzak/util-linux-workKarel Zak2-0/+49
* 'PR/swapon-fstab' of https://github.com/karelzak/util-linux-work: swapon: (man page) add details about fstab configuration
2025-08-13fallocate: add FALLOC_FL_WRITE_ZEROES supportZhang Yi2-6/+25
The Linux kernel (since version 6.17) supports FALLOC_FL_WRITE_ZEROES in fallocate(2). Add support for FALLOC_FL_WRITE_ZEROES to the fallocate utility by introducing a new option -w|--write-zeroes. Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=278c7d9b5e0c Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
2025-08-13swapon: (man page) add details about fstab configurationKarel Zak2-0/+49
The fstab(5) man page already describes some basic aspects of "swap," but it makes sense to be more specific in the swapon man page and describe everything in one place, serving as a normative reference for what is expected on Linux in fstab for swap. Fixes: https://github.com/util-linux/util-linux/issues/3667 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-08-12mount: add --beneath supportKarel Zak2-2/+20
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-08-05Merge branch 'PR/libmount-excl' of https://github.com/karelzak/util-linux-workKarel Zak2-4/+27
* 'PR/libmount-excl' of https://github.com/karelzak/util-linux-work: mount: add --exclusive command line option libmount: Add support for FSCONFIG_CMD_CREATE_EXCL lib: add FSCONFIG_CMD_CREATE_EXCL
2025-08-05setpriv: improve landlock usage() outputKarel Zak4-33/+39
* Add help for rights names * Keep usage() output for Landlock more structured * Add a note to the man page that "fs" is subject to change Signed-off-by: Karel Zak <kzak@redhat.com>
2025-08-02setpriv: Add support for LANDLOCK_ACCESS_FS_IOCTL_DEVGünther Noack1-0/+3
The LANDLOCK_ACCESS_FS_IOCTL_DEV access right controls whether the process may use IOCTL on opened device files. It is available since Linux 6.10. Compatibility remark: With this change, using the --landlock-access="fs" shortcut now requires Linux 6.10+, where it previously required Linux 6.2+.
2025-07-31mount: add --exclusive command line optionKarel Zak2-4/+27
The new option ensures that the kernel does not reuse existing superblock. The new option is available to non-root users as it does not affect the superblock itself or any other aspects of the mount process. It makes the current mounting more restrictive, so it makes sense to allow it for non-root users. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-07-28ldattach: Allow changing the MTU for GSM0710 framingSeppo Takalo2-9/+17
Traditionally ldattach have hard coded MTU of 127 bytes which differs from defaults proposed in 3GPP TS 27.010 which is 31 bytes when basic framing is used. Add '-m <value>' parameter that is only GSM0710 specific and already handled by the kernel. Use same value for both MTU and MRU. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-07-24setpriv: Improve getgroups() PortabilityKarel Zak1-13/+13
setpriv(1) is Linux-only, and on Linux, getgroups() returns at least one group. However, it's better to use more portable and generic code patterns and assume that getgroups() can return zero. Fixes: https://github.com/util-linux/util-linux/issues/3654 Reported-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2025-07-14textual: harmonize the messages for invalid count and timeout valuesBenno Schulenberg2-4/+3
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-07-14textual: harmonize the messages for an invalid size, length, and offsetBenno Schulenberg1-3/+3
The added words "argument" or "value" or "specified" don't make things clearer and are just unneeded verbosity. Also, use all lowercase. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-06-30lib/strutils: add ul_ prefix to strrep() and strrem() functionsKarel Zak1-2/+2
Addresses: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-06-30lib/strutils: add ul_ prefix to strconcat() functionsKarel Zak1-1/+1
Addresses: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-06-30lib/strutils: add ul_ prefix to startswith() and endswith()Karel Zak4-8/+8
Addresses: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-06-26lib/strv: use ul_ prefix for strv functionsKarel Zak6-19/+19
The functions are originally from systemd/udev, so it's possible that during static linking, they may collide with other systemd-based components. Fixes: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-06-24ldattach: add ifndef BOTHERKarel Zak1-1/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-06-19docs: update mount options for 'ntfs3'Johannes Schneider1-11/+36
Cleanout the mount options, and import the options from the upstream documentation found at https://docs.kernel.org/filesystems/ntfs3.html Fixes: 847264af6 docs: update mount type to 'ntfs3' Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
2025-06-13docs: update mount type to 'ntfs3'Johannes Schneider1-1/+1
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
2025-06-09Merge branch 'PR/Benno-2Jun' of https://github.com/karelzak/util-linux-workKarel Zak28-41/+62
* 'PR/Benno-2Jun' of https://github.com/karelzak/util-linux-work: treewide: replace postal address in license specifier with a terse URL docs: stop the copyright verbiage from getting included in the POT file docs: make the "po4a:" line the first line, like in all other .adoc files correct the full name of the GPL in various files remove "Copyright (C) ...." notes from files that claim no copyright remove two leftover license lines from colors.{c,h}
2025-06-06treewide: replace postal address in license specifier with a terse URLBenno Schulenberg13-39/+26
This brings the license specifier into the internet age. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-06-06docs: stop the copyright verbiage from getting included in the POT fileBenno Schulenberg17-0/+34
For some reason the asciidoc parser from `po4a` includes *all* comments from an adoc file into the util-linux-man.pot file. Xgettext had a way to include only certain comments, but `po4a` does not appear to have a dedicated mechanism for this. So... use some bricolage: insert a fruitless 'ifdef' as a barrier between the copyright/license comment and the title line. This prevents `po4a` from seeing the two things as belonging together. This shrinks the util-linux-man.pot file by 1267 lines (2.5%), equivalent to nearly 67kB (4.8%). Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-06-06docs: make the "po4a:" line the first line, like in all other .adoc filesBenno Schulenberg1-1/+1
Also, there should be no space before "po4a:" for the line to be valid. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-06-06correct the full name of the GPL in various filesBenno Schulenberg1-1/+1
Last year, commit f4cb44bd11 corrected the full name of the GPL in a dozen files, but still left the mistaken name in eight places. (Also, in the first file, just reshuffle the license line, to be in the same position as in other files.) Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-06-05nsenter: (man) improve descriptions for some optionsMartin Joerg1-6/+6
Signed-off-by: Martin Joerg <martin.joerg@gmail.com>
2025-05-29textual: harmonize the wording of the error message for an invalid PIDBenno Schulenberg1-1/+1
Having four different forms for the same basic message is unneeded. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-05-29lib/colors: call gettext() only when the argument of --color is invalidBenno Schulenberg1-2/+1
Instead of calling gettext() before starting to interpret the argument of option -L/--color, call it only when it's needed: when the argument is not recognized. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-05-26Merge branch 'PR/AT_SECURE' of https://github.com/karelzak/util-linux-workKarel Zak1-1/+1
* 'PR/AT_SECURE' of https://github.com/karelzak/util-linux-work: treewide: improve getauxval(AT_SECURE) usage lib/env, ...: use getauxval(AT_SECURE) for SUID check
2025-05-22lscpu: Fix loongarch op-mode output with recent kernelXi Ruoyao1-1/+3
Since Linux-6.12, the "loongarch32" item in the ISA field is separated to "loongarch32r" and "loongarch32s," breaking our expectation. Link: https://git.kernel.org/torvalds/c/34e3c4500cdc Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2025-05-20treewide: improve getauxval(AT_SECURE) usageKarel Zak1-2/+1
Let's enhance portability and readability slightly. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-20Merge branch 'at_secure' of https://github.com/MaxKellermann/util-linux into ↵Karel Zak1-1/+2
PR/AT_SECURE * 'at_secure' of https://github.com/MaxKellermann/util-linux: lib/env, ...: use getauxval(AT_SECURE) for SUID check
2025-05-20lscpu: fix possible buffer overflow in cpuinfo parserKarel Zak1-3/+2
Addresses: https://github.com/util-linux/util-linux/pull/3577 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-13treewide: add ul_ to parse_timestamp() function nameKarel Zak3-4/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-13treewide: add ul_ to parse_switch() function nameKarel Zak4-8/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-13treewide: add ul_ to parse_size() function nameKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-13Merge branch 'PR/PATH-consolidate' of ↵Karel Zak3-7/+10
https://github.com/karelzak/util-linux-work * 'PR/PATH-consolidate' of https://github.com/karelzak/util-linux-work: setpriv: follow /etc/login.defs for PATH su: use logindefs_setenv_path() login: use logindefs_setenv_path() logindefs: Add function to set PATH
2025-05-13Merge branch 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-workKarel Zak1-6/+8
* 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-work: setpriv: protect COLORTERM and NO_COLOR env. variables su: protect COLORTERM and NO_COLOR env. variables login: protect COLORTERM and NO_COLOR env. variables
2025-05-10lib/env, ...: use getauxval(AT_SECURE) for SUID checkMax Kellermann1-1/+2
Comparing effective and real uid/gid is not a proper way to check for SUID execution: 1. this does not consider file capabilities 2. this check breaks when NO_NEW_PRIVS is used as the Linux kernel resets effective ids during execve(); this means the check is false, but the process still has raised capabilities For more details about the NO_NEW_PRIVS problem, check this post and the surrounding thread: https://lore.kernel.org/lkml/20250509184105.840928-1-max.kellermann@ionos.com/ Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
2025-05-07setpriv: protect COLORTERM and NO_COLOR env. variablesKarel Zak1-6/+8
The patch also replaces set/get env with ul_env_list to protect variables. Fixes: https://github.com/util-linux/util-linux/issues/3463 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-07setpriv: follow /etc/login.defs for PATHKarel Zak3-7/+10
The patch also cleans up the --reset-env description in the man page. Fixes: https://github.com/util-linux/util-linux/issues/3560 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-07mount: check for stdout for fstab reload hintKarel Zak1-0/+11
Fixes: https://github.com/util-linux/util-linux/issues/3558 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-05-05Merge branch 'PR/parse_switch' of https://github.com/karelzak/util-linux-workKarel Zak5-17/+15
* 'PR/parse_switch' of https://github.com/karelzak/util-linux-work: fix and add parse_switch() test strutils: move an error message to where it is used, and improve it irqtop: use standard 'always/never' arguments instead of 'enable/disable'
2025-05-05strutils: move an error message to where it is used, and improve itBenno Schulenberg4-11/+8
Calling gettext() is somewhat costly: it has to find the given message among the more than five thousand messages in util-linux's repertoire. So, call gettext() only when the message actually gets printed. Besides, allowing to customize the error message for parse_switch() was a nice gesture, but it's unneeded: a fixed error message is good enough. Also, "argument error" was rather vague, as it doesn't say _what_ the error is. Better say "unsupported argument". Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-05-05irqtop: use standard 'always/never' arguments instead of 'enable/disable'Benno Schulenberg2-8/+9
Most other util-linux tools that accept the option argument "auto" additionally accept "always" and "never", not "enable" / "disable". So, make option --cpu-stat accept those standard words (besides the deviant ones), and adjust the documentation to use the standard words. Furthermore, make --cpu-stat accept also "on", "off", "yes", "no", "1", and "0", to allow the user to use shorter words. The per-CPU stats can now be suppressed with a succinct: `irqtop -c0`. CC: Zhenwei Pi <pizhenwei@bytedance.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-29irqtop: make the wording of an error message identical to that of anotherBenno Schulenberg1-1/+1
(Besides: the original looked like a statement, not like an error message.) Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-29unshare: make the wording of a message identical to that of three othersBenno Schulenberg1-1/+1
That is: spare translators having to translate different strings that mean the exact same thing. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-24docs: correct mistaken uses of "overwrite" to say "override" insteadBenno Schulenberg3-6/+22
This mostly comes down to harmonizing the wording and markup of the various --lock options. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-24docs: correct misspellings of "may be" and mistaken uses of "overwritten"Benno Schulenberg2-2/+4
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-24lscpu: (man) don't refer to a missing section, and improve some wordingsBenno Schulenberg1-11/+20
Three years ago commit aa049eabb3 removed the COLUMNS section but forgot to remove the reference to it. Replace the reference with a referral to the --help text. In the bargain, join two paragraphs that belong together, improve some wordings, and sort two options. This fixes #2590 (https://github.com/util-linux/util-linux/issues/2590). Reported-by: Fabien Malfoy Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-24renice: (man) reword several things, to be clearer, and improve some markupBenno Schulenberg1-11/+26
Also, remove a reference to ulimit(1p) that doesn't make sense. CC: David Anes <david.anes@suse.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-24renice: in usage text, condense the oververbose description of option -nBenno Schulenberg1-4/+2
The --help text should be concise: it serves only as a reminder of how things work. When a more wordy explanation is needed, there is always the man page (as every --help text says at the end). CC: David Anes <david.anes@suse.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-24rtcwake: (man) reduce an inflated table to sane proportionsBenno Schulenberg1-13/+16
Asciidoctor puts an unneeded blank line into every table cell (this is fixed in git [1], but not released yet), and will unnecessarily wrap text in a cell when the text is slightly longer than average. Replace the table with a block of preformatted text, and replace the "+5min" example with a true format that covers most cases, and give some examples of that format after the block. [1] https://github.com/asciidoctor/asciidoctor/commit/9cb73f8c9bee Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-23swapoff: check blkid_probe_lookup_value() return code [coverity scan]Karel Zak1-2/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-22Merge branch 'PR/swapoff-resolve-leaks' of ↵Karel Zak1-14/+25
https://github.com/karelzak/util-linux-work * 'PR/swapoff-resolve-leaks' of https://github.com/karelzak/util-linux-work: swapoff: add comments for do_swapoff swapoff: clean up tag resolution
2025-04-22Merge branch 'spelling' of https://github.com/jwilk-forks/util-linuxKarel Zak1-1/+1
* 'spelling' of https://github.com/jwilk-forks/util-linux: mount: (man) add missing word
2025-04-16Merge branch 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-workKarel Zak1-1/+3
* 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-work: libmount: (subdir) support detached open_tree() (>=6.15) libmount: (subdir) restrict for real mounts only libmount: (subdir) remove unused code
2025-04-16setarch: (man) correct the markup of the synopsis and of two optionsBenno Schulenberg1-18/+19
Drop the second line of the synopsis as it is unneeded (it is covered by the first line since argument "arch" became optional) and distracts from the similarity/contrast between the other two lines. Mark "arch" in the new second synopsis line in italics, as it is a placeholder, not a literal. Also, improve some wording, reduce redundancy by reshuffling the --pid option, and remove a redudant -v from an example. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-15docs: add -h/--help and -V/--version to three man pages that lacked themBenno Schulenberg3-10/+4
Also, harmonize the wording and placement of these options in a few other man pages, and use an `include` where possible. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-15losetup,lscpu: (man) add the missing -h/--help and -V/--version optionsBenno Schulenberg2-0/+4
Three years ago, commit 2b2d317242 removed these options from these two man pages but forgot to replace them with the relevant `include`. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-15docs: fix a few indentation issuesBenno Schulenberg3-3/+6
That is: add "+" or " +" to keep paragraphs together. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-15docs: improve and harmonize the description of -H / --list-columnsBenno Schulenberg1-1/+2
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-09mount: (man) add missing wordJakub Wilk1-1/+1
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2025-04-09libmount: (subdir) restrict for real mounts onlyKarel Zak1-1/+3
It's now possible to use, for example, for bind operations, but it does not make sense as you can specify the target with the subdirectory. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-09swapoff: add comments for do_swapoffzt20xx1-1/+4
[kzak@redhat.com: - add the comment to swapoff_by() too] Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-09swapoff: clean up tag resolutionKarel Zak1-13/+21
- Rename swapoff_resolve_tag() to resolve_swapfile_tag() and retain only code relevant to swapfiles. - Always call mnt_resolve_*() before resolve_swapfile_tag() to resolve tags/paths on standard block devices. - Call free() for resolve_swapfile_tag() to avoid memory leaks. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-08Merge branch 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-workKarel Zak5-24/+23
* 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-work: zramctl: (man) mention the required arguments for -p and -r zramctl: restore normal description indentations in the usage text textual: fix a mistruncated message, and fix a typo hwclock: remove two comments about parameters that no longer exist
2025-04-08mount: (man) shorten an overlong line, and improve some markupBenno Schulenberg1-7/+8
Also, in the synopis mention -F separately to make it more obvious that it applies only to -A, swap two options to make a line more similar to the preceding one, and improve some wording. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08mount: (man) fix some indentation issues, and improve a few wordingsBenno Schulenberg1-11/+20
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08eject: (man) add the missing SYNOPSIS headerBenno Schulenberg1-0/+2
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08blkzone: (man) reduce two overblown tables to legible proportionsBenno Schulenberg1-23/+21
Before version 2.37, before asciidoctor was used, the first three lines of the first table looked like this: start Zone start sector len Zone length in number of sectors wptr Zone write pointer position After the move to asciidoctor, the first three lines of the first table in the generated man page looked like this: ┌────────┬────────────────────────────┐ │ │ │ │start │ Zone start sector │ ├────────┼────────────────────────────┤ │ │ │ │len │ Zone length in number of │ │ │ sectors │ ├────────┼────────────────────────────┤ │ │ │ │wptr │ Zone write pointer │ │ │ position │ ├────────┼────────────────────────────┤ Three to four screen lines for just one line of information! Reduce the tables to sane proportions again by simply using blocks of preformatted text. (The substition of xN for x? is needed because somehow the ? in the indented text is a special character in groff.) Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08choom: (man) add the missing SYNOPSIS section header, and improve wordingBenno Schulenberg1-2/+4
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08zramctl: (man) mention the required arguments for -p and -rBenno Schulenberg2-8/+11
Also, sort the options strictly alphabetically ("r" before "raw"). Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08zramctl: restore normal description indentations in the usage textBenno Schulenberg1-11/+12
Commit 19c12e63b1 from four months ago changed the indentation of *all* the option descriptions in the usage text. That was the wrong thing to do, as it invalidates all existing translations for no good reason. When one of the options is (or needs to become) overlong, then the thing to do is: to put the description of this option on the next line. So, restore the indentation of the descriptions to what they were before commit 19c12e63b1, and wrap the description of -p. Also, make the description of -b fit within 80 columns, and sort the options better: alphabetically, but single letter before long option. CC: LiviaMedeiros <livia@cirno.name> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08textual: fix a mistruncated message, and fix a typoBenno Schulenberg2-2/+2
The phrase "in human-readable form" was chosen rather than "in human-readable format" because it's shorter and lets the line fit *just* within 80 columns. Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08hwclock: remove two comments about parameters that no longer existBenno Schulenberg1-5/+0
Commit 336f7c5f68 from nine years ago removed the 'universal' and 'testing' parameters of do_adjustment() but forgot to update the leading comment. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-08Merge branch 'fallthrough' of https://github.com/teknoraver/util-linuxKarel Zak5-7/+7
* 'fallthrough' of https://github.com/teknoraver/util-linux: Use the 'fallthrough' attribute move XXH_FALLTHROUGH into a generic include file Fix XXH_HAS_C_ATTRIBUTE check
2025-04-08Merge branch 'PR/treewide-fix-optarg' of ↵Karel Zak2-4/+12
https://github.com/karelzak/util-linux-work * 'PR/treewide-fix-optarg' of https://github.com/karelzak/util-linux-work: treewide: fix optional arguments usage
2025-04-07Use the 'fallthrough' attributeMatteo Croce5-7/+7
C23[1] and CPP17[2] introduced the 'fallthrough' attribute to let the compiler know that we're intentionally falling through a case statement. This suppress a warning with new compilers when doing an implicit fallthrough. [1] https://en.cppreference.com/w/c/language/attributes/fallthrough [2] https://en.cppreference.com/w/cpp/language/attributes/fallthrough
2025-04-07treewide: fix optional arguments usageKarel Zak2-4/+12
In some parts of the code, the optional argument handling is missing for cases where the argument starts with '='. This is particularly important for short options with optional arguments, as suggested by our man pages. The libc getopt_long() handles this for long options, but for short options, it's our responsibility. Note that some argument parsing functions (mostly colormode_or_err()) already implement this, as they are usually used with optional arguments. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-04treewide: use strtopid_or_err()Masatake YAMATO3-3/+3
Addresses: https://github.com/util-linux/util-linux/pull/3486 Suggested-by: Thomas Weißschuh <thomas@t-8ch.de> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2025-04-03Merge branch 'PR/Benno-31Mar' of https://github.com/karelzak/util-linux-workKarel Zak2-18/+19
* 'PR/Benno-31Mar' of https://github.com/karelzak/util-linux-work: tests: update coresched tests coresched: reduce excessive whitespace and verbosity in usage text lsblk: (man) remove the incorrect spaces between the arguments of --ct hardlink: fix typoed semicolon to colon in error message findmnt: (man) remove duplicated option, and correct a description irqtop: improve several more option descriptions, and align them all irqtop: improve the description of --batch, and align it with others last: don't use a tab character in the --help usage text uclampset: simplify the synopsis in the --help usage text enosys: add the missing arguments of -s and -i to the usage text
2025-04-03setarch: use strtopid_or_err()Karel Zak1-1/+1
Addresses: https://github.com/util-linux/util-linux/pull/3486 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-02irqtop: improve several more option descriptions, and align them allBenno Schulenberg2-15/+15
Keep at least two spaces between option+argument and its description, while making sure not to go above 80 columns per line. Also, improve the docstring (there is no need to mention that irqtop is a utility) and remove the ugly Q from the list of interactive keys. CC: Joe Jin <joe.jin@oracle.com> CC: Zhenwei Pi <pizhenwei@bytedance.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-02irqtop: improve the description of --batch, and align it with othersBenno Schulenberg2-6/+7
Also improve the description of --delay and tweak the one of --json, and align both descriptions with the preceding ones. CC: Joe Jin <joe.jin@oracle.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-04-02treewide: avoid strcasecmp() for ASCII-only stringsKarel Zak15-35/+52
Use cctype.h for locale-independent string comparison and to avoid tricky string conversions like in tr_TR locales. Fixes: https://github.com/util-linux/util-linux/issues/3490 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-01Merge branch 'setarch--show-pid' of https://github.com/masatake/util-linuxKarel Zak2-2/+58
* 'setarch--show-pid' of https://github.com/masatake/util-linux: setarch: add -p/--pid option showing the personality of specified process procfs: add a helper function to access /proc/$pid/personality bash-completion: (setarch) show some options as the 1st arg
2025-04-01Merge branch 'master' of https://github.com/pls-no-hack/util-linuxKarel Zak1-1/+1
* 'master' of https://github.com/pls-no-hack/util-linux: Fix typo in blkdiscard docs
2025-04-01lsns: enhance compilation without USE_NS_GET_APIKarel Zak1-22/+10
- Move add_namespace_for_nsfd() declaration to the #ifdef block - Replace get_netnsid_for_fd() with inline code as it's used only once References: 2ced43400f35f7bd45b29364e04166a63a06e16a Signed-off-by: Karel Zak <kzak@redhat.com>
2025-04-01Merge branch 'bugfix/undefined-reference-add_namespace_for_nsfd' of ↵Karel Zak1-0/+6
https://github.com/ThomasDevoogdt/util-linux * 'bugfix/undefined-reference-add_namespace_for_nsfd' of https://github.com/ThomasDevoogdt/util-linux: lsns: fix undefined reference to add_namespace_for_nsfd #3483
2025-03-28Fix typo in blkdiscard docspls-no-hack1-1/+1
2025-03-28setarch: add -p/--pid option showing the personality of specified processMasatake YAMATO2-2/+58
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2025-03-27ipcs: align the first group of options with later ones in the usage textBenno Schulenberg1-2/+2
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-03-27swapon: improve a translator hint, and remove a pointless oneBenno Schulenberg1-2/+2
The reference to "each entry below" made no sense, as that second translator hint is not before a gettextized message and therefore did not make it into the POT file. Gettextizing that message is not useful as 1) there is nothing to translate, and 2) allowing the translators to fiddle with the tabs is too complicated, and 3) the --summary output is deprecated anyway. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-03-27fstrim: mark only the mountpoint as placeholder, not options -A and -aBenno Schulenberg1-1/+1
Also, write "mountpoint" as one word here, because it's clearer. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-03-27chmem: (man) add missing end-of-bold marker, and add missing OR barBenno Schulenberg1-2/+2
Also, use "EXAMPLES", in the plural, as there are four examples. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>