@@ -5,52 +5,44 @@ use core::{
55 marker:: PhantomData ,
66 ops:: IndexMut ,
77} ;
8- #[ cfg( unix) ]
9- use std:: os:: unix:: ffi:: OsStrExt ;
10- #[ cfg( all( feature = "std" , target_os = "linux" ) ) ]
8+ #[ cfg( target_os = "linux" ) ]
119use std:: {
1210 ffi:: { CStr , CString } ,
1311 os:: fd:: AsRawFd ,
1412} ;
15- #[ cfg( feature = "std" ) ]
1613use std:: {
1714 ffi:: { OsStr , OsString } ,
1815 io:: { Read , Write } ,
16+ os:: unix:: ffi:: OsStrExt ,
1917 path:: { Path , PathBuf } ,
20- process:: Child ,
21- process:: { Command , Stdio } ,
18+ process:: { Child , Command , Stdio } ,
2219 time:: Duration ,
2320} ;
2421
25- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
22+ #[ cfg( target_os = "linux" ) ]
2623use libafl_bolts:: core_affinity:: CoreId ;
2724use libafl_bolts:: {
2825 fs:: { get_unique_std_input_file, InputFile } ,
2926 tuples:: { Handle , MatchName , RefIndexable } ,
3027 AsSlice ,
3128} ;
32- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
29+ #[ cfg( target_os = "linux" ) ]
3330use libc:: STDIN_FILENO ;
34- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
31+ #[ cfg( target_os = "linux" ) ]
3532use nix:: unistd:: Pid ;
36- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
33+ #[ cfg( target_os = "linux" ) ]
3734use typed_builder:: TypedBuilder ;
3835
3936use super :: HasTimeout ;
40- #[ cfg( all( feature = "std" , unix) ) ]
41- use crate :: executors:: Executor ;
42- #[ cfg( all( feature = "std" , any( unix, doc) ) ) ]
43- use crate :: executors:: ExitKind ;
4437use crate :: {
4538 corpus:: Corpus ,
46- executors:: { hooks:: ExecutorHooksTuple , HasObservers } ,
47- inputs:: { HasTargetBytes , UsesInput } ,
39+ executors:: { hooks:: ExecutorHooksTuple , Executor , ExitKind , HasObservers } ,
40+ inputs:: { HasTargetBytes , Input , UsesInput } ,
4841 observers:: { ObserversTuple , StdErrObserver , StdOutObserver } ,
4942 state:: { HasCorpus , HasExecutions , State , UsesState } ,
5043 std:: borrow:: ToOwned ,
44+ Error ,
5145} ;
52- #[ cfg( feature = "std" ) ]
53- use crate :: { inputs:: Input , Error } ;
5446
5547/// How to deliver input to an external program
5648/// `StdIn`: The target reads from stdin
@@ -178,7 +170,7 @@ where
178170///
179171/// This configurator was primarly developed to be used in conjunction with
180172/// [`crate::executors::hooks::intel_pt::IntelPTHook`]
181- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
173+ #[ cfg( target_os = "linux" ) ]
182174#[ derive( Debug , Clone , PartialEq , Eq , TypedBuilder ) ]
183175pub struct PTraceCommandConfigurator {
184176 #[ builder( setter( into) ) ]
@@ -195,7 +187,7 @@ pub struct PTraceCommandConfigurator {
195187 timeout : u32 ,
196188}
197189
198- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
190+ #[ cfg( target_os = "linux" ) ]
199191impl < I > CommandConfigurator < I , Pid > for PTraceCommandConfigurator
200192where
201193 I : HasTargetBytes ,
@@ -331,7 +323,6 @@ where
331323}
332324
333325// this only works on unix because of the reliance on checking the process signal for detecting OOM
334- #[ cfg( all( feature = "std" , unix) ) ]
335326impl < I , OT , S , T > CommandExecutor < OT , S , T >
336327where
337328 S : State + HasExecutions + UsesInput < Input = I > ,
@@ -388,7 +379,6 @@ where
388379 }
389380}
390381
391- #[ cfg( all( feature = "std" , unix) ) ]
392382impl < EM , OT , S , T , Z > Executor < EM , Z > for CommandExecutor < OT , S , T >
393383where
394384 EM : UsesState < State = S > ,
@@ -425,7 +415,7 @@ where
425415 }
426416}
427417
428- #[ cfg( all ( feature = "std" , target_os = "linux" ) ) ]
418+ #[ cfg( target_os = "linux" ) ]
429419impl < EM , OT , S , T , Z , HT > Executor < EM , Z > for CommandExecutor < OT , S , T , HT , Pid >
430420where
431421 EM : UsesState < State = S > ,
@@ -759,8 +749,7 @@ impl CommandExecutorBuilder {
759749
760750/// A `CommandConfigurator` takes care of creating and spawning a [`Command`] for the [`CommandExecutor`].
761751/// # Example
762- #[ cfg_attr( all( feature = "std" , unix) , doc = " ```" ) ]
763- #[ cfg_attr( not( all( feature = "std" , unix) ) , doc = " ```ignore" ) ]
752+ /// ```
764753/// use std::{io::Write, process::{Stdio, Command, Child}, time::Duration};
765754/// use libafl::{Error, inputs::{BytesInput, HasTargetBytes, Input, UsesInput}, executors::{Executor, command::CommandConfigurator}, state::{UsesState, HasExecutions}};
766755/// use libafl_bolts::AsSlice;
@@ -801,7 +790,6 @@ impl CommandExecutorBuilder {
801790/// MyExecutor.into_executor(())
802791/// }
803792/// ```
804- #[ cfg( all( feature = "std" , unix) ) ]
805793pub trait CommandConfigurator < I , C = Child > : Sized {
806794 /// Get the stdout
807795 fn stdout_observer ( & self ) -> Option < Handle < StdOutObserver > > {
@@ -882,7 +870,6 @@ mod tests {
882870 } ;
883871
884872 #[ test]
885- #[ cfg( unix) ]
886873 #[ cfg_attr( miri, ignore) ]
887874 fn test_builder ( ) {
888875 let mut mgr = SimpleEventManager :: new ( SimpleMonitor :: new ( |status| {
0 commit comments