Skip to content

Commit

Permalink
Merge pull request #185 from ids1024/rdwr-cloexec
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix authored Dec 4, 2023
2 parents f7ffcd0 + cfe2850 commit 79a9e2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drm-ffi/drm-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
#![allow(non_snake_case)]

#[cfg(any(target_os = "android", target_os = "linux"))]
pub use linux_raw_sys::general::__kernel_size_t;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub type drm_handle_t = core::ffi::c_uint;
mod platform {
pub use linux_raw_sys::general::__kernel_size_t;
pub type drm_handle_t = core::ffi::c_uint;
pub const DRM_RDWR: u32 = linux_raw_sys::general::O_RDWR;
pub const DRM_CLOEXEC: u32 = linux_raw_sys::general::O_CLOEXEC;
}

#[cfg(not(any(target_os = "android", target_os = "linux")))]
type __kernel_size_t = libc::size_t;
#[cfg(not(any(target_os = "android", target_os = "linux")))]
pub type drm_handle_t = core::ffi::c_ulong;
mod platform {
pub type __kernel_size_t = libc::size_t;
pub type drm_handle_t = core::ffi::c_ulong;
pub const DRM_RDWR: u32 = libc::O_RDWR as u32;
pub const DRM_CLOEXEC: u32 = libc::O_CLOEXEC as u32;
}

pub use platform::*;

#[cfg(feature = "use_bindgen")]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ use rustix::io::Errno;

use crate::util::*;

pub use drm_ffi::{DRM_CLOEXEC as CLOEXEC, DRM_RDWR as RDWR};

/// This trait should be implemented by any object that acts as a DRM device. It
/// is a prerequisite for using any DRM functionality.
///
Expand Down

0 comments on commit 79a9e2b

Please sign in to comment.