From 33249db1c0f20491947c92e092961171a7bd4f68 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Sat, 12 Aug 2017 16:49:08 +0100 Subject: Moved ptrace constants into enum types added minor functionality. Used the libc_enum! macro to create enums for the ptrace event, request, and libc_bitflags for options constants defined in libc. Also, replicated functionality to move from c_int to PtraceEvent enum in PR #728 as it appears to be abandoned. Added utility function for detaching from tracee. Updated names and removed ptrace::ptrace namespace --- test/sys/test_ptrace.rs | 3 +-- test/sys/test_wait.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs index 16b24110..20cde1aa 100644 --- a/test/sys/test_ptrace.rs +++ b/test/sys/test_ptrace.rs @@ -16,8 +16,7 @@ fn test_ptrace() { // Just make sure ptrace_setoptions can be called at all, for now. #[test] fn test_ptrace_setoptions() { - use nix::sys::ptrace::ptrace::PTRACE_O_TRACESYSGOOD; - let err = ptrace::setoptions(getpid(), PTRACE_O_TRACESYSGOOD).unwrap_err(); + let err = ptrace::setoptions(getpid(), ptrace::PTRACE_O_TRACESYSGOOD).unwrap_err(); assert!(err != Error::UnsupportedOperation); } diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs index 0193e262..0fcaa19c 100644 --- a/test/sys/test_wait.rs +++ b/test/sys/test_wait.rs @@ -55,7 +55,7 @@ fn test_waitstatus_pid() { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] mod ptrace { use nix::sys::ptrace; - use nix::sys::ptrace::ptrace::*; + use nix::sys::ptrace::*; use nix::sys::signal::*; use nix::sys::wait::*; use nix::unistd::*; @@ -81,7 +81,7 @@ mod ptrace { assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceSyscall(child))); // Then get the ptrace event for the process exiting assert!(ptrace::cont(child, None).is_ok()); - assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceEvent(child, SIGTRAP, PTRACE_EVENT_EXIT))); + assert_eq!(waitpid(child, None), Ok(WaitStatus::PtraceEvent(child, SIGTRAP, Event::PTRACE_EVENT_EXIT as i32))); // Finally get the normal wait() result, now that the process has exited assert!(ptrace::cont(child, None).is_ok()); assert_eq!(waitpid(child, None), Ok(WaitStatus::Exited(child, 0))); -- cgit v1.2.3