@@ -881,12 +881,12 @@ pub fn execveat(dirfd: RawFd, pathname: &CStr, args: &[&CStr],
881881/// descriptors will remain identical after daemonizing.
882882/// * `noclose = false`: The process' stdin, stdout, and stderr will point to
883883/// `/dev/null` after daemonizing.
884- #[ cfg_attr ( any( target_os = "macos" , target_os = "ios" ) , deprecated (
885- since= "0.14.0 ",
886- note= "Deprecated in MacOSX 10.5"
887- ) ) ]
888- # [ cfg_attr ( any ( target_os = "macos" , target_os = "ios" ) , allow ( deprecated ) ) ]
889- # [ cfg ( not ( target_os = "redox " ) ) ]
884+ #[ cfg ( any( target_os = "android" ,
885+ target_os = "dragonfly ",
886+ target_os = "freebsd" ,
887+ target_os = "linux" ,
888+ target_os = "netbsd" ,
889+ target_os = "openbsd " ) ) ]
890890pub fn daemon ( nochdir : bool , noclose : bool ) -> Result < ( ) > {
891891 let res = unsafe { libc:: daemon ( nochdir as c_int , noclose as c_int ) } ;
892892 Errno :: result ( res) . map ( drop)
@@ -1097,60 +1097,6 @@ pub fn pipe2(flags: OFlag) -> Result<(RawFd, RawFd)> {
10971097 unsafe { Ok ( ( fds. assume_init ( ) [ 0 ] , fds. assume_init ( ) [ 1 ] ) ) }
10981098}
10991099
1100- /// Like `pipe`, but allows setting certain file descriptor flags.
1101- ///
1102- /// The following flags are supported, and will be set after the pipe is
1103- /// created:
1104- ///
1105- /// `O_CLOEXEC`: Set the close-on-exec flag for the new file descriptors.
1106- /// `O_NONBLOCK`: Set the non-blocking flag for the ends of the pipe.
1107- #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
1108- #[ deprecated(
1109- since="0.10.0" ,
1110- note="pipe2(2) is not actually atomic on these platforms. Use pipe(2) and fcntl(2) instead"
1111- ) ]
1112- pub fn pipe2 ( flags : OFlag ) -> Result < ( RawFd , RawFd ) > {
1113- let mut fds = mem:: MaybeUninit :: < [ c_int ; 2 ] > :: uninit ( ) ;
1114-
1115- let res = unsafe { libc:: pipe ( fds. as_mut_ptr ( ) as * mut c_int ) } ;
1116-
1117- Errno :: result ( res) ?;
1118-
1119- unsafe {
1120- pipe2_setflags ( fds. assume_init ( ) [ 0 ] , fds. assume_init ( ) [ 1 ] , flags) ?;
1121-
1122- Ok ( ( fds. assume_init ( ) [ 0 ] , fds. assume_init ( ) [ 1 ] ) )
1123- }
1124- }
1125-
1126- #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
1127- fn pipe2_setflags ( fd1 : RawFd , fd2 : RawFd , flags : OFlag ) -> Result < ( ) > {
1128- use crate :: fcntl:: FcntlArg :: F_SETFL ;
1129-
1130- let mut res = Ok ( 0 ) ;
1131-
1132- if flags. contains ( OFlag :: O_CLOEXEC ) {
1133- res = res
1134- . and_then ( |_| fcntl ( fd1, F_SETFD ( FdFlag :: FD_CLOEXEC ) ) )
1135- . and_then ( |_| fcntl ( fd2, F_SETFD ( FdFlag :: FD_CLOEXEC ) ) ) ;
1136- }
1137-
1138- if flags. contains ( OFlag :: O_NONBLOCK ) {
1139- res = res
1140- . and_then ( |_| fcntl ( fd1, F_SETFL ( OFlag :: O_NONBLOCK ) ) )
1141- . and_then ( |_| fcntl ( fd2, F_SETFL ( OFlag :: O_NONBLOCK ) ) ) ;
1142- }
1143-
1144- match res {
1145- Ok ( _) => Ok ( ( ) ) ,
1146- Err ( e) => {
1147- let _ = close ( fd1) ;
1148- let _ = close ( fd2) ;
1149- Err ( e)
1150- }
1151- }
1152- }
1153-
11541100/// Truncate a file to a specified length
11551101///
11561102/// See also
0 commit comments