Since Linux kernel commit 8dbd76e79a16 ("tcp/dccp: fix possible race
__inet_lookup_established()") (in v5.5), it's actually hlist_nulls_head
what is used for items of inet_hashinfo::listening_hash. This commit was
also backported to stable kernels, so with the change it works for all
releases starting with v4.9. The version 4.4 is not supported right now
(nulls head list is probably not known at the time).
Fixes: #268
Signed-off-by: Martin Liska <mliska@suse.cz>
This script mimics crash>sys and provides the following output:
CPUS 16
DATE Fri Jan 27 20:26:24 2023
UPTIME 1 day, 7:29:37
LOAD AVERAGE 0.00, 0.00, 0.00
TASKS 317
NODENAME tw
RELEASE 6.1.7-1-default
VERSION #1 SMP PREEMPT_DYNAMIC Wed Jan 18 11:12:34 UTC 2023 (872045c)
MACHINE x86_64
MEMORY 12.67 GiB
Signed-off-by: Martin Liska <mliska@suse.cz>
Since Linux kernel commit cae3873c5b3a ("net: inet: Retire port only
listening_hash") (in v5.19), listening_hash is removed and we need
to iterate lhash2 table.
The script reports now:
LISTEN [::]:22 [::]:0 /system.slice/sshd.service
LISTEN 0.0.0.0:22 0.0.0.0:0 /system.slice/sshd.service
LISTEN [::1]:631 [::]:0 /system.slice/cups.service
LISTEN 127.0.0.1:25 0.0.0.0:0 /system.slice/postfix.service
LISTEN [::1]:25 [::]:0 /system.slice/postfix.service
LISTEN 127.0.0.1:631 0.0.0.0:0 /system.slice/cups.service
ESTABLISHED 192.168.122.99:22 192.168.122.1:45906 /system.slice/sshd.service
ESTABLISHED 192.168.122.99:22 192.168.122.1:48066 /system.slice/sshd.service
ESTABLISHED 192.168.122.99:22 192.168.122.1:41128 /system.slice/sshd.service
Signed-off-by: Martin Liska <mliska@suse.cz>
New output:
PID PPID CPU ST COMM
1 0 4 S systemd
2 0 13 S [kthreadd]
3 2 0 I [rcu_gp]
4 2 0 I [rcu_par_gp]
5 2 0 I [slub_flushwq]
6 2 0 I [netns]
8 2 0 I [kworker/0:0H]
10 2 0 I [mm_percpu_wq]
11 2 0 I [rcu_tasks_kthre]
...
Signed-off-by: Martin Liska <mliska@suse.cz>
Co-authored-by: Omar Sandoval <osandov@osandov.com>
When inode_path returns None and it's passed to fsdecode,
I get TypeError exception:
```
File "/usr/lib64/python3.10/os.py", line 823, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType
```
Thus catch both exception types.
Signed-off-by: Martin Liska <mliska@suse.cz>
It's come up several times that it'd be nice to have somewhere to dump
drgn scripts that people write while debugging without requiring them to
be cleaned up and scrutinized in code review. Serapheim Dimitropoulos
noted that several projects have a "contrib" directory for this purpose.
See [1]. Let's create one, document it, exclude it from pre-commit, and
move our (mostly unmaintained) examples there.
1: https://drewdevault.com/2020/06/06/Add-a-contrib-directory.html
Signed-off-by: Omar Sandoval <osandov@osandov.com>