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