Page 1 of 1

esp32 can not use sigaction function

Posted: Mon Jun 06, 2022 3:34 pm
by twtxgd
the code is below ,but when I use sigaction function, the compile was failed, it said
"undefined reference to `sigaction", but I have already include the signal.h , so what's the problem? Thanks very much!
...
...
#include "esp_system.h"
#include <pthread.h>
#include "esp_spi_flash.h"
#include "signal.h"

void app_main(void)
{
int i;
pthread_t thrid_sx1302;
printf("Hello world!\n");
struct sigaction sigact;
sigaction(SIGQUIT, &sigact, NULL); /* Ctrl-\ */
sigaction(SIGINT, &sigact, NULL); /* Ctrl-C */
sigaction(SIGTERM, &sigact, NULL); /* default "kill" command */
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
...
...

}

Re: esp32 can not use sigaction function

Posted: Tue Jun 07, 2022 2:38 am
by ESP_Sprite
ESP-IDF does not support signals. Things like SIGQUIT (a request to quit the current program) don't really make sense on a microcontroller without a clear concept of applications.

Re: esp32 can not use sigaction function

Posted: Tue Jun 07, 2022 2:55 am
by twtxgd
Got it, thank you !