xf86drm: Add drmIsMaster()
We can't use drmSetMaster to query whether or not a drm fd is master because it requires CAP_SYS_ADMIN, even if the fd *is* a master fd. Pick DRM_IOCTL_MODE_ATTACHMODE as a long-deprecated ioctl that is DRM_MASTER but not DRM_ROOT_ONLY as the probe by which we can detect whether or not the fd is master. This is useful for code that might get master by open()ing the drm device while no other master exists, but can't call drmSetMaster itself because it's not running as root or is in a container, where container-root isn't real-root. v2: Use the AUTH_MAGIC request rather than MODE_ATTACHMODE, as it's more clearly related to master status. v3: [Emil] Don't expose internals, check for -EACCES. Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Loading
Please register or sign in to comment