Skip to content

Commit ea099dd

Browse files
bors[bot]asomers
andauthored
Merge #1255
1255: Remove several deprecated constants and functions r=asomers a=asomers * `unistd::daemon` on Apple * `unistd::pipe2` on Apple * `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple * `sys::event::FilterFlag::NOTE_REAP` on Apple * `sys::ptrace::ptrace` on Android and Linux All have been deprecated for more than two releases and one year. Co-authored-by: Alan Somers <asomers@gmail.com>
2 parents b71059f + d080785 commit ea099dd

File tree

5 files changed

+24
-85
lines changed

5 files changed

+24
-85
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7575
optional arguments.
7676
(#[1242](https://github.com/nix-rust/nix/pull/1242))
7777

78+
- Removed `unistd::daemon` and `unistd::pipe2` on OSX and ios
79+
(#[1255](https://github.com/nix-rust/nix/pull/1255))
80+
81+
- Removed `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` and
82+
`sys::event::FilterFlag::NOTE_REAP` on OSX and ios.
83+
(#[1255](https://github.com/nix-rust/nix/pull/1255))
84+
85+
- Removed `sys::ptrace::ptrace` on Android and Linux.
86+
(#[1255](https://github.com/nix-rust/nix/pull/1255))
87+
7888
## [0.17.0] - 3 February 2020
7989
### Added
8090
- Add `CLK_TCK` to `SysconfVar`

src/sys/event.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ libc_bitflags!(
128128
NOTE_EXEC;
129129
NOTE_EXIT;
130130
#[cfg(any(target_os = "macos", target_os = "ios"))]
131-
#[deprecated( since="0.14.0", note="Deprecated since OSX 10.9")]
132-
#[allow(deprecated)]
133-
NOTE_EXIT_REPARENTED;
134-
#[cfg(any(target_os = "macos", target_os = "ios"))]
135131
NOTE_EXITSTATUS;
136132
NOTE_EXTEND;
137133
#[cfg(any(target_os = "macos",
@@ -177,11 +173,6 @@ libc_bitflags!(
177173
NOTE_OOB;
178174
NOTE_PCTRLMASK;
179175
NOTE_PDATAMASK;
180-
#[cfg(any(target_os = "macos", target_os = "ios"))]
181-
#[cfg(any(target_os = "macos", target_os = "ios"))]
182-
#[deprecated( since="0.14.0", note="Deprecated since OSX 10.9")]
183-
#[allow(deprecated)]
184-
NOTE_REAP;
185176
NOTE_RENAME;
186177
NOTE_REVOKE;
187178
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]

src/sys/ptrace/linux.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,6 @@ libc_bitflags! {
168168
}
169169
}
170170

171-
/// Performs a ptrace request. If the request in question is provided by a specialised function
172-
/// this function will return an unsupported operation error.
173-
#[deprecated(
174-
since="0.10.0",
175-
note="usages of `ptrace()` should be replaced with the specialized helper functions instead"
176-
)]
177-
pub unsafe fn ptrace(request: Request, pid: Pid, addr: AddressType, data: *mut c_void) -> Result<c_long> {
178-
use self::Request::*;
179-
match request {
180-
PTRACE_PEEKTEXT | PTRACE_PEEKDATA | PTRACE_GETSIGINFO |
181-
PTRACE_GETEVENTMSG | PTRACE_SETSIGINFO | PTRACE_SETOPTIONS |
182-
PTRACE_POKETEXT | PTRACE_POKEDATA | PTRACE_KILL => Err(Error::UnsupportedOperation),
183-
_ => ptrace_other(request, pid, addr, data)
184-
}
185-
}
186-
187171
fn ptrace_peek(request: Request, pid: Pid, addr: AddressType, data: *mut c_void) -> Result<c_long> {
188172
let ret = unsafe {
189173
Errno::clear();

src/unistd.rs

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -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"))]
890890
pub 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

test/test_unistd.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,14 @@ fn test_pipe() {
579579

580580
// pipe2(2) is the same as pipe(2), except it allows setting some flags. Check
581581
// that we can set a flag.
582+
#[cfg(any(target_os = "android",
583+
target_os = "dragonfly",
584+
target_os = "emscripten",
585+
target_os = "freebsd",
586+
target_os = "linux",
587+
target_os = "netbsd",
588+
target_os = "openbsd",
589+
target_os = "redox"))]
582590
#[test]
583591
fn test_pipe2() {
584592
let (fd0, fd1) = pipe2(OFlag::O_CLOEXEC).unwrap();

0 commit comments

Comments
 (0)