]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ss: Introduce -T, --threads option
authorPeilin Ye <peilin.ye@bytedance.com>
Wed, 25 May 2022 02:53:41 +0000 (19:53 -0700)
committerDavid Ahern <dsahern@kernel.org>
Mon, 30 May 2022 15:54:28 +0000 (09:54 -0600)
commite2267e68b9b56d29e381be1bfff465340c67992c
treecfd8857fbb2dc437e9ec779d07b4ea036236d072
parent12d491e58ff574219f1c01f844c0c76e4f4e5eef
ss: Introduce -T, --threads option

The -p, -Z and -z options only show process (thread group leader)
information.  For example, if the thread group leader has exited, but
another thread in the group is still using a socket, ss -[pZz] does not
show it.

Add a new option, -T (--threads), to show thread information.  It implies
the -p option.  For example, imagine process A and thread B (in the same
group) using the same socket.  ss -p only shows A:

  $ ss -ltp "sport = 1234"
  State   Recv-Q  Send-Q  Local Address:Port      Peer Address:Port       Process
  LISTEN  0       100           0.0.0.0:1234           0.0.0.0:*           users:(("test",pid=2932547,fd=3))

ss -T shows A and B:

  $ ss -ltT "sport = 1234"
  State   Recv-Q  Send-Q  Local Address:Port      Peer Address:Port       Process
  LISTEN  0       100           0.0.0.0:1234           0.0.0.0:*           users:(("test",pid=2932547,tid=2932548,fd=3),("test",pid=2932547,tid=2932547,fd=3))

If -T is used, -Z and -z also show SELinux contexts for threads.

Rename some variables (from "process" to "task", for example) since we
use them for both processes and threads.

Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
man/man8/ss.8
misc/ss.c