diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/rust/crash-context/src/linux/getcontext.rs | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/crash-context/src/linux/getcontext.rs')
-rw-r--r-- | third_party/rust/crash-context/src/linux/getcontext.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/third_party/rust/crash-context/src/linux/getcontext.rs b/third_party/rust/crash-context/src/linux/getcontext.rs new file mode 100644 index 0000000000..93bb5fdaff --- /dev/null +++ b/third_party/rust/crash-context/src/linux/getcontext.rs @@ -0,0 +1,24 @@ +//! Implementation of [`getcontext`](https://man7.org/linux/man-pages/man3/getcontext.3.html) + +extern "C" { + /// A portable implementation of [`getcontext`](https://man7.org/linux/man-pages/man3/getcontext.3.html) + /// since it is not supported by all libc implementations, namely `musl`, as + /// it has been deprecated from POSIX for over a decade + /// + /// The implementation is ported from Breakpad, which is itself ported from + /// libunwind + #[cfg_attr(target_arch = "aarch64", allow(improper_ctypes))] + pub fn crash_context_getcontext(ctx: *mut super::ucontext_t) -> i32; +} + +cfg_if::cfg_if! { + if #[cfg(target_arch = "x86_64")] { + mod x86_64; + } else if #[cfg(target_arch = "x86")] { + mod x86; + } else if #[cfg(target_arch = "aarch64")] { + mod aarch64; + } else if #[cfg(target_arch = "arm")] { + mod arm; + } +} |