evadot / drm-subtree

WIP drm drivers for FreeBSD
15 stars 9 forks source link

drm_os_freebsd: Fix drm_fstub_ioctl return value sign #32

Open jrtc27 opened 1 year ago

jrtc27 commented 1 year ago

This function is at the FreeBSD/Linux boundary, with unlocked_ioctl conforming to Linux's return value conventions, i.e. errors are negative, and drm_fstub_ioctl conforming to FreeBSD's, i.e. errors are positive. Thus, negate the return value here to translate between the two, otherwise userspace will see negated errno values that don't match any known value; in particular, libdrm's drmIsMaster will erroneously always return true, which breaks KWin leasing a DRM fd to Xwayland.

This also matches what linuxkpi does, as used by drm-kmod.