Skip to content

Conversation

@Aditya-Sarna
Copy link

@Aditya-Sarna Aditya-Sarna commented Dec 18, 2025

  • Add includes for linux/string.h and linux/errname.h
  • Implement lualinux_errno_index() to dynamically lookup errno values using errname()
  • Keep old static errno table as fallback when CONFIG_SYMBOLIC_ERRNAME is not enabled
  • Update luaopen_linux() to create errno table with metatable for dynamic lookup

When CONFIG_SYMBOLIC_ERRNAME is enabled, errno values are resolved dynamically via errname() function. Otherwise, the static table is used as before.fixes #320

- Add includes for linux/string.h and linux/errname.h
- Implement lualinux_errno_index() to dynamically lookup errno values using errname()
- Keep old static errno table as fallback when CONFIG_SYMBOLIC_ERRNAME is not enabled
- Update luaopen_linux() to create errno table with metatable for dynamic lookup

When CONFIG_SYMBOLIC_ERRNAME is enabled, errno values are resolved dynamically
via errname() function. Otherwise, the static table is used as before.
Copy link
Contributor

@lneto lneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should use this path.. IMO, it's unnecessarily complicated. I would just add a new function to return errname, instead of carrying the burden of creating a new lib like this.. if we feel we really want a table for that, we can do it on Lua side (in the same way we do with socket/inet, for instance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

replace lualinux_errno with errname()

2 participants