FreeBSD/src 991666a (r340408)lib/libnv common_impl.h msgio.c, lib/libnv/tests nvlist_send_recv_test.c

Ensure that libnv can be used when kern.trap_enotcap=1.

libnv used fcntl(fd, F_GETFL) to test whether fd is a valid file
descriptor.  Aside from being racy, this check requires CAP_FCNTL
rights on fd.  Instead, use fcntl(fd, F_GETFD), which does not require
any capability rights.

Also remove some redundant fd_is_valid() checks to avoid extra system
calls; in many cases we were performing this check immediately before
dup()ing the descriptor.

Reviewed by:    cem, oshogbo (previous version)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D17963
DeltaFile
+32-6lib/libnv/tests/nvlist_send_recv_test.c
+0-14sys/contrib/libnv/nvpair.c
+10-1lib/libnv/common_impl.h
+0-5lib/libnv/msgio.c
+42-264 files

UnifiedSplitRaw