diff options
author | Vitaly _Vi Shukela <vi0oss@gmail.com> | 2020-09-10 23:04:35 +0300 |
---|---|---|
committer | Vitaly _Vi Shukela <vi0oss@gmail.com> | 2020-09-20 01:51:46 +0300 |
commit | 74cb1545f4d2249b6086c3f4aa242e43362759de (patch) | |
tree | d710ee4a9a9a40f69a3a03aa853ce4469ba448c4 /test/sys | |
parent | 2c2440521acb5942a5f937b8d3126577cf91106a (diff) | |
download | nix-74cb1545f4d2249b6086c3f4aa242e43362759de.zip |
Mark nix::unistd::fork as unsafe.
Fix tests. No change in documentation.
Resolves #1030.
Diffstat (limited to 'test/sys')
-rw-r--r-- | test/sys/test_ptrace.rs | 4 | ||||
-rw-r--r-- | test/sys/test_uio.rs | 2 | ||||
-rw-r--r-- | test/sys/test_wait.rs | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/test/sys/test_ptrace.rs b/test/sys/test_ptrace.rs index 46ea3d6a..3b60dd70 100644 --- a/test/sys/test_ptrace.rs +++ b/test/sys/test_ptrace.rs @@ -81,7 +81,7 @@ fn test_ptrace_cont() { return; } - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => { ptrace::traceme().unwrap(); // As recommended by ptrace(2), raise SIGTRAP to pause the child @@ -132,7 +132,7 @@ fn test_ptrace_syscall() { let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => { ptrace::traceme().unwrap(); // first sigstop until parent is ready to continue diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs index 236560f4..4fa838c9 100644 --- a/test/sys/test_uio.rs +++ b/test/sys/test_uio.rs @@ -212,7 +212,7 @@ fn test_process_vm_readv() { let mut vector = vec![1u8, 2, 3, 4, 5]; let (r, w) = pipe().unwrap(); - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Parent { child } => { close(w).unwrap(); // wait for child diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs index 53b7c84a..d1056250 100644 --- a/test/sys/test_wait.rs +++ b/test/sys/test_wait.rs @@ -11,7 +11,7 @@ fn test_wait_signal() { let _ = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); // Safe: The child only calls `pause` and/or `_exit`, which are async-signal-safe. - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => { pause(); unsafe { _exit(123) } @@ -28,7 +28,7 @@ fn test_wait_exit() { let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); // Safe: Child only calls `_exit`, which is async-signal-safe. - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => unsafe { _exit(12); }, Parent { child } => { assert_eq!(waitpid(child, None), Ok(WaitStatus::Exited(child, 12))); @@ -48,7 +48,7 @@ fn test_waitstatus_from_raw() { fn test_waitstatus_pid() { let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); - match fork().unwrap() { + match unsafe{fork()}.unwrap() { Child => unsafe { _exit(0) }, Parent { child } => { let status = waitpid(child, None).unwrap(); @@ -98,7 +98,7 @@ mod ptrace { require_capability!(CAP_SYS_PTRACE); let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test"); - match fork().expect("Error: Fork Failed") { + match unsafe{fork()}.expect("Error: Fork Failed") { Child => ptrace_child(), Parent { child } => ptrace_parent(child), } |