Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no-std builds for MacOS and BSDs #647

Merged
merged 2 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/net/send_recv/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,12 @@ impl<'buf, 'slice, 'fd> SendAncillaryBuffer<'buf, 'slice, 'fd> {
self.length = new_length;

// Get the last header in the buffer.
let mut last_header = leap!(messages::Messages::new(buffer).last());
let last_header = leap!(messages::Messages::new(buffer).last());

// Set the header fields.
unsafe {
last_header.cmsg_len = c::CMSG_LEN(source_len) as _;
last_header.cmsg_level = cmsg_level;
last_header.cmsg_type = cmsg_type;
}
last_header.cmsg_len = unsafe { c::CMSG_LEN(source_len) } as _;
last_header.cmsg_level = cmsg_level;
last_header.cmsg_type = cmsg_type;

// Get the pointer to the payload and copy the data.
unsafe {
Expand Down
3 changes: 2 additions & 1 deletion src/process/procctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#![allow(unsafe_code)]

use alloc::vec::Vec;
use core::mem::MaybeUninit;
use core::ptr;

Expand Down Expand Up @@ -329,7 +330,7 @@ pub fn get_reaper_pids(process: ProcSelector) -> io::Result<Vec<PidInfo>> {
// Sadly no better way to guarantee that we get all the results than to
// allocate ~8MB of memory..
const PID_MAX: usize = 99999;
let mut pids: Vec<procctl_reaper_pidinfo> = vec![Default::default(); PID_MAX];
let mut pids: Vec<procctl_reaper_pidinfo> = alloc::vec![Default::default(); PID_MAX];
let mut pinfo = procctl_reaper_pids {
rp_count: PID_MAX as _,
rp_pad0: [0; 15],
Expand Down
2 changes: 1 addition & 1 deletion src/process/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ pub enum WaitId<'a> {
/// Eat the lifetime for non-Linux platforms.
#[doc(hidden)]
#[cfg(not(target_os = "linux"))]
__EatLifetime(std::marker::PhantomData<&'a ()>),
__EatLifetime(core::marker::PhantomData<&'a ()>),
// TODO(notgull): Once this crate has the concept of PGIDs, add a WaitId::Pgid
}

Expand Down