Does signal.h can not use for developer?

wangshuoran
Posts: 37
Joined: Fri Dec 24, 2021 12:40 pm

Does signal.h can not use for developer?

Postby wangshuoran » Mon Oct 10, 2022 5:39 am

When in linux socket, SIGPIPE is an signal we must handle.
But when I want to handle it in ESP32. Errors will be reported during compilation:

```c
#include <signal.h>
#include <stdio.h>

void sighandler(int signum) {
printf("signal %d\n", signum);
}

void app_main(void) {
signal(SIGPIPE, sighandler);
raise(SIGPIPE);
}
```
image.png
image.png (157.71 KiB) Viewed 1433 times
Does ESP-IDF do not use signal.h?
And in ESP-IDF components signal handle is OK. Why?

And in ESP-IDF components the SIGPIPE handler with different action function (I search all of ESP-IDF folder). Doesn't that conflict?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Does signal.h can not use for developer?

Postby ESP_igrr » Mon Oct 10, 2022 7:52 pm

Hi wangshuoran,

Signals and signal handling are not implemented in esp-idf. Calling raise() will abort the program.

Esp-idf contains several third party libraries which work on multiple platforms, so perhaps you found usage of 'signal' function which is intended for Linux. However, that code is not compiled in esp-idf.
(If you think there is some usage of 'signal' which is compiled as part of esp-idf build process, please point that out and we'll take a look!)

Who is online

Users browsing this forum: No registered users and 260 guests