[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- UnixSignals.cpp ---------------------------------------------------===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-02-19 02:52:47 +08:00
|
|
|
#include "lldb/Target/UnixSignals.h"
|
2015-07-14 09:09:28 +08:00
|
|
|
#include "Plugins/Process/Utility/FreeBSDSignals.h"
|
|
|
|
#include "Plugins/Process/Utility/LinuxSignals.h"
|
|
|
|
#include "Plugins/Process/Utility/MipsLinuxSignals.h"
|
2015-12-15 08:50:19 +08:00
|
|
|
#include "Plugins/Process/Utility/NetBSDSignals.h"
|
2019-03-07 02:20:23 +08:00
|
|
|
#include "lldb/Host/HostInfo.h"
|
2017-11-14 00:16:33 +08:00
|
|
|
#include "lldb/Utility/ArchSpec.h"
|
2015-07-14 09:09:28 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb_private;
|
2021-10-28 09:33:17 +08:00
|
|
|
using namespace llvm;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-02-19 02:52:47 +08:00
|
|
|
UnixSignals::Signal::Signal(const char *name, bool default_suppress,
|
|
|
|
bool default_stop, bool default_notify,
|
|
|
|
const char *description, const char *alias)
|
2010-10-15 10:39:01 +08:00
|
|
|
: m_name(name), m_alias(alias), m_description(),
|
|
|
|
m_suppress(default_suppress), m_stop(default_stop),
|
2015-10-20 17:21:04 +08:00
|
|
|
m_notify(default_notify) {
|
2010-10-15 10:39:01 +08:00
|
|
|
if (description)
|
|
|
|
m_description.assign(description);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2015-07-14 09:09:28 +08:00
|
|
|
lldb::UnixSignalsSP UnixSignals::Create(const ArchSpec &arch) {
|
|
|
|
const auto &triple = arch.GetTriple();
|
|
|
|
switch (triple.getOS()) {
|
|
|
|
case llvm::Triple::Linux: {
|
|
|
|
switch (triple.getArch()) {
|
|
|
|
case llvm::Triple::mips:
|
|
|
|
case llvm::Triple::mipsel:
|
|
|
|
case llvm::Triple::mips64:
|
|
|
|
case llvm::Triple::mips64el:
|
|
|
|
return std::make_shared<MipsLinuxSignals>();
|
|
|
|
default:
|
|
|
|
return std::make_shared<LinuxSignals>();
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-07-14 09:09:28 +08:00
|
|
|
case llvm::Triple::FreeBSD:
|
|
|
|
case llvm::Triple::OpenBSD:
|
|
|
|
return std::make_shared<FreeBSDSignals>();
|
2015-12-15 08:50:19 +08:00
|
|
|
case llvm::Triple::NetBSD:
|
|
|
|
return std::make_shared<NetBSDSignals>();
|
2016-09-07 04:57:50 +08:00
|
|
|
default:
|
2015-07-14 09:09:28 +08:00
|
|
|
return std::make_shared<UnixSignals>();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-07-14 09:09:28 +08:00
|
|
|
}
|
|
|
|
|
2019-03-07 02:20:23 +08:00
|
|
|
lldb::UnixSignalsSP UnixSignals::CreateForHost() {
|
|
|
|
static lldb::UnixSignalsSP s_unix_signals_sp =
|
|
|
|
Create(HostInfo::GetArchitecture());
|
|
|
|
return s_unix_signals_sp;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
// UnixSignals constructor
|
|
|
|
UnixSignals::UnixSignals() { Reset(); }
|
|
|
|
|
2015-07-14 09:09:28 +08:00
|
|
|
UnixSignals::UnixSignals(const UnixSignals &rhs) : m_signals(rhs.m_signals) {}
|
|
|
|
|
2016-02-19 02:52:47 +08:00
|
|
|
UnixSignals::~UnixSignals() = default;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
void UnixSignals::Reset() {
|
2020-10-07 14:33:04 +08:00
|
|
|
// This builds one standard set of Unix Signals. If yours aren't quite in
|
2018-05-01 00:49:04 +08:00
|
|
|
// this order, you can either subclass this class, and use Add & Remove to
|
2020-10-07 14:33:04 +08:00
|
|
|
// change them or you can subclass and build them afresh in your constructor.
|
[NFC] Darwin llgs support from Week of Code
This code represents the Week of Code work I did on bringing up
lldb-server LLGS support for Darwin. It does not include the
Xcode project changes needed, as we don't want to throw that switch
until more support is implemented (i.e. this change is inert, no
build systems use it yet. I've verified on Ubuntu 16.04, macOS
Xcode and macOS cmake builds).
This change does some minimal refactoring of code that is shared
with the Linux LLGS portion, moving it from NativeProcessLinux into
NativeProcessProtocol. That code is also used by NativeProcessDarwin.
Current state on Darwin:
* Process launching is implemented. (Attach is not).
Launching on devices has not yet been tested (FBS/BKS might
need a bit of work).
* Inferior waitpid monitoring and communication of exit status
via MainLoop callback is implemented.
* Memory read/write, breakpoints, thread register context, etc.
are not yet implemented. This impacts process stop/resume, as
the initial launch suspended immediately starts the process
up and running because it doesn't know it is supposed to remain
stopped.
* I implemented the equivalent of MachThreadList as
NativeThreadListDarwin, in anticipation that we might want to
factor out common parts into NativeThreadList{Protocol} and share
some code here. After writing it, though, the fallout from merging
Mach Task/Process into a single concept plus some other minor
changes makes the whole NativeThreadListDarwin concept nothing more
than dead weight. I am likely going to get rid of this class and
just manage it directly in NativeProcessDarwin, much like I did
for NativeProcessLinux.
* There is a stub-out call for starting a STDIO thread. That will
go away and adopt the MainLoop pselect-based IOObject reading.
I am developing the fully-integrated changes in the following repo,
which contains the necessary Xcode bits and the glue that enables
lldb-debugserver on a macOS system:
https://github.com/tfiala/lldb/tree/llgs-darwin
This change also breaks out a few of the lldb-server tests into
their own directory, and adds some $qHostInfo tests (not sure why
I didn't write those tests back when I initially implemented that
on the Linux side).
llvm-svn: 280604
2016-09-04 08:18:56 +08:00
|
|
|
//
|
2020-10-07 14:33:04 +08:00
|
|
|
// Note: the signals below are the Darwin signals. Do not change these!
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
m_signals.clear();
|
2020-10-07 14:33:04 +08:00
|
|
|
|
|
|
|
// clang-format off
|
2020-10-09 11:01:21 +08:00
|
|
|
// SIGNO NAME SUPPRESS STOP NOTIFY DESCRIPTION
|
|
|
|
// ====== ============== ======== ====== ====== ===================================================
|
|
|
|
AddSignal(1, "SIGHUP", false, true, true, "hangup");
|
|
|
|
AddSignal(2, "SIGINT", true, true, true, "interrupt");
|
|
|
|
AddSignal(3, "SIGQUIT", false, true, true, "quit");
|
|
|
|
AddSignal(4, "SIGILL", false, true, true, "illegal instruction");
|
|
|
|
AddSignal(5, "SIGTRAP", true, true, true, "trace trap (not reset when caught)");
|
|
|
|
AddSignal(6, "SIGABRT", false, true, true, "abort()");
|
|
|
|
AddSignal(7, "SIGEMT", false, true, true, "pollable event");
|
|
|
|
AddSignal(8, "SIGFPE", false, true, true, "floating point exception");
|
|
|
|
AddSignal(9, "SIGKILL", false, true, true, "kill");
|
|
|
|
AddSignal(10, "SIGBUS", false, true, true, "bus error");
|
|
|
|
AddSignal(11, "SIGSEGV", false, true, true, "segmentation violation");
|
|
|
|
AddSignal(12, "SIGSYS", false, true, true, "bad argument to system call");
|
|
|
|
AddSignal(13, "SIGPIPE", false, false, false, "write on a pipe with no one to read it");
|
|
|
|
AddSignal(14, "SIGALRM", false, false, false, "alarm clock");
|
|
|
|
AddSignal(15, "SIGTERM", false, true, true, "software termination signal from kill");
|
|
|
|
AddSignal(16, "SIGURG", false, false, false, "urgent condition on IO channel");
|
|
|
|
AddSignal(17, "SIGSTOP", true, true, true, "sendable stop signal not from tty");
|
|
|
|
AddSignal(18, "SIGTSTP", false, true, true, "stop signal from tty");
|
|
|
|
AddSignal(19, "SIGCONT", false, false, true, "continue a stopped process");
|
|
|
|
AddSignal(20, "SIGCHLD", false, false, false, "to parent on child stop or exit");
|
|
|
|
AddSignal(21, "SIGTTIN", false, true, true, "to readers process group upon background tty read");
|
|
|
|
AddSignal(22, "SIGTTOU", false, true, true, "to readers process group upon background tty write");
|
|
|
|
AddSignal(23, "SIGIO", false, false, false, "input/output possible signal");
|
|
|
|
AddSignal(24, "SIGXCPU", false, true, true, "exceeded CPU time limit");
|
|
|
|
AddSignal(25, "SIGXFSZ", false, true, true, "exceeded file size limit");
|
|
|
|
AddSignal(26, "SIGVTALRM", false, false, false, "virtual time alarm");
|
|
|
|
AddSignal(27, "SIGPROF", false, false, false, "profiling time alarm");
|
|
|
|
AddSignal(28, "SIGWINCH", false, false, false, "window size changes");
|
|
|
|
AddSignal(29, "SIGINFO", false, true, true, "information request");
|
|
|
|
AddSignal(30, "SIGUSR1", false, true, true, "user defined signal 1");
|
|
|
|
AddSignal(31, "SIGUSR2", false, true, true, "user defined signal 2");
|
2020-10-07 14:33:04 +08:00
|
|
|
// clang-format on
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-10-09 09:40:57 +08:00
|
|
|
|
2016-02-19 02:52:47 +08:00
|
|
|
void UnixSignals::AddSignal(int signo, const char *name, bool default_suppress,
|
|
|
|
bool default_stop, bool default_notify,
|
|
|
|
const char *description, const char *alias) {
|
2015-10-20 15:05:46 +08:00
|
|
|
Signal new_signal(name, default_suppress, default_stop, default_notify,
|
|
|
|
description, alias);
|
2010-10-15 10:39:01 +08:00
|
|
|
m_signals.insert(std::make_pair(signo, new_signal));
|
2017-03-08 05:34:40 +08:00
|
|
|
++m_version;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void UnixSignals::RemoveSignal(int signo) {
|
|
|
|
collection::iterator pos = m_signals.find(signo);
|
|
|
|
if (pos != m_signals.end())
|
|
|
|
m_signals.erase(pos);
|
2017-03-08 05:34:40 +08:00
|
|
|
++m_version;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *UnixSignals::GetSignalAsCString(int signo) const {
|
|
|
|
collection::const_iterator pos = m_signals.find(signo);
|
|
|
|
if (pos == m_signals.end())
|
2016-02-19 02:52:47 +08:00
|
|
|
return nullptr;
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
2010-10-15 10:39:01 +08:00
|
|
|
return pos->second.m_name.GetCString();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::SignalIsValid(int32_t signo) const {
|
|
|
|
return m_signals.find(signo) != m_signals.end();
|
|
|
|
}
|
|
|
|
|
2015-10-20 15:05:46 +08:00
|
|
|
ConstString UnixSignals::GetShortName(ConstString name) const {
|
2020-02-11 16:05:37 +08:00
|
|
|
if (name)
|
|
|
|
return ConstString(name.GetStringRef().substr(3)); // Remove "SIG" from name
|
2015-10-20 15:05:46 +08:00
|
|
|
return name;
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
int32_t UnixSignals::GetSignalNumberFromName(const char *name) const {
|
2010-10-16 07:16:40 +08:00
|
|
|
ConstString const_name(name);
|
|
|
|
|
|
|
|
collection::const_iterator pos, end = m_signals.end();
|
|
|
|
for (pos = m_signals.begin(); pos != end; pos++) {
|
2015-10-20 15:05:46 +08:00
|
|
|
if ((const_name == pos->second.m_name) ||
|
|
|
|
(const_name == pos->second.m_alias) ||
|
|
|
|
(const_name == GetShortName(pos->second.m_name)) ||
|
|
|
|
(const_name == GetShortName(pos->second.m_alias)))
|
2010-10-16 07:16:40 +08:00
|
|
|
return pos->first;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2021-09-25 05:36:49 +08:00
|
|
|
int32_t signo;
|
|
|
|
if (llvm::to_integer(name, signo))
|
2010-06-09 00:52:24 +08:00
|
|
|
return signo;
|
2010-10-16 07:16:40 +08:00
|
|
|
return LLDB_INVALID_SIGNAL_NUMBER;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t UnixSignals::GetFirstSignalNumber() const {
|
|
|
|
if (m_signals.empty())
|
|
|
|
return LLDB_INVALID_SIGNAL_NUMBER;
|
|
|
|
|
|
|
|
return (*m_signals.begin()).first;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t UnixSignals::GetNextSignalNumber(int32_t current_signal) const {
|
|
|
|
collection::const_iterator pos = m_signals.find(current_signal);
|
|
|
|
collection::const_iterator end = m_signals.end();
|
|
|
|
if (pos == end)
|
|
|
|
return LLDB_INVALID_SIGNAL_NUMBER;
|
2016-09-07 04:57:50 +08:00
|
|
|
else {
|
|
|
|
pos++;
|
2010-06-09 00:52:24 +08:00
|
|
|
if (pos == end)
|
|
|
|
return LLDB_INVALID_SIGNAL_NUMBER;
|
|
|
|
else
|
2010-10-15 10:39:01 +08:00
|
|
|
return pos->first;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-19 02:52:47 +08:00
|
|
|
const char *UnixSignals::GetSignalInfo(int32_t signo, bool &should_suppress,
|
|
|
|
bool &should_stop,
|
|
|
|
bool &should_notify) const {
|
2010-06-09 00:52:24 +08:00
|
|
|
collection::const_iterator pos = m_signals.find(signo);
|
|
|
|
if (pos == m_signals.end())
|
2016-02-19 02:52:47 +08:00
|
|
|
return nullptr;
|
2010-06-09 00:52:24 +08:00
|
|
|
else {
|
2010-10-15 10:39:01 +08:00
|
|
|
const Signal &signal = pos->second;
|
|
|
|
should_suppress = signal.m_suppress;
|
|
|
|
should_stop = signal.m_stop;
|
|
|
|
should_notify = signal.m_notify;
|
2010-06-09 00:52:24 +08:00
|
|
|
return signal.m_name.AsCString("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-15 10:39:01 +08:00
|
|
|
bool UnixSignals::GetShouldSuppress(int signo) const {
|
2010-06-09 00:52:24 +08:00
|
|
|
collection::const_iterator pos = m_signals.find(signo);
|
2010-10-15 10:39:01 +08:00
|
|
|
if (pos != m_signals.end())
|
|
|
|
return pos->second.m_suppress;
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-15 10:39:01 +08:00
|
|
|
bool UnixSignals::SetShouldSuppress(int signo, bool value) {
|
2010-06-09 00:52:24 +08:00
|
|
|
collection::iterator pos = m_signals.find(signo);
|
2010-10-15 10:39:01 +08:00
|
|
|
if (pos != m_signals.end()) {
|
|
|
|
pos->second.m_suppress = value;
|
2017-03-08 05:34:40 +08:00
|
|
|
++m_version;
|
2010-10-15 10:39:01 +08:00
|
|
|
return true;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-10-15 10:39:01 +08:00
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::SetShouldSuppress(const char *signal_name, bool value) {
|
2010-10-16 07:16:40 +08:00
|
|
|
const int32_t signo = GetSignalNumberFromName(signal_name);
|
|
|
|
if (signo != LLDB_INVALID_SIGNAL_NUMBER)
|
|
|
|
return SetShouldSuppress(signo, value);
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::GetShouldStop(int signo) const {
|
2010-10-15 10:39:01 +08:00
|
|
|
collection::const_iterator pos = m_signals.find(signo);
|
|
|
|
if (pos != m_signals.end())
|
|
|
|
return pos->second.m_stop;
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::SetShouldStop(int signo, bool value) {
|
2010-10-15 10:39:01 +08:00
|
|
|
collection::iterator pos = m_signals.find(signo);
|
|
|
|
if (pos != m_signals.end()) {
|
|
|
|
pos->second.m_stop = value;
|
2017-03-08 05:34:40 +08:00
|
|
|
++m_version;
|
2010-10-15 10:39:01 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::SetShouldStop(const char *signal_name, bool value) {
|
2010-10-16 07:16:40 +08:00
|
|
|
const int32_t signo = GetSignalNumberFromName(signal_name);
|
|
|
|
if (signo != LLDB_INVALID_SIGNAL_NUMBER)
|
|
|
|
return SetShouldStop(signo, value);
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::GetShouldNotify(int signo) const {
|
2010-10-15 10:39:01 +08:00
|
|
|
collection::const_iterator pos = m_signals.find(signo);
|
|
|
|
if (pos != m_signals.end())
|
|
|
|
return pos->second.m_notify;
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::SetShouldNotify(int signo, bool value) {
|
2010-10-15 10:39:01 +08:00
|
|
|
collection::iterator pos = m_signals.find(signo);
|
|
|
|
if (pos != m_signals.end()) {
|
|
|
|
pos->second.m_notify = value;
|
2017-03-08 05:34:40 +08:00
|
|
|
++m_version;
|
2010-10-15 10:39:01 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool UnixSignals::SetShouldNotify(const char *signal_name, bool value) {
|
2010-10-16 07:16:40 +08:00
|
|
|
const int32_t signo = GetSignalNumberFromName(signal_name);
|
|
|
|
if (signo != LLDB_INVALID_SIGNAL_NUMBER)
|
|
|
|
return SetShouldNotify(signo, value);
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2015-07-14 09:09:28 +08:00
|
|
|
|
|
|
|
int32_t UnixSignals::GetNumSignals() const { return m_signals.size(); }
|
|
|
|
|
|
|
|
int32_t UnixSignals::GetSignalAtIndex(int32_t index) const {
|
|
|
|
if (index < 0 || m_signals.size() <= static_cast<size_t>(index))
|
|
|
|
return LLDB_INVALID_SIGNAL_NUMBER;
|
|
|
|
auto it = m_signals.begin();
|
|
|
|
std::advance(it, index);
|
|
|
|
return it->first;
|
|
|
|
}
|
2017-03-08 05:34:40 +08:00
|
|
|
|
|
|
|
uint64_t UnixSignals::GetVersion() const { return m_version; }
|
|
|
|
|
|
|
|
std::vector<int32_t>
|
|
|
|
UnixSignals::GetFilteredSignals(llvm::Optional<bool> should_suppress,
|
|
|
|
llvm::Optional<bool> should_stop,
|
|
|
|
llvm::Optional<bool> should_notify) {
|
|
|
|
std::vector<int32_t> result;
|
|
|
|
for (int32_t signo = GetFirstSignalNumber();
|
|
|
|
signo != LLDB_INVALID_SIGNAL_NUMBER;
|
|
|
|
signo = GetNextSignalNumber(signo)) {
|
|
|
|
|
|
|
|
bool signal_suppress = false;
|
|
|
|
bool signal_stop = false;
|
|
|
|
bool signal_notify = false;
|
|
|
|
GetSignalInfo(signo, signal_suppress, signal_stop, signal_notify);
|
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// If any of filtering conditions are not met, we move on to the next
|
|
|
|
// signal.
|
2017-03-08 05:34:40 +08:00
|
|
|
if (should_suppress.hasValue() &&
|
|
|
|
signal_suppress != should_suppress.getValue())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (should_stop.hasValue() && signal_stop != should_stop.getValue())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (should_notify.hasValue() && signal_notify != should_notify.getValue())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
result.push_back(signo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2021-10-28 09:33:17 +08:00
|
|
|
|
|
|
|
void UnixSignals::IncrementSignalHitCount(int signo) {
|
|
|
|
collection::iterator pos = m_signals.find(signo);
|
|
|
|
if (pos != m_signals.end())
|
|
|
|
pos->second.m_hit_count += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
json::Value UnixSignals::GetHitCountStatistics() const {
|
|
|
|
json::Array json_signals;
|
|
|
|
for (const auto &pair: m_signals) {
|
|
|
|
if (pair.second.m_hit_count > 0)
|
|
|
|
json_signals.emplace_back(json::Object{
|
|
|
|
{ pair.second.m_name.GetCString(), pair.second.m_hit_count }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return std::move(json_signals);
|
|
|
|
}
|