]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 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>
4 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>
4 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

4 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>
4 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>
4 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>
4 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>
4 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

4 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

4 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

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agolsfd: use one function to all symlinks
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>
4 years agolib/path: add ul_path_next_dirent()
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>
4 years agolib/path: use flags for fstatat()
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>
4 years agolsfd: fix ASSOC_EXE use, make file->association use more robust
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>
4 years agolsfd: cleanup collect_outofbox_files stuff
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>
4 years agolsfd: small cleanup to mountinfo/nodev code
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>
4 years agolsfd: use path_cxt to read process
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>
4 years agolsfd: fix typo, rename function
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>
4 years agobuild-sys: remove lib/procutils.c
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>
4 years agolsfd: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:40:55 +0000 (17:40 +0200)] 
lsfd: use lib/procfs.c

4 years agolsns: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:40:04 +0000 (17:40 +0200)] 
lsns: use lib/procfs.c

4 years agolsipc: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:54 +0000 (17:39 +0200)] 
lsipc: use lib/procfs.c

4 years agouclampset: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:33 +0000 (17:39 +0200)] 
uclampset: use lib/procfs.c

4 years agotaskset: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:16 +0000 (17:39 +0200)] 
taskset: use lib/procfs.c

4 years agochrt: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:39:00 +0000 (17:39 +0200)] 
chrt: use lib/procfs.c

4 years agolslocks: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:38:47 +0000 (17:38 +0200)] 
lslocks: use lib/procfs.c

4 years agokill: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:38:31 +0000 (17:38 +0200)] 
kill: use lib/procfs.c

4 years agolib/caputils: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:38:04 +0000 (17:38 +0200)] 
lib/caputils: use lib/procfs.c

4 years agolslogins: use lib/procfs.c
Karel Zak [Tue, 7 Sep 2021 15:37:46 +0000 (17:37 +0200)] 
lslogins: use lib/procfs.c

4 years agolib/procfs: add functions to read /proc/#/ stuff
Karel Zak [Tue, 7 Sep 2021 15:32:01 +0000 (17:32 +0200)] 
lib/procfs: add functions to read /proc/#/ stuff

This is extension to lib/path.c (the same as lib/sysfs.c for block
devices) to read info about processes.

* replaces code from lib/procutils.c
* remove proc_{open,close}_processes(), opendir and readdir is good enough
* add procfs_dirent_*() functions to work with readdir() from /proc
* add new path_cxt based API (will be extended in next commits) for
  complex tasks

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/path: fstat dir itself
Karel Zak [Mon, 6 Sep 2021 09:52:09 +0000 (11:52 +0200)] 
lib/path: fstat dir itself

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: revert include/path.h use
Karel Zak [Thu, 2 Sep 2021 14:32:33 +0000 (16:32 +0200)] 
lsfd: revert include/path.h use

We need something better to handle work with processes.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: add reference to proc from file
Karel Zak [Thu, 2 Sep 2021 12:30:58 +0000 (14:30 +0200)] 
lsfd: add reference to proc from file

* add to file struct reference to process
* add file to the list of the process' files in new_file()

This makes things more straightforward.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: move list_free() to list.h
Karel Zak [Thu, 2 Sep 2021 12:13:49 +0000 (14:13 +0200)] 
lsfd: move list_free() to list.h

4 years agolsfd: reorder function
Karel Zak [Thu, 2 Sep 2021 12:00:44 +0000 (14:00 +0200)] 
lsfd: reorder function

Keep free_() after new_().

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: remove collect_file()
Karel Zak [Thu, 2 Sep 2021 11:58:49 +0000 (13:58 +0200)] 
lsfd: remove collect_file()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: cleanup new file initialization
Karel Zak [Wed, 1 Sep 2021 17:10:20 +0000 (19:10 +0200)] 
lsfd: cleanup new file initialization

