According to audit_log_user_message(3) result 1 is "success" and 0 is
"failed", we use standard EXIT_{SUCCESS,FAILURE} macros with reverse
status.
Addresses: https://github.com/karelzak/util-linux/issues/966
Signed-off-by: Karel Zak <kzak@redhat.com>
Since v2.34 --list prints devices only once to make the output
user-readable. Unfortunately, it's regression for scripts/applications
where we need to parse lsblk output. So, let's make --pairs and --raw
backwardly compatible with versions before 2.34 and print all hierarchy.
Addresses: https://github.com/ibm-s390-tools/s390-tools/issues/80
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/exfat.c: In function ‘probe_exfat’:
./include/c.h:133:17: warning: comparison of distinct pointer types lacks a cast
libblkid/src/superblocks/exfat.c:129:5: note: in expansion of macro ‘min’
./include/c.h:134:8: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's consolidate the code, we need to use it in libfdisk too. It
seems better to keep it generic and libblkid independent.
This patch also removes blkid_encode_alloc(), this function is overkill.
Signed-off-by: Karel Zak <kzak@redhat.com>
______________________________________________________
GNU C Library NEWS -- history of user-visible changes.
Version 2.31
Deprecated and removed features, and other changes affecting compatibility:
* The settimeofday function can still be used to set a system-wide time
zone when the operating system supports it. This is because the Linux
kernel reused the API, on some architectures, to describe a system-wide
time-zone-like offset between the software clock maintained by the kernel,
and the "RTC" clock that keeps time when the system is shut down.
However, to reduce the odds of this offset being set by accident,
settimeofday can no longer be used to set the time and the offset
simultaneously. If both of its two arguments are non-null, the call
will fail (setting errno to EINVAL).
Callers attempting to set this offset should also be prepared for the call
to fail and set errno to ENOSYS; this already happens on the Hurd and on
some Linux architectures. The Linux kernel maintainers are discussing a
more principled replacement for the reused API. After a replacement
becomes available, we will change settimeofday to fail with ENOSYS on all
platforms when its 'tzp' argument is not a null pointer.
settimeofday itself is obsolescent according to POSIX. Programs that set
the system time should use clock_settime and/or the adjtime family of
functions instead. We may cease to make settimeofday available to newly
linked binaries after there is a replacement for Linux's time-zone-like
offset API.
______________________________________________________
hwclock(8) had one settimeofday(2) call where both args were set for
--hctosys when the RTC was ticking UTC. This allowed setting the system
time, timezone, and locking the warp_clock function with a single call.
That operation now takes 3 calls of settimeofday(2).
Although this common operation now takes three calls, the overall logic
for the set_system_clock() function was simplified.
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Allocating and freeing all the time is a little bit heavier, but it is also
more robust. It is impossible to know if field lenghts stay fixed.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit add total and delta as separate columns rather than a toggle,
making output generally more informative. When using command I found that
sort order key bindings should match with first letter of column headers so
that they are as easy as possible to remember, and therefore enhancing user
experience.
Requested-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This matches with sort order n for name, and allows later usage of d for
delta without needing to go around d for description.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Change total to display delta or count depending on run mode. Add space in
between header and irqtop body. Print only number of active CPU in header.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Visible cursor is distraction. Secondly with visible cursor key commands
can be visible adding unwanted characters to end of output.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The rirst output is total count followed by number of interupts since
previous screen update. This is how the irqtop worked before libsmartcols
was added to the command.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This makes output to be automatically be nicely adjusted to optimal width.
In this commit also removes excess spaces from description strings.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Having a when and from where information is useful in situations when output
is examined later and possibly elsewhere. Typical example would be a
screenshot or output copy-paste of a terminal to a ticketing system.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The event loop takes care of the standard screen updates, signals, and user
inputs. Two nice things using even loop like this are; 1) no need for any
global variables and 2) effect of user commands is immediate.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
With very short delay one can see irqfile file descriptors pile up rather
quickly causing program to stop with too many open files error. This commit
fixes that, and removes couple other memory leaks. With these the command
should hopefully run fine for days if not even months.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
The logger and rtwake time function changes continue the same fixes as
previous commit - use thread safe functions. The libsmartcols condition
removal is possible because width must be greater than tb->termwidth that is
size_t and cannot be smaller than zero. And remove couple FIXME's that are
old and unlikely ever to get fixed.
Reference: 3160589d86
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* 'various-fixes' of https://github.com/kerolasa/util-linux:
kill: include sys/types.h before checking SYS_pidfd_send_signal
libfdisk: fix pointer wraparound warning
hwclock: update yacc file
script: fix minor warning
getopt: use examples installation directory in man page
fstrim: randomize timer start time across 100 minutes
various: use threadsafe versions of time functions [lgtm scan]
write: fix potential string overflow