fix windows build
This commit is contained in:
parent
fde48be53e
commit
909d0f8574
@ -65,8 +65,8 @@ use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "std")]
|
||||
use std::{
|
||||
env, fs,
|
||||
net::SocketAddr,
|
||||
io::{Read, Write},
|
||||
mem::zeroed,
|
||||
net::{TcpListener, TcpStream},
|
||||
thread,
|
||||
};
|
||||
@ -74,6 +74,7 @@ use std::{
|
||||
#[cfg(all(feature = "std", unix))]
|
||||
use nix::{
|
||||
cmsg_space,
|
||||
mem::zeroed,
|
||||
sys::{
|
||||
socket::{recvmsg, sendmsg, ControlMessage, ControlMessageOwned, MsgFlags},
|
||||
uio::IoVec,
|
||||
@ -136,13 +137,15 @@ pub type Tag = u32;
|
||||
#[cfg(feature = "std")]
|
||||
pub enum Listener {
|
||||
Tcp(TcpListener),
|
||||
#[cfg(unix)]
|
||||
Unix(UnixListener),
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub enum ListenerStream {
|
||||
Tcp(TcpStream, std::net::SocketAddr),
|
||||
Unix(UnixStream, std::os::unix::net::SocketAddr),
|
||||
Tcp(TcpStream, SocketAddr),
|
||||
#[cfg(unix)]
|
||||
Unix(UnixStream, unix::net::SocketAddr),
|
||||
Empty(),
|
||||
}
|
||||
|
||||
@ -157,6 +160,7 @@ impl Listener {
|
||||
ListenerStream::Empty()
|
||||
}
|
||||
},
|
||||
#[cfg(unix)]
|
||||
Listener::Unix(inner) => match inner.accept() {
|
||||
Ok(res) => ListenerStream::Unix(res.0, res.1),
|
||||
Err(err) => {
|
||||
@ -1486,6 +1490,7 @@ where
|
||||
};
|
||||
}
|
||||
}
|
||||
#[cfg(unix)]
|
||||
ListenerStream::Unix(stream, addr) => unsafe {
|
||||
dbg!("New connection", addr);
|
||||
|
||||
|
@ -7,7 +7,7 @@ pub use unix_shmem::UnixShMem;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(windows)]
|
||||
pub use unix_shmem::Win32ShMem;
|
||||
pub use shmem::Win32ShMem;
|
||||
|
||||
use alloc::string::{String, ToString};
|
||||
use core::fmt::Debug;
|
||||
@ -105,8 +105,7 @@ pub trait HasFd {
|
||||
fn shm_id(&self) -> i32;
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(unix, feature = "std"))]
|
||||
pub mod unix_shmem {
|
||||
|
||||
use core::{mem::size_of, ptr, slice};
|
||||
@ -446,21 +445,16 @@ pub mod unix_shmem {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(all(feature = "std", windows))]
|
||||
pub mod shmem {
|
||||
|
||||
use core::{mem::size_of, slice};
|
||||
use std::ffi::CStr;
|
||||
|
||||
use super::ShMem;
|
||||
use crate::Error;
|
||||
//TODO use super::ShMem;
|
||||
|
||||
/// The default Sharedmap impl for windows using shmctl & shmget
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Win32ShMem {
|
||||
pub filename: [u8; 64],
|
||||
pub handle: windows::win32::system_services::HANDLE,
|
||||
//TODO pub handle: windows::win32::system_services::HANDLE,
|
||||
pub map: *mut u8,
|
||||
pub map_size: usize,
|
||||
}
|
||||
|
@ -514,15 +514,17 @@ where
|
||||
|
||||
// We start ourself as child process to actually fuzz
|
||||
if std::env::var(_ENV_FUZZER_SENDER).is_err() {
|
||||
let path = std::env::current_dir()?;
|
||||
mgr = if cfg!(target_os = "android") {
|
||||
LlmpEventManager::<I, S, SH, ST>::new_on_domain_socket(
|
||||
stats,
|
||||
&format!("{}/.llmp_socket", path.display()).to_string(),
|
||||
)?
|
||||
} else {
|
||||
LlmpEventManager::<I, S, SH, ST>::new_on_port(stats, broker_port)?
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
let path = std::env::current_dir()?;
|
||||
mgr = LlmpEventManager::<I, S, SH, ST>::new_on_domain_socket(
|
||||
stats,
|
||||
&format!("{}/.llmp_socket", path.display()).to_string(),
|
||||
)?;
|
||||
};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
{mgr = LlmpEventManager::<I, S, SH, ST>::new_on_port(stats, broker_port)?};
|
||||
|
||||
if mgr.is_broker() {
|
||||
// Yep, broker. Just loop here.
|
||||
|
Loading…
x
Reference in New Issue
Block a user