Smithay / drm-rs

A low-level abstraction of the Direct Rendering Manager API
MIT License
77 stars 51 forks source link

Export drm RDWR/CLOEXEC flags #182

Closed cmeissl closed 9 months ago

cmeissl commented 9 months ago

The drm headers define:

#define DRM_RDWR O_RDWR
#define DRM_CLOEXEC O_CLOEXEC

These can be passed to prime_handle_to_fd and should be exported by the drm crate.

ids1024 commented 9 months ago

This isn't strictly necessary since those should always be the same as the variants from libc, but it could be handy to just have drm::CLOEXEC and drm::RDWR.

These may differ by OS/architecture (looking at libc, O_CLOEXEC is different on some Linux architectures?), so they can be defined using linux-raw-sys on Linux and libc elsewhere. Matching rustix and how drm-sys defines __kernel_size_t.