Skip to content

Commit f801597

Browse files
author
Mike Magin
committed
Fixes brendangregg#81 - When the kernel informs us of LOST EVENTS, clear lastfile
Correlating two lines seperated by a gulf of lost events results in spurious output, for example a open that was attempted on a non-existing file, but which seems to have resulted in a valid returncode.
1 parent 98d42a2 commit f801597

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

opensnoop

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ fi ) | $awk -v o=$offset -v opt_name=$opt_name -v name=$name \
245245
# sys_open()
246246
$1 != "#" && $(4+o) == "sys_open" {
247247
filename = lastfile[pid]
248+
if (!filename)
249+
next
248250
delete lastfile[pid]
249251
if (opt_file && filename !~ file)
250252
next
@@ -262,7 +264,9 @@ fi ) | $awk -v o=$offset -v opt_name=$opt_name -v name=$name \
262264
printf "%-16.16s %-6s %4s %s\n", comm, pid, rval, filename
263265
}
264266
265-
$0 ~ /LOST.*EVENTS/ { print "WARNING: " $0 > "/dev/stderr" }
267+
$0 ~ /LOST.*EVENTS/ {
268+
delete lastfile
269+
print "WARNING: " $0 > "/dev/stderr" }
266270
'
267271

268272
### end tracing

0 commit comments

Comments
 (0)