An eventfd file descriptor can be used by drivers such as DRM drivers through linuxkpi. A driver can hold a reference to such a file regardless of the fact it is used by userland or not.
This patch introduces a refcount in struct eventfd_ctx, plus the eventfd_get() and eventfd_put() functions to acquire and release references. These functions will be used by DRM drivers for instance.
This structure is internal to sys/kern/sys_eventfd.c and not used anywhere else. Thus it is safe to add a field without breaking anything.
This is a requirement to the following patch to drm-kmod:
https://github.com/freebsd/drm-kmod/pull/358
Sponsored by: The FreeBSD Foundation