]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 years agologger: verify --size of large enough for message header
Karel Zak [Thu, 21 Oct 2021 13:40:41 +0000 (15:40 +0200)] 
logger: verify --size of large enough for message header

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2011602
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agowdctl: update man page
Karel Zak [Thu, 21 Oct 2021 13:04:33 +0000 (15:04 +0200)] 
wdctl: update man page

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: (adoc) add more exapmles
Masatake YAMATO [Wed, 20 Oct 2021 14:22:28 +0000 (23:22 +0900)] 
lsfd: (adoc) add more exapmles

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: remove --source option
Masatake YAMATO [Wed, 20 Oct 2021 13:29:45 +0000 (22:29 +0900)] 
lsfd: remove --source option

-Q '(SOURCE == ...)' works well for the same purpose.
See https://github.com/karelzak/util-linux/pull/1418#issuecomment-945643880

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add KTHREAD column
Masatake YAMATO [Tue, 19 Oct 2021 08:05:08 +0000 (17:05 +0900)] 
lsfd: add KTHREAD column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for displaying symlinks
Masatake YAMATO [Fri, 15 Oct 2021 20:38:49 +0000 (05:38 +0900)] 
lsfd: (test) add a case for displaying symlinks

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for displaying COMMAND column
Masatake YAMATO [Fri, 15 Oct 2021 19:24:28 +0000 (04:24 +0900)] 
lsfd: (test) add a case for displaying COMMAND column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for displaying socket pairs
Masatake YAMATO [Fri, 15 Oct 2021 18:48:43 +0000 (03:48 +0900)] 
lsfd: (test) add a case for displaying socket pairs

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for displaying DEV column
Masatake YAMATO [Fri, 15 Oct 2021 17:47:03 +0000 (02:47 +0900)] 
lsfd: (test) add a case for displaying DEV column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) improve the code converting file descriptor numbers
Masatake YAMATO [Fri, 15 Oct 2021 17:34:38 +0000 (02:34 +0900)] 
lsfd: (helper) improve the code converting file descriptor numbers

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for displaying a character device
Masatake YAMATO [Fri, 15 Oct 2021 16:42:57 +0000 (01:42 +0900)] 
lsfd: (test) add a case for displaying a character device

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add --debug-filter option
Masatake YAMATO [Fri, 15 Oct 2021 02:24:23 +0000 (11:24 +0900)] 
lsfd: add --debug-filter option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for testing SIZE column
Masatake YAMATO [Fri, 15 Oct 2021 02:04:27 +0000 (11:04 +0900)] 
lsfd: (test) add a case for testing SIZE column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for testing FLAGS (wronly,nonblock) column
Masatake YAMATO [Fri, 15 Oct 2021 01:59:05 +0000 (10:59 +0900)] 
lsfd: (test) add a case for testing FLAGS (wronly,nonblock) column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) add "nonblock" parameter to pipe-no-fork factory
Masatake YAMATO [Fri, 15 Oct 2021 01:58:03 +0000 (10:58 +0900)] 
lsfd: (helper) add "nonblock" parameter to pipe-no-fork factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) update examples in the help message
Masatake YAMATO [Fri, 15 Oct 2021 01:28:09 +0000 (10:28 +0900)] 
lsfd: (helper) update examples in the help message

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) add "dentries" parameter to directory factory
Masatake YAMATO [Thu, 14 Oct 2021 15:17:43 +0000 (00:17 +0900)] 
lsfd: (helper) add "dentries" parameter to directory factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) add "dir" parameter to directory factory
Masatake YAMATO [Thu, 14 Oct 2021 15:01:49 +0000 (00:01 +0900)] 
lsfd: (helper) add "dir" parameter to directory factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) test POS column
Masatake YAMATO [Thu, 14 Oct 2021 13:55:28 +0000 (22:55 +0900)] 
lsfd: (test) test POS column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) add "offset" parameter to ro-regular-file factory
Masatake YAMATO [Thu, 14 Oct 2021 13:51:49 +0000 (22:51 +0900)] 
lsfd: (helper) add "offset" parameter to ro-regular-file factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) accept an integer argument for a parameter
Masatake YAMATO [Thu, 14 Oct 2021 13:51:18 +0000 (22:51 +0900)] 
lsfd: (helper) accept an integer argument for a parameter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) add "file" parameter to ro-regular-file factory
Masatake YAMATO [Thu, 14 Oct 2021 09:49:34 +0000 (18:49 +0900)] 
lsfd: (helper) add "file" parameter to ro-regular-file factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) allow to pass extra parameters
Masatake YAMATO [Thu, 14 Oct 2021 09:47:39 +0000 (18:47 +0900)] 
lsfd: (helper) allow to pass extra parameters

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) use more "const" modifiers
Masatake YAMATO [Thu, 14 Oct 2021 09:34:48 +0000 (18:34 +0900)] 
lsfd: (helper) use more "const" modifiers

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (helper) set proper errno before calling err()
Masatake YAMATO [Thu, 14 Oct 2021 13:46:30 +0000 (22:46 +0900)] 
lsfd: (helper) set proper errno before calling err()

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) accept % char as a part of column name
Masatake YAMATO [Fri, 15 Oct 2021 21:08:38 +0000 (06:08 +0900)] 
lsfd: (filter) accept % char as a part of column name

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) fix a memory leak
Masatake YAMATO [Thu, 21 Oct 2021 11:54:38 +0000 (20:54 +0900)] 
lsfd: (filter) fix a memory leak

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: remove prototype decls for removed functions
Masatake YAMATO [Sun, 17 Oct 2021 11:01:09 +0000 (20:01 +0900)] 
lsfd: remove prototype decls for removed functions

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: declare local variables at the beginning of block
Masatake YAMATO [Thu, 21 Oct 2021 12:01:28 +0000 (21:01 +0900)] 
lsfd: declare local variables at the beginning of block

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agowdctl: add --setpregovernor
Karel Zak [Thu, 21 Oct 2021 11:09:58 +0000 (13:09 +0200)] 
wdctl: add --setpregovernor

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agowdctl: set_watchdog() refactoring
Karel Zak [Thu, 21 Oct 2021 10:38:16 +0000 (12:38 +0200)] 
wdctl: set_watchdog() refactoring

