Using epoll on a sampling perf_event_open file descriptor returns EPOLLHUP
I am writing a program that uses the Linux perf api to measure the number of instructions run by a program, and I want to receive a notification once the child process reaches a given number of instructions. Perf provides a way to do this via overflow notifications, and according to its official manpage overflow notifications can be captured in two ways: