123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #!/bin/rc
- rfork e
- flagfmt='b,s,f binary,r res,x width'
- args='name | pid list'
- if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
- aux/usage
- exit usage
- }
- if(~ $#flags 1 && ~ $#flagb 1){
- echo 'cannot use both -b and -s' >[1=2]
- exit usage
- }
- leakflags=()
- if(~ $#flags 1)
- leakflags=($leakflags -s)
- if(~ $#flagf 1)
- leakflags=($leakflags -f $flagf)
- acidleakflags=()
- if(~ $#flagb 1)
- acidleakflags=($acidleakflags -b)
- if(~ $#flagr 1)
- acidleakflags=($acidleakflags -r $flagr)
- if(~ $#flagx 1)
- acidleakflags=($acidleakflags -x $flagx)
- if(! test -d /proc/$1) {
- # x=`{psu | awk '$NF=="'$1'" {print $2}'}
- x=`{psu | grep ' '$1'$' | sed 's/^[^ ]+ +([0-9]+).*/\1/'}
- if(~ $#x 0) {
- echo 'no processes named '$1 >[1=2]
- exit usage
- }
- echo leak $leakflags $acidleakflags $x
- exit
- }
- pidlist=`{echo $"* | tr ' ' ,}
- echo 'leakdump({'$pidlist'})' |
- acid -lpool -lleak $1 $flagf |
- aux/acidleak $acidleakflags $flagf |
- {
- if(~ $#flags 1)
- awk '{print $4}' |
- sort | uniq -c | sort -nr |
- sed 's! *(.*) (0x.*)!src(\2); // \1!'
- if not
- cat
- }
|