Function debug_assert_fd_is_open

Source
pub(crate) fn debug_assert_fd_is_open(fd: RawFd)
Expand description

Aborts the process if a file desceriptor is not open, if debug asserts are enabled

Many IO syscalls can’t be fully trusted about EBADF error codes because those might get bubbled up from a remote FUSE server rather than the file descriptor in the current process being invalid.

So we check file flags instead which live on the file descriptor and not the underlying file. The downside is that it costs an extra syscall, so we only do it for debug.