@@ -10,6 +10,7 @@ use hotplug::{AttachedDevice, HotPlug};
1010
1111use std:: fmt:: Display ;
1212use std:: fs:: File ;
13+ use std:: io:: { PipeWriter , Read } ;
1314use std:: mem:: ManuallyDrop ;
1415use std:: os:: unix:: process:: CommandExt ;
1516use std:: pin:: pin;
@@ -21,8 +22,6 @@ use clap::Parser;
2122use log:: info;
2223use runc:: Container ;
2324use runc:: cli:: { CreateOptions , GlobalOptions } ;
24- use rustix:: fd:: OwnedFd ;
25- use rustix:: pipe:: PipeFlags ;
2625use rustix:: process:: Signal ;
2726use tokio_stream:: StreamExt ;
2827
@@ -53,7 +52,7 @@ impl Display for Event {
5352 }
5453}
5554
56- async fn create ( global : GlobalOptions , create : CreateOptions , notifier : OwnedFd ) -> Result < ( ) > {
55+ async fn create ( global : GlobalOptions , create : CreateOptions , notifier : PipeWriter ) -> Result < ( ) > {
5756 let mut notifier = Some ( notifier) ;
5857
5958 let config = runc:: config:: Config :: from_bundle ( & create. bundle ) ?;
@@ -226,15 +225,15 @@ fn do_main() -> Result<()> {
226225 // However for early forking, we need to know whether a container is successfully created.
227226 // We do this by creating a pipe. The pipe can be closed by either the child process exiting,
228227 // or the child process closing it.
229- let ( parent, child) = rustix :: pipe :: pipe_with ( PipeFlags :: CLOEXEC ) ?;
228+ let ( mut parent, child) = std :: io :: pipe ( ) ?;
230229 match safe_fork:: fork ( ) . expect ( "should still be single-threaded" ) {
231230 None => {
232231 drop ( parent) ;
233232 tokio:: runtime:: Runtime :: new ( ) ?. block_on ( create ( args. global , create_options, child) ) ?;
234233 }
235234 Some ( pid) => {
236235 drop ( child) ;
237- if rustix :: io :: read ( parent , & mut [ 0 ] ) ? == 0 {
236+ if parent . read ( & mut [ 0 ] ) ? == 0 {
238237 // In this case, the child process exited before notifying us.
239238 std:: process:: exit ( pid. join ( ) ?. code ( ) . unwrap_or ( 1 ) as _ ) ;
240239 }
0 commit comments