* keep wanted values in struct wd_control
* make set_watchdog() more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agowdctl: print the current and available governors
Karel Zak [Thu, 21 Oct 2021 10:16:35 +0000 (12:16 +0200)] 
wdctl: print the current and available governors

 # wdctl
 ...
 Pre-timeout:    0 seconds
 Pre-timeout governor: noop
 Available pre-timeout governors: userspace noop panic
 ...

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: add links to adjtime_config manpage
Karel Zak [Thu, 21 Oct 2021 09:36:44 +0000 (11:36 +0200)] 
docs: add links to adjtime_config manpage

Fixes: https://github.com/karelzak/util-linux/issues/1478
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: split additional tests into subtests
Vojtěch Eichler [Tue, 19 Oct 2021 18:45:28 +0000 (20:45 +0200)] 
tests: split additional tests into subtests

3 years agobuild-sys: remove bashism
Karel Zak [Tue, 19 Oct 2021 16:54:31 +0000 (18:54 +0200)] 
build-sys: remove bashism

Addresses: https://github.com/karelzak/util-linux/issues/1476
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: Fix test/misc/swaplabel failure due to change in mkswap behaviour.
Mark Hindley [Mon, 18 Oct 2021 17:53:01 +0000 (17:53 +0000)] 
tests: Fix test/misc/swaplabel failure due to change in mkswap behaviour.

mkswap now warns if the image file has holes. If fallocate is used to create the
file, use POSIX semantics to ensure the file has no holes.

This fixes the test failure

misc: swaplabel                      ... FAILED (misc/swaplabel)
========= script: /build/util-linux-2.37.2/tests/ts/misc/swaplabel =================
================= OUTPUT =====================
     1  Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
     2  LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
     3  LABEL: 1234567890abcde
     4  UUID:  12345678-abcd-abcd-abcd-1234567890ab
================= EXPECTED ===================
     1  Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
     2  LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
     3  LABEL: 1234567890abcde
     4  UUID:  12345678-abcd-abcd-abcd-1234567890ab
================= O/E diff ===================
==============================================

The additional error appears in swaplabel.err:

 mkswap: <swapfile> contains holes or other unsupported extents.
         This swap file can be rejected by kernel on swap activation!
         Use --verbose for more details.

[zeha@debian.org: this appears to be important/required when building
inside cowbuilder, on an ext3 filesystem.]

Signed-off-by: Mark Hindley <mark@hindley.org.uk>
3 years agobuild-sys: make libtool patching more robust
Karel Zak [Tue, 19 Oct 2021 08:52:10 +0000 (10:52 +0200)] 
build-sys: make libtool patching more robust

Fixes: https://github.com/karelzak/util-linux/issues/1476
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agowdctl: sysfs open refactoring
Karel Zak [Tue, 19 Oct 2021 08:11:37 +0000 (10:11 +0200)] 
wdctl: sysfs open refactoring

Let's make the sysfs handler usable in more functions.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agowdctl: add --setpretimeout
Karel Zak [Tue, 19 Oct 2021 07:47:44 +0000 (09:47 +0200)] 
wdctl: add --setpretimeout

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblockdev: remove accidental non-breaking spaces
Chris Hofstaedtler [Mon, 18 Oct 2021 07:40:01 +0000 (07:40 +0000)] 
blockdev: remove accidental non-breaking spaces

commit 9147d2ad8abb73cea5799323fc73ccdaf675826f introduced these
C2A0 spaces, but without saying anything. Likely this was an
accident.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996751
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
3 years agomcookie: fix infinite-loop when use -f
Hiroaki Sengoku [Fri, 15 Oct 2021 05:02:46 +0000 (14:02 +0900)] 
mcookie: fix infinite-loop when use -f

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: remove duplicated an O_ flag entry
Masatake YAMATO [Fri, 15 Oct 2021 20:40:17 +0000 (05:40 +0900)] 
lsfd: remove duplicated an O_ flag entry

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agotests: split several tests into subtests
Vojtěch Eichler [Thu, 14 Oct 2021 10:33:45 +0000 (12:33 +0200)] 
tests: split several tests into subtests

3 years agobuild-sys: patch libtool.m4 for darwin
Karel Zak [Thu, 14 Oct 2021 10:17:31 +0000 (12:17 +0200)] 
build-sys: patch libtool.m4 for darwin

Fixes: https://github.com/karelzak/util-linux/issues/1468
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: (logger) check for socat
Karel Zak [Thu, 14 Oct 2021 08:46:45 +0000 (10:46 +0200)] 
tests: (logger) check for socat

Addresses: https://github.com/karelzak/util-linux/issues/1466
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agosu: reset RLIMIT_AS too
Karel Zak [Thu, 14 Oct 2021 08:28:59 +0000 (10:28 +0200)] 
su: reset RLIMIT_AS too

Fixes: https://github.com/karelzak/util-linux/issues/1465
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: add note about GitHub PR
Karel Zak [Thu, 14 Oct 2021 08:22:14 +0000 (10:22 +0200)] 
docs: add note about GitHub PR

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agofindmnt: (adoc) Added section stating exit code semantics
Mister Me [Thu, 7 Oct 2021 14:34:00 +0000 (08:34 -0600)] 
findmnt: (adoc) Added section stating exit code semantics

per issue #1464:

    https://github.com/karelzak/util-linux/issues/1464

[kzak@redhat.com: - move the text from DESCRIPTION to EXIT STATUS section]

Signed-off-by: Glenn Golden <gdg@zplane.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: link lib_common to test_procfs
Masatake YAMATO [Sun, 10 Oct 2021 08:01:40 +0000 (17:01 +0900)] 
build-sys: link lib_common to test_procfs

Suggested by Thomas Weißschuh at
https://github.com/karelzak/util-linux/pull/1418#pullrequestreview-775639562

