]>
git.ipfire.org Git - thirdparty/util-linux.git/log
Karel Zak [Tue, 2 Nov 2021 08:15:13 +0000 (09:15 +0100)]
lsfd: remove unused --sysroot
It's unnecessary to redirect to any /proc dump if we can use 'test_mkfds'.
Signed-off-by: Karel Zak <kzak@redhat.com>
Masatake YAMATO [Fri, 22 Oct 2021 08:10:02 +0000 (17:10 +0900)]
lsfd: delete an unnecessary semicolon
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Masatake YAMATO [Fri, 22 Oct 2021 03:48:47 +0000 (12:48 +0900)]
lsfd: introduce -p/--pid option, pids filter working in the early stage
$ time sudo ./lsfd -Q '(PID == 1) or (PID == 2)' > /dev/null
real 0m0.508s
user 0m0.230s
sys 0m0.267s
$ time sudo ./lsfd -p 1,2 > /dev/null
real 0m0.088s
user 0m0.036s
sys 0m0.033s
$ [ $(./lsfd -p 1,2) = $(./lsfd -Q '(PID == 1) or (PID == 2)') ]
$ echo $?
0
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Masatake YAMATO [Fri, 22 Oct 2021 03:48:47 +0000 (12:48 +0900)]
lsfd: introduce -p/--pid option, pids filter working in the early stage
$ time sudo ./lsfd -Q '(PID == 1) or (PID == 2)' > /dev/null
real 0m0.508s
user 0m0.230s
sys 0m0.267s
$ time sudo ./lsfd -p 1,2 > /dev/null
real 0m0.088s
user 0m0.036s
sys 0m0.033s
$ [ $(./lsfd -p 1,2) = $(./lsfd -Q '(PID == 1) or (PID == 2)') ]
$ echo $?
0
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Karel Zak [Wed, 6 Oct 2021 09:20:51 +0000 (11:20 +0200)]
lsfd: function rename
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
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>
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>
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>
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>
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>
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>
Masatake YAMATO [Sun, 3 Oct 2021 19:22:09 +0000 (04:22 +0900)]
lsfd: (adoc) put missing :: at the end of options
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>
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>
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>
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>
Mario Blättermann [Fri, 1 Oct 2021 19:35:42 +0000 (21:35 +0200)]
lsfd: Add new man page to po4a.cfg
Mario Blättermann [Fri, 1 Oct 2021 18:40:12 +0000 (20:40 +0200)]
lsfd: Add initial man page
Mario Blättermann [Fri, 1 Oct 2021 18:39:48 +0000 (20:39 +0200)]
lsfd: Fix typos in lsfd.c
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Karel Zak [Wed, 8 Sep 2021 12:32:31 +0000 (14:32 +0200)]
lsfd: use one function to all symlinks
This commit introduces collect_file_symlink() to gather info from
arbitrary symlink (e.g. /proc/#/exe, /proc/#/fd/1).
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 8 Sep 2021 11:44:20 +0000 (13:44 +0200)]
lib/path: add ul_path_next_dirent()
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 8 Sep 2021 11:16:29 +0000 (13:16 +0200)]
lib/path: use flags for fstatat()
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 8 Sep 2021 10:52:43 +0000 (12:52 +0200)]
lsfd: fix ASSOC_EXE use, make file->association use more robust
Let's use is_association() macro in the code rather than directly
check file->association as this struct member has special semantic.
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 8 Sep 2021 09:22:15 +0000 (11:22 +0200)]
lsfd: cleanup collect_outofbox_files stuff
* use path_cxt
* call fstat() only once (no extra call to get uid)
* reduce names to variables to get function calls to one line ;-)
* fix use of procfs_process_get_cmdname()
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 8 Sep 2021 08:49:43 +0000 (10:49 +0200)]
lsfd: small cleanup to mountinfo/nodev code
* use path_cxt to open mountinfo (so remove open_mountinfo())
* move all nodev code to one place
* merge add_nodev() to add_nodevs()
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 8 Sep 2021 08:28:14 +0000 (10:28 +0200)]
lsfd: use path_cxt to read process
* path_cxt is based on openat-like functions and lib/path.c provides
large number of utils to use it
* one handler is re-used for all processes to reduce memory allocation
* list of process is moved to lsfd_control to make it available everywhere
* read tasks when we read process, no later
* lists initialization is done when object (process) is allocated
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 7 Sep 2021 15:53:06 +0000 (17:53 +0200)]
lsfd: fix typo, rename function
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 7 Sep 2021 15:42:37 +0000 (17:42 +0200)]
build-sys: remove lib/procutils.c
Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 7 Sep 2021 15:40:55 +0000 (17:40 +0200)]
lsfd: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:40:04 +0000 (17:40 +0200)]
lsns: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:54 +0000 (17:39 +0200)]
lsipc: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:33 +0000 (17:39 +0200)]
uclampset: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:16 +0000 (17:39 +0200)]
taskset: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:00 +0000 (17:39 +0200)]
chrt: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:38:47 +0000 (17:38 +0200)]
lslocks: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:38:31 +0000 (17:38 +0200)]
kill: use lib/procfs.c