Commit 76b79149 authored by Graham King's avatar Graham King Committed by GitHub
Browse files

fix: Various for MacOS (#155)

- Mac doesn't have `pipe2` syscall so use plain `pipe`.
- rtnetlink isn't a dependency on mac so don't use the type
parent 82f455d5
......@@ -62,4 +62,7 @@ validator = { version = "0.20.0", features = ["derive"] }
uuid = { version = "1", features = ["v4", "serde"] }
xxhash-rust = { version = "0.8", features = ["xxh3", "const_xxh3"] }
strum = { version = "0.27", features = ["derive"] }
prometheus = { version = "0.13" }
\ No newline at end of file
prometheus = { version = "0.13" }
[profile.dev.package]
insta.opt-level = 3
......@@ -39,6 +39,7 @@ impl LinkDataError {
Self { kind, interface }
}
#[cfg(target_os = "linux")]
fn communication(communication_error: rtnetlink::Error) -> Self {
let kind = LinkDataErrorKind::Communication(communication_error);
let interface = None;
......@@ -61,6 +62,7 @@ impl std::error::Error for LinkDataError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self.kind {
LinkDataErrorKind::Connection(ref e) => Some(e),
#[cfg(target_os = "linux")]
LinkDataErrorKind::Communication(ref e) => Some(e),
}
}
......@@ -69,6 +71,7 @@ impl std::error::Error for LinkDataError {
#[derive(Debug)]
pub enum LinkDataErrorKind {
Connection(std::io::Error),
#[cfg(target_os = "linux")]
Communication(rtnetlink::Error),
}
......
......@@ -160,6 +160,3 @@ insta = { version = "1.41", features = [
[build-dependencies]
bindgen = "0.70"
cmake = "0.1"
[profile.dev.package]
insta.opt-level = 3
......@@ -447,7 +447,8 @@ async fn start_sglang(
// This pipe is how sglang tells us it's ready
let mut pipe_fds: [libc::c_int; 2] = [-1, -1];
unsafe {
let err = libc::pipe2(pipe_fds.as_mut_ptr() as *mut c_int, 0); // libc::O_NONBLOCK);
// Seems to be OK without libc::O_NONBLOCK
let err = libc::pipe(pipe_fds.as_mut_ptr() as *mut c_int);
if err != 0 {
anyhow::bail!("libc::pipe error {err}");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment