Source code

Revision control

Copy as Markdown

Other Tools

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
use crash_helper_common::{messages::ChildProcessRendezVousReply, GeckoChildId, Pid};
use nix::libc::{prctl, PR_SET_PTRACER};
use std::process;
use crate::CrashHelperClient;
impl CrashHelperClient {
pub(crate) fn prepare_for_minidump(
crash_helper_pid: Pid,
id: GeckoChildId,
) -> ChildProcessRendezVousReply {
// SAFETY: Calling `prctl()` is always safe, no pointers are involved.
let res = unsafe { prctl(PR_SET_PTRACER, crash_helper_pid) };
ChildProcessRendezVousReply::new(/* dumpable */ res >= 0, process::id() as Pid, id, [])
}
}