Commit ee9f0e0a authored by Daniel Zozin's avatar Daniel Zozin Committed by yonghong-song

Remove handling of KeyboardInterrupt exception (#1843)

KeyboardInterrupt exception is not handled anymore. It will be
propagated and handled by the caller.
parent 365eade7
......@@ -1041,7 +1041,6 @@ class BPF(object):
fields (task, pid, cpu, flags, timestamp, msg) or None if no
line was read (nonblocking=True)
"""
try:
while True:
line = self.trace_readline(nonblocking)
if not line and nonblocking: return (None,) * 6
......@@ -1063,8 +1062,6 @@ class BPF(object):
sym_end = line.find(b":")
msg = line[sym_end + 2:]
return (task, int(pid), int(cpu), flags, float(ts), msg)
except KeyboardInterrupt:
exit()
def trace_readline(self, nonblocking=False):
"""trace_readline(nonblocking=False)
......@@ -1080,8 +1077,6 @@ class BPF(object):
line = trace.readline(1024).rstrip()
except IOError:
pass
except KeyboardInterrupt:
exit()
return line
def trace_print(self, fmt=None):
......@@ -1093,7 +1088,6 @@ class BPF(object):
example: trace_print(fmt="pid {1}, msg = {5}")
"""
try:
while True:
if fmt:
fields = self.trace_fields(nonblocking=False)
......@@ -1103,8 +1097,6 @@ class BPF(object):
line = self.trace_readline(nonblocking=False)
print(line)
sys.stdout.flush()
except KeyboardInterrupt:
exit()
@staticmethod
def _sym_cache(pid):
......@@ -1194,13 +1186,10 @@ class BPF(object):
Poll from all open perf ring buffers, calling the callback that was
provided when calling open_perf_buffer for each entry.
"""
try:
readers = (ct.c_void_p * len(self.perf_buffers))()
for i, v in enumerate(self.perf_buffers.values()):
readers[i] = v
lib.perf_reader_poll(len(readers), readers, timeout)
except KeyboardInterrupt:
exit()
def kprobe_poll(self, timeout = -1):
"""kprobe_poll(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment