Consider this program:
#include <stdio.h>
#include <sys/epoll.h>
int main(void) {
int epfd = epoll_create1(0);
struct epoll_event event;
event.events = EPOLLIN;
event.data.fd = 0;
epoll_ctl(epfd, EPOLL_CTL_ADD, 0, &event);
epoll_wait(epfd, &event, 1, -1);
perror("epoll_wait");
return 0;
}
When I run this program by itself, resizing the terminal (thus generating SIGWINCH) doesn't do anything to it, and it keeps waiting for input on stdin. When I run it inside strace or ltrace, the SIGWINCH results in epoll_wait erroring with EINTR. My understanding of EINTR is that it's only generated if a signal calls a signal handler in your code, but I don't have any of them registered. I thought that strace or ltrace may have been setting one for me, so I tried explicitly setting it to SIG_IGN, but this still didn't stop the EINTR. Why is this happening?