Page MenuHomeFreeBSD

eventfd: Add refcounting
Needs ReviewPublic

Authored by dumbbell on Jun 14 2025, 5:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 3, 11:41 AM
Unknown Object (File)
Thu, Oct 2, 4:55 PM
Unknown Object (File)
Thu, Oct 2, 4:56 AM
Unknown Object (File)
Tue, Sep 30, 8:36 AM
Unknown Object (File)
Sep 14 2025, 5:55 AM
Unknown Object (File)
Sep 4 2025, 7:00 PM
Unknown Object (File)
Aug 31 2025, 8:48 AM
Unknown Object (File)
Aug 6 2025, 12:40 PM
Subscribers

Details

Reviewers
None
Group Reviewers
linuxkpi
Summary

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

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped