Karel Zak [Fri, 6 Mar 2020 14:28:57 +0000 (15:28 +0100)]
irqtop: cleanup sort stuff
* user "cmp" in the function names (it does not sort)
* keep all in irq-common.c
* use column names on command line (e.g. --sort NAME)
* hardcode default to sort_result()
Sami Kerola [Sat, 22 Feb 2020 16:42:56 +0000 (16:42 +0000)]
irqtop: add total and delta as own columns
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>
Sami Kerola [Fri, 21 Feb 2020 22:28:43 +0000 (22:28 +0000)]
irqtop: display number of new interupts in-between updates
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.
Sami Kerola [Sun, 5 Jan 2020 10:40:12 +0000 (10:40 +0000)]
irqtop: include hostname and timestamp to output header
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.
Sami Kerola [Sun, 5 Jan 2020 09:27:19 +0000 (09:27 +0000)]
irqtop: use epoll event loop
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.
Sami Kerola [Sat, 4 Jan 2020 09:35:19 +0000 (09:35 +0000)]
irqtop: fix open file descriptor leak
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.
zhenwei pi [Mon, 11 Nov 2019 12:48:59 +0000 (20:48 +0800)]
irqtop: implement a new utility to display kernel interrupt
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.
Sami Kerola [Thu, 20 Feb 2020 20:08:00 +0000 (20:08 +0000)]
various: fix more lgtm scan warnings
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.
Karel Zak [Tue, 18 Feb 2020 13:02:41 +0000 (14:02 +0100)]
Merge branch 'various-fixes' of https://github.com/kerolasa/util-linux
* '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
Karel Zak [Mon, 17 Feb 2020 12:13:11 +0000 (13:13 +0100)]
lscpu: fix SIGSEGV on archs without drawers & books
The drawers and books are optional and not supported on all
architectures and in this case drawers/books relevant arrays are not
allocated, so don't access it although user wants it
(e.g. "lscpu -p -y --output-all").
This patch also cleans up arrays allocation to make it more readable
and robust against edit mistakes.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1801760 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Sat, 15 Feb 2020 21:12:50 +0000 (21:12 +0000)]
kill: include sys/types.h before checking SYS_pidfd_send_signal
Including sys/types.h must happen before SYS_pidfd_send_signal is checked,
because that header defines variable in normal conditions. When sys/types.h
does not have SYS_pidfd_send_signal then fallback is defined in config.h
that is included by default, and has therefore worked fine before and after
this change.
Sami Kerola [Sun, 9 Feb 2020 22:14:56 +0000 (22:14 +0000)]
various: use threadsafe versions of time functions [lgtm scan]
Deprecating calls to not-thread safe asctime(), ctime(), and localtime()
calls is pretty close to pointless change. Lets do it to reduce lgtm scan
warnings with justification it's nicer to use static analysis tools when
they have very few positives.
Karel Zak [Mon, 10 Feb 2020 12:51:23 +0000 (13:51 +0100)]
Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
tests: Add UDF hdd image with emoji label created by mkudffs 2.2
libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
Pali Rohár [Sun, 9 Feb 2020 12:04:39 +0000 (13:04 +0100)]
tests: Add UDF hdd image with emoji label created by mkudffs 2.2
mkudffs 2.2 can create UDF filesystem which label contains Unicode code
points above U+FFFF which cannot be represented by UCS-2 encoding and
therefore UTF-16 needs to be used (via surrogate pairs). Unicode code
points above U+FFFF are encoded in UTF-8 by four bytes and some example is
emoji "😀".
This is test case to check that libblkid correctly supports UTF-16
decoding. It was created by mkudffs 2.2:
Pali Rohár [Sun, 9 Feb 2020 12:04:34 +0000 (13:04 +0100)]
libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
Function blkid_encode_to_utf8() says that is supports BLKID_ENC_UTF16LE and
BLKID_ENC_UTF16BE encodings, but it is not truth and supports only UCS-2
(and not full UTF-16).
As all places where BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE is used expects
UTF-16 and not UCS-2, this patch changes implementation of encodings
BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE to supports full UTF-16, including
surrogate pairs and not only UCS-2.
Karel Zak [Wed, 5 Feb 2020 13:37:41 +0000 (14:37 +0100)]
libfdisk: (gpt) add functionality to move backup header
- add fdisk_gpt_disable_relocation() to disable move backup header to standard location
- add fdisk_gpt_enable_minimize() to move backup header behind last partition
Note that fdisk_gpt_disable_relocation() has to be used before fdisk_assign_device(),
because automatic relocation is done when libfdisk reads the header from the device.
Karel Zak [Tue, 4 Feb 2020 15:17:42 +0000 (16:17 +0100)]
fstrim: do not use Protect setting in systemd service
The ProtectHome= and ProtectSystem= settings mounts all stuff for the service in read-only mode.
The fstrim ioctl operates on read-only mountpoint file descriptor, but
on some read-only filesystem the operation can fail, so since 2d22ac64e4 we check for read-only volumes and skip it.
References: Upstream: http://github.com/karelzak/util-linux/commit/2d22ac64e4d6e6732640f38b7232b5bcdc84a877
Addresses: https://github.com/karelzak/util-linux/issues/948 Signed-off-by: Karel Zak <kzak@redhat.com>
jonnyh64 [Wed, 29 Jan 2020 21:24:16 +0000 (22:24 +0100)]
chrt: Use sched_setscheduler system call directly
musl libc does not support the sched_setscheduler library function
because the underlying Linux system call does not confirm to Posix;
this patch makes chrt use the system call directly
[kzak@redhat.com:
- note that musl libc implements sched_setscheduler()
but returns -ENOSYS all time...
- add ifdefs to the patch
- make sure we include syscall.h]
References: http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2
Addresses: https://github.com/karelzak/util-linux/issues/943 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 28 Jan 2020 09:45:07 +0000 (10:45 +0100)]
libmount: fix x- options use for non-root users
libmount returns EPERM for all X- and x- mount options for non-root
users when evaluate X-mount.mkdir. It's bug, we need to be sensitive
to only X-mount.mkdir and only if the target directory is missing.
Addresses: https://github.com/karelzak/util-linux/issues/941 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 27 Jan 2020 15:17:10 +0000 (16:17 +0100)]
build-sys: add --disable-hwclock-gplv3
The currently used date/time parser (for hwclock --set --date <date>)
is gnulib based code with GPLv3.
This patch allows to avoid this code and replace it with minimalistic
date/time parser.
Addresses: https://github.com/karelzak/util-linux/issues/891 Reported-by: Carlos Santos <unixmania@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>