7 perl
-p -e 's/^Open AF_UNIX socket [0-9]*: <unknown>/Open AF_UNIX socket ...: <unknown>/' |
8 perl
-p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: \/dev\/null/Open $1 ...: \/dev\/null/' |
9 # Solaris-specific, translate /devices/pseudo/mm@0:null to /dev/null
10 perl
-p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: \/devices\/pseudo\/mm\@0:null/Open $1 ...: \/dev\/null/' |
11 # Nb: on Darwin, /tmp is a symlink to /private/tmp, so sometimes it's
12 # necessary to filter out the "/private" part.
13 perl
-p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: (\/private)?\/tmp\/(sock|data1|data2|file)\.[0-9]*/Open $1 ...: \/tmp\/$3/' |
14 perl
-p -e 's/^Open file descriptor [0-9]*: .*/Open file descriptor ...: .../' |
15 perl
-p -e 's/^Open file descriptor [0-9]*:$/Open file descriptor ...:/' |
16 perl
-p -e 's/File descriptor [0-9]*: .* is already closed/File descriptor ...: ... is already closed/' |
17 perl
-p -e 's/127.0.0.1:[0-9]*/127.0.0.1:.../g' |
18 perl
-p -e 's/socket\.c:[1-9][0-9]*/in \/...libc.../' |
19 # arm systems substitute open for creat
20 perl
-p -e 's/open \(open64\.c:[1-9][0-9]*\)/creat (in \/...libc...)/' |
21 perl
-p -e "s/: open \(/: creat (/" |
23 # FreeBSD specific fdleak filters
24 perl
-p -e 's/ _close / close /;s/ _openat / creat /;s/ _write/ write/;s/internet/AF_INET socket 4: 127.0.0.1:... <-> 127.0.0.1:.../' |
25 sed '/by 0x........: close (in \/...libc...)/d' |
26 sed '/by 0x........: creat (in \/...libc...)/d' |
28 # Solaris specific fdleak filters
29 perl
-p -e 's/ __close / close /' |
30 sed '/ _so_socket /d;' |
31 awk '/ socket /{sub(/ by /, " at "); print; next}{print}' |
32 awk '/ at .* _syscall6 /{getline; getline; sub(/ by /, " at "); print; next}{print}' |
34 # Stack traces showing where fds were created have lots of variations:
35 # different numbers of entries, line numbers or not depending on whether
36 # libc debug info is present, 'main' vs. '(below main)', etc.
38 # So we just cut out the entire stack trace. It's coarse but effective;
39 # before we did this we had a plethora of expected outputs, with only
40 # painfully minor variations between them.
41 perl
-p -0 -e 's/(Open[^\n]*\n)( (at|by)[^\n]*\n)+/$1 ...\n/gs' |
43 sed "s/by 0x........: (below main)/by 0x........: main/" |
44 sed "s/by 0x........: main (.*)/by 0x........: main/" |
46 # With glibc debuginfo installed we might see syscall-template.S,
47 # dup2.c close.c or creat64.c
48 perl
-p -e "s/\(syscall-template.S:[0-9]*\)/(in \/...libc...)/" |
49 perl
-p -e "s/\(close.c:[0-9]*\)/(in \/...libc...)/" |
50 perl
-p -e "s/\(creat(?:64)?.c:[0-9]*\)/(in \/...libc...)/" |
51 perl
-p -e "s/\(dup2.c:[0-9]*\)/(in \/...libc...)/"