ss: add -P/--process-age option to display process runtime
Subsystems (2)
PATCH v2 1/1 ss: add -P/--process-age option to display process runtime
Add a new option (-P/--process-age) to display process uptime/age alongside process info inside socket user context output.
---
v2:
- Fixed patch whitespace and tab formatting.
--- man/man8/ss.8 | 3 + misc/ss.c | 662 +++++++++++++++++++++++++++++--------------------- 2 files changed, 385 insertions(+), 280 deletions(-)
man/man8/ss.8 +3 -0
@@ -163,6 +163,9 @@ the number of packets dropped before they are de-multiplexed into the socket .TP \.B \-P, \-\-process\-age Show process age/runtime alongside process socket information. +.TP +\.B \-P, \-\-process\-age +Show process age/runtime alongside process socket information. Show processes using sockets. .TP .B \-T, \-\-threads
misc/ss.c +382 -280
1,176 lines not on this page · raw message
Signature · 1 line
2.43.7
Quoted 49 lines · On Thu, 17 Sep 2026 03:04:02 +0530 Harshith Hari…
Add a new option (-P/--process-age) to display process uptime/age alongside process info inside socket user context output.
Signed-off-by Harshith Hari <[email protected]>---
v2:
- Fixed patch whitespace and tab formatting.Signed-off-by Harshith Hari <[email protected]>--- man/man8/ss.8 | 3 + misc/ss.c | 662 +++++++++++++++++++++++++++++--------------------- 2 files changed, 385 insertions(+), 280 deletions(-)man/man8/ss.8 +3
-0@@ -163,6 +163,9 @@ the number of packets dropped before they are de-multiplexed into the socket .TP \.B \-P, \-\-process\-age Show process age/runtime alongside process socket information. +.TP +\.B \-P, \-\-process\-age +Show process age/runtime alongside process socket information. Show processes using sockets. .TP .B \-T, \-\-threadsmisc/ss.c +0
-14@@ -56,58 +56,58 @@ static int show_process_age;static void print_process_age (pid_t pid) { -char path[64 ]; -FILE *f; -unsigned long long starttime; -double uptime =0.0 ; -long clock_ticks =sysconf (_SC_CLK_TCK); - -f =fopen ("/proc/uptime" ,"r" ); -if (!f) -return ; - -if (fscanf (f,"%lf" , &uptime) !=1 ) { -fclose (f); -return ; -}
misc/ss.c static int show_process_age; · line 67
Quoted 10 lines
misc/ss.c +9
-1-fclose (f); +char path[64 ]; +FILE *f; +unsigned long long starttime; +double uptime =0.0 ; +long clock_ticks =sysconf (_SC_CLK_TCK); + + f =fopen ("/proc/uptime" ,"r" ); +if (!f) +
I don't think you understand how to submit patches.
This is repeated version where the diff is against your misformatted previous version.
And you did not listen to my feedback that the ss tool is about sockets not processes. If you wanted to this kind of thing better off doing some local tool that either scripts ss and ps output, or uses kernel API's
Don't need more growth in tools for this.