3 years agolsfd: (adoc) write about filter expression
Masatake YAMATO [Tue, 5 Oct 2021 14:55:30 +0000 (23:55 +0900)] 
lsfd: (adoc) write about filter expression

Charelle Collett helped me improve the setences.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add a case for displaying a directory
Masatake YAMATO [Mon, 11 Oct 2021 22:24:42 +0000 (07:24 +0900)] 
lsfd: (test) add a case for displaying a directory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (test) add cases for displaying a regular file and pipe
Masatake YAMATO [Sun, 10 Oct 2021 00:58:55 +0000 (09:58 +0900)] 
lsfd: (test) add cases for displaying a regular file and pipe

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add FUID and OWNER columns
Masatake YAMATO [Mon, 11 Oct 2021 21:42:37 +0000 (06:42 +0900)] 
lsfd: add FUID and OWNER columns

UID and USER is for processes.
FUID and OWNER is for owners of files.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: fill UID column with the process's uid
Masatake YAMATO [Mon, 11 Oct 2021 21:27:58 +0000 (06:27 +0900)] 
lsfd: fill UID column with the process's uid

The original code fills the column with the owner id of the executable
file. Because lsfd fills USER column field by decoding UID column, the
USER in lsfd meant the owner name of the executable.

On the other hand, lsof fills the USER column with the process's user
name.

To avoid users confusing, this change makes lsfd do the same lsof;
filling UID column with the process's uid.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) implement !~, an operator for regex unmatching
Masatake YAMATO [Sun, 10 Oct 2021 18:59:35 +0000 (03:59 +0900)] 
lsfd: (filter) implement !~, an operator for regex unmatching

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) implement =~, an operator for regex matching
Masatake YAMATO [Fri, 8 Oct 2021 06:51:55 +0000 (15:51 +0900)] 
lsfd: (filter) implement =~, an operator for regex matching

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) make error messages in check_type methods
Masatake YAMATO [Fri, 8 Oct 2021 06:27:23 +0000 (15:27 +0900)] 
lsfd: (filter) make error messages in check_type methods

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) give a name to a constant
Masatake YAMATO [Fri, 8 Oct 2021 03:18:16 +0000 (12:18 +0900)] 
lsfd: (filter) give a name to a constant

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter) whitespace cleanup
Masatake YAMATO [Fri, 8 Oct 2021 06:52:43 +0000 (15:52 +0900)] 
lsfd: (filter) whitespace cleanup

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) remove a redundant word
Masatake YAMATO [Thu, 7 Oct 2021 09:08:06 +0000 (18:08 +0900)] 
lsfd: (adoc) remove a redundant word

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agohardlink: improve verbose messages
Karel Zak [Thu, 7 Oct 2021 11:11:18 +0000 (13:11 +0200)] 
hardlink: improve verbose messages

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: fix test_procfs SOURCES
Karel Zak [Thu, 7 Oct 2021 08:43:32 +0000 (10:43 +0200)] 
build-sys: fix test_procfs SOURCES

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsns: optimize mountinfo use
Karel Zak [Wed, 6 Oct 2021 11:36:42 +0000 (13:36 +0200)] 
lsns: optimize mountinfo use

Let's parse mountinfo only for unknown namespaces or when
namespace Id is not accessible (unprivileged users).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: remove unused code
Karel Zak [Wed, 6 Oct 2021 09:22:07 +0000 (11:22 +0200)] 
lsfd: remove unused code

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: function rename
Karel Zak [Wed, 6 Oct 2021 09:20:51 +0000 (11:20 +0200)] 
lsfd: function rename

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: cleanup lsfd related stuff
Karel Zak [Wed, 6 Oct 2021 09:11:16 +0000 (11:11 +0200)] 
build-sys: cleanup lsfd related stuff

