Skip to content

Commit bc30b21

Browse files
committed
Auto merge of #2574 - devnexen:fbsd_14_pt_coredump, r=Amanieu
ptrace_coredump ptrace query addition for FreeBSD 14.
2 parents 22ebc1f + d2e88fd commit bc30b21

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

libc-test/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,9 @@ fn test_freebsd(target: &str) {
21362136
true
21372137
}
21382138

2139+
// Added in FreeBSD 14.
2140+
"PT_COREDUMP" | "PC_ALL" | "PC_COMPRESS" if Some(14) > freebsd_ver => true,
2141+
21392142
_ => false,
21402143
}
21412144
});
@@ -2170,6 +2173,9 @@ fn test_freebsd(target: &str) {
21702173
// obsolete version
21712174
"vmtotal" if Some(11) == freebsd_ver => true,
21722175

2176+
// `ptrace_coredump` introduced in FreeBSD 14.
2177+
"ptrace_coredump" if Some(14) > freebsd_ver => true,
2178+
21732179
_ => false,
21742180
}
21752181
});

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ s! {
167167
pub sr_error: ::c_int,
168168
}
169169

170+
pub struct ptrace_coredump {
171+
pub pc_fd: ::c_int,
172+
pub pc_flags: u32,
173+
pub pc_limit: ::off_t,
174+
}
175+
170176
pub struct cpuset_t {
171177
#[cfg(target_pointer_width = "64")]
172178
__bits: [::c_long; 4],
@@ -1948,6 +1954,7 @@ pub const PT_GET_EVENT_MASK: ::c_int = 25;
19481954
pub const PT_SET_EVENT_MASK: ::c_int = 26;
19491955
pub const PT_GET_SC_ARGS: ::c_int = 27;
19501956
pub const PT_GET_SC_RET: ::c_int = 28;
1957+
pub const PT_COREDUMP: ::c_int = 29;
19511958
pub const PT_GETREGS: ::c_int = 33;
19521959
pub const PT_SETREGS: ::c_int = 34;
19531960
pub const PT_GETFPREGS: ::c_int = 35;
@@ -1967,6 +1974,9 @@ pub const PTRACE_LWP: ::c_int = 0x0010;
19671974
pub const PTRACE_VFORK: ::c_int = 0x0020;
19681975
pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC;
19691976

1977+
pub const PC_COMPRESS: u32 = 0x00000001;
1978+
pub const PC_ALL: u32 = 0x00000002;
1979+
19701980
pub const PROC_SPROTECT: ::c_int = 1;
19711981
pub const PROC_REAP_ACQUIRE: ::c_int = 2;
19721982
pub const PROC_REAP_RELEASE: ::c_int = 3;

0 commit comments

Comments
 (0)