mirror of
https://github.com/openai/codex.git
synced 2026-05-01 03:42:05 +03:00
Summary - simplify the macOS sleep inhibitor FFI by replacing `dlopen` / `dlsym` / `transmute` with normal IOKit extern calls and `SAFETY` comments - switch to cfg-selected platform implementations (`imp::SleepInhibitor`) instead of `Box<dyn ...>` - check in minimal IOKit bindings generated with `bindgen` and include them from the macOS backend - enable direct IOKit linkage in Bazel macOS builds by registering `IOKit` in the Bazel `osx.framework(...)` toolchain extension list - update `Cargo.lock` and `MODULE.bazel.lock` after removing the build-time `bindgen` dependency path Testing - `just fmt` - `cargo clippy -p codex-utils-sleep-inhibitor --all-targets -- -D warnings` - `cargo test -p codex-utils-sleep-inhibitor` - `bazel test //codex-rs/utils/sleep-inhibitor:all --test_output=errors` - `just bazel-lock-update` - `just bazel-lock-check` Context - follow-up to #11711 addressing Ryan's review comments - `bindgen` is used to generate the checked-in bindings file, but not at build time
28 lines
868 B
Rust
28 lines
868 B
Rust
/* automatically generated by rust-bindgen 0.71.1 */
|
|
|
|
pub const kIOReturnSuccess: u32 = 0;
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct __CFString {
|
|
_unused: [u8; 0],
|
|
}
|
|
pub type CFStringRef = *const __CFString;
|
|
pub type kern_return_t = ::std::os::raw::c_int;
|
|
pub type IOReturn = kern_return_t;
|
|
pub type IOPMAssertionID = u32;
|
|
pub type IOPMAssertionLevel = u32;
|
|
pub const kIOPMAssertionLevelOff: _bindgen_ty_36 = 0;
|
|
pub const kIOPMAssertionLevelOn: _bindgen_ty_36 = 255;
|
|
pub type _bindgen_ty_36 = ::std::os::raw::c_uint;
|
|
unsafe extern "C" {
|
|
pub fn IOPMAssertionRelease(AssertionID: IOPMAssertionID) -> IOReturn;
|
|
}
|
|
unsafe extern "C" {
|
|
pub fn IOPMAssertionCreateWithName(
|
|
AssertionType: CFStringRef,
|
|
AssertionLevel: IOPMAssertionLevel,
|
|
AssertionName: CFStringRef,
|
|
AssertionID: *mut IOPMAssertionID,
|
|
) -> IOReturn;
|
|
}
|