Page 1 of 1

Does signal.h can not use for developer?

Posted: Mon Oct 10, 2022 5:39 am
by wangshuoran
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 1473 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?

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

Posted: Mon Oct 10, 2022 7:52 pm
by ESP_igrr
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!)