Skip to content

Commit 4eb7b10

Browse files
authored
fix: Various for MacOS (ai-dynamo#155)
- Mac doesn't have `pipe2` syscall so use plain `pipe`. - rtnetlink isn't a dependency on mac so don't use the type
1 parent 8d78e33 commit 4eb7b10

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ validator = { version = "0.20.0", features = ["derive"] }
6262
uuid = { version = "1", features = ["v4", "serde"] }
6363
xxhash-rust = { version = "0.8", features = ["xxh3", "const_xxh3"] }
6464
strum = { version = "0.27", features = ["derive"] }
65-
prometheus = { version = "0.13" }
65+
prometheus = { version = "0.13" }
66+
67+
[profile.dev.package]
68+
insta.opt-level = 3

launch/dynamo-run/src/net.rs

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl LinkDataError {
3939
Self { kind, interface }
4040
}
4141

42+
#[cfg(target_os = "linux")]
4243
fn communication(communication_error: rtnetlink::Error) -> Self {
4344
let kind = LinkDataErrorKind::Communication(communication_error);
4445
let interface = None;
@@ -61,6 +62,7 @@ impl std::error::Error for LinkDataError {
6162
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
6263
match self.kind {
6364
LinkDataErrorKind::Connection(ref e) => Some(e),
65+
#[cfg(target_os = "linux")]
6466
LinkDataErrorKind::Communication(ref e) => Some(e),
6567
}
6668
}
@@ -69,6 +71,7 @@ impl std::error::Error for LinkDataError {
6971
#[derive(Debug)]
7072
pub enum LinkDataErrorKind {
7173
Connection(std::io::Error),
74+
#[cfg(target_os = "linux")]
7275
Communication(rtnetlink::Error),
7376
}
7477

lib/llm/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,3 @@ insta = { version = "1.41", features = [
160160
[build-dependencies]
161161
bindgen = "0.70"
162162
cmake = "0.1"
163-
164-
[profile.dev.package]
165-
insta.opt-level = 3

lib/llm/src/engines/sglang/worker.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ async fn start_sglang(
447447
// This pipe is how sglang tells us it's ready
448448
let mut pipe_fds: [libc::c_int; 2] = [-1, -1];
449449
unsafe {
450-
let err = libc::pipe2(pipe_fds.as_mut_ptr() as *mut c_int, 0); // libc::O_NONBLOCK);
450+
// Seems to be OK without libc::O_NONBLOCK
451+
let err = libc::pipe(pipe_fds.as_mut_ptr() as *mut c_int);
451452
if err != 0 {
452453
anyhow::bail!("libc::pipe error {err}");
453454
}

0 commit comments

Comments
 (0)