- add lsfd to meson.build
- add Masatake to AUTHORS
- add me to lsfd.c header and man page

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: add new man page to Makemodule.am
Masatake YAMATO [Sun, 3 Oct 2021 19:47:56 +0000 (04:47 +0900)] 
lsfd: add new man page to Makemodule.am

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) write more about the -o option
Masatake YAMATO [Sun, 3 Oct 2021 19:44:21 +0000 (04:44 +0900)] 
lsfd: (adoc) write more about the -o option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) add proc(5) to SEE ALSO section
Masatake YAMATO [Sun, 3 Oct 2021 18:57:06 +0000 (03:57 +0900)] 
lsfd: (adoc) add proc(5) to SEE ALSO section

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) reorder the options
Masatake YAMATO [Sun, 3 Oct 2021 08:56:47 +0000 (17:56 +0900)] 
lsfd: (adoc) reorder the options

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) update DESCRIPTION
Masatake YAMATO [Sun, 3 Oct 2021 06:58:38 +0000 (15:58 +0900)] 
lsfd: (adoc) update DESCRIPTION

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) reorder the sections
Masatake YAMATO [Sun, 3 Oct 2021 07:06:20 +0000 (16:06 +0900)] 
lsfd: (adoc) reorder the sections

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (adoc) put missing :: at the end of options
Masatake YAMATO [Sun, 3 Oct 2021 19:22:09 +0000 (04:22 +0900)] 
lsfd: (adoc) put missing :: at the end of options

3 years agolsfd: fix a typo in DEVTYPE description
Masatake YAMATO [Sun, 3 Oct 2021 19:37:19 +0000 (04:37 +0900)] 
lsfd: fix a typo in DEVTYPE description

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: wrap code for debugging with #ifdef DEBUG/#endif
Masatake YAMATO [Fri, 1 Oct 2021 17:24:31 +0000 (02:24 +0900)] 
lsfd: wrap code for debugging with #ifdef DEBUG/#endif

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: convert lines introducing local variable to a block with {...}
Masatake YAMATO [Fri, 1 Oct 2021 17:15:00 +0000 (02:15 +0900)] 
lsfd: convert lines introducing local variable to a block with {...}

The following code causing an error on test run on GitHub Action:

  case FOO:
      type localvar;

This change converts above code to:

  case FOO: {
      type localvar;
  }

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: change the license of the filtering engine to LGPL
Masatake YAMATO [Fri, 1 Oct 2021 16:53:14 +0000 (01:53 +0900)] 
lsfd: change the license of the filtering engine to LGPL

This change is for moving the filtering engine to libsmartcols in the
future.

In addition to the change, I made myself a copyright holder of the
code.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: Add new man page to po4a.cfg
Mario Blättermann [Fri, 1 Oct 2021 19:35:42 +0000 (21:35 +0200)] 
lsfd: Add new man page to po4a.cfg

3 years agolsfd: Add initial man page
Mario Blättermann [Fri, 1 Oct 2021 18:40:12 +0000 (20:40 +0200)] 
lsfd: Add initial man page

3 years agolsfd: Fix typos in lsfd.c
Mario Blättermann [Fri, 1 Oct 2021 18:39:48 +0000 (20:39 +0200)] 
lsfd: Fix typos in lsfd.c

3 years agolsfd: use new scols_line_get_column_data()
Karel Zak [Fri, 1 Oct 2021 11:10:46 +0000 (13:10 +0200)] 
lsfd: use new scols_line_get_column_data()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibsmartcols: add scols_line_get_column_data()
Karel Zak [Fri, 1 Oct 2021 11:10:06 +0000 (13:10 +0200)] 
libsmartcols: add scols_line_get_column_data()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: collect threads level information if TID is specified in a filter
Masatake YAMATO [Tue, 28 Sep 2021 12:57:31 +0000 (21:57 +0900)] 
lsfd: collect threads level information if TID is specified in a filter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: introduce --source filter option
Masatake YAMATO [Fri, 24 Sep 2021 19:32:27 +0000 (04:32 +0900)] 
lsfd: introduce --source filter option

Reflecting the review comment:

    add filter by SOURCE (lsfd --source sda1)

