1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_SandboxReporterClient_h
8 #define mozilla_SandboxReporterClient_h
10 #include "reporter/SandboxReporterCommon.h"
14 // This class is instantiated in child processes in Sandbox.cpp to
15 // send reports from the SIGSYS handler to the SandboxReporter
16 // instance in the parent.
17 class SandboxReporterClient
{
19 // Note: this does not take ownership of the file descriptor; if
20 // it's not kSandboxReporterFileDesc (e.g., for unit testing), the
21 // caller will need to close it to avoid leaks.
22 SandboxReporterClient(SandboxReport::ProcType aProcType
, int aFd
);
24 // This constructor uses the default fd (kSandboxReporterFileDesc)
25 // for a sandboxed child process.
26 explicit SandboxReporterClient(SandboxReport::ProcType aProcType
);
28 // Constructs a report from a signal context (the ucontext_t* passed
29 // as void* to an sa_sigaction handler); uses the caller's pid and tid.
30 SandboxReport
MakeReport(const void* aContext
);
32 void SendReport(const SandboxReport
& aReport
);
34 SandboxReport
MakeReportAndSend(const void* aContext
) {
35 SandboxReport report
= MakeReport(aContext
);
41 SandboxReport::ProcType mProcType
;
45 } // namespace mozilla
47 #endif // mozilla_SandboxReporterClient_h