Skip to content

Commit

Permalink
disable close_range and TTY detection on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
squell committed Jan 22, 2025
1 parent 9279ab6 commit 317c7a3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn close_range(min_fd: c_uint, max_fd: c_uint) -> io::Result<()> {
// - any errors while closing a specific fd will be effectively ignored
// - if the provided range or flags are invalid, that will be reported
// as an error but will not cause undefined behaviour
cerr(unsafe { libc::close_range(min_fd, max_fd, 0) })?;
//cerr(unsafe { libc::close_range(min_fd, max_fd, 0) })?;
}

Ok(())
Expand Down Expand Up @@ -738,6 +738,13 @@ impl Process {
}
}

/// Returns the device identifier of the TTY device that is currently
/// attached to the given process
#[cfg(target_os = "macos")]
pub fn tty_device_id(pid: WithProcess) -> std::io::Result<Option<DeviceId>> {

Check warning on line 744 in src/system/mod.rs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

unused variable: `pid`

Check warning on line 744 in src/system/mod.rs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

unused variable: `pid`
Ok(None)
}

/// Get the process starting time of a specific process
#[cfg(target_os = "linux")]
pub fn starting_time(pid: WithProcess) -> io::Result<SystemTime> {
Expand Down Expand Up @@ -812,6 +819,12 @@ impl Process {
let ki_start = ki_proc[0].ki_start;
Ok(SystemTime::new(ki_start.tv_sec, ki_start.tv_usec * 1000))
}

/// Get the process starting time of a specific process
#[cfg(target_os = "macos")]
pub fn starting_time(pid: WithProcess) -> io::Result<SystemTime> {

Check warning on line 825 in src/system/mod.rs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

unused variable: `pid`

Check warning on line 825 in src/system/mod.rs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

unused variable: `pid`
SystemTime::now()
}
}

/// Read the n-th field (with 0-based indexing) from `/proc/<pid>/self`.
Expand Down

0 comments on commit 317c7a3

Please sign in to comment.