Skip to content

Commit a13e6cf

Browse files
ammarioclaude
andcommitted
Add proper libc import for Linux module
Import libc with 'use libc;' statement with proper cfg attribute for Linux. This resolves the compilation issue on Linux CI. 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b032da9 commit a13e6cf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/jail/linux.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ use std::process::{Command, ExitStatus};
44
use std::time::{SystemTime, UNIX_EPOCH};
55
use tracing::{debug, error, info, warn};
66

7+
// Import libc for system calls (getuid, kill)
8+
#[cfg(target_os = "linux")]
9+
use libc;
10+
711
/// Linux jail implementation using network namespaces
812
/// Provides complete network isolation without persistent system state
913
pub struct LinuxJail {
@@ -44,7 +48,7 @@ impl LinuxJail {
4448
fn check_root() -> Result<()> {
4549
// Check UID directly using libc
4650
#[cfg(target_os = "linux")]
47-
let uid = unsafe { ::libc::getuid() };
51+
let uid = unsafe { libc::getuid() };
4852
#[cfg(not(target_os = "linux"))]
4953
let uid = 1000; // Non-root UID for non-Linux platforms
5054

@@ -411,7 +415,7 @@ impl LinuxJail {
411415
if let Ok(pid) = parts[1].parse::<u32>() {
412416
// Check if process still exists
413417
#[cfg(target_os = "linux")]
414-
let exists = unsafe { ::libc::kill(pid as i32, 0) == 0 };
418+
let exists = unsafe { libc::kill(pid as i32, 0) == 0 };
415419
#[cfg(not(target_os = "linux"))]
416420
let exists = false; // Assume process doesn't exist on non-Linux
417421

0 commit comments

Comments
 (0)