On Tue, Oct 27, 2020 at 7:14 AM Michael Kerrisk (man-pages) <mtk.manpages@xxxxxxxxx> wrote: > On 10/26/20 4:54 PM, Jann Horn wrote: > > I'm a bit on the fence now on whether non-blocking mode should use > > ENOTCONN or not... I guess if we returned ENOENT even when there are > > no more listeners, you'd have to disambiguate through the poll() > > revents, which would be kinda ugly? > > I must confess, I'm not quite clear on which two cases you > are trying to distinguish. Can you elaborate? Let's say someone writes a program whose responsibilities are just to handle seccomp events and to listen on some other fd for commands. And this is implemented with an event loop. Then once all the target processes are gone (including zombie reaping), we'll start getting EPOLLERR. If NOTIF_RECV starts returning -ENOTCONN at this point, the event loop can just call into the seccomp logic without any arguments; it can just call NOTIF_RECV one more time, see the -ENOTCONN, and terminate. The downside is that there's one more error code userspace has to special-case. This would be more consistent with what we'd be doing in the blocking case. If NOTIF_RECV keeps returning -ENOENT, the event loop has to also tell the seccomp logic what the revents are. I guess it probably doesn't really matter much.