#!/bin/rc rfork e if(! ~ $#* 1) { echo "usage: $0 netdir" >[1=2] exit usage } qids=`{ls -q $1/^(ctl data) | sed 's/^\(//; s/ .*//'} pat=`{echo $qids | sed 's, ,|,'} pids=`{grep $pat /proc/*/fd | sed 's,/proc/,,; s,/fd.*,,'} { for(x in $pids) { cmd=`{cat /proc/$x/args} if(~ $cmd '') cmd=`{sed 's/ .*//' /proc/$x/status} echo $x ' ' $cmd } } | sort -n # connections managed by devtls and other streams-style devices won't # be found