@@ -56,6 +56,7 @@ use crate::mem::ManuallyDrop;
5656use crate :: net:: TcpStream ;
5757use crate :: os:: unix:: fs:: FileTypeExt ;
5858use crate :: os:: unix:: io:: { AsRawFd , FromRawFd , RawFd } ;
59+ use crate :: os:: unix:: net:: UnixStream ;
5960use crate :: process:: { ChildStderr , ChildStdin , ChildStdout } ;
6061use crate :: ptr;
6162use crate :: sync:: atomic:: { AtomicBool , Ordering } ;
@@ -320,6 +321,34 @@ impl CopyWrite for &TcpStream {
320321 }
321322}
322323
324+ impl CopyRead for UnixStream {
325+ fn properties ( & self ) -> CopyParams {
326+ // avoid the stat syscall since we can be fairly sure it's a socket
327+ CopyParams ( FdMeta :: Socket , Some ( self . as_raw_fd ( ) ) )
328+ }
329+ }
330+
331+ impl CopyRead for & UnixStream {
332+ fn properties ( & self ) -> CopyParams {
333+ // avoid the stat syscall since we can be fairly sure it's a socket
334+ CopyParams ( FdMeta :: Socket , Some ( self . as_raw_fd ( ) ) )
335+ }
336+ }
337+
338+ impl CopyWrite for UnixStream {
339+ fn properties ( & self ) -> CopyParams {
340+ // avoid the stat syscall since we can be fairly sure it's a socket
341+ CopyParams ( FdMeta :: Socket , Some ( self . as_raw_fd ( ) ) )
342+ }
343+ }
344+
345+ impl CopyWrite for & UnixStream {
346+ fn properties ( & self ) -> CopyParams {
347+ // avoid the stat syscall since we can be fairly sure it's a socket
348+ CopyParams ( FdMeta :: Socket , Some ( self . as_raw_fd ( ) ) )
349+ }
350+ }
351+
323352impl CopyWrite for ChildStdin {
324353 fn properties ( & self ) -> CopyParams {
325354 CopyParams ( FdMeta :: Pipe , Some ( self . as_raw_fd ( ) ) )
0 commit comments