-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Request
Add support in wrapped_facade_headers for signal-related types and functions (e.g., kill, sigaction, sigemptyset, std::sig_atomic_t, pid_t).
Background
In the Spider project, we're using signal handling functions and types for graceful termination when receiving signals like SIGTERM. Currently, we have to add linter suppressions (NOLINTNEXTLINE(misc-include-cleaner)) when using these functions:
// Send SIGTERM to task executor
pid_t const pid = spider::core::ChildPid::get_pid();
if (pid > 0) {
// NOLINTNEXTLINE(misc-include-cleaner)
kill(pid, SIGTERM);
}Similarly for using sigaction, sigemptyset and other signal-related functions:
// NOLINTBEGIN(misc-include-cleaner)
struct sigaction sig_action{};
sig_action.sa_handler = stop_task_handler;
sigemptyset(&sig_action.sa_mask);
sig_action.sa_flags |= SA_RESTART;
if (0 != sigaction(SIGTERM, &sig_action, nullptr)) {
spdlog::error("Fail to install signal handler for SIGTERM: errno {}", errno);
return cSignalHandleErr;
}
// NOLINTEND(misc-include-cleaner)Implementation suggestion
Add appropriate wrappers in wrapped_facade_headers for:
killfunction from<signal.h>/<csignal>sigaction,sigemptysetand other signal handling functions- Signal-related types like
pid_tandstd::sig_atomic_t
References
This issue was identified during review of y-scope/spider#104, which implements graceful exit when receiving SIGTERM.
Metadata
Metadata
Assignees
Labels
No labels