mirror of
https://github.com/openai/codex.git
synced 2026-05-02 18:37:01 +00:00
fix: simplify macOS sleep inhibitor FFI (#12340)
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
This commit is contained in:
committed by
GitHub
parent
fd67aba114
commit
5b71246001
@@ -1,16 +1,12 @@
|
||||
use crate::PlatformSleepInhibitor;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct DummySleepInhibitor;
|
||||
pub(crate) struct SleepInhibitor;
|
||||
|
||||
impl DummySleepInhibitor {
|
||||
impl SleepInhibitor {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl PlatformSleepInhibitor for DummySleepInhibitor {
|
||||
fn acquire(&mut self) {}
|
||||
pub(crate) fn acquire(&mut self) {}
|
||||
|
||||
fn release(&mut self) {}
|
||||
pub(crate) fn release(&mut self) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user