Don't use new_<class>() functions if we have already have
file_class callbacks.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: keep main() at the end of the code
Karel Zak [Wed, 1 Sep 2021 16:12:09 +0000 (18:12 +0200)] 
lsfd: keep main() at the end of the code

and usage() before main().

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: use 'new_' prefix when we allocate something
Karel Zak [Wed, 1 Sep 2021 15:50:51 +0000 (17:50 +0200)] 
lsfd: use 'new_' prefix when we allocate something

It's more readable than rather than 'make_'.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: add --sysroot, use lib/path.c
Karel Zak [Wed, 1 Sep 2021 15:36:29 +0000 (17:36 +0200)] 
lsfd: add --sysroot, use lib/path.c

* use struct path_cxt to read from /procfs

* add --sysroot to redirect lsfd to alternative location (necessary
  for regression tests)

* merge collect_procs() into collect()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: add --notruncate
Karel Zak [Wed, 1 Sep 2021 14:50:04 +0000 (16:50 +0200)] 
lsfd: add --notruncate

* make COMMAND and NAME truncated by default (to keep output on terminal readable)
* add --notruncate to disable the default behaviour

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: tiny change to default colummns initialization
Karel Zak [Wed, 1 Sep 2021 14:35:42 +0000 (16:35 +0200)] 
lsfd: tiny change to default colummns initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsfd: unify nodev lists into global one
Masatake YAMATO [Thu, 13 May 2021 20:24:21 +0000 (05:24 +0900)] 
lsfd: unify nodev lists into global one

4 years agolsfd: don't use threads
Masatake YAMATO [Thu, 13 May 2021 19:23:19 +0000 (04:23 +0900)] 
lsfd: don't use threads

4 years agolsfd: fill PROTONAME field of file for mmap'ed socket
Masatake YAMATO [Mon, 10 May 2021 03:56:56 +0000 (12:56 +0900)] 
lsfd: fill PROTONAME field of file for mmap'ed socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add MAPLEN column
Masatake YAMATO [Mon, 10 May 2021 03:54:55 +0000 (12:54 +0900)] 
lsfd: add MAPLEN column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: introduce a data structure for storing common fdinfo data
Masatake YAMATO [Mon, 10 May 2021 02:07:23 +0000 (11:07 +0900)] 
lsfd: introduce a data structure for storing common fdinfo data

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: increase the threads to collect information
Masatake YAMATO [Tue, 4 May 2021 17:50:14 +0000 (02:50 +0900)] 
lsfd: increase the threads to collect information

$ sudo ./lsfd -l | wc -l
75837

[NUM_COLLECTORS 1]
sudo ./lsfd -l > /dev/null  1.16s user 0.62s system 98% cpu 1.805 total
sudo ./lsfd -l > /dev/null  1.12s user 0.50s system 99% cpu 1.630 total
sudo ./lsfd -l > /dev/null  1.14s user 0.49s system 99% cpu 1.642 total

[NUM_COLLECTORS 2]
sudo ./lsfd -l > /dev/null  1.18s user 0.53s system 127% cpu 1.343 total
sudo ./lsfd -l > /dev/null  1.21s user 0.50s system 126% cpu 1.350 total
sudo ./lsfd -l > /dev/null  1.14s user 0.51s system 128% cpu 1.291 total

[NUM_COLLECTORS 3]
sudo ./lsfd -l > /dev/null  1.21s user 0.55s system 138% cpu 1.278 total
sudo ./lsfd -l > /dev/null  1.15s user 0.51s system 139% cpu 1.187 total
sudo ./lsfd -l > /dev/null  1.15s user 0.51s system 140% cpu 1.180 total

[NUM_COLLECTORS 4]
sudo ./lsfd -l > /dev/null  1.23s user 0.66s system 154% cpu 1.218 total
sudo ./lsfd -l > /dev/null  1.22s user 0.54s system 154% cpu 1.137 total
sudo ./lsfd -l > /dev/null  1.14s user 0.64s system 158% cpu 1.123 total

