On Fri, Apr 07, 2023 at 11:45:41PM -0700, Philip Guenther wrote: > On Fri, Apr 7, 2023 at 9:44 AM Dave Voutila <d...@sisu.io> wrote: > ... > > > Touch longer, but won't generate ktrace noise by blind calls to close(2) > > and also accounts for the other error conditions (EINTR, EIO). > > > > For EIO, not sure yet how we want to handle it other than log it. > > > > For EINTR, we want to account for that race and make sure we retry since > > the vmm process is long-lived and could inadvertently keep things like > > tty fds or disk image fds open after the guest vm terminates. > > > > So, this is an area where > * the current POSIX standard leaves the behavior unspecified > * everyone (except HP-UX) made close() *always* invalidate the fd, even if > it fails with EINTR
macOS is also an exception--even messier exception. Ans worse, rather than fix things one way or another, they simply added close$NOCANCEL. See, e.g., https://chromium.googlesource.com/chromium/src/base/+/refs/heads/main/mac/close_nocancel.cc In the case of macOS, the root issue is POSIX thread cancellation, the gift that keeps on giving.