Skip to content

Commit a773b88

Browse files
bors[bot]dalance
andcommitted
Merge #892
892: Fixed ptrace::Request cfg conditions r=asomers a=dalance The cfg condition of ptrace::Request seems to be different from libc. For example, PTRACE_GETREGS is defined by libc to i686-unknown-linux-gnu target, but it is not defined in ptrace::Request. I tried to change the cfg condition to the same as libc's condition. I thinks this change covers the definitions under src/unix/notbsd directory in libc repository. Co-authored-by: dalance <[email protected]>
2 parents 1b80024 + 1dda866 commit a773b88

File tree

2 files changed

+54
-12
lines changed

2 files changed

+54
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4545
`request_code_write`, and `request_code_readwrite` respectively. These have also now been exposed
4646
in the documentation.
4747
([#833](https://github.com/nix-rust/nix/pull/833))
48+
- Enabled more `ptrace::Request` definitions for uncommon Linux platforms
49+
([#892](https://github.com/nix-rust/nix/pull/892))
4850

4951
### Fixed
5052
- Properly exposed 460800 and 921600 baud rates on NetBSD

src/sys/ptrace.rs

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,76 @@ libc_enum!{
3434
PTRACE_CONT,
3535
PTRACE_KILL,
3636
PTRACE_SINGLESTEP,
37-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64", target_arch = "s390x"), not(target_os = "android")))]
37+
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
38+
all(target_os = "linux", any(target_env = "musl",
39+
target_arch = "mips",
40+
target_arch = "mips64",
41+
target_arch = "s390x",
42+
target_arch = "x86_64",
43+
target_pointer_width = "32"))))]
3844
PTRACE_GETREGS,
39-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64", target_arch = "s390x"), not(target_os = "android")))]
45+
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
46+
all(target_os = "linux", any(target_env = "musl",
47+
target_arch = "mips",
48+
target_arch = "mips64",
49+
target_arch = "s390x",
50+
target_arch = "x86_64",
51+
target_pointer_width = "32"))))]
4052
PTRACE_SETREGS,
41-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64", target_arch = "s390x"), not(target_os = "android")))]
53+
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
54+
all(target_os = "linux", any(target_env = "musl",
55+
target_arch = "mips",
56+
target_arch = "mips64",
57+
target_arch = "s390x",
58+
target_arch = "x86_64",
59+
target_pointer_width = "32"))))]
4260
PTRACE_GETFPREGS,
43-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64", target_arch = "s390x"), not(target_os = "android")))]
61+
#[cfg(any(all(target_os = "android", target_pointer_width = "32"),
62+
all(target_os = "linux", any(target_env = "musl",
63+
target_arch = "mips",
64+
target_arch = "mips64",
65+
target_arch = "s390x",
66+
target_arch = "x86_64",
67+
target_pointer_width = "32"))))]
4468
PTRACE_SETFPREGS,
4569
PTRACE_ATTACH,
4670
PTRACE_DETACH,
47-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64"), not(target_os = "android")))]
71+
#[cfg(all(target_os = "linux", any(target_env = "musl",
72+
target_arch = "mips",
73+
target_arch = "mips64",
74+
target_arch = "arm",
75+
target_arch = "x86",
76+
target_arch = "x86_64")))]
4877
PTRACE_GETFPXREGS,
49-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64"), not(target_os = "android")))]
78+
#[cfg(all(target_os = "linux", any(target_env = "musl",
79+
target_arch = "mips",
80+
target_arch = "mips64",
81+
target_arch = "arm",
82+
target_arch = "x86",
83+
target_arch = "x86_64")))]
5084
PTRACE_SETFPXREGS,
5185
PTRACE_SYSCALL,
5286
PTRACE_SETOPTIONS,
5387
PTRACE_GETEVENTMSG,
5488
PTRACE_GETSIGINFO,
5589
PTRACE_SETSIGINFO,
56-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64", target_arch = "s390x"), not(target_os = "android")))]
90+
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
91+
target_arch = "mips64"))))]
5792
PTRACE_GETREGSET,
58-
#[cfg(all(any(target_env = "musl", target_arch ="x86_64", target_arch = "s390x"), not(target_os = "android")))]
93+
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
94+
target_arch = "mips64"))))]
5995
PTRACE_SETREGSET,
60-
#[cfg(not(any(target_os = "android", target_arch = "mips", target_arch = "mips64")))]
96+
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
97+
target_arch = "mips64"))))]
6198
PTRACE_SEIZE,
62-
#[cfg(not(any(target_os = "android", target_arch = "mips", target_arch = "mips64")))]
99+
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
100+
target_arch = "mips64"))))]
63101
PTRACE_INTERRUPT,
64-
#[cfg(not(any(target_os = "android", target_arch = "mips", target_arch = "mips64")))]
102+
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
103+
target_arch = "mips64"))))]
65104
PTRACE_LISTEN,
66-
#[cfg(not(any(target_os = "android", target_arch = "mips", target_arch = "mips64")))]
105+
#[cfg(all(target_os = "linux", not(any(target_arch = "mips",
106+
target_arch = "mips64"))))]
67107
PTRACE_PEEKSIGINFO,
68108
}
69109
}

0 commit comments

Comments
 (0)