]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lsfd: print the detail of the timer associated with a timerfd
authorMasatake YAMATO <yamato@redhat.com>
Fri, 2 Jun 2023 23:42:27 +0000 (08:42 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Sun, 4 Jun 2023 08:18:38 +0000 (17:18 +0900)
commit188b7d64bb60071ef9c221d10c69c9fe8a1bdc11
treed052e4c9d99b7dcc263dcffd01076bc53b54a5ba
parent1fa185647115cd58717196011673b81e7ffad935
lsfd: print the detail of the timer associated with a timerfd

An example output:

    # ./lsfd -p 1  -Q '(TYPE == "timerfd")' -oCOMMAND,PID,ASSOC,TYPE,INODE,NAME
    COMMAND PID ASSOC    TYPE INODE NAME
    systemd   1    22 timerfd  1060 clockid=monotonic remaining=4625.661834645
    systemd   1    25 timerfd  1060 clockid=realtime remaining=398.164618943
    systemd   1   112 timerfd  1060 clockid=realtime remaining=7537606384.202715161

Added three new columns, TIMERFD.{CLOCKID,TIMERFD.REMAINING,INTERVAL}.
The filter engine works well with them.

An example listing timerfd files expiring within 1.2 seconds.

    # ./lsfd -Q '(TIMERFD.REMAINING > 0.0) && (TIMERFD.REMAINING < 1.2)'
    COMMAND          PID        USER ASSOC MODE    TYPE       SOURCE MNTID INODE NAME
    Xorg           17069         jet    26  rw- timerfd anon_inodefs    15  1060 clockid=monotonic remaining=0.061075544
    systemd-oomd 2382701 systemd-oom     8  rw- timerfd anon_inodefs    15  1060 clockid=monotonic remaining=0.178126915

Using SCOLS_JSON_NUMBER as the data type for TIMERFD.REMAINING and
TIMERFD.INTERVAL columns is suggested by Thomas Weißschuh
<thomas@t-8ch.de>.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-unkn.c
misc-utils/lsfd.c
misc-utils/lsfd.h