crash_context/linux/getcontext.rs
1//! Implementation of [`getcontext`](https://man7.org/linux/man-pages/man3/getcontext.3.html)
2
3extern "C" {
4 /// A portable implementation of [`getcontext`](https://man7.org/linux/man-pages/man3/getcontext.3.html)
5 /// since it is not supported by all libc implementations, namely `musl`, as
6 /// it has been deprecated from POSIX for over a decade
7 ///
8 /// The implementation is ported from Breakpad, which is itself ported from
9 /// libunwind
10 #[cfg_attr(target_arch = "aarch64", allow(improper_ctypes))]
11 pub fn crash_context_getcontext(ctx: *mut super::ucontext_t) -> i32;
12}
13
14cfg_if::cfg_if! {
15 if #[cfg(target_arch = "x86_64")] {
16 mod x86_64;
17 } else if #[cfg(target_arch = "x86")] {
18 mod x86;
19 } else if #[cfg(target_arch = "aarch64")] {
20 mod aarch64;
21 } else if #[cfg(target_arch = "arm")] {
22 mod arm;
23 }
24}