File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ //! A wrapper around `rustix::fs::pivot_root`.
2+
3+ #[ cfg( all( target_os = "linux" , feature = "fs" , feature = "process" ) ) ]
4+ fn main ( ) -> rustix:: io:: Result < ( ) > {
5+ let mut args = std:: env:: args ( ) ;
6+ if args. len ( ) != 3 {
7+ eprintln ! ( "Usage: {} new_root put_old" , args. next( ) . unwrap( ) ) ;
8+ std:: process:: exit ( 1 ) ;
9+ }
10+
11+ let _argv0 = args. next ( ) . unwrap ( ) ;
12+ let new_root = args. next ( ) . unwrap ( ) ;
13+ let put_old = args. next ( ) . unwrap ( ) ;
14+
15+ rustix:: process:: pivot_root ( new_root, put_old) ?;
16+
17+ Ok ( ( ) )
18+ }
19+
20+ #[ cfg( any(
21+ not( target_os = "linux" ) ,
22+ not( feature = "fs" ) ,
23+ not( feature = "process" )
24+ ) ) ]
25+ fn main ( ) -> Result < ( ) , & ' static str > {
26+ Err ( "This example requires --features=fs,process and is only supported on Linux." )
27+ }
You can’t perform that action at this time.
0 commit comments