mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-13 03:18:29 -04:00
AP_HAL_Linux: RCInput_RPI: ignore unwanted signals
We are setting a termination handler for some signals which are of not interest. Just ignore them. Ignoring SIGWINCH allows for example to run on a screen and change the window size later without killing ardupilot.
This commit is contained in:
parent
c1984451e7
commit
d062b5b8f2
@ -374,12 +374,23 @@ void RCInput_RPI::init_DMA()
|
||||
// We must stop DMA when the process is killed
|
||||
void RCInput_RPI::set_sigaction()
|
||||
{
|
||||
struct sigaction sa, sa_old;
|
||||
|
||||
memset(&sa_old, 0, sizeof(sa));
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
|
||||
/* Ignore signals */
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGWINCH, &sa, nullptr);
|
||||
sigaction(SIGTTOU, &sa, nullptr);
|
||||
sigaction(SIGTTIN, &sa, nullptr);
|
||||
|
||||
/*
|
||||
* Catch all other signals to ensure DMA is disabled - some of them may
|
||||
* already be handled elsewhere in cases we consider normal termination.
|
||||
* In those cases the teardown() method must be called.
|
||||
*/
|
||||
for (int i = 0; i < NSIG; i++) {
|
||||
// catch all signals to ensure DMA is disabled - some of them may
|
||||
// already be handled elsewhere in cases we consider normal
|
||||
// termination. In those cases the teardown() method must be called.
|
||||
struct sigaction sa, sa_old;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sigaction(i, nullptr, &sa_old);
|
||||
|
||||
if (sa_old.sa_handler == nullptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user