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

perf_reader_poll exit on standard input #18

Closed joelagnel closed 6 years ago

joelagnel commented 6 years ago

Currently tools like opensnoop just hang when you try to CTRL+C. The reason is perf_reader_poll doesn't see the interruption since its running remotely.

Remote side debugging shows this:

2352   DeviceStorageMo   231   0 /system/framework/arm64/boot.art
2352   DeviceStorageMo   231   0 /data/dalvik-cache/arm64/system@framework@boot.art
Sending command PERF_READER_POLL -1 4 12 11 10 9
^CSending command BPF_DELETE_ELEM 4 AAAAAA== 4

After the ^C, the Delete command is sent, but its not processed because BPFd is sleeping on the perf poll. Fix should be to poll STDIN as well, for any activity, and if so process an interruption within BPFd.