Karel Zak [Mon, 5 Feb 2024 11:07:49 +0000 (12:07 +0100)]
Merge branch 'lsfd--error' of https://github.com/masatake/util-linux
* 'lsfd--error' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case testing ERROR type appeared in TYPE column
tests: (test_mkfds::mmap) new factory
lsfd: add --_drop-prvilege option for testing purpose
lsfd: add ERROR as a new type
lsfd: (refactor) make the steps for new_file consistent
lsfd: (refactor) add abst_class as super class of file_class
lsfd: (refactor) simplify the step to make a file struct
lsfd: (refactor) simplify the step to copy a file struct if the result of its stat is reusable
lsfd: (refactor) flatten bit fields in struct file
lsfd: fix typos of a function name
Karel Zak [Mon, 5 Feb 2024 10:55:39 +0000 (11:55 +0100)]
Merge branch 'meson/lastlog2' of https://github.com/t-8ch/util-linux
* 'meson/lastlog2' of https://github.com/t-8ch/util-linux:
meson: only build liblastlog when enabled
meson: create dedicated config for pam_lastlog2
meson: use a dependency object for sqlite3
meson: use a dependency object for liblastlog2
Karel Zak [Mon, 5 Feb 2024 09:54:17 +0000 (10:54 +0100)]
Merge branch 'enosys/optim' of https://github.com/t-8ch/util-linux
* 'enosys/optim' of https://github.com/t-8ch/util-linux:
enosys: optimize bytecode when execve is not blocked
enosys: optimize bytecode when no ioctls are blocked
enosys: add helpers for 64 bit integer loading
enosys: drop unnessecary load of ioctl number
Karel Zak [Mon, 29 Jan 2024 13:01:34 +0000 (14:01 +0100)]
Merge branch 'lsfd--limit-listing-kthreads' of https://github.com/masatake/util-linux
* 'lsfd--limit-listing-kthreads' of https://github.com/masatake/util-linux:
lsfd: don't list kernel threads unless --threads is given
lsfd: (refactor) rename a function, s/new_process/new_proc/g
Karel Zak [Wed, 24 Jan 2024 08:56:13 +0000 (09:56 +0100)]
Merge branch 'boilerplate/test' of https://github.com/t-8ch/util-linux
* 'boilerplate/test' of https://github.com/t-8ch/util-linux:
Documentation: add basic smoketest for boilerplate.c
treewide: fix newlines when using fputs
Thomas Weißschuh [Tue, 23 Jan 2024 19:22:21 +0000 (20:22 +0100)]
treewide: fix newlines when using fputs
The `fputs()` introduced in #2561 does not automatically include a
trailing newline which the original `puts()` did.
This broke the `--help` output of various utilities.
Changing all format strings to include a newline is not feasible as it
would force all translations to be adapted.
Instead introduce a new helper `fputsln()` that works as expected.
Karel Zak [Tue, 23 Jan 2024 13:54:17 +0000 (14:54 +0100)]
Merge branch 'lastlog2' of https://github.com/schubi2/util-linux
* 'lastlog2' of https://github.com/schubi2/util-linux:
lastlog2 - Y2038 safe version of lastlog pam_lastlog2 - PAM module which logs user login with lastlog2
Edward Chron [Thu, 4 Jan 2024 20:43:46 +0000 (12:43 -0800)]
dmesg: add caller_id support
Submission to Project: util-linux
Open Incident: #2609 at github.com/util-linux/util-linux/issues/2609
Component: util-linux/sys-utils
File: dmesg.c
Code level patch applied against: 2.39.3 - latest code pulled from
git.github.com:util-linux/util-linux.git
Revision: #1 on 2023/12/08 per Review from Karel Zak
Revision: #2 on 2023/12/12 Adjust line offsets for master update and
Add caller_id_size init to dmesg -K
Revision: #3 on 2023/12/12 Use of sizeof for cidbuf and limit search
for caller_id to dmesg prefix to msg text
Revision: #4 on 2023/12/15 Ensure SYSLOG and kmsg inputs have
caller_id_size set appropriately
Revision: #5 on 2023/12/24 Make caller_id width consistent with
makedumpfile
Revision: #6 on 2023/12/30 Use updated test naming convention
Revision: #7 on 2024/01/04 Normalize kmsg caller_id spacing for test
platforms by removing caller_id padding
in test generated output.
Add support to standard dmesg command for the optional Linux Kernel
debug CONFIG option PRINTK_CALLER which adds an optional dmesg field
that contains the Thread Id or CPU Id that is issuing the printk to
add the message to the kernel ring buffer. This makes debugging simpler
as dmesg entries for a specific thread or CPU can be recognized.
The dmesg -S using the old syslog interface supports printing the
PRINTK_CALLER field but currently standard dmesg does not support
printing the field if present. There are utilities that use dmesg and
so it would be optimal if dmesg supported PRINTK_CALLER as well.
The additional field provided by PRINTK_CALLER is only present
if it was configured for the Linux kernel where the dmesg command
is run. It is a debug option and not configured by default so the
dmesg output will only change for those kernels where the option was
configured when the kernel was built. For users who went to the
trouble to configure PRINTK_CALLER and have the extra field available
for debugging, having dmesg print the field is very helpful.
Size of the PRINTK_CALLER field is determined by the maximum number
tasks that can be run on the system which is limited by the value of
/proc/sys/kernel/pid_max as pid values are from 0 to value - 1.
This value determines the number of id digits needed by the caller id.
The PRINTK_CALLER field is printed as T<id> for a Task Id or C<id>
for a CPU Id for a printk in CPU context. The values are left space
padded and enclosed in parentheses such as: [ T123] or [ C16]
For consistency with dmesg -S which supports the PRINTK_CALLER field
the field is printed followed by a space. For JSON format output the
PRINTK_CALLER field is identified as caller as that is consistent with
it's naming in /dev/kmsg. No space padding is used to reduce space
consumed by the JSON output. So the output from the command on a system
with PRINTK_CALLER field enabled in the Linux .config file the dmesg
output appears as:
> dmesg
...
[ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -x
...
kern :info : [ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
> dmesg -S
...
[ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -S -x
...
kern :info : [ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
Note: When dmesg uses the old syslog interface the reserved space for
the PRINTK_CALLER field is capped at 5 digits because 32-bit
kernels are capped at 32768 as the max number of PIDs. However,
64-bit systems are currently capped at 2^22 PIDs (0 - 4194303).
The PID cap is set by PID_MAX_LIMIT but the system limit can be
less so we use /proc/sys/kernel/pid_max to determine the size
needed to hold the maximum PID value size for the current system.
Many 64-bit systems support 2^22 PIDs (0 - 4194303) and you see:
This is the only difference seen with PRINTK_CALLER configured and
printing between the dmesg /dev/kmsg interface and the dmesg -S syslog
interface.
Tests naming has been revised based on naming convention Thomas used to
introduce dmest json tests. The naming of test and input files that
reside in tests/ts/dmeg include:
<name> are existing dmesg syslog interface tests and input files.
cid-<name> are dmesg syslog interface caller_id tests and input files.
json-<name> are dmesg kmsg interface tests and input files.
cid-json-<name> are dmesg kmsg interface caller_id tests and input files.
Resulting expected files match the test names.
Signed-off-by: Ivan Delalande <colona@arista.com> Signed-off-by: Edward Chron <echron@arista.com> Signed-off-by: Karel Zak <kzak@redhat.com>
As none of the cputype_patterns match any of the fields in that file,
`cpu->type` is never set, which causes `get_cell_data` to always
return nullptr. The output of `lscpu -b --extended=CPU` and `lscpu
-p` is then empty.
Resolve that.
[kzak@redhat.com: - fix DEF_PAT_CPUTYPE()s order
- refresh lscpu/lscpu-rv64-linux test]
Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 23 Jan 2024 10:07:58 +0000 (11:07 +0100)]
Merge branch 'lsfd--fix-2691' of https://github.com/masatake/util-linux
* 'lsfd--fix-2691' of https://github.com/masatake/util-linux:
tests: (lsfd::column-xmode) skip some subtests if OFD locks are not available
tests: (lsfd) skip mkfds-netns if SIOCGSKNS is not defined
tests: (lsfd) add lsfd_check_mkfds_factory as a help function
tests: (test_mkfds) add --is-available option
lsfd: build lsfd even if kcmp.h is not available
tests: (refactor (test_mkfds, lsfd)) use TS_EXIT_NOTSUPP instead of EXIT_ENOSYS
Karel Zak [Tue, 23 Jan 2024 10:06:51 +0000 (11:06 +0100)]
Merge branch 'findmnt-inode' of https://github.com/masatake/util-linux
* 'findmnt-inode' of https://github.com/masatake/util-linux:
findmnt: add -I, --dfi options for imitating the output of df -i
findmnt: add inode-related columns for implementing "df -i" like output