joelagnel / bpfd

BPFd (Deprecated, please see README.md) : Berkeley Packet Filter daemon (BPFd). Makes it possible to run BCC tools across systems.
Apache License 2.0
95 stars 23 forks source link

Poll stdin as well when polling perf_readers #40

Closed jcanseco closed 6 years ago

jcanseco commented 6 years ago

This modifies the perf_reader polling logic for bpfd to include stdin into the collection of file descriptors to poll when polling perf_reader file descriptors.

This allows bpfd to be able to react to user input via stdin immediately as opposed to before where it had to wait for the poll() to return before it could address user input.

This fixes a bug where bcc tools like opensnoop.py refused to terminate right away when interrupted with SIGINT (for example via Ctrl+C) since it was still waiting for bpfd to respond to a command that bpfd failed to respond to right away since it was still waiting for poll() to return.

Signed-off-by: Jazel Canseco jcanseco@google.com

Fixes #18

jcanseco commented 6 years ago

This was tested with opensnoop.py (with this BCC-side fix applied), and it terminated properly even when bpfd was in the middle of polling perf_readers.