Thank you for your reply, Gustavo.
I'm using the MIMXRT1064-EVK with version 2.15.000 of the SDK.
I'm trying to build an application that uses FreeRTOS, lwip stack and mbedtls stack.
I tried adding "int errno;" to "struct lwip_sock".
And I newly defined "set_errno_each()" and "get_errno_each()".
------------------------------------------
/lwip/src/include/lwip/priv/sockets_priv.h
------------------------------------------
struct lwip_sock {
...
#ifdef MODIFY_LWIP_SOCK
int errno;
#endif
};
#ifdef MODIFY_LWIP
#define set_errno_each(err, errno) (errno) = (err)
#endif
------------------------------------------
/lwip/src/include/lwip/sockets.h
------------------------------------------
#ifdef MODIFY_LWIP_SOCK
int get_errno_each(int fd);
#endif
------------------------------------------
/lwip/src/api/sockets.c
------------------------------------------
#ifdef MODIFY_LWIP_SOCK
int get_errno_each(int fd)
{
struct lwip_sock *sock = get_socket(fd);
if (!sock) {
return -1;
}
return sock->errno;
}
#endif
This change seems to have generally worked.
However, there are cases where the lwip_sock object does not exist in the traditional errno setting location, in which case sock->errno also does not exist, so it cannot always be referenced.
This modify is not very smart.
Is there a better way?
I appreciate your help.