mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-28 17:57:31 +02:00
Previous gai_strerror() returned numeric representation of the code, but used TLS storage, which might cause issues with stack sizes on all tasks in the system. Alternatively we can leave the storage to static only (which wouldn't be thread-safe) or we could one-time allocate and never free (which is wrong). This option uses hardcoded strings for common error codes used in lwip. The disadvantage is that we might need to update the impl in the future when lwip adds more codes.
33 lines
693 B
C
33 lines
693 B
C
/*
|
|
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#pragma once
|
|
|
|
#include "lwip/sockets.h"
|
|
#include "netdb_macros.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef CONFIG_IDF_TARGET_LINUX
|
|
// namespace with esp_ on linux to avoid duplication of symbols
|
|
#define gai_strerror esp_gai_strerror
|
|
#endif
|
|
|
|
/**
|
|
* @brief Returns a string representing of `getaddrinfo()` error code.
|
|
*
|
|
* @param[in] errcode Error code returned by `getaddrinfo()`.
|
|
*
|
|
* @return A pointer to a string containing the error code, for example "EAI_NONAME"
|
|
* for EAI_NONAME error type.
|
|
*/
|
|
const char *gai_strerror(int errcode);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|