[NUM_COLLECTORS 5]
sudo ./lsfd -l > /dev/null  1.19s user 0.72s system 171% cpu 1.118 total
sudo ./lsfd -l > /dev/null  1.14s user 0.62s system 165% cpu 1.063 total
sudo ./lsfd -l > /dev/null  1.15s user 0.73s system 176% cpu 1.063 total

[NUM_COLLECTORS 6]
sudo ./lsfd -l > /dev/null  1.23s user 0.70s system 173% cpu 1.115 total
sudo ./lsfd -l > /dev/null  1.29s user 0.67s system 169% cpu 1.157 total
sudo ./lsfd -l > /dev/null  1.24s user 0.75s system 185% cpu 1.070 total

[NUM_COLLECTORS 7]
sudo ./lsfd -l > /dev/null  1.32s user 0.74s system 182% cpu 1.130 total
sudo ./lsfd -l > /dev/null  1.25s user 0.82s system 195% cpu 1.058 total
sudo ./lsfd -l > /dev/null  1.22s user 0.74s system 188% cpu 1.041 total

[NUM_COLLECTORS 8]
sudo ./lsfd -l > /dev/null  1.30s user 0.92s system 194% cpu 1.141 total
sudo ./lsfd -l > /dev/null  1.21s user 0.81s system 197% cpu 1.027 total
sudo ./lsfd -l > /dev/null  1.22s user 0.79s system 199% cpu 1.005 total

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: introduce DEVNAME column and use it as default
Masatake YAMATO [Sun, 9 May 2021 03:16:43 +0000 (12:16 +0900)] 
lsfd: introduce DEVNAME column and use it as default

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add a function to get the name of filesystem from a given minor number
Masatake YAMATO [Sun, 9 May 2021 01:41:34 +0000 (10:41 +0900)] 
lsfd: add a function to get the name of filesystem from a given minor number

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add a stub for fifo type
Masatake YAMATO [Sun, 9 May 2021 02:36:07 +0000 (11:36 +0900)] 
lsfd: add a stub for fifo type

4 years agolsfd: add MISCDEV column
Masatake YAMATO [Fri, 7 May 2021 19:47:23 +0000 (04:47 +0900)] 
lsfd: add MISCDEV column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: read misc character device names from /proc/misc
Masatake YAMATO [Fri, 7 May 2021 19:46:11 +0000 (04:46 +0900)] 
lsfd: read misc character device names from /proc/misc

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add CHRDRV column
Masatake YAMATO [Fri, 7 May 2021 18:51:25 +0000 (03:51 +0900)] 
lsfd: add CHRDRV column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: read character driver names from /proc/devices
Masatake YAMATO [Fri, 7 May 2021 18:50:16 +0000 (03:50 +0900)] 
lsfd: read character driver names from /proc/devices

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add PARTITION column
Masatake YAMATO [Fri, 7 May 2021 18:28:46 +0000 (03:28 +0900)] 
lsfd: add PARTITION column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: read /proc/partitions
Masatake YAMATO [Fri, 7 May 2021 18:25:30 +0000 (03:25 +0900)] 
lsfd: read /proc/partitions

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: introduce name_manager
Masatake YAMATO [Fri, 7 May 2021 16:50:20 +0000 (01:50 +0900)] 
lsfd: introduce name_manager

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: replace "socket:" in NAME of SOCKET with its protoname
Masatake YAMATO [Sun, 9 May 2021 01:49:25 +0000 (10:49 +0900)] 
lsfd: replace "socket:" in NAME of SOCKET with its protoname

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add PROTONAME column
Masatake YAMATO [Thu, 6 May 2021 18:57:45 +0000 (03:57 +0900)] 
lsfd: add PROTONAME column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: allow passing a proc object to the constructors of the file classes
Masatake YAMATO [Thu, 6 May 2021 18:57:03 +0000 (03:57 +0900)] 
lsfd: allow passing a proc object to the constructors of the file classes

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: make username_cache lsfd-file privaite
Masatake YAMATO [Thu, 6 May 2021 15:00:05 +0000 (00:00 +0900)] 
lsfd: make username_cache lsfd-file privaite

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add the way to initialize and finalize classes
Masatake YAMATO [Thu, 6 May 2021 14:51:00 +0000 (23:51 +0900)] 
lsfd: add the way to initialize and finalize classes

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: move file_class variants after their constructors
Masatake YAMATO [Thu, 6 May 2021 14:34:51 +0000 (23:34 +0900)] 
lsfd: move file_class variants after their constructors

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: fill POS and MODE columns for SHM and MEM associated files
Masatake YAMATO [Thu, 6 May 2021 13:26:48 +0000 (22:26 +0900)] 
lsfd: fill POS and MODE columns for SHM and MEM associated files