Example output:

    # ./lsfd --source proc | head
    COMMAND             PID   USER ASSOC MODE TYPE SOURCE MNTID      INODE NAME
    systemd               1   root    10  r--  REG   proc    23      18542 /proc/1/mountinfo
    systemd               1   root    14  r--  REG   proc    23 4026532082 /proc/swaps
    systemd-resolve     856   root     7  r--  REG   proc   254      24841 /proc/sys/kernel/hostname
    low-memory-moni     898   root     7  rw-  REG   proc   425 4026532073 /proc/pressure/memory
    low-memory-moni     898   root     8  rw-  REG   proc   425 4026532073 /proc/pressure/memory
    low-memory-moni     898   root     9  rw-  REG   proc   425 4026532073 /proc/pressure/memory
    packagekitd       25205   root    12  r--  REG   proc    23      69645 /proc/25205/mountinfo
    systemd           26466   root    10  r--  REG   proc    23      71813 /proc/26466/mountinfo
    systemd           26466   root    14  r--  REG   proc    23 4026532082 /proc/swaps

    # ./lsfd --source proc -Q '(PID == 898)'
    COMMAND           PID USER ASSOC MODE TYPE SOURCE MNTID      INODE NAME
    low-memory-moni   898 root     7  rw-  REG   proc   425 4026532073 /proc/pressure/memory
    low-memory-moni   898 root     8  rw-  REG   proc   425 4026532073 /proc/pressure/memory
    low-memory-moni   898 root     9  rw-  REG   proc   425 4026532073 /proc/pressure/memory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: introduce -Q option for generic filtering
Masatake YAMATO [Mon, 20 Sep 2021 17:58:48 +0000 (02:58 +0900)] 
lsfd: introduce -Q option for generic filtering

Examples:

    # ./lsfd -Q "(FD <= 9) and (TYPE == 'SOCK')" -Q "COMMAND == 'ssh'" | head
    COMMAND     PID USER ASSOC MODE TYPE SOURCE MNTID    INODE NAME
    ssh      153907 root     4  rw- SOCK sockfs     9  2450021 TCP:[2450021]
    ssh     1657696 root     4  rw- SOCK sockfs     9 64357645 TCP:[64357645]
    ssh     1657696 root     5  rw- SOCK sockfs     9 64363596 UNIX:[64363596]
    ssh     2345473 root     4  rw- SOCK sockfs     9 81978848 TCP:[81978848]
    ssh     2345473 root     5  rw- SOCK sockfs     9 81980736 UNIX:[81980736]
    ssh     2345473 root     9  rw- SOCK sockfs     9 81980737 UNIX:[81980737]
    ssh     2345475 root     4  rw- SOCK sockfs     9 81975091 UNIX:[81975091]
    ssh     3958804 root     0  rw- SOCK sockfs     9 87840900 UNIX:[87840900]
    ssh     3958804 root     4  rw- SOCK sockfs     9 87836642 TCP:[87836642]

    # ./lsfd -Q "((ASSOC == 'exe') || (ASSOC == 'pid')) and (USER == 'yamato')"
    COMMAND        PID   USER ASSOC MODE TYPE SOURCE MNTID      INODE NAME
    lsfd        690292 yamato   exe  ---  REG   dm-2     0   34474245 /home/yamato/var/util-linux/util-linux/.libs/lsfd
    lsfd        690292 yamato   pid  ---  REG   nsfs     0 4026531836 pid:[4026531836]
    pidns      1458677 yamato   exe  ---  REG   dm-2     0   34212178 /home/yamato/var/kernel-essential-training/container/pidns
    pidns      1458677 yamato   pid  ---  REG   nsfs     0 4026533715 pid:[4026533715]
    fd-catalog 1677961 yamato   exe  ---  REG   dm-2     0  128715536 /home/yamato/var/fd-catalog/fd-catalog (deleted)
    fd-catalog 1677961 yamato   pid  ---  REG   nsfs     0 4026531836 pid:[4026531836]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add filter engine
Masatake YAMATO [Mon, 20 Sep 2021 17:57:37 +0000 (02:57 +0900)] 
lsfd: add filter engine

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: fix a typo in comment
Masatake YAMATO [Fri, 24 Sep 2021 17:14:05 +0000 (02:14 +0900)] 
lsfd: fix a typo in comment

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: optimize symlinks use
Karel Zak [Thu, 30 Sep 2021 09:11:30 +0000 (11:11 +0200)] 
lsfd: optimize symlinks use

Like the previous commit, this patch tries to reuse
/proc/#/{fd,ns,cwd,root} symlinks if possible. On my machine it
saves ~2000 stat() calls.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: optimize maps use
Karel Zak [Thu, 30 Sep 2021 08:42:02 +0000 (10:42 +0200)] 
lsfd: optimize maps use

The /proc/#/maps file usually contains the same file more than once.
This patch tries to reuse previous file to reduce number of stat()
calls, see "strace --summary-only" output below, the syscall is reduce
in 50%.

old version:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 55.57    0.118708           2     50756      5414 newfstatat

new version:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 39.17    0.058501           2     24436      5382 newfstatat

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: use only "/proc/#/maps" file
Karel Zak [Mon, 20 Sep 2021 13:23:58 +0000 (15:23 +0200)] 
lsfd: use only "/proc/#/maps" file

* do not read /proc/#/map_files symlinks
* use paths from /proc/#/maps
* do not maintain map entries

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: don't use 'long int' for file data
Karel Zak [Mon, 20 Sep 2021 11:30:28 +0000 (13:30 +0200)] 
lsfd: don't use 'long int' for file data

Let's always assume positions, offsets, etc.. as 64-bit numbers.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: cleanup fdinfo handling
Karel Zak [Mon, 20 Sep 2021 11:16:06 +0000 (13:16 +0200)] 
lsfd: cleanup fdinfo handling

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd:remove struct fdinfo_data
Karel Zak [Mon, 20 Sep 2021 10:46:31 +0000 (12:46 +0200)] 
lsfd:remove struct fdinfo_data

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: split new_file(), remove map_file_data
Karel Zak [Mon, 20 Sep 2021 10:28:50 +0000 (12:28 +0200)] 
lsfd: split new_file(), remove map_file_data

Don't initialize entire 'struct file' in one step. It seems better to
use different ways according to file source (map, symlink, etc.).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: rename DEVNAME column to SOURCE
Masatake YAMATO [Thu, 16 Sep 2021 16:04:48 +0000 (01:04 +0900)] 
lsfd: rename DEVNAME column to SOURCE

Reflecting the review comment:

    maybe rename DEVNAME to SOURCE as we have here things like 'devtmpfs' etc.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: remove redundant "nodev:" prefix from DEVNAME column
Masatake YAMATO [Thu, 16 Sep 2021 15:46:39 +0000 (00:46 +0900)] 
lsfd: remove redundant "nodev:" prefix from DEVNAME column

Reflecting the review comment:

    remove "nodev:" from DEVNAME

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add DEVTYPE column
Masatake YAMATO [Thu, 16 Sep 2021 15:22:14 +0000 (00:22 +0900)] 
lsfd: add DEVTYPE column

Reflecting the review comment:

    add DEVTYPE for blk, char, and nodev

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: sort the enumerators about columns
Masatake YAMATO [Thu, 16 Sep 2021 15:07:45 +0000 (00:07 +0900)] 
lsfd: sort the enumerators about columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: rename the column DEVICE to MAJ:MIN
Masatake YAMATO [Thu, 16 Sep 2021 15:01:30 +0000 (00:01 +0900)] 
lsfd: rename the column DEVICE to MAJ:MIN

Reflecting the review comment:

    add MAJ:MIN for major and minor numbers, remove DEVICE (we use
    MAJ:MIN in other tools)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: don't duplicate ASSOC_EXE processing
Karel Zak [Wed, 8 Sep 2021 12:42:05 +0000 (14:42 +0200)] 
lsfd: don't duplicate ASSOC_EXE processing

Signed-off-by: Karel Zak <kzak@redhat.com>