esp32 can not use sigaction function

twtxgd
Posts: 3
Joined: Tue Jan 26, 2021 9:10 am

esp32 can not use sigaction function

Postby twtxgd » Mon Jun 06, 2022 3:34 pm

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" : "");
...
...

}

ESP_Sprite
Posts: 9052
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 can not use sigaction function

Postby ESP_Sprite » Tue Jun 07, 2022 2:38 am

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.

twtxgd
Posts: 3
Joined: Tue Jan 26, 2021 9:10 am

Re: esp32 can not use sigaction function

Postby twtxgd » Tue Jun 07, 2022 2:55 am

Got it, thank you !

Who is online

Users browsing this forum: No registered users and 60 guests