evdev: add devnum sysctl

Add a sysctl entry for the evdev device number (devnum) to allow
libudev-devd to populate the corresponding device information
fields (MAJOR and MINOR) when running in a jail with no input devices
exposed through devfs.

Signed-off-by: Quentin Thébault <quentin.thebault@defenso.fr>

Reviewed by:	wulf
Sponsored by:	Defenso
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D56968
This commit is contained in:
Quentin Thébault
2026-06-14 11:34:51 -05:00
committed by Kyle Evans
parent 2e1f5b7897
commit 746c374aa9
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -283,6 +283,11 @@ evdev_sysctl_create(struct evdev_dev *evdev)
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "sw_bits", CTLFLAG_RD,
evdev->ev_sw_flags, sizeof(evdev->ev_sw_flags), "",
"Input device supported switch events");
SYSCTL_ADD_U64(&evdev->ev_sysctl_ctx,
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "devnum", CTLFLAG_RD,
&evdev->ev_devnum, 0,
"Input device number");
}
static int
@@ -328,6 +333,7 @@ evdev_register_common(struct evdev_dev *evdev)
ret = evdev_cdev_create(evdev);
if (ret != 0)
goto bail_out;
evdev->ev_devnum = dev2udev(evdev->ev_cdev);
/* Create sysctls (for device enumeration without /dev/input access rights) */
evdev_sysctl_create(evdev);
+1
View File
@@ -114,6 +114,7 @@ struct evdev_dev
uid_t ev_cdev_uid;
gid_t ev_cdev_gid;
int ev_cdev_mode;
dev_t ev_devnum;
int ev_unit;
enum evdev_lock_type ev_lock_type;
struct mtx * ev_state_lock; /* State lock */