Skip to content

ss: Introduce -T, --threads option

Peilin Ye netdev 1 version Applied

Status from this message: This series was applied to iproute2/iproute2-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 0 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/7ss: Use assignment-suppression character in sscanf()misc/ss.c+2 -30 replies
2/7ss: Remove unnecessary stack variable 'p' in user_ent_hash_build()misc/ss.c+3 -50 replies
3/7ss: Do not call user_ent_hash_build() more than oncemisc/ss.c+3 -90 replies
4/7ss: Delete unnecessary call to snprintf() in user_ent_hash_build()misc/ss.c+1 -40 replies
5/7ss: Fix coding style issues in user_ent_hash_build()misc/ss.c+12 -100 replies
6/7ss: Factor out fd iterating logic from user_ent_hash_build()misc/ss.c+79 -650 replies
7/7ss: Introduce -T, --threads optionman/man8/ss.8 misc/ss.c+72 -300 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH iproute2-next 0/7] ss: Introduce -T, --threads option

From: Peilin Ye <[email protected]>

Hi all,

This patchset adds a new ss option, -T (--threads), to show thread information. It extends the -p (--processes) option, and should be useful for debugging, monitoring multi-threaded applications. Example output:

  $ 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))

It implies -p i.e. it outputs all threads in the thread group, including the thread group leader. When -T is used, -Z and -z also show SELinux contexts for threads.

[1-5/7] are small clean-ups for the user_ent_hash_build() function. [6/7] factors out logic iterating $PROC_ROOT/$PID/fd/ from user_ent_hash_build() to make [7/7] easier. [7/7] actually implements the feature.

Thanks,
Peilin Ye (7):
ss: Use assignment-suppression character in sscanf()
ss: Remove unnecessary stack variable 'p' in user_ent_hash_build()
ss: Do not call user_ent_hash_build() more than once
ss: Delete unnecessary call to snprintf() in user_ent_hash_build()
ss: Fix coding style issues in user_ent_hash_build()
ss: Factor out fd iterating logic from user_ent_hash_build()
ss: Introduce -T, --threads option

 man/man8/ss.8 |   8 +-
 misc/ss.c     | 230 +++++++++++++++++++++++++++++---------------------
 2 files changed, 142 insertions(+), 96 deletions(-)
Signature · 1 line
2.20.1