Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ESP32] Errno mismatch between esp-idf and mpy #5752

Closed
@tve

Description

@tve

The esp32 port sets MICROPY_USE_INTERNAL_ERRNO which causes the built-in list of error codes in py/mperrno.h to be used. That's mostly OK, but there are discrepancies WRT esp-idf (see newlib's errno.h) and lots of missing error codes as a result. Examples:

  • MP uses 115 for EINPROGRESS while esp-idf uses 119, this particular one is patched up in exception_from_errno in https://github.com/micropython/micropython/blob/master/ports/esp32/modsocket.c#L156, however esp-idf uses 115 for ENETDOWN, which is now essentially undetectable
  • socket operations can return errno 23, which is not defined in MP's list, which means the user has to go on a hunt for where that may be defined to see that it's ENFILE /* Too many open files in system */ (happens, for example, if one doesn't close sockets on error somewhere).
  • there are many other useful socket errors which are not in MP's list

Q: is there a reason the esp32 port sets the insufficient MICROPY_USE_INTERNAL_ERRNO other than expediency at the time?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions