From 1e75c2446bf628916a1f725ddb80a0d2fef83284 Mon Sep 17 00:00:00 2001 From: Anek Date: Fri, 19 Jan 2024 15:14:28 +0500 Subject: [PATCH] dragonflyBSD --- Cargo.lock | 20 ++++++++++++++++++++ Cargo.toml | 1 + src/memory_management.rs | 2 ++ 3 files changed, 23 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 067325a3..dc8e03f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,6 +41,15 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -86,6 +95,16 @@ dependencies = [ "byteorder 0.5.3", ] +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "gdbstub" version = "0.6.3" @@ -273,6 +292,7 @@ dependencies = [ "byteorder 1.4.3", "combine", "elf", + "errno-dragonfly", "gdbstub", "goblin", "hash32", diff --git a/Cargo.toml b/Cargo.toml index 5486da28..1b551ee7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ include = [ arbitrary = { version = "1.0", optional = true, features = ["derive"] } byteorder = "1.2" combine = "3.8.1" +errno-dragonfly = "0.1.2" gdbstub = { version = "0.6.2", optional = true } goblin = "0.5.1" hash32 = "0.2.0" diff --git a/src/memory_management.rs b/src/memory_management.rs index 7606db3c..0d73a32f 100644 --- a/src/memory_management.rs +++ b/src/memory_management.rs @@ -47,6 +47,8 @@ macro_rules! libc_error_guard { let errno = *libc::__errno(); #[cfg(target_os = "linux")] let errno = *libc::__errno_location(); + #[cfg(target_os = "dragonfly")] + let errno = *errno_dragonfly::errno_location(); return Err(EbpfError::LibcInvocationFailed(stringify!($function), args, errno)); } }