/proc/$pid/maps files are used as the data sourecs.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: introduce new association SHM representing shared file mapping
Masatake YAMATO [Thu, 6 May 2021 13:19:11 +0000 (22:19 +0900)] 
lsfd: introduce new association SHM representing shared file mapping

MEM is kept for representing private file mapping.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add code for reading /proc/$pid/maps
Masatake YAMATO [Thu, 6 May 2021 13:15:24 +0000 (22:15 +0900)] 
lsfd: add code for reading /proc/$pid/maps

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: introduce fopenf helper function
Masatake YAMATO [Sun, 9 May 2021 17:29:31 +0000 (02:29 +0900)] 
lsfd: introduce fopenf helper function

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add stubs for sockets and files of unknown type
Masatake YAMATO [Thu, 6 May 2021 06:10:49 +0000 (15:10 +0900)] 
lsfd: add stubs for sockets and files of unknown type

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: simplify class hierarchy
Masatake YAMATO [Thu, 6 May 2021 05:54:27 +0000 (14:54 +0900)] 
lsfd: simplify class hierarchy

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: replace POS with MNT_ID in default column set
Masatake YAMATO [Thu, 6 May 2021 05:45:11 +0000 (14:45 +0900)] 
lsfd: replace POS with MNT_ID in default column set

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add MODE column
Masatake YAMATO [Thu, 6 May 2021 05:29:43 +0000 (14:29 +0900)] 
lsfd: add MODE column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add FLAGS, MNTID, and POS columns
Masatake YAMATO [Thu, 6 May 2021 05:28:58 +0000 (14:28 +0900)] 
lsfd: add FLAGS, MNTID, and POS columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add infrstructure code for reading fdinfo files
Masatake YAMATO [Thu, 6 May 2021 05:25:56 +0000 (14:25 +0900)] 
lsfd: add infrstructure code for reading fdinfo files

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: don't collect and print redundant information about threads
Masatake YAMATO [Tue, 4 May 2021 18:37:57 +0000 (03:37 +0900)] 
lsfd: don't collect and print redundant information about threads

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: support threads with -l option
Masatake YAMATO [Tue, 4 May 2021 16:47:49 +0000 (01:47 +0900)] 
lsfd: support threads with -l option

-t and -T are reserved for ffiltering feature.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: print the owner of process as USER
Masatake YAMATO [Tue, 4 May 2021 18:36:09 +0000 (03:36 +0900)] 
lsfd: print the owner of process as USER

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: adjust column width for COMMAND
Masatake YAMATO [Tue, 4 May 2021 17:50:51 +0000 (02:50 +0900)] 
lsfd: adjust column width for COMMAND

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add NLINK and DELETED columns
Masatake YAMATO [Mon, 3 May 2021 07:22:29 +0000 (16:22 +0900)] 
lsfd: add NLINK and DELETED columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsfd: add columns for SIZE
Masatake YAMATO [Mon, 3 May 2021 06:59:26 +0000 (15:59 +0900)] 
lsfd: add columns for SIZE

Signed-off-by: Masatake YAMATO <yamato@